1. Theory

If one can re-arrange an ordinary differential equation into the following standard form:

dy/dx = ƒ(x) g(y)

then the solution may be found by the technique of separation of variables.

dy/g(x) = ƒ(x) dx

This result is obtained by dividing the standard form by g(y), and then integrating both sides with respect to x.

2. Exercises

Click on questions to reveal their solutions

Exercise 1:

Find the general solution of dy/dx = 3x2ey and the particular solution that satisfies the condition y(0) = 1

Solution:

The equation is of the form dy/dx = ƒ(x) g(y), where ƒ(x) = 3x2 and g(x) = ey, so we can separate the variables and then integrate:

eydy = 3x2dx    i.e.  ey = x3 + A   (where A = arbitrary constant)

General solution: y = ln (x3 + A)

Particular solution: y(x) = 1 when x = 0, i.e.  e1 = 03 + A

i.e.  A = e   and   y = ln (x3 + e)

Exercise 2:

Find the general solution of dy/dx = y/x

Solution:

The equation is of the form dy/dx = ƒ(x) g(y), where ƒ(x) = 1/x and g(x) = y, so we can separate the variables and then integrate:

dy/y = dx/x
i.e.  ln y = ln x + C
  = ln x + ln k   (ln k = C = constant)
i.e.  ln y − ln x = ln k
i.e.  ln (yx) = ln k
i.e.  y = kx

Exercise 3:

Solve the equation dy/dx = y + 1/x − 1 given the boundary condition: y = 1 at x = 0

Solution:

Find the general solution first. Then aply the boundary condition to get the particular solution.

The equation is of the form dy/dx = ƒ(x) g(y), where ƒ(x) = 1/x − 1 and g(x) = y + 1, so separate the variables and integrate:

dy/y + 1 = dx/x − 1
i.e.  ln (y + 1) = ln (x − 1) + C
  = ln (x − 1) + ln k   (k = arbitrary constant)
i.e.  ln (y + 1) − ln (x − 1) = ln k
i.e.  ln ( y + 1/x − 1 ) = ln k
i.e.  y + 1/x − 1 = k
i.e.  y + 1 = k(x − 1)   ⇐ general solution

Now determine k for particular solution with y(0) = 1:

1 + 1 = k(0 − 1)
i.e.  2 = k
∴  k = −2
so: y + 1 = −2 (x − 1)
∴  y = −2x + 1   ⇐ particular solution

Exercise 4:

Solve y2dy/dx = x and find the particular solution when y(0) = 1

Solution:

Use separation of variables to find the general solution first:

y2dy = xdx    i.e. y3/3 = x2/2 + C ⇐ general solution

Particular solution: with y = 1, x = 0, i.e. 1⁄3 = 0 + C, i.e. C = 1⁄3

i.e. y3 = 3y/2 + 1

Exercise 5:

Find the solution of dy/dx = e2x+y that has y = 0 when x = 0

Solution:

Find the general solution first, then find the particular solution.

Write equation as dy/dx = e2x ey   ( ≡ ƒ(x) g(y))

Separate variables and integrate:

dy/ey = e2xdx
i.e.  −ey = 1/2 e2x + C
i.e.  ey = 1/2 e2xC
i.e.  −y = ln (1/2 e2xC)
i.e.  y = − ln (1/2 e2xC)   ⇐ general solution

Particular solution with y = 0, x = 0 gives:

0 = − ln (1/2C)
i.e.  − 1/2C = 1
i.e.  C = 3/2
∴  y = −ln ( 3 − e2x/2 )

Exercise 6:

Find the general solution of xy/x + 1 = dy/dx

Solution:

Separate variables and integrate:

x/ x + 1dx = dy/ y

Numerator and denominator of LHS are same degree in x: reduce degree of numerator using long division:

x/ x + 1 = x + 1 − 1/ x + 1 = x + 1/ x + 11/ x + 1 = 1 − 1/ x + 1
i.e.   (1 − 1/x + 1 )dx = dy/y
i.e.  x − ln (x + 1) = ln y + ln k   (ln k = constant of integration)
i.e.  x = ln (x + 1) + ln y + ln k
  = ln [ky(x + 1)]
i.e.  ex = ky(x + 1)   ⇐ general solution

Exercise 7:

Find the general solution of x sin 2ydy/dx = (x + 1)2

Solution:

Separate variables and integrate:

i.e.  sin2ydy = (x + 1)2/xdx
i.e.   1/2 (1 − cos 2y) dy = x2 + 2x + 1/xdx
i.e.   1/2 dy1/2 cos 2ydy = ( x + 2 + 1/x )dx
i.e.   1/2 y1/21/2 sin 2y = 1/2x2 + 2x + ln x + C

Exercise 8:

Solve dy/dx = −2x tan y

Solution:

Find general solution first.

Separate variables:   dy/tan y = −2xdx
Integrate:  i.e.   cot ydy = −2xdx
i.e.  ln (sin y) = −2⋅ x2/2 + A
i.e.  sin y = ex2 + A
{ Note: cos y/sin ydy is of form ƒ′(y)/ƒ(y)dy = ln [ƒ(y)] + C }

Particular solution: y = π/2 when x = 0

gives:  sin π/2 = eA
i.e.  1 = eA
i.e.  A = 0
∴  sin y = ex2

Exercise 9:

Solve (1 + x2)dy/dx + xy = 0 and find the particular solution when y(0) = 2

Solution:

Separate variables and integrate:

(1 + x2)dy/dx = xy
dy/y = x/1 + x2dx
dy/y = 1/2 2x/1 + x2dx
{ Note: compare with ƒ′(x)/ƒ(x) }
i.e.  ln y = 1/2 ln (1 + x2) + ln k   (ln k = constant)
i.e.  ln y + ln (1 + x2)½ = ln k
i.e.  ln [y(1 + x2)½] = ln k
∴  y(1 + x2)½ = k   ⇐ general solution

Particular solution with y(0) = 2:

i.e.  y(x) = 2 when x = 0
i.e.  2(1 + 0)½ = k
i.e.  k = 2
∴  y(1 + x)½ = 2

Exercise 10:

Solve xdy/dx = y2 + 1 and find the particular solution when y(1) = 1

Solution:

dy/y2 + 1 = dx/x
{ Use standard integral: dy/1 + y2 = tan−1y + C }
i.e.  tan−1y = ln x + C   ⇐  general solution

Particular solution with y = 1 when x = 1:

tan π/4 = 1   ∴ tan−1(1) = π/4 while   ln (1) = 0 (i.e. 1 = e0)
∴  π/4 = 0 + C
i.e.   C = π/4
∴  tan−1y = ln x + π/4    ⇐  particular solution

Exercise 11:

Find the general solution of xdy/dx = y2 − 1

Solution:

dy/y2 − 1 = dx/x
Use partial fractions:   1/y2 − 1 = A/y − 1 + B/y + 1 = A(y + 1) + B(y − 1)/ (y − 1)(y + 1)
  = A(y + 1) + B(y − 1)/ y2 − 1

Compare numerators:   1 = (A + B)y + (AB)   [true for all y]

  A + B = 0
  AB = 1
  2A = 1
 
∴ A = 1/2, B = −1/2
i.e.   A/y − 1 + B/y + 1dy = dx/x
i.e.   1/2 1/y − 11/y + 1dy = dx/x
i.e.   1/2 [ln (y − 1) − ln (y + 1)] = ln x + ln k
i.e.   ln (y − 1) − ln (y + 1) − 2 ln x = ln k
i.e.   ln  [ y − 1/(y + 1)x2] = 2 ln k
∴   y − 1 = k'x2(y + 1)   (k' = k2 = constant)

Exercise 12:

Find the general solution of 1/y dy/dx = x/x2 + 1

Solution:

dy/y = x/x2 + 1dx = 1/2 2x/x2 + 1dx
{ Note: ƒ′(x)/ƒ(x)dx = ln [ƒ(x)] + A }
i.e.  ln y = 1/ 2 ln (x2 + 1) + C
i.e.   1/ 2 ln y2 = 1/ 2 ln (x2 + 1) + C   (modify LHS to allow log manipulations)
i.e.   1/ 2 ln  [ y2/ x2 + 1 ] = C
i.e.   y2/ x2 + 1 = e2C
i.e.   y2 = k(x2 + 1)   (where k = e2C = constant)

Exercise 13:

Solve dy/dx = y/x(x + 1)

Solution:

dy/y = dx/x(x + 1)
Use partial fractions:   1/x(x + 1) = A/x + B/x + 1 = A(x + 1) + Bx/ x(x + 1)
  = (A + B)x + A/ x(x + 1)

Compare numerators:   1 = (A + B)x + A   [true for all x]

i.e.  A + B = 0 and A = 1,   ∴ B = −1

i.e.   dy/y = ( 1/x1/x + 1 )dx
i.e.   ln y = ln x − ln (x + 1) + C
i.e.   ln y − ln x + ln (x + 1) = ln k   (ln k = C = constant)
i.e.   ln [ y(x + 1)/ x ] = ln k
i.e.  y(x + 1)/ x = k
∴  y = kx/ x + 1   ⇐ general solution

Particular solution with y(1) = 3:

i.e.  3 = k/ 1 + 1
i.e.  k = 6
∴  y = 6x/ x + 1

Exercise 14:

Find the general solution of sec xdy/dx = sec2y

Solution:

i.e.   dy/sec2y = dx/sec x
i.e.   cos2ydy = cos xdx
i.e.   1 + cos 2y/2 = cos xdx
y/2 + 1/21/2sin 2y = sin x + C
∴   2y + sin 2y = 4 sin x + C'   (where C' = 4C = constant)

Exercise 15:

Find the general solution of cosec3xdy/dx = cos2y

Solution:

i.e.   dy/cos2y = dx/cosec3x
  = sin3xdx
  = sin2x ⋅sin xdx
  = (1 − cos2x ⋅sin xdx
  = sin xdxcos2x ⋅sin xdx
    Set u = cos x in 2nd term, so du/dx = −sin x
    → cos2x sin x = −u2du
LHS is standard integral: sec2dy = tan y + A    
i.e.  tan y = −cos x + cos3x/3 + C   ⇐ general solution

Exercise 16:

Find the general solution of (1 − x2)dy/dx + x(ya) = 0

Solution:

Rewrite equation:  (1 − x2) dy/dx = x(ya)
i.e.   dy/ya = x/1 − x2dx
i.e.   dy/ya = + 1/2 −2x/1 − x2dx    [compare RHS with ƒ′(x)/ƒ(x)dx]
i.e.   ln (ya) = 1/2  ln (1 − x2) + ln k
i.e.   ln (ya) − ln (1 − x2)½ = ln k
∴   ya = k(1 − x2)½

3. Standard Integrals

ƒ(x) ƒ(x) dx   ƒ(x) ƒ(x) dx
xn xn+1/ n+1 (n ≠ −1)   [g(x)]ng'(x) [g(x)]n+1/ n+1 (n ≠ −1)
1/x ln x   g'(x)/g(x) ln g(x)
ex ex   ax ax/ln a (a > 0)
sin x −cos x   sinh x cosh x
cos x sin x   cosh x sinh x
tan x − ln cosx   tanh x ln cosh x
cosec x ln tan  x/2   cosech x ln tanh  x/2
sec x ln sec x + tan x   sec x 2 tan−1ex
sec2x tan x   sec2x tanh x
cot x ln sin x   cot x ln sinh x
sin2x x/2sin 2x/4   sinh2x sinh 2x/4x/2
cos2x x/2 + sin 2x/4   cosh2x sinh 2x/4 + x/2
1/ a2 + x2 1/ a tan −1x/ a   (a > 0)   a2 + x2 a2/ 2 [ sinh−1( x/ a ) + x a2x2 / a2 ]
1/ a2x2 1/ 2a ln  a + x/ ax    (0 < x < a)   a2x2 a2/ 2 [ sin−1( x/ a ) + x a2x2 / a2 ]
1/ x2a2 1/ 2a ln  xa/ x + a   (x > a > 0)   x2a2 a2/ 2 [−cosh−1( x/ a ) + x x2a2 / a2 ]
1/ a2 + x2 ln  x + a2 + x2 / a    (a > 0)      
1/ a2x2 sin−1x/ a     (−a < x < a)   1/ x2a2 ln  x + x2a2 / a   (x > a > 0)

PPLATO material © copyright 2004, University of Salford