Separable Differential Equations

by George E. Hrabovsky

The General Solution

We will frequently encounter differential equations which can be reduced to the following form,

A[x] dx + B[y] dy == 0				(1)

where A[x] is some function of x, and B[y] is some function of y.  To solve this type of equation we integrate each of the functions in (1) with respect to the independent variables,

Integrate[A[x], x] + Integrate[B[y], y]
	== C[1]					(2)

where C[1] is an arbitrary constant.

Example 1

Suppose we have the equation,

x dx + y dy == 0				(3)

We can then integrate each side in accordance with (2) above,

Integrate[x, x] + Integrate[y, y]

Which yields

We now solve this for y after setting it equal to a constant c.

Solve[% == c, y]

Which is the solution to (3).

Example 2

Suppose we have the equation,

1/x dx - 1/y dy == 0				(4)

Integrating this, we have,

Integrate[1/x, x] - Integrate[1/y, y]

We now solve this for y,

Solve[% == c, y]

Example 3

Suppose we have the equation,

x dx + 1/y dy == 0				(5)

We integrate this,

Integrate[x, x] + Integrate[1/y, y]

We set this equal to a constant c, and then solve for y,

Solve[% == c, y]

Example 4

Suppose we have the equation,

(x^2 + 1) dx + (y^2 + y) dy == 0		(6)

We can integrate the equation,

Integrate[x^2 + 1, x] +
	Integrate[y^2 + y, y]

We now set this equal to the constant c and solve for y, which gives us,

Solve[%8 == c, y]

This is an incredibly long and difficult solution involving imaginary numbers, a somewhat friendlier solution can be found by multiplying the results of the integration by 6,

6 x + 6 x^3/3 + 6 y^2/2 + 6 y^3/3 == 6 c	(7)

Which yields,

6 x + 2 x^3 + 3 y^2 + 2 y^3 == 6 c

which is the friendlier solution.

Initial-Value Problem

There will be times when we have specific values of x and y,

A[x] dx + B[y] dy == 0; y[x0] == y0		(8)

In this case we can integrate (8) in the following manner,

Integrate[A[t], {t, x0, x}] +
	Integrate[B[s], {s, y0, y}] == 0	(9)

Example 1

Given the equation,

Sin[x] dx + y dy == 0; y[0] == -2		(10)

Integrating (10) yields,

Integrate[Sin[s], {s, 0, x}] +
	Integrate[t, {t, -2, y}]

We can then set this equal to 0 and then solve for y,

Solve[% == 0, y]

Example 2

Given the equation,

(x^2 + 1) dx + 1/y dy == 0; y[-1] == 1		(11)

we integrate this in the manner described by (9),

Integrate[s^2 + 1, {s, -1, x}] +
	Integrate[1/t, {t, 1, y}]

We set this equal to zero and then solve for y,

Solve[% == 0, y]

Which is the solution of (11).

Example 3

Given the equation,

x Exp[x^2] dx + (y^5 - 1) dy == 0; y[0] == 0	(12)

We integrate this according to (9),

Integrate[s Exp[s^2], {s, 0, x}] +
	Integrate[t^5 - 1, {t, 0, y}]

One solution is to set this equal to zero, then add 1/2 to both sides thus getting,

1/2 Exp[x^2] + 1/6 y^6 - y = 1/2

With Mathematica we can then solve for y,

Solve[1/2 Exp[x^2] + 1/6 y^6 - y == 1/2, y]

So the solution is,

y^6 - 6 y == 3 - 3 Exp[x^2].

Equations Which Must be Separated

Example 1

Given the equation,

dy/dx == y/x^2					(13)

before we can integrate (13) we must first divide both sides by y and multiply both sides by dx,

dy/y == dx/x^2

and then subtract both sides by dx/x^2,

dy/y - dx/x^2 == 0				(14)

now we can integrate both sides of (14),

Integrate[1/y, y] +
	Integrate[1/x^2, x]

Setting this equal to a constant c and then solving for y,

Solve[% == c, y]

Which is the solution of (13).

Example 2

Given the equation,

dy/dx == (x Exp[x])/(2 y)				(15)

We must multiply both sides by (2 y) dx,

2 y dy == x Exp[x] dx

We next subtract the right hand side from both sides,

2 y dy - x Exp[x] dx == 0

We now integrate,

Integrate[2 y, y] + Integrate[x Exp[x], x]

We now set this equal to c and solve for y,

Solve[% == c, y]

Example 3

Given the equation with intial-value conditions,

dy/dx == (x^2 y - y)/(y + 1); y[3] == -1.		(16)

We must first isolate y on the right-hand side of (16),

dy/dx == y (x^2 - 1)/(y + 1).

We next multiply both sides by (y + 1),

dy (y + 1)/dx == y (x^2 - 1).

We now divide both sides by y,

dy (y + 1)/(dx y) == x^2 - 1.

We next multiply both sides by dx,

dy (y + 1)/y == (x^2 - 1) dx.

We now subtract the right hand side from both sides,

dy (y + 1)/y - (x^2 - 1) dx == 0.

We may simplify this,

dy (1 + 1/y) - (x^2 - 1) dx == 0

We can now integrate this,

Integrate[(1 + 1/s), {s, -1, y}] -
	Integrate[t^2 - 1, {t, 3, x}]

This is as far as we can take it.  So the solution is,

y + Log[y] == -7 + I Pi - x + 1/3 x^3.

Conclusion

Thus we end our discussion of separable differential equations, the simplest kind of ordinary differential equations.  While there are many equations which can be solved in this way, the majority may not.  The next discussion will be that of Homogeneous Differential Equations.