AP Calculus AB · Study guide

Finding General Solutions Using Separation of Variables

AP® Calculus AB · Unit 7 · Differential Equations

Separation of Variables

Many differential equations can be solved by gathering each variable on its own side and integrating. This guide shows the method, where the constant goes, and what can be lost along the way.

The idea in one paragraph

A differential equation is separable if it can be written as \(\frac{dy}{dx} = g(x)\,h(y)\). Move everything with \(y\) to the left with \(dy\) and everything with \(x\) to the right with \(dx\): \(\frac{1}{h(y)}\,dy = g(x)\,dx\). Integrate both sides, add one constant \(C\), then solve for \(y\) if you can. The result is the general solution: a family of functions, one for each \(C\).

1When it works

EquationSeparable?
\(\frac{dy}{dx} = xy\)Yes: \(x \cdot y\)
\(\frac{dy}{dx} = \frac{x}{y}\)Yes: \(x \cdot \frac1y\)
\(\frac{dy}{dx} = e^{x - y}\)Yes: \(e^x \cdot e^{-y}\)
\(\frac{dy}{dx} = x + y\)No: a sum cannot be split into a product

2The method

Worked Example 1 Exponential type

\(\dfrac{dy}{dx} = xy\)

  1. 1
    Separate: put every \(y\) with \(dy\) and every \(x\) with \(dx\): \(\dfrac{1}{y}\,dy = x\,dx\).
  2. 2
    Integrate both sides: \(\ln|y| = \dfrac{x^2}{2} + C\). One constant is enough; it absorbs the constants from both sides.
  3. 3
    Solve for \(y\): \(|y| = e^{x^2/2 + C} = e^C e^{x^2/2}\). Write \(\pm e^C\) as a single constant \(C\).
Answer: \(y = Ce^{x^2/2}\)
Figure 1. Separating variables produces one formula with a constant C. Every value of C gives a solution curve, including C = 0, the flat solution that dividing by y would have hidden.
Write it like this

“Separating variables, \(\frac{1}{y}\,dy = x\,dx\). Integrating both sides, \(\ln|y| = \frac{x^2}{2} + C\), so \(y = Ce^{x^2/2}\).”

Common Mistake 1 · Putting a constant on each side

\(\ln|y| + C_1 = \frac{x^2}{2} + C_2\) is correct but wasteful: subtracting gives one constant. Write a single \(C\) on one side.

Common Mistake 2 · Adding C after exponentiating

From \(\ln|y| = \frac{x^2}{2} + C\), the next line is \(|y| = e^{x^2/2 + C} = e^Ce^{x^2/2}\), so the constant multiplies. Writing \(y = e^{x^2/2} + C\) is wrong.

Worked Example 2 Squares on both sides

\(\dfrac{dy}{dx} = \dfrac{x}{y}\)

  1. 1
    \(y\,dy = x\,dx\). Integrate: \(\dfrac{y^2}{2} = \dfrac{x^2}{2} + C\).
  2. 2
    Multiply by 2 and rename the constant: \(y^2 = x^2 + C\).
Answer: \(y^2 = x^2 + C\), or \(y = \pm\sqrt{x^2 + C}\). The sign is chosen later from an initial condition.

3Solving for y

Worked Example 3 A power of y

\(\dfrac{dy}{dx} = y^2\)

  1. 1
    \(y^{-2}\,dy = dx\). Integrate: \(-y^{-1} = x + C\).
  2. 2
    Solve: \(y = -\dfrac{1}{x + C}\).
Answer: \(y = -\dfrac{1}{x + C}\) (and the constant solution \(y = 0\)).
Worked Example 4 Split an exponential first

\(\dfrac{dy}{dx} = e^{x - y}\)

  1. 1
    Rewrite: \(e^{x - y} = e^x e^{-y}\). Then \(e^y\,dy = e^x\,dx\).
  2. 2
    Integrate: \(e^y = e^x + C\). Take ln: \(y = \ln(e^x + C)\).
Answer: \(y = \ln(e^x + C)\)
Worked Example 5 A shifted exponential

\(\dfrac{dy}{dx} = 0.5(y - 4)\)

  1. 1
    Separate: \(\dfrac{1}{y - 4}\,dy = 0.5\,dx\).
  2. 2
    Integrate: \(\ln|y - 4| = 0.5x + C\).
  3. 3
    Exponentiate and rename the constant: \(y - 4 = Ce^{0.5x}\).
Answer: \(y = 4 + Ce^{0.5x}\). The constant solution \(y = 4\) is the case \(C = 0\).
Worked Example 6 When y cannot be isolated

\(\dfrac{dy}{dx} = \dfrac{2x}{3y^2 + 1}\)

  1. 1
    Separate: \((3y^2 + 1)\,dy = 2x\,dx\).
  2. 2
    Integrate: \(y^3 + y = x^2 + C\).
  3. 3
    There is no simple formula for \(y\) from \(y^3 + y = \dots\), so stop here.
Answer: \(y^3 + y = x^2 + C\). An equation with \(y\) not isolated is still the general solution.

4What can go wrong

Common Mistake 3 · Losing a solution when dividing

Dividing by \(y\) assumes \(y \neq 0\). But \(y = 0\) also satisfies \(\frac{dy}{dx} = xy\). It reappears as \(C = 0\) in \(y = Ce^{x^2/2}\); in other equations, check constant solutions separately.

Quick reference

StepAction
1Write as \(\frac{dy}{dx} = g(x)h(y)\)
2Separate: \(\frac{1}{h(y)}dy = g(x)dx\)
3Integrate both sides; one + C
4Solve for y; rename constants
5Check for constant solutions lost by dividing