Guides / Differential equations

Separable differential equations: separate, integrate, add C, then solve for y

A differential equation tells you how fast something changes, and solving it means finding the thing itself. When the rate is a function of x times a function of y, you can move every y to one side and every x to the other and integrate each side. The method is short. The mistakes are about the constant, the square root, and what counts as separable.

Short answer

If dydx = g(x) · h(y), divide by h(y) and multiply by dx: dyh(y) = g(x) dx. Integrate both sides and add one constant C straight away, before you solve for y. Use the initial condition to find C, pick the square root or sign that matches it, and check the answer in the original equation. A sum like x + y is not separable.

Why it works

Write the equation as 1h(y) · dydx = g(x). If H is an antiderivative of 1/h, the left side is ddx H(y) by the chain rule. So H(y) and ∫ g(x) dx have the same derivative, and they differ by a constant. "Multiply by dx and integrate" is shorthand for exactly that.

That's also why the constant goes in at the integration step. It is the constant between two antiderivatives. Once you exponentiate or take a square root, it is no longer something you add on at the end.

Example 1: exponential form

Solve dydx = y cos x with y(0) = 3.

  1. dyy = cos x dxSeparate: every y on the left, every x on the right. This divides by y, so assume y ≠ 0.
  2. ln |y| = sin x + CIntegrate both sides, and add the constant now.
  3. y = Aesin xExponentiate: |y| = eCesin x, and A = ±eC absorbs the sign. The constant has become a multiplier.
  4. y(0) = Ae0 = A = 3, so y = 3esin xCheck: y′ = 3esin x · cos x = y cos x.

Example 2: a square root at the end

Solve dydx = 3x2 + 12y with y(1) = 3.

  1. 2y dy = (3x2 + 1) dxMultiply both sides by 2y dx.
  2. y2 = x3 + x + CIntegrate both sides, constant included.
  3. 9 = 1 + 1 + C, so C = 7Find C while the equation is still in terms of y², before taking the root.
  4. y = √(x3 + x + 7)The positive root, because y(1) = 3 is positive. It is a solution while x³ + x + 7 > 0, which is for x > −1.739 or so.

Example 3: growth from two data points

A population grows at a rate proportional to its size, P′ = kP. It is 200 at t = 0 and 1600 at t = 3 hours. Find P(5).

  1. P = P(0)ekt = 200ektSeparating gives ln P = kt + C, the same steps as Example 1.
  2. 200e3k = 1600, so e3k = 8 and k = ln 83 = ln 2Use the second data point to find k.
  3. P = 200 · 2t, P(5) = 200 · 32 = 6400et ln 2 = 2t: the population doubles every hour.

Example 4: where the solution stops

Solve dydx = 1 + y2 with y(0) = 1.

  1. dy1 + y2 = dxg(x) = 1 here, which is still a product.
  2. arctan y = x + C, and C = arctan 1 = π4Integrate, then use y(0) = 1.
  3. y = tan(x + π4), for −3π4 < x < π4tan blows up when x + π/4 = ±π/2, so the solution through (0, 1) lives only between those two points.

Common mistakes, and the exact line they happen on

1. Adding the constant at the end

The equation from Example 1.

  1. ln |y| = sin xIntegrated, but with the constant left for later.
  2. y = esin x + C, and y(0) = 3 gives y = esin x + 2This is the mistake. Check it at x = 0: y′ = cos 0 · e0 = 1, but y cos x = 3 · 1 = 3, so it doesn't solve the equation. The constant belongs on the line before, and exponentiating turns it into a multiplier: y = 3esin x.

2. Taking the positive root when y starts negative

The equation from Example 2, but with y(1) = −3.

  1. y2 = x3 + x + 7Right so far: (−3)² = 9 gives the same C = 7.
  2. y = √(x3 + x + 7)This is the mistake. This gives y(1) = 3, not −3. Squaring threw away the sign, and the initial condition is how you get it back: y = −√(x³ + x + 7). Both roots solve the equation, but only one passes through the starting point.

3. Separating a sum

Solve dydx = x + y with y(0) = 1.

  1. dyy = x dx, so y = ex2/2This is the mistake. Dividing x + y by y gives x/y + 1, not x. You can separate only when the right side is a product g(x) · h(y), and x + y isn't one. Check: at x = 0 this y has y′ = 0, but x + y = 1. The equation is linear and needs an integrating factor (practice set); its solution is y = 2ex − x − 1.

Practice

  1. Solve y′ = 3x2y with y(0) = 2.

    Show answer

    ln |y| = x3 + C, so y = 2ex3.

  2. Solve y′ = xy2 with y(0) = 1.

    Show answer

    y33 = x22 + 13, so y = ∛(32x2 + 1). A cube root has no sign to choose.

  3. Solve y′ = e−y with y(0) = 0.

    Show answer

    ey dy = dx gives ey = x + 1, so y = ln(x + 1), for x > −1.

  4. Solve y′ = yx with y(1) = 3, for x > 0.

    Show answer

    ln |y| = ln x + C, so y = Ax and y = 3x.

  5. A culture triples every 4 hours, with P′ = kP. Find k.

    Show answer

    e4k = 3, so k = ln 34 ≈ 0.2747 per hour.