# Change of variable for separable differential equations

### Differential Equations

Sometimes we’ll be given a differential equation in the form

???y'=Q(x)-P(x)y???

and asked to find a general solution to the equation, which will be an equation for ???y??? in terms of ???x???.

In this case, it can be really helpful to use a change of variable to find the solution. To use a change of variable, we’ll follow these steps:

Substitute ???u=y'??? so that the equation becomes ???u=Q(x)-P(x)y???.

Solve for ???y???.

Take the derivative of both sides in order to get ???y'???.

Since ???u=y'???, back-substitute and replace ???y'??? with ???u???.

Solve for ???u'???, then replace ???u'??? with ???du/dx???.

Separate variables to put ???u??? on one side and ???x??? on the other.

Integrate both sides with respect to ???x???, then solve for ???u???.

Since ???u=Q(x)-P(x)y???, back-substitute and replace ???u??? with ???Q(x)-P(x)y???.

Solve for ???y??? in terms of ???x??? to find the general solution.

These steps can be hard to remember and tricky to follow, but the key is to get rid of all of the ???y???, ???y'??? and ???x??? values, and replace them with ???u??? and ???u'???. If you can get the equation entirely in terms of ???u??? and ???u'???, then the rest of the problem should fall into place.

Let’s look at an example.

**Example**

Use a change of variable to solve the differential equation.

???y'=2x+y???

We need to change the current equation so that it is in terms of a new variable ???u??? and its derivative ???u'???. The equation is already solved for ???y'???, which is what we want, so we’ll go ahead and substitute ???u??? for ???y'???.

If ???u=y'???, then

???y'=2x+y???

???u=2x+y???

Solving this equation for ???y???, we get

???y=u-2x???

Now we need to find the derivative of ???y???, so we’ll take the derivative of both sides of this equation. Remember, since ???u??? is a function, and not just a variable, its derivative is ???u'???, not just ???1???.

???y'=u'-2???

We already said at the beginning of this problem that ???u=y'???, so if we replace ???y'??? on the left side with ???u???, we get

???u=u'-2???

Now that our equation is entirely in terms of ???u??? and ???u'???, we want to solve it for ???u'???.

???u'=u+2???

Since ???u'??? is the same thing as ???du/dx???, we can change the equation to

???\frac{du}{dx}=u+2???

???du=(u+2)\ dx???

???\frac{1}{u+2}\ du=dx???

Now that the variables are separated, with the ???u???’s on the left and the ???x???’s on the right, we’ll integrate both sides.

???\int\frac{1}{u+2}\ du=\int{dx}???

???\ln{\left|u+2\right|}=x+C???

???e^{\ln{\left|u+2\right|}}=e^{x+C}???

???\left|u+2\right|=e^xe^C???

Remember that ???e^C??? is a constant, so we can just call it ???C???.

???\left|u+2\right|=Ce^x???

We can remove the absolute value brackets by adding a ???\pm??? to the terms on the right-hand side of the equation.

???u+2=\pm Ce^x???

We can include the ???\pm??? into the constant ???C???.

???u+2=Ce^x???

???u=Ce^x-2???

We know from earlier that ???u=2x+y???. Since we just found that ???u=Ce^x-2???, we can make a substitution for ???u???.

???Ce^x-2=2x+y???

Finally, we solve for ???y??? to find the general solution to the differential equation.

???y=Ce^x-2x-2???