Home / Articles / Differential Equations
Differential Equations · 3 min read

Separable Differential Equations

Learn to solve separable differential equations step by step, apply initial conditions and avoid common errors, with worked examples including Newton's cooling.

Separable differential equations are usually the first type of ODE students learn to solve, and for good reason: the method is short, logical and appears in almost every calculus and differential equations exam. If you can integrate, you can solve these. Let's walk through the method and several complete examples.

What Makes an Equation Separable?

A first-order ODE is separable if it can be written in the form

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

that is, the right-hand side factors into a function of \( x \) alone multiplied by a function of \( y \) alone.

Some quick checks:

  • \( \frac{dy}{dx} = xy \) is separable: \( g(x) = x \), \( h(y) = y \).
  • \( \frac{dy}{dx} = \frac{x^2}{y} \) is separable: \( g(x) = x^2 \), \( h(y) = \frac{1}{y} \).
  • \( \frac{dy}{dx} = e^{x+y} \) is separable, because \( e^{x+y} = e^x e^y \).
  • \( \frac{dy}{dx} = x + y \) is not separable, because a sum cannot be split into a product.

The Method

  1. Separate the variables. Move every \( y \) term (with \( dy \)) to one side and every \( x \) term (with \( dx \)) to the other:

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

  1. Integrate both sides.

$$ \int \frac{1}{h(y)}\,dy = \int g(x)\,dx + C. $$

  1. Solve for \( y \) if possible, to get an explicit solution.
  2. Apply the initial condition to find \( C \).
  3. Check for constant solutions you may have lost by dividing by \( h(y) \).

You need only one constant: constants from both sides combine into a single \( C \).

Worked Example 1: Exponential-Type Solution

Solve \( \frac{dy}{dx} = xy \) with \( y(0) = 2 \).

Step 1: Separate. Divide by \( y \) (assuming \( y \neq 0 \)) and multiply by \( dx \):

$$ \frac{1}{y}\,dy = x\,dx. $$

Step 2: Integrate.

$$ \ln|y| = \frac{x^2}{2} + C. $$

Step 3: Solve for \( y \). Exponentiate both sides:

$$ |y| = e^{C}e^{x^2/2} \quad\Longrightarrow\quad y = Ae^{x^2/2}, $$

where \( A = \pm e^{C} \). Allowing \( A = 0 \) also recovers the solution \( y = 0 \), which we lost when dividing.

Step 4: Apply the condition.

$$ y(0) = Ae^{0} = A = 2. $$

Answer: \( y = 2e^{x^2/2} \).

Check: \( y' = 2e^{x^2/2}\cdot x = x\left(2e^{x^2/2}\right) = xy \). Correct.

Worked Example 2: An Implicit Solution First

Solve \( \frac{dy}{dx} = \frac{x^2}{y} \) with \( y(0) = 3 \).

Step 1: Separate. Multiply both sides by \( y\,dx \):

$$ y\,dy = x^2\,dx. $$

Step 2: Integrate.

$$ \frac{y^2}{2} = \frac{x^3}{3} + C. $$

This is an implicit solution. We can apply the condition now or after solving for \( y \).

Step 3: Apply the condition. At \( x = 0, y = 3 \):

$$ \frac{9}{2} = 0 + C \quad\Longrightarrow\quad C = \frac{9}{2}. $$

Step 4: Solve for \( y \). Multiply by 2:

$$ y^2 = \frac{2x^3}{3} + 9. $$

Taking the square root gives \( \pm \). Since \( y(0) = 3 \) is positive, we choose the positive root:

$$ y = \sqrt{\frac{2x^3}{3} + 9}. $$

Check: \( y' = \frac{1}{2}\left(\frac{2x^3}{3} + 9\right)^{-1/2}\cdot 2x^2 = \frac{x^2}{y} \). Correct.

Worked Example 3: Newton's Law of Cooling

A cup of tea at \( 90^\circ\text{C} \) is placed in a room at \( 20^\circ\text{C} \). After 10 minutes it is \( 60^\circ\text{C} \). Its temperature satisfies \( \frac{dT}{dt} = -k(T - 20) \). Find \( T(t) \).

Step 1: Separate.

$$ \frac{1}{T - 20}\,dT = -k\,dt. $$

Step 2: Integrate.

$$ \ln|T - 20| = -kt + C \quad\Longrightarrow\quad T - 20 = Ae^{-kt}. $$

Step 3: Use \( T(0) = 90 \).

$$ 90 - 20 = A \quad\Longrightarrow\quad A = 70, \qquad T = 20 + 70e^{-kt}. $$

Step 4: Use \( T(10) = 60 \) to find \( k \).

$$ 60 = 20 + 70e^{-10k} \quad\Longrightarrow\quad e^{-10k} = \frac{40}{70} = \frac{4}{7}. $$

$$ k = \frac{1}{10}\ln\frac{7}{4} \approx 0.0560 \text{ per minute}. $$

Answer: \( T(t) = 20 + 70e^{-0.0560t} \). As \( t \to \infty \), \( T \to 20 \), which matches room temperature.

Common Mistakes

  • Separating a sum. \( \frac{dy}{dx} = x + y \) cannot be separated; it needs the integrating factor method instead.
  • Forgetting the constant, or adding it only after exponentiating incorrectly. Add \( C \) right after integrating.
  • Writing \( e^{x^2/2 + C} = e^{x^2/2} + e^{C} \). The correct step is \( e^{x^2/2 + C} = e^{C}e^{x^2/2} \).
  • Losing solutions. Dividing by \( h(y) \) can lose constant solutions where \( h(y) = 0 \), such as \( y = 0 \).
  • Choosing the wrong square root sign. Let the initial condition decide.

Key Takeaways

  • An ODE is separable if \( \frac{dy}{dx} \) factors as \( g(x)h(y) \).
  • Separate, integrate both sides, add one constant, then solve for \( y \).
  • Use the initial condition to find the constant, and pick signs that match it.
  • Check for constant solutions lost when dividing.
  • Always verify by differentiating your answer.

Need step-by-step solutions to your differential equations homework or a complete assignment? Contact Amathify's experts and PhD scholars on WhatsApp or through the "Ask a Question" form.

Stuck on a problem or assignment?

Our experts and PhD scholars solve maths, physics and chemistry — step by step.

WhatsApp usAsk a question

Related articles