Skip to content
Tutorials Center
My learning

Topics

Lesson 5 of 39 ยท First-order ODEs

Separable Differential Equations

Solve separable first-order ODEs by separating variables and integrating. Handle lost solutions, implicit answers and initial conditions, verified with SymPy and SciPy.

The first solution method for nonlinear equations is also the most satisfying. An equation is separable if you can move everything involving y to one side and everything involving t to the other:

dy/dt = g(t)*h(y).

Then you integrate each side separately. Many familiar models are separable: exponential growth, Newton's cooling, logistic growth, and many "rate depends on current amount" laws. This lesson gives the method, the traps (lost solutions and implicit answers), and checks every answer numerically.

The method

Starting from dy/dt = g(t)*h(y) with h(y) != 0:

  1. Divide by h(y) and treat dy and dt like differentials: dy / h(y) = g(t) dt.
  2. Integrate both sides: integral of dy/h(y) = integral of g(t) dt + C.
  3. Solve for y if possible.
  4. Apply the initial condition to fix C.
  5. Check the cases h(y) = 0 separately: each root y = y0 is a constant solution you may have divided away.

Treating dy/dt as a fraction is shorthand for the chain rule: if you differentiate H(y(t)) = G(t) + C where H' = 1/h, you get y'/h(y) = g(t), which is the original equation.

Worked example

Solve dy/dt = t*y, y(0) = 3. Separate: dy/y = t dt. Integrate: ln|y| = t**2/2 + C. Exponentiate: y = A*e**(t**2/2) with A = ยฑe**C. The condition y(0) = 3 gives A = 3. Also y = 0 is a solution that the division missed; here it is captured by A = 0.

Python Verify a separable solution

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Lost solutions

Division by h(y) is only legal where h(y) != 0. Consider dy/dt = y**2 - 1. Separating requires y**2 != 1; the constants y = 1 and y = -1 are solutions found by inspection (their derivative is zero and y**2 - 1 = 0). Partial fractions give (1/2) ln|(y - 1)/(y + 1)| = t + C, which solves to y = (1 + A*e**(2*t))/(1 - A*e**(2*t)). The value y = -1 is the limit A -> infinity; y = 1 corresponds to A = 0, but only some constants are captured by the formula. Always list the roots of h separately and say whether they are included.

Implicit answers

Not every separable equation can be solved for y. For dy/dt = t/(y + y**3): (y + y**3) dy = t dt, so y**2/2 + y**4/4 = t**2/2 + C. This is a legitimate implicit solution: it defines y as a function of t locally. A numerical solution can confirm that this combination stays constant along the trajectory, a good check technique.

Python Check an implicit solution with a conserved quantity

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Interval of validity

The solution you find lives on a specific interval. For dy/dt = y**2 with y(0) = 1 you get y = 1/(1 - t), valid only for t < 1 (see existence and uniqueness). For dy/dt = -t/y, y(0) = 2 you get y**2 = 4 - t**2, so y = sqrt(4 - t**2) on -2 < t < 2; at the ends the slope becomes infinite. State the interval with the answer.

Typical applications

  • Population or decay: dP/dt = k*P gives P = P0*e**(k*t).
  • Logistic growth: dP/dt = r*P*(1 - P/K); separation uses partial fractions and yields P = K / (1 + A*e**(-r*t)).
  • Torricelli's law (tank draining): dh/dt = -c*sqrt(h); separation gives sqrt(h) = sqrt(h0) - c*t/2, so a tank empties in finite time 2*sqrt(h0)/c.
Python Draining tank (Torricelli)

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The tank reaches zero in finite time: the square-root nonlinearity violates the uniqueness hypothesis at h = 0, so a solution can "arrive" there.

When separation does not work

If the right side mixes t and y inextricably, like dy/dt = t + y, you cannot separate it. That equation is linear, and the integrating factor method handles it. Others yield to substitutions that make them separable.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. Which equation is separable?

    t*y2 factors as g(t)*h(y) with g = t and h = y2. The others cannot be written as a product.
  2. 2. After separating y' = k*y, what is the integrated form?

    dy/y = k dt integrates to ln|y| = k*t + C.
  3. 3. Why must you check h(y) = 0 separately?

    Separation divides by h(y), so any constant y0 with h(y0) = 0 is a solution that may be lost.
  4. 4. The solution of y' = y**2, y(0) = 1 is valid on

    The solution y = 1/(1 - t) blows up at t = 1; the interval containing t = 0 is t < 1.

Summary

  • A separable equation y' = g(t)*h(y) becomes dy/h(y) = g(t) dt; integrate both sides.
  • Check the roots of h(y) separately: they are constant solutions that may be lost.
  • Solutions are sometimes implicit; a numerical conserved quantity is a good check.
  • Always give the interval on which your solution is valid.
  • Exponential, logistic and tank-draining models are all separable.

Next: Linear First-order Equations and Integrating Factors