31.1 Differential Equations and dy/dx = f(x)

AHL 5.18

In this section you will learn
  • what a differential equation is, and what its order is
  • the difference between a general solution and a particular solution
  • how to check that a function is a solution of a differential equation
  • how to solve \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = f(x)\) by direct integration
  • (Extension) how to solve \(\dfrac{\mathrm{d}^2y}{\mathrm{d}x^2} = f(x)\) by integrating twice

Differential equations describe how things change: the speed of a car, the temperature of a cup of tea, the size of a population of bacteria. In this unit you need all the integration methods of Unit 27.

What is a differential equation?

Definition Not in the formula booklet

A differential equation (DE) is an equation that contains a derivative of an unknown function, for example \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) or \(\dfrac{\mathrm{d}^2y}{\mathrm{d}x^2}\).

Some examples:

\[ \frac{\mathrm{d}y}{\mathrm{d}x} = 3x^2 - 1, \qquad \frac{\mathrm{d}y}{\mathrm{d}x} + 2y = x, \qquad \frac{\mathrm{d}P}{\mathrm{d}t} = 0.4P, \qquad \frac{\mathrm{d}^2y}{\mathrm{d}x^2} + y = 0 . \]

The order of a differential equation

Order Not in the formula booklet

The order of a differential equation is the order of the highest derivative in it.

  • A first order DE contains \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\) but no higher derivative.
  • A second order DE contains \(\dfrac{\mathrm{d}^2y}{\mathrm{d}x^2}\) (and possibly \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\)).
Differential equation Order
\(\dfrac{\mathrm{d}y}{\mathrm{d}x} = xy^2\) first
\(\dfrac{\mathrm{d}y}{\mathrm{d}x} - 5 = \sin x\) first
\(\dfrac{\mathrm{d}^2y}{\mathrm{d}x^2} - 3\dfrac{\mathrm{d}y}{\mathrm{d}x} = 4y\) second
\(\dfrac{\mathrm{d}^2x}{\mathrm{d}t^2} + x = t\) second

A power on the derivative does not change the order: \(\left(\dfrac{\mathrm{d}y}{\mathrm{d}x}\right)^2 = y\) is still first order. The IB AA course (AHL 5.18) studies first order differential equations.

General solution and particular solution

Look at the differential equation

\[ \frac{\mathrm{d}y}{\mathrm{d}x} = 6x . \]

Integrate both sides with respect to \(x\): \(\;y = 3x^2 + c\), where \(c\) is an arbitrary constant.

  • \(y = 3x^2 + c\) is the general solution. It is a whole family of curves, one for each value of \(c\).
  • If we also know a point on the curve, for example \(y = 5\) when \(x = 0\), then \(c = 5\) and \(y = 3x^2 + 5\). This is a particular solution.

Solutions of a differential equation Not in the formula booklet

  • A solution is a relationship between \(x\) and \(y\) (with no derivatives) that makes the DE true.
  • The general solution of a first order DE contains one arbitrary constant.
  • A particular solution uses an extra condition (an initial condition such as \(y(0) = 5\)) to find the constant.
  • Going from the DE to the solution is integration. Going back from the solution to the DE is differentiation.

To check a solution, differentiate it and substitute into the DE. Both sides must be equal for all \(x\).

Example 1 Consider the differential equation \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 4x - 2y\).

(a) Show that \(y = 2x - 1 + c\,\mathrm{e}^{-2x}\) is a solution of the differential equation for any constant \(c\).

(b) Sketch the solution curves for \(c = 0, \pm 1, \pm 2\).

(c) Find the particular solution whose graph passes through \((0, 2)\).

(d) Find the equation of the tangent to this particular solution at \((0, 2)\).

(a) \(y = 2x - 1 + c\,\mathrm{e}^{-2x} \Rightarrow \dfrac{\mathrm{d}y}{\mathrm{d}x} = 2 - 2c\,\mathrm{e}^{-2x}\).

Right-hand side: \(4x - 2y = 4x - 4x + 2 - 2c\,\mathrm{e}^{-2x} = 2 - 2c\,\mathrm{e}^{-2x}\).

The two sides are equal for all \(x\), so the function is a solution for every \(c\).

(b) For \(c = 0\) the solution is the straight line \(y = 2x - 1\). For other values of \(c\) the curves approach this line as \(x \to \infty\), because \(c\,\mathrm{e}^{-2x} \to 0\). For \(c > 0\) the curve is above the line; for \(c < 0\) it is below. See Figure 1.

(c) \(x = 0,\ y = 2\): \(\;2 = 0 - 1 + c\), so \(c = 3\). \(\qquad y = 2x - 1 + 3\mathrm{e}^{-2x}\).

(d) We do not need the solution: the DE gives the gradient directly. At \((0, 2)\): \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 4(0) - 2(2) = -4\).

Tangent: \(y - 2 = -4(x - 0)\), so \(y = -4x + 2\).

Figure 1: Solution curves of \(\frac{\mathrm{d}y}{\mathrm{d}x} = 4x - 2y\). Each short grey segment has the gradient given by the DE at that point.

The grey segments in Figure 1 form a slope field. Every solution curve follows the segments. You do not need to draw slope fields in AA, but the picture shows clearly why a DE has a family of solutions.

Differential equations of the form dy/dx = f(x)

If the right-hand side contains only \(x\), simply integrate both sides with respect to \(x\).

Direct integration Not in the formula booklet

\[ \frac{\mathrm{d}y}{\mathrm{d}x} = f(x) \quad\Longrightarrow\quad y = \int f(x)\,\mathrm{d}x . \]

Do not forget the constant \(+\,c\). Then use the initial condition to find \(c\).

  • \(f(x)\): a function of \(x\) only
  • \(c\): a constant of integration

Example 2 Find the general solution of \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = \cos^2 x\). Hence find the particular solution for which \(y = 2\) when \(x = 0\).

Use the double angle identity \(\cos^2 x = \dfrac{1}{2}(1 + \cos 2x)\):

\[ y = \int \frac{1}{2}(1 + \cos 2x)\,\mathrm{d}x = \frac{x}{2} + \frac{\sin 2x}{4} + c . \]

\(x = 0,\ y = 2\): \(\;2 = 0 + 0 + c\), so \(c = 2\). \(\qquad y = \dfrac{x}{2} + \dfrac{\sin 2x}{4} + 2\).

Extension — second order: d²y/dx² = f(x)

Second order differential equations are not in the AA syllabus, but the simple type \(\dfrac{\mathrm{d}^2y}{\mathrm{d}x^2} = f(x)\) needs only integration. Integrate twice. Each integration gives a new constant, so the general solution has two constants, and we need two conditions. (You used the same idea in kinematics: acceleration \(\to\) velocity \(\to\) displacement.)

Example A. Solve \(\dfrac{\mathrm{d}^2y}{\mathrm{d}x^2} = x(2 - x)\), given that \(y = 0\) when \(x = 0\) and \(y = 1\) when \(x = 2\).

\(\dfrac{\mathrm{d}^2y}{\mathrm{d}x^2} = 2x - x^2 \;\Rightarrow\; \dfrac{\mathrm{d}y}{\mathrm{d}x} = x^2 - \dfrac{x^3}{3} + A \;\Rightarrow\; y = \dfrac{x^3}{3} - \dfrac{x^4}{12} + Ax + B\).

\(y(0) = 0\): \(B = 0\). \(\qquad y(2) = 1\): \(\dfrac{8}{3} - \dfrac{16}{12} + 2A = 1 \Rightarrow \dfrac{4}{3} + 2A = 1 \Rightarrow A = -\dfrac{1}{6}\).

\[ y = \frac{x^3}{3} - \frac{x^4}{12} - \frac{x}{6} . \]

An application

In science, many laws are written as differential equations. When the rate depends only on the independent variable, direct integration is enough.

Example 3 A spherical tank stores hot water. Its steel wall has inner radius \(r_1 = 0.60\) m and outer radius \(r_2 = 0.62\) m. The inner surface of the wall is kept at \(90\ ^\circ\mathrm{C}\). Heat flows out through the wall at a constant rate \(q = 120\) W. In a material with thermal conductivity \(k\), the temperature \(T\) at distance \(r\) m from the centre satisfies

\[ \frac{\mathrm{d}T}{\mathrm{d}r} = -\frac{q}{4\pi k r^2} . \]

For steel, \(k = 15\). The tank is then covered with a layer of foam with \(k = 0.04\), so that the outside of the foam is at \(30\ ^\circ\mathrm{C}\). The heat flow \(q = 120\) W is the same through the steel and the foam.

(a) Find the temperature of the outer surface of the steel.

(b) Find the outer radius \(r_3\) of the foam.

(c) Find the thickness of the foam, in cm.

Integrate with respect to \(r\): \(\;T = \displaystyle\int -\frac{q}{4\pi k}\,r^{-2}\,\mathrm{d}r = \frac{q}{4\pi k r} + c\).

So between two radii \(r_a < r_b\) in the same material, \(\;T(r_a) - T(r_b) = \dfrac{q}{4\pi k}\left(\dfrac{1}{r_a} - \dfrac{1}{r_b}\right)\).

(a) Steel: \(\;90 - T_2 = \dfrac{120}{4\pi(15)}\left(\dfrac{1}{0.60} - \dfrac{1}{0.62}\right) = 0.636\,62 \times 0.053\,763 = 0.0342\).

\(T_2 = 90 - 0.0342 = 89.97\ ^\circ\mathrm{C}\) (2 d.p.). The steel loses almost no heat — it is a good conductor.

(b) Foam: \(\;T_2 - 30 = \dfrac{120}{4\pi(0.04)}\left(\dfrac{1}{0.62} - \dfrac{1}{r_3}\right)\).

\(\dfrac{1}{0.62} - \dfrac{1}{r_3} = \dfrac{59.966 \times 4\pi(0.04)}{120} = 0.251\,19\), so \(\dfrac{1}{r_3} = 1.612\,90 - 0.251\,19 = 1.361\,71\).

\(r_3 = 0.734\) m (3 s.f.).

(c) Thickness \(= r_3 - r_2 = 0.7344 - 0.62 = 0.114\) m \(\approx 11.4\) cm.

Common errors

✗ Wrong ✓ Right Why
\(\left(\dfrac{\mathrm{d}y}{\mathrm{d}x}\right)^2 = y\) is second order It is first order Order = highest derivative, not the highest power.
Leaving out \(+\,c\) \(y = \int f(x)\,\mathrm{d}x + c\) Without \(c\) you have only one curve of the family.
Finding \(c\) before integrating Integrate first, then substitute the point The constant appears only after integration.
Checking a solution at one value of \(x\) only Show both sides are equal for all \(x\) One point is not enough.
Solving the DE to find a tangent gradient Substitute the point into the DE The DE is the gradient formula.

Exercises

1 State the order of each differential equation.

(a) \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = x^2 y \qquad\)

(b) \(\dfrac{\mathrm{d}^2y}{\mathrm{d}x^2} + 4\dfrac{\mathrm{d}y}{\mathrm{d}x} = \mathrm{e}^x \qquad\)

(c) \(\left(\dfrac{\mathrm{d}y}{\mathrm{d}x}\right)^3 + y = 2x\)

(a) first

(b) second

(c) first (the cube is a power, not a second derivative).

2 Verify that \(y = 3\ln(x^2 + 2x) + 5\) is a solution of \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = \dfrac{6x + 6}{x^2 + 2x}\).

\(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 3 \times \dfrac{2x + 2}{x^2 + 2x} = \dfrac{6x + 6}{x^2 + 2x}\), which is the right-hand side. ✓

3 Find the constants \(a\) and \(b\) such that \(y = ax + b\) is a solution of \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 6x - 3y\).

\(\dfrac{\mathrm{d}y}{\mathrm{d}x} = a\), so \(a = 6x - 3(ax + b) = (6 - 3a)x - 3b\) for all \(x\).

Compare: \(x\)-terms \(6 - 3a = 0 \Rightarrow a = 2\); constants \(a = -3b \Rightarrow b = -\dfrac{2}{3}\).

4 Show that \(y = \dfrac{4}{x} + 2x^2\) satisfies \(x\dfrac{\mathrm{d}y}{\mathrm{d}x} + y = 6x^2\), and find the gradient of this curve at \(x = 1\).

\(\dfrac{\mathrm{d}y}{\mathrm{d}x} = -\dfrac{4}{x^2} + 4x\). \(\quad x\dfrac{\mathrm{d}y}{\mathrm{d}x} + y = -\dfrac{4}{x} + 4x^2 + \dfrac{4}{x} + 2x^2 = 6x^2\). ✓

At \(x = 1\): \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = -4 + 4 = 0\).

5 Find the general solution of \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = \sin 3x - \cos^2 x\).

\(\cos^2 x = \dfrac{1}{2} + \dfrac{1}{2}\cos 2x\), so

\(y = -\dfrac{\cos 3x}{3} - \dfrac{x}{2} - \dfrac{\sin 2x}{4} + c\).

6 Find the general solution of \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 4 + \mathrm{e}^{-3x}\).

\(y = 4x - \dfrac{1}{3}\mathrm{e}^{-3x} + c\).

7 Solve \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = \dfrac{2}{3x + 1}\), given that \(y(0) = 1\).

\(y = \dfrac{2}{3}\ln|3x + 1| + c\). \(\quad y(0) = 1\): \(\;c = 1\) (since \(\ln 1 = 0\)).

\(y = \dfrac{2}{3}\ln|3x + 1| + 1\).

8 Solve \(\dfrac{\mathrm{d}y}{\mathrm{d}t} - 3t^2 = 2t\,\mathrm{e}^{t^2}\), given that \(y(0) = 4\).

\(\dfrac{\mathrm{d}y}{\mathrm{d}t} = 3t^2 + 2t\,\mathrm{e}^{t^2}\). The second term has the form \(f'(t)\,\mathrm{e}^{f(t)}\), so

\(y = t^3 + \mathrm{e}^{t^2} + c\). \(\quad y(0) = 4\): \(\;4 = 0 + 1 + c\), so \(c = 3\).

\(y = t^3 + \mathrm{e}^{t^2} + 3\).

9 Extension Solve \(\dfrac{\mathrm{d}^2y}{\mathrm{d}x^2} = 12x^2 - 4\), given that \(y = 2\) and \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = -1\) when \(x = 0\).

\(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 4x^3 - 4x + A\); at \(x = 0\): \(A = -1\).

\(y = x^4 - 2x^2 - x + B\); at \(x = 0\): \(B = 2\). \(\qquad y = x^4 - 2x^2 - x + 2\).

10 Extension A shelf of length 3 m rests on supports at its two ends \(O\) and \(P\). Take \(O\) as the origin and \(x\) m as the distance along the shelf from \(O\). The height of the shelf above the line \(OP\) is \(y\) m, where

\[ \frac{\mathrm{d}^2y}{\mathrm{d}x^2} = 0.008\,(3x - x^2), \qquad 0 \le x \le 3, \]

and \(y = 0\) at both supports.

(a) Find \(y\) in terms of \(x\).

(b) Find the maximum sag (distance below \(OP\)) in cm, and where it occurs.

(c) Find the sag \(0.5\) m from \(P\).

(d) Find the angle between the shelf and the horizontal at the point \(0.5\) m from \(P\).

(a) \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 0.008\left(\dfrac{3x^2}{2} - \dfrac{x^3}{3}\right) + A\), \(\quad y = 0.008\left(\dfrac{x^3}{2} - \dfrac{x^4}{12}\right) + Ax + B\).

\(y(0) = 0 \Rightarrow B = 0\). \(\;y(3) = 0 \Rightarrow 0.008\left(\dfrac{27}{2} - \dfrac{81}{12}\right) + 3A = 0 \Rightarrow 0.054 + 3A = 0 \Rightarrow A = -0.018\).

\(y = 0.008\left(\dfrac{x^3}{2} - \dfrac{x^4}{12}\right) - 0.018x\).

(b) The shelf is symmetric, so the lowest point is at the middle, \(x = 1.5\) (check: \(\frac{\mathrm{d}y}{\mathrm{d}x} = 0.008(3.375 - 1.125) - 0.018 = 0\)). \(y(1.5) = 0.008(1.6875 - 0.421\,875) - 0.027 = -0.016\,875\). Maximum sag \(\approx 1.69\) cm at \(x = 1.5\) m.

(c) \(x = 2.5\): \(y = 0.008(7.8125 - 3.255\,21) - 0.045 = -0.008\,54\). Sag \(\approx 0.854\) cm.

(d) \(\dfrac{\mathrm{d}y}{\mathrm{d}x}\Big|_{x = 2.5} = 0.008(9.375 - 5.208\,33) - 0.018 = 0.015\,33\). Angle \(= \arctan(0.015\,33) \approx 0.878^\circ\).