Separable Differential Equations
A separable differential equation is one you can write as dy/dx = g(x)·h(y), so all the y’s can move to one side and all the x’s to the other. To solve it, separate the variables, integrate both sides, add one constant C, and solve for y. An initial condition then gives the value of C.
Before this lesson: Verifying Solutions to Differential Equations, Euler’s Method and U-Substitution
The idea: sort the x’s and the y’s
A differential equation like dy/dx = 4x/y mixes x and y. You can’t integrate the right side with respect to x, because y is an unknown function of x.
The fix is to sort. Move every y, along with dy, to the left side. Move every x, along with dx, to the right side. Now each side has only one variable, so you can integrate each side on its own.
This works because of the chain rule. Integrating (1/h(y)) dy on the left is the same as integrating (1/h(y))·(dy/dx) dx, so both sides are really integrals with respect to x.
How to solve separable differential equations
\dfrac{dy}{dx} = g(x)\,h(y) \quad\Longrightarrow\quad \int \dfrac{1}{h(y)}\,dy = \int g(x)\,dx- Separate: divide both sides by h(y) and multiply both sides by dx, so dy is with the y’s and dx is with the x’s.
- Integrate both sides.
- Add one constant of integration, C, on the x side. (Constants from both sides combine into one.)
- Solve for y if you can. If you can’t, leave the answer as an equation in x and y, called an implicit solution.
- Use the initial condition to find C, and use it to choose a sign if a square root appears.
Watch for lost solutions. Dividing by h(y) is only allowed when h(y) ≠ 0. If h(c) = 0 for some number c, then the constant function y = c is also a solution, called an equilibrium solution.
How to tell if an equation is separable
The right side must factor into a function of x times a function of y. Factoring or using exponent rules sometimes shows the split.
| Equation | Separable? | Why |
|---|---|---|
| \dfrac{dy}{dx} = xy^2 | Yes | g(x) = x, h(y) = y^2 |
| \dfrac{dy}{dx} = y + xy | Yes | Factor: y(1 + x) |
| \dfrac{dy}{dx} = e^{x+y} | Yes | e^{x+y} = e^x e^y |
| \dfrac{dy}{dx} = x + y | No | A sum of x and y can’t be written as a product |
| \dfrac{dy}{dx} = \sin(xy) | No | x and y are stuck together inside the sine |
Separable differential equations examples
Example 1: Square root solution
Solve dy/dx = 4x/y with y(1) = 3.
y\,dy = 4x\,dx
Multiply both sides by y and by dx to separate the variables.
\int y\,dy = \int 4x\,dx
Integrate both sides.
\dfrac{y^2}{2} = 2x^2 + CUse the power rule on each side (see antiderivatives), with one constant on the right.
y^2 = 4x^2 + 2C
Multiply both sides by 2.
y^2 = 4x^2 + K
Rename 2C as K. It is still just some constant.
3^2 = 4(1)^2 + K
Substitute x = 1 and y = 3.
9 = 4 + K
Simplify each side.
K = 5
Subtract 4 from both sides.
y^2 = 4x^2 + 5
Put K = 5 back into the equation.
y = \sqrt{4x^2 + 5}Take the positive square root, because y(1) = 3 is positive.
Answer: y = √(4x² + 5). Check: y′ = 4x/√(4x² + 5) = 4x/y, and y(1) = √9 = 3.
Example 2: Exponential solution
Solve dy/dx = 3x²y with y(0) = 5.
\dfrac{1}{y}\,dy = 3x^2\,dxDivide both sides by y and multiply by dx.
\int \dfrac{1}{y}\,dy = \int 3x^2\,dxIntegrate both sides.
\ln|y| = x^3 + C
The integral of 1/y is ln|y| (see integrals that give natural logarithms).
|y| = e^{x^3 + C}Rewrite in exponential form (see logarithms).
|y| = e^{C}e^{x^3}Split the power with the product rule for exponents (see exponent rules).
y = A\,e^{x^3}Let A = ±e^C. A = 0 also works, since y = 0 is a solution.
5 = A\,e^{0}Substitute x = 0 and y = 5.
A = 5
Use e⁰ = 1.
Answer: y = 5e^(x³). The constant C became a multiplier A, which is how exponential solutions usually look.
Example 3: Splitting an exponential
Solve dy/dx = e^(2x − y) with y(0) = 0.
\dfrac{dy}{dx} = e^{2x}e^{-y}Split the power into a product of an x part and a y part.
e^{y}\,dy = e^{2x}\,dxMultiply both sides by e^y and by dx.
\int e^{y}\,dy = \int e^{2x}\,dxIntegrate both sides.
e^{y} = \tfrac{1}{2}e^{2x} + CIntegrate e^(2x) with u = 2x (see u-substitution).
e^{0} = \tfrac{1}{2}e^{0} + CSubstitute x = 0 and y = 0.
1 = \tfrac{1}{2} + CUse e⁰ = 1.
C = \tfrac{1}{2}Subtract 1/2 from both sides.
e^{y} = \tfrac{1}{2}e^{2x} + \tfrac{1}{2}Put C back in.
y = \ln\left(\tfrac{1}{2}e^{2x} + \tfrac{1}{2}\right)Take the natural log of both sides.
Answer: y = ln((e^(2x) + 1)/2).
Example 4: Factor first
Solve dy/dx = xy² + x with y(0) = 1.
\dfrac{dy}{dx} = x(y^2 + 1)Factor out x (see factoring out the GCF). Now the equation is separable.
\dfrac{1}{y^2 + 1}\,dy = x\,dxDivide by y² + 1 (never zero) and multiply by dx.
\int \dfrac{1}{1 + y^2}\,dy = \int x\,dxIntegrate both sides.
\arctan y = \dfrac{x^2}{2} + CThe left side is an arctangent (see integrals that give inverse trig functions).
\arctan 1 = 0 + C
Substitute x = 0 and y = 1.
C = \dfrac{\pi}{4}Since tan(π/4) = 1.
\arctan y = \dfrac{x^2}{2} + \dfrac{\pi}{4}Put C back in.
y = \tan\left(\dfrac{x^2}{2} + \dfrac{\pi}{4}\right)Take the tangent of both sides.
Answer: y = tan(x²/2 + π/4). This solution is valid only while x²/2 + π/4 stays below π/2, so for |x| less than √(π/2) ≈ 1.25.
Example 5: Draining a tank (word problem)
Water drains from a tank through a hole in the bottom. The depth h (in feet) after t minutes follows dh/dt = −0.2√h, and the tank starts 16 feet deep. Find the depth after 10 minutes and when the tank is empty.
h^{-1/2}\,dh = -0.2\,dtDivide both sides by √h and multiply by dt.
\int h^{-1/2}\,dh = \int -0.2\,dtIntegrate both sides.
2h^{1/2} = -0.2t + CPower rule: add 1 to −1/2 and divide by 1/2.
2\sqrt{16} = -0.2(0) + CSubstitute t = 0 and h = 16.
C = 8
Since 2(4) = 8.
2\sqrt{h} = 8 - 0.2tPut C back in.
\sqrt{h} = 4 - 0.1tDivide both sides by 2.
h = (4 - 0.1t)^2
Square both sides (valid while 4 − 0.1t ≥ 0).
h(10) = (4 - 1)^2 = 9
Depth after 10 minutes.
4 - 0.1t = 0
The tank is empty when h = 0.
t = 40
Add 0.1t to both sides and divide by 0.1.
Answer: 9 feet deep after 10 minutes, and empty after 40 minutes. The depth drops fastest at the start, when the water pressure is highest.
Common mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Adding C after solving for y | y = e^{x^3} + C | Add C right after you integrate, then solve. It becomes y = Ae^{x^3}. |
| Splitting e^{x^3 + C} into a sum | e^{x^3 + C} = e^{x^3} + e^C | Powers add when bases multiply: e^{x^3 + C} = e^C e^{x^3}. |
| Separating a sum | From dy/dx = x + y, writing dy − y = x dx | x + y is not a product, so the equation isn’t separable. |
| Losing a constant solution | Dividing by y and never noting y = 0 | Check where h(y) = 0. Those constant functions are solutions too. |
| Choosing the wrong square root | Writing y = -\sqrt{4x^2 + 5} when y(1) = 3 | Use the sign of the initial y-value. |
| Dropping dx or dy | Writing y dy = 4x and then integrating | Each side needs its own dy or dx, so you know which variable to integrate with respect to. |
Related methods
Slope fields and Euler’s method
A slope field shows the shape of the solutions, and Euler’s method estimates them with numbers. Separation of variables gives the exact formula, so you can use it to check both.
Checking your answer
Differentiate your solution and substitute it back into the equation, as in verifying solutions to differential equations. Also check that it meets the initial condition.
Growth, cooling and logistic models
The rest of this unit applies separation to dy/dt = ky (Exponential Models with Differential Equations), to Newton’s law of cooling and to logistic growth. All three are separable. Compare the algebra version in exponential growth and decay.
Equations that aren’t separable
Equations like dy/dx = x + y need other methods, such as an integrating factor. Those are taught in the Differential Equations course.
Practice problems
- Find the general solution of dy/dx = 2x/y².
- Solve dy/dx = 5y with y(0) = 2.
- Solve dy/dx = x²/y with y(0) = −2.
- Solve dy/dx = y cos x with y(0) = 3.
- Solve dy/dx = e^(x + y) with y(0) = 0.
- Solve dy/dx = (1 + y²)/(1 + x²) with y(0) = 1. Write y without inverse trig functions.
- Solve dy/dx = xy − 2y with y(0) = 4.
- Which are separable? (a) dy/dx = x − xy (b) dy/dx = sin(xy) (c) dy/dx = eˣy²
- Solve dy/dx = 2xy² with y(0) = 1.
- A chemical breaks down so that its mass A (in grams) after t hours follows dA/dt = −0.5A², with A(0) = 4. Find a formula for A and the mass after 6 hours.
Show answers
1.
y^2\,dy = 2x\,dx
Multiply both sides by y² and by dx.
\int y^2\,dy = \int 2x\,dx
Integrate both sides.
\dfrac{y^3}{3} = x^2 + CPower rule on each side.
y^3 = 3x^2 + K
Multiply by 3 and rename 3C as K.
y = \sqrt[3]{3x^2 + K}Take the cube root of both sides.
Answer: y = ∛(3x² + K)
2.
\dfrac{1}{y}\,dy = 5\,dxDivide by y and multiply by dx.
\ln|y| = 5x + C
Integrate both sides.
y = A\,e^{5x}Exponentiate and let A = ±e^C.
2 = A\,e^{0}Substitute x = 0 and y = 2.
A = 2
Use e⁰ = 1.
Answer: y = 2e^(5x)
3.
y\,dy = x^2\,dx
Multiply both sides by y and by dx.
\dfrac{y^2}{2} = \dfrac{x^3}{3} + CIntegrate both sides.
y^2 = \dfrac{2x^3}{3} + KMultiply by 2 and rename 2C as K.
(-2)^2 = 0 + K
Substitute x = 0 and y = −2.
K = 4
Simplify.
y = -\sqrt{\dfrac{2x^3}{3} + 4}Take the negative root, because y(0) = −2 is negative.
Answer: y = −√(2x³/3 + 4)
4.
\dfrac{1}{y}\,dy = \cos x\,dxDivide by y and multiply by dx.
\ln|y| = \sin x + C
Integrate both sides.
y = A\,e^{\sin x}Exponentiate and let A = ±e^C.
3 = A\,e^{\sin 0} = ASubstitute x = 0 and y = 3; sin 0 = 0.
Answer: y = 3e^(sin x)
5.
\dfrac{dy}{dx} = e^{x}e^{y}Split the power into a product.
e^{-y}\,dy = e^{x}\,dxMultiply both sides by e^(−y) and by dx.
-e^{-y} = e^{x} + CIntegrate both sides; the integral of e^(−y) is −e^(−y).
-e^{0} = e^{0} + CSubstitute x = 0 and y = 0.
C = -2
Since −1 = 1 + C.
e^{-y} = 2 - e^{x}Put C back in and multiply both sides by −1.
-y = \ln(2 - e^{x})Take the natural log of both sides.
y = -\ln(2 - e^{x})Multiply both sides by −1.
Answer: y = −ln(2 − eˣ), valid for x less than ln 2
6.
\dfrac{1}{1 + y^2}\,dy = \dfrac{1}{1 + x^2}\,dxDivide by 1 + y² and multiply by dx.
\arctan y = \arctan x + C
Integrate both sides.
\arctan 1 = \arctan 0 + C
Substitute x = 0 and y = 1.
C = \dfrac{\pi}{4}Since arctan 1 = π/4 and arctan 0 = 0.
y = \tan\left(\arctan x + \dfrac{\pi}{4}\right)Take the tangent of both sides.
y = \dfrac{\tan(\arctan x) + \tan\frac{\pi}{4}}{1 - \tan(\arctan x)\tan\frac{\pi}{4}}Use the tangent sum formula (see sum and difference formulas).
y = \dfrac{x + 1}{1 - x}Use tan(arctan x) = x and tan(π/4) = 1.
Answer: y = (1 + x)/(1 − x), for x less than 1
7.
\dfrac{dy}{dx} = y(x - 2)Factor out y.
\dfrac{1}{y}\,dy = (x - 2)\,dxDivide by y and multiply by dx.
\ln|y| = \dfrac{x^2}{2} - 2x + CIntegrate both sides.
y = A\,e^{x^2/2 - 2x}Exponentiate and let A = ±e^C.
4 = A\,e^{0}Substitute x = 0 and y = 4.
Answer: y = 4e^(x²/2 − 2x)
8.
x - xy = x(1 - y)
(a) Factor out x: a product, so separable.
\sin(xy)
(b) x and y can’t be pulled apart: not separable.
e^{x}y^2(c) Already a product of eˣ and y²: separable.
Answer: (a) and (c) are separable; (b) is not
9.
y^{-2}\,dy = 2x\,dxDivide by y² and multiply by dx.
-y^{-1} = x^2 + CIntegrate both sides with the power rule.
-\dfrac{1}{1} = 0 + CSubstitute x = 0 and y = 1.
C = -1
Simplify.
-\dfrac{1}{y} = x^2 - 1Put C back in.
\dfrac{1}{y} = 1 - x^2Multiply both sides by −1.
y = \dfrac{1}{1 - x^2}Take the reciprocal of both sides.
Answer: y = 1/(1 − x²), for x between −1 and 1
10.
A^{-2}\,dA = -0.5\,dtDivide by A² and multiply by dt.
-A^{-1} = -0.5t + CIntegrate both sides.
-\dfrac{1}{4} = 0 + CSubstitute t = 0 and A = 4.
\dfrac{1}{A} = 0.5t + \dfrac{1}{4}Put C back in and multiply both sides by −1.
\dfrac{1}{A} = \dfrac{2t + 1}{4}Write the right side over 4 (see adding and subtracting fractions).
A = \dfrac{4}{2t + 1}Take the reciprocal of both sides.
A(6) = \dfrac{4}{13} \approx 0.308Substitute t = 6.
Answer: A = 4/(2t + 1), so about 0.31 grams after 6 hours
Separable differential equations FAQ
What makes a differential equation separable?
It is separable when dy/dx can be written as a function of x times a function of y. Then every y can go with dy and every x with dx.
How do you solve a separable differential equation?
Separate the variables, integrate both sides, add one constant C, and solve for y. Use the initial condition, if one is given, to find C.
Why is there only one constant of integration?
Each side does produce a constant, but you can subtract one from the other and combine them into a single constant. Putting it on the x side is the usual choice.
Can every first-order differential equation be solved by separation of variables?
No. Equations like dy/dx = x + y or dy/dx = sin(xy) don’t split into an x part times a y part. They need other methods or a numerical method like Euler’s method.
Summary
- A separable equation can be written as dy/dx = g(x)·h(y).
- Separate: (1/h(y)) dy = g(x) dx, then integrate both sides.
- Add one constant C right after integrating, before solving for y.
- Exponential solutions come out as y = Ae^(…), where the constant is a multiplier.
- Use the initial condition to find C and to pick the sign of a square root.
- Values where h(y) = 0 give constant (equilibrium) solutions.
Previous lesson: Euler’s Method
Next lesson: Exponential Models with Differential Equations
Back to the Calculus 2 Index