## Solving differential equations by separation of variables

A common differential equation is of the form $y' = f(x) \cdot g(y)$. In this situation, the equation can be solved by a technique called “separation of variables”. It involves putting all the y terms on one side of the equation and all the x terms on the other side. Then integration on both sides leads to a solution. Let’s look at a couple of examples.

Example 1

Solve: $\dfrac{dy}{dx} = \dfrac{2x}{y^2}$ with the initial condition $y(0) = 2.$

First, multiply both sides by y2 and by dx to separate the variables (all the y terms on one side and all the x terms on the other): $y^2 \; dy = 2x \; dx$

Note that dy/dx isn’t really a fraction, but you can treat it as a fraction to separate the variables. Now you have an exact differential on each side, so you can integrate both sides: $\int y^2 \; dy = \int 2x \; dx$ $\dfrac{1}{3} y^3 = x^2 + C$

Why isn’t there a constant of integration on the left side? Well, there was, but we subtracted it and combined it with the constant of integration on the right so there is only one constant. Always do it this way, and put the constant on the independent variable side. Now solve for y: $y = \sqrt{3x^2 + C}$

Why didn’t we multiply the constant by 3? Well, we did, but a constant times three is still a constant, so we simplified it. Always keep your constant as simple as possible. Now solve for the constant, using the initial condition given: $2 = \sqrt{3(0)^2 + C} \rightarrow C = 8$ $\therefore y = \sqrt{3x^2 + 8}$

Example 2:

Solve: $\dfrac{dy}{dx} = \dfrac{y}{\sqrt{x}}$ with the initial condition $y(0) = 2.$

As before, separate the variables: $\dfrac{dy}{y} = \dfrac{dx}{\sqrt{x}}$

Note that the dy and dx terms must always be in the numerator. Now integrate and solve for y: $\displaystyle \int \dfrac{dy}{y} = \int \dfrac{dx}{\sqrt{x}}$ $\ln |y| = 2 \sqrt{x} + C$ $y = e^{2 \sqrt{x} + C} = Ce^{2 \sqrt{x}}$

Wait, how did the constant move from the exponent to the coefficient? It’s a simplification trick. Proceed as follows: $y = e^{2 \sqrt{x} + C} = e^{2 \sqrt{x}} \cdot e^C$

But eC is a constant too, so just call it C. Where did the absolute value sign go? Because C can be either positive or negative, we can drop the absolute value sign around the y. Let’s finish the problem by solving for C: $2 = Ce^{2 \sqrt{0}} \rightarrow C = 2$ $\therefore y = 2e^{2 \sqrt{x}}$

Calculus
Blue Taste Theme created by Jabox