# How to Solve a Differential Equation with Separation of Variables

### 3 Examples Solving a Separable Differential Equation

A differential equation of the form

y' = f(x)g(y)

is called a separable differential equation because it is possible to separate the variables and transform the equation into the form A(y) = B(x). If the function A(y) is invertible and of a suitable form, one can express y as a function of x. Here are several examples to show how the method works.

### Example 1

Solve the differential equation y' = x2ey. First write y' as dy/dx and treat the derivative as a fraction. By cross multiplying dy/dx = x2ey, we arrive at

e-y dy = x2 dx.

Now integrate both sides:

-e-y = (1/3)x3 + c.

It is necessary to append the "+ c" to the right hand side because different initial conditions yield different final solutions. Since the left hand side is invertible, we can solve for y:

y = -ln[-(1/3)x3 - c].

If we are supplied with the initial condition y(0) = 0.3, then we find that c = -0.7408. So the final solution is

y = -ln[0.7408 - (1/3)x3].

### Example 2

Solve dy/dx = x2ey/y. Following the method above gives us

ye-y dy = x2 dx,
-ye-y - e-y = (1/3)x3 + c.

Unfortunately, there is no way to solve the left-hand side for y, so this is the most simplified form of the solution.

### Example 3

Solve y' = tan(y/x) + y/x. On the surface, this does not look separable because we can't untangle the tangent function. However, we can use change of variables with the substitution y = zx and y' = z'x + z. Now the problem becomes

z'x + z = tan(z) + z
z'x = tan(z)
x dz/dx = tan(z)
cot(z) = 1/x dx
ln(sin(z)) = ln(x) + c
sin(z) = ecx
z = arcsin[ecx]

Using the relation y = zx, the solution is y = (x)arcsin[ecx]. With the initial condition y(1) = 1, we find that c = -0.1726, so the final solution is y = (x)arcsin[0.8415x].