Unit 7 · Topic 7.6 Beta

General Solutions by Separation of Variables

4 min read · freeNot practiced

You can now write a differential equation, check a proposed solution and sketch solutions from a slope field. This page finds solutions by formula. The method, separation of variables, works whenever the variables can be pulled apart. On the AP® Calculus AB exam it is the only solving method you need.

When an equation is separable

A differential equation dydx=F(x,y)\frac{dy}{dx} = F(x, y) is separable when the right side is a product of a function of xx alone and a function of yy alone:

dydx=g(x)h(y).\frac{dy}{dx} = g(x)\,h(y).

EquationSeparable?Why
dydx=2xy2\frac{dy}{dx} = 2xy^2yes(2x)(y2)(2x)(y^2)
dydx=ex−y\frac{dy}{dx} = e^{x - y}yesexe−ye^{x}e^{-y}, by an exponent rule
dydx=x2y\frac{dy}{dx} = \frac{x^2}{y}yesx2⋅1yx^2 \cdot \frac{1}{y}
dydx=x+y\frac{dy}{dx} = x + ynoa sum cannot be written as g(x)h(y)g(x)h(y)

The method in four steps

  1. Separate. Multiply and divide so that every yy is on the side with dydy and every xx is on the side with dxdx: 1h(y)dy=g(x)dx\frac{1}{h(y)}\,dy = g(x)\,dx. Both dydy and dxdx stay in numerators.
  2. Integrate both sides. ∫1h(y)dy\int \frac{1}{h(y)}\,dy=∫g(x)dx= \int g(x)\,dx.
  3. Add the constant now. Each side has its own constant, but C2−C1C_2 - C_1 is just one constant, so write a single +C+ C, usually on the xx side. Do it in this step, not later.
  4. Solve for yy if you can. The result, with CC still in it, is the general solution: a whole family of curves.

Worked example 1. Find the general solution of dydx=2xy2\frac{dy}{dx} = 2xy^2.

Separate: divide by y2y^2 and multiply by dxdx: y−2dy=2xdxy^{-2}\,dy = 2x\,dx.

Integrate: ∫y−2dy=∫2xdx\int y^{-2}\,dy = \int 2x\,dx, so −1y=x2+C-\frac{1}{y} = x^2 + C.

Solve: take reciprocals and change the sign: y=−1x2+Cy = -\frac{1}{x^2 + C}.

Check one case: with C=1C = 1, y=−(x2+1)−1y = -(x^2 + 1)^{-1} and dydx\frac{dy}{dx}=2x(x2+1)−2= 2x(x^2 + 1)^{-2}=2xy2= 2xy^2. It works.

Look at what would happen if you waited to add the constant: −1y=x2-\frac{1}{y} = x^2 gives y=−1x2y = -\frac{1}{x^2}, and then "+C+ C" gives y=−1x2+Cy = -\frac{1}{x^2} + C. That family is different, and for C≠0C \ne 0 it does not satisfy the equation. The constant must go in when you integrate.

Logarithms and the absolute value

Many separable equations put 1y\frac{1}{y} on the left. Its antiderivative is ln⁡|y|\ln|y|, with the absolute value. Keep it; it decides which solutions you find.

Worked example 2. Find the general solution of dydx=xy\frac{dy}{dx} = xy.

Separate: dyy=xdx\frac{dy}{y} = x\,dx (this assumes y≠0y \ne 0; see below).

Integrate: ln⁡|y|=x22+C\ln|y| = \frac{x^2}{2} + C.

Exponentiate both sides: |y||y|=ex2/2+C= e^{x^2/2 + C}=eCex2/2= e^{C}e^{x^2/2}.

Remove the absolute value: y=±eCex2/2y = \pm e^{C}e^{x^2/2}. The number ±eC\pm e^{C} can be any nonzero constant; call it AA. So y=Aex2/2y = Ae^{x^2/2}.

Finally, y=0y = 0 also satisfies dydx=xy\frac{dy}{dx} = xy (both sides are 0), but dividing by yy hid it. Allowing A=0A = 0 brings it back. General solution: y=Aex2/2y = Ae^{x^2/2} for any constant AA.

The slope field of dy/dx = xy on −2.5 ≤ x ≤ 2.5 and −4 ≤ y ≤ 4, with the curves y = Ce^(x²/2) for C = 0.25, 0.5, 1, 2 in crimson above the x-axis, for C = −0.25, −0.5, −1, −2 in blue below it, and C = 0, the x-axis itself, in green. Each curve is flattest at x = 0 and follows the segments.
Figure 1. The general solution y=Aex2/2y = Ae^{x^2/2} of dydx=xy\frac{dy}{dx} = xy drawn on its slope field: A>0A > 0 above the axis, A<0A < 0 below, A=0A = 0 on it. LevlPrep original diagram.

Two algebra facts do most of the work here. First, ea+b=eaebe^{a + b} = e^{a}e^{b}, which turns ex2/2+Ce^{x^2/2 + C} into a constant times ex2/2e^{x^2/2}; it is not ex2/2+Ce^{x^2/2} + C. Second, ln⁡|y|=u\ln|y| = u means |y|=eu|y| = e^{u}; you undo a logarithm by exponentiating the whole other side.

Shifted variables

The cooling equation dTdt=−0.05(T−20)\frac{dT}{dt} = -0.05(T - 20) separates as dTT−20=−0.05dt\frac{dT}{T - 20} = -0.05\,dt. The whole quantity T−20T - 20 stays together in the denominator, and its antiderivative is ln⁡|T−20|\ln|T - 20|:

ln⁡|T−20|=−0.05t+C,T=20+Ae−0.05t.\ln|T - 20| = -0.05t + C, \qquad T = 20 + Ae^{-0.05t}.

Common slips

  • Leaving an xx on the dydy side or a yy on the dxdx side. If the variables will not separate, the method does not apply.
  • Missing +C+ C, or adding it only after solving for yy.
  • Writing ln⁡y\ln y instead of ln⁡|y|\ln|y|, which loses the negative solutions.
  • Writing eu+C=eu+Ce^{u + C} = e^{u} + C. It is eCeue^{C}e^{u}, a constant times eue^{u}.

Spot a mistake on this page?