Skip to content

Solving separable differential equations

A separable differential equation is a first-order equation whose variables can be rearranged so that every expression involving yy is with dydy and every expression involving xx is with dxdx. Integration then gives a family of solution curves.

The standard form is

dydx=f(x)g(y).\frac{dy}{dx}=f(x)g(y).

Where g(y)0g(y)\ne0, rearrange it as

1g(y)dy=f(x)dx\frac1{g(y)}\,dy=f(x)\,dx

and integrate both sides:

1g(y)dy=f(x)dx.\boxed{\int\frac1{g(y)}\,dy=\int f(x)\,dx.}

This lesson is about solving the equation. For what a differential equation says about a real situation, continue to interpreting differential-equation models.

You should be able to:

  • integrate powers, exponentials and reciprocal functions using integration basics
  • use integration by substitution
  • rearrange equations involving logarithms and exponentials
  • apply an initial condition to find a constant
  • differentiate with the chain rule to check a solution

An equation such as

dydx=2xy\frac{dy}{dx}=2xy

does not ask for one number. It asks for functions y(x)y(x) whose gradient at each point (x,y)(x,y) equals 2xy2xy. There is usually a family of such functions, distinguished by an arbitrary constant.

An initial condition, such as y=3y=3 when x=0x=0, selects one member of the family. It is often written y(0)=3y(0)=3.

For dydx=f(x)g(y)\frac{dy}{dx}=f(x)g(y):

  1. Separate the variables, putting the yy terms with dydy and the xx terms with dxdx.
  2. Integrate both sides.
  3. Write just one arbitrary constant, usually on the right.
  4. Rearrange for yy if an explicit solution is required and possible.
  5. Use any initial condition to find the constant.
  6. Check by differentiating and substituting into the original equation.

The rearrangement with dydy and dxdx is a compact way to perform a valid chain-rule substitution. It is not simply cancelling decorative symbols.

Solve

dydx=3x2y.\frac{dy}{dx}=3x^2y.

For y0y\ne0, divide by yy and multiply by dxdx:

1ydy=3x2dx.\frac1y\,dy=3x^2\,dx.

Integrate:

1ydy=3x2dxlny=x3+C.\begin{aligned} \int\frac1y\,dy&=\int3x^2\,dx\\ \ln|y|&=x^3+C. \end{aligned}

Exponentiating gives

y=ex3+C=eCex3.|y|=e^{x^3+C}=e^C e^{x^3}.

Rather than carrying the positive quantity eCe^C and a separate sign, absorb both into a new non-zero constant AA:

y=Aex3.y=Ae^{x^3}.

The division by yy excluded y=0y=0, but y=0y=0 also satisfies the original equation. Including it amounts to allowing A=0A=0. Thus the complete family is

y=Aex3,AR.\boxed{y=Ae^{x^3}},\qquad A\in\mathbb R.

Check:

dydx=Aex3(3x2)=3x2y.\frac{dy}{dx}=Ae^{x^3}(3x^2)=3x^2y.

Worked example 2: use an initial condition

Section titled “Worked example 2: use an initial condition”

Solve

dydx=2xy,y=3 when x=2.\frac{dy}{dx}=\frac{2x}{y}, \qquad y=3\text{ when }x=2.

Separate the variables:

ydy=2xdx.y\,dy=2x\,dx.

Integrate both sides:

12y2=x2+C.\frac12y^2=x^2+C.

It is convenient to multiply through by 22 and rename the arbitrary constant:

y2=2x2+C.y^2=2x^2+C.

Apply (x,y)=(2,3)(x,y)=(2,3):

9=2(22)+C,9=2(2^2)+C,

so C=1C=1. Hence

y2=2x2+1.y^2=2x^2+1.

Taking a square root creates two algebraic branches, but the initial condition y=3>0y=3>0 selects the positive branch:

y=2x2+1.\boxed{y=\sqrt{2x^2+1}}.

Check by implicit differentiation:

2ydydx=4xdydx=2xy.2y\frac{dy}{dx}=4x \quad\Longrightarrow\quad \frac{dy}{dx}=\frac{2x}{y}.

An explicit solution has yy isolated, such as

y=2x2+1.y=\sqrt{2x^2+1}.

An implicit solution gives a relationship between xx and yy, such as

y22x2=1.y^2-2x^2=1.

Both forms can be valid. Do not force an implicit equation into an awkward or impossible explicit form unless the question asks for yy in terms of xx.

Find the solution of

dydx=x2+1y2+1\frac{dy}{dx}=\frac{x^2+1}{y^2+1}

that passes through (0,1)(0,1). Give your answer implicitly.

Separate:

(y2+1)dy=(x2+1)dx.(y^2+1)\,dy=(x^2+1)\,dx.

Integrate:

y33+y=x33+x+C.\frac{y^3}{3}+y=\frac{x^3}{3}+x+C.

Use (0,1)(0,1):

13+1=C,\frac13+1=C,

so C=43C=\frac43. Multiplying by 33 gives the cleaner implicit answer

y3+3y=x3+3x+4.\boxed{y^3+3y=x^3+3x+4}.

There is no benefit in trying to solve this cubic for yy.

Solve

dydx=x(1+y),y(0)=2.\frac{dy}{dx}=x(1+y), \qquad y(0)=2.

For y1y\ne-1,

11+ydy=xdx.\frac1{1+y}\,dy=x\,dx.

Therefore

ln1+y=x22+C.\ln|1+y|=\frac{x^2}{2}+C.

Using the initial condition before exponentiating is efficient:

ln3=C.\ln3=C.

Thus

ln1+y=x22+ln3.\ln|1+y|=\frac{x^2}{2}+\ln3.

Since 1+y=3>01+y=3>0 at x=0x=0, the relevant branch is positive:

1+y=3ex2/2.1+y=3e^{x^2/2}.

Hence

y=3ex2/21.\boxed{y=3e^{x^2/2}-1}.

The excluded constant function y=1y=-1 also solves the differential equation, but it cannot satisfy y(0)=2y(0)=2.

Worked example 5: a less obvious separation

Section titled “Worked example 5: a less obvious separation”

Solve

(1+x2)dydx=2xy2,y(0)=1.(1+x^2)\frac{dy}{dx}=2xy^2, \qquad y(0)=1.

First isolate the derivative:

dydx=2x1+x2y2.\frac{dy}{dx}=\frac{2x}{1+x^2}y^2.

For y0y\ne0, separate:

y2dy=2x1+x2dx.y^{-2}\,dy=\frac{2x}{1+x^2}\,dx.

Integrate. The right side uses the reverse chain rule:

1y=ln(1+x2)+C.-\frac1y=\ln(1+x^2)+C.

Use x=0x=0, y=1y=1:

1=ln1+C,-1=\ln1+C,

so C=1C=-1. Therefore

1y=ln(1+x2)1.-\frac1y=\ln(1+x^2)-1.

Rearranging,

y=11ln(1+x2).\boxed{y=\frac1{1-\ln(1+x^2)}}.

This formula is valid only where its denominator is non-zero. The interval containing the initial point ends when

1ln(1+x2)=0x=±e1.1-\ln(1+x^2)=0 \quad\Longrightarrow\quad x=\pm\sqrt{e-1}.

So the solution through (0,1)(0,1) is defined on

e1<x<e1.-\sqrt{e-1}<x<\sqrt{e-1}.

This is a useful A* detail: a solution formula and its interval of validity are not always the same thing.

Dividing by an expression involving yy may discard solutions for which that expression is zero.

For example, consider

dydx=x(y2)(y+1).\frac{dy}{dx}=x(y-2)(y+1).

Separating by division gives

1(y2)(y+1)dy=xdx,\frac1{(y-2)(y+1)}\,dy=x\,dx,

but this assumes (y2)(y+1)0(y-2)(y+1)\ne0. Before dividing, test its zeros in the original equation:

y=2andy=1\boxed{y=2\quad\text{and}\quad y=-1}

are constant solutions because each makes both sides zero. They must be recorded separately if the complete solution set is required.

The same warning applies when cancelling a factor. Always ask: what values made the factor zero?

Integrating dydx\frac{dy}{dx} term by term

Section titled “Integrating dydx\frac{dy}{dx}dxdy​ term by term”

From

dydx=xy,\frac{dy}{dx}=xy,

it is wrong to write y=12x212y2+Cy=\frac12x^2\cdot\frac12y^2+C. The variables must first be separated:

1ydy=xdx.\frac1y\,dy=x\,dx.

Writing

F(y)+C1=G(x)+C2F(y)+C_1=G(x)+C_2

is not incorrect, but only the difference C2C1C_2-C_1 matters. Replace it with one constant:

F(y)=G(x)+C.F(y)=G(x)+C.

The integral is

1ydy=lny+C,\int\frac1y\,dy=\ln|y|+C,

not automatically lny+C\ln y+C. An initial condition may later determine whether the relevant branch is positive or negative.

If y2=h(x)y^2=h(x), then y=±h(x)y=\pm\sqrt{h(x)} describes two branches. A non-zero initial value selects one branch. Do not leave ±\pm when the condition determines the sign.

First integrate to obtain the family, then substitute the given xx and yy values. Never put the initial values into the differential equation and expect to determine the integration constant, because the constant has not appeared yet.

Which equations are separable?

(a) dydx=x2(1y),(b) dydx=x+y,(c) ydydx=cosx.\text{(a) }\frac{dy}{dx}=x^2(1-y), \qquad \text{(b) }\frac{dy}{dx}=x+y, \qquad \text{(c) }y\frac{dy}{dx}=\cos x.
Answer

(a) and (c) are separable:

11ydy=x2dx,ydy=cosxdx.\frac1{1-y}\,dy=x^2\,dx, \qquad y\,dy=\cos x\,dx.

Equation (b) is not separable in its given form because x+yx+y cannot be written as a product of a function of xx and a function of yy.

Solve

dydx=4xy.\frac{dy}{dx}=4xy.
Answer

For y0y\ne0,

1ydy=4xdx.\frac1y\,dy=4x\,dx.

Hence

lny=2x2+C\ln|y|=2x^2+C

and

y=Ae2x2.\boxed{y=Ae^{2x^2}}.

Allowing A=0A=0 includes the constant solution y=0y=0.

Given

dydx=xy2,y(0)=2,\frac{dy}{dx}=\frac{x}{y^2}, \qquad y(0)=2,

find yy explicitly.

Answer

Separate and integrate:

y2dy=xdxy33=x22+C.y^2\,dy=x\,dx \quad\Longrightarrow\quad \frac{y^3}{3}=\frac{x^2}{2}+C.

Using y(0)=2y(0)=2 gives C=83C=\frac83. Therefore

2y3=3x2+16,2y^3=3x^2+16,

so

y=3x2+1623.\boxed{y=\sqrt[3]{\frac{3x^2+16}{2}}}.

Which solutions could be lost when separating

dydx=exy(y5)?\frac{dy}{dx}=e^x y(y-5)?
Answer

Division by y(y5)y(y-5) excludes y=0y=0 and y=5y=5. Both are constant solutions of the original equation:

y=0andy=5.\boxed{y=0\quad\text{and}\quad y=5}.

Show that

y=23x2y=\frac{2}{3-x^2}

satisfies dydx=xy2\frac{dy}{dx}=xy^2 wherever it is defined.

Answer

Differentiate using the chain rule:

dydx=2(1)(3x2)2(2x)=4x(3x2)2.\frac{dy}{dx} =2(-1)(3-x^2)^{-2}(-2x) =\frac{4x}{(3-x^2)^2}.

Also,

xy2=x(23x2)2=4x(3x2)2.xy^2=x\left(\frac2{3-x^2}\right)^2 =\frac{4x}{(3-x^2)^2}.

The expressions agree. The solution is not defined at x=±3x=\pm\sqrt3.

  • Confirm that the equation can be written as dydx=f(x)g(y)\frac{dy}{dx}=f(x)g(y).
  • Separate completely before integrating.
  • Use one arbitrary constant.
  • Check values excluded by division for constant solutions.
  • Apply the initial condition to the integrated equation.
  • Select the correct branch after taking roots or exponentiating.
  • Give an implicit answer unless an explicit form is requested.
  • Differentiate your result to check it against the original equation.

Use interpreting differential-equation models to connect solution families and initial conditions to growth, decay and other real processes. Revisit integration by substitution if either side of a separated equation is difficult to integrate, and use checking answers to strengthen substitution, differentiation and domain checks.