31.6 Maclaurin Series from Differential Equations; Modelling

AHL 5.18 AHL 5.19

In this section you will learn
  • how to find the Maclaurin series of a solution directly from the differential equation, without solving it
  • how to set up (formulate) a differential equation from a description in words
  • the steps of modelling: formulate, solve, use the conditions, interpret

You met Maclaurin series in Unit 30. Here the derivatives come from the DE.

Maclaurin series from a differential equation

Consider \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = f(x, y)\) with initial condition \(y(0) = y_0\). Often we cannot solve the equation exactly. But we can still find a polynomial approximation to the solution near \(x = 0\).

Recall the Maclaurin series In the HL formula booklet

\[ f(x) = f(0) + x f'(0) + \frac{x^2}{2!}f''(0) + \cdots \]

Here the function is the solution \(y\), so \[ y(x) = y(0) + x\,y'(0) + \frac{x^2}{2!}\,y''(0) + \frac{x^3}{3!}\,y'''(0) + \cdots \]

Method

  1. Differentiate the DE again and again (implicit differentiation: remember \(y\) is a function of \(x\)), to get formulae for \(y'', y''', \ldots\)
  2. Substitute \(x = 0\) and \(y = y_0\): first into \(y'\), then use these values to find \(y''(0)\), then \(y'''(0)\), and so on.
  3. Put the values into the Maclaurin series.

For example, if \(y' = xy\):

\[ \begin{aligned} y'' &= \frac{\mathrm{d}}{\mathrm{d}x}(xy) \\ &= 1 \cdot y + x\,y' && {\color{#9F353A}\text{product rule}} \\ &= y + xy' \\[6pt] y''' &= \frac{\mathrm{d}}{\mathrm{d}x}(y) + \frac{\mathrm{d}}{\mathrm{d}x}(xy') && {\color{#9F353A}\text{differentiate each term}} \\ &= y' + \big(1 \cdot y' + x\,y''\big) && {\color{#9F353A}\text{product rule on } xy'} \\ &= 2y' + xy'' \end{aligned} \]

Example 1 Consider the differential equation

\[ (x + 1)\frac{\mathrm{d}y}{\mathrm{d}x} = y + (x + 1)^2\,\mathrm{e}^{x}, \qquad x > -1, \]

where \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 2\) when \(x = 0\).

(a) Find the first three non-zero terms in the Maclaurin series of \(y\).

(b) Solve the equation exactly to find the particular solution, and check your answer to (a).

(a) First find \(y(0)\). Put \(x = 0\) in the DE: \(\;1 \times 2 = y(0) + 1\), so \(y(0) = 1\).

Differentiate the DE with respect to \(x\) (product rule on both sides):

\[ y' + (x + 1)y'' = y' + 2(x + 1)\mathrm{e}^x + (x + 1)^2\mathrm{e}^x . \]

The \(y'\) terms cancel. Divide by \((x + 1)\): \(\;y'' = 2\mathrm{e}^x + (x + 1)\mathrm{e}^x = (x + 3)\,\mathrm{e}^x\). So \(y''(0) = 3\).

\[ y \approx 1 + 2x + \frac{3}{2!}x^2 = 1 + 2x + \frac{3}{2}x^2 . \]

(b) Standard form: \(\dfrac{\mathrm{d}y}{\mathrm{d}x} - \dfrac{1}{x + 1}y = (x + 1)\mathrm{e}^x\). Integrating factor \(\mathrm{e}^{-\ln(x + 1)} = \dfrac{1}{x + 1}\).

\(\dfrac{\mathrm{d}}{\mathrm{d}x}\left(\dfrac{y}{x + 1}\right) = \mathrm{e}^x \Rightarrow \dfrac{y}{x + 1} = \mathrm{e}^x + c\). \(\;y(0) = 1\): \(1 = 1 + c\), \(c = 0\). \(\qquad y = (x + 1)\,\mathrm{e}^x\).

Check: \((x + 1)\left(1 + x + \dfrac{x^2}{2} + \cdots\right) = 1 + 2x + \dfrac{3}{2}x^2 + \cdots\) ✓

Example 2 The function \(y\) satisfies \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = x + y^2\) and \(y(0) = 1\). This equation cannot be solved with the methods of this unit.

(a) Find the Maclaurin series for \(y\) up to the term in \(x^3\).

(b) Hence estimate \(y(0.1)\).

(a) \(y' = x + y^2\), \(\quad y'' = 1 + 2y\,y'\), \(\quad y''' = 2(y')^2 + 2y\,y''\).

At \(x = 0\): \(y = 1\); \(\;y' = 0 + 1 = 1\); \(\;y'' = 1 + 2(1)(1) = 3\); \(\;y''' = 2(1)^2 + 2(1)(3) = 8\).

\[ y \approx 1 + x + \frac{3}{2}x^2 + \frac{8}{6}x^3 = 1 + x + \frac{3}{2}x^2 + \frac{4}{3}x^3 . \]

(b) \(y(0.1) \approx 1 + 0.1 + 0.015 + 0.001\,33 = 1.116\) (4 s.f.).

Modelling with differential equations

Many situations in science and economics involve a rate of change: radioactive decay, heating and cooling, the growth of a population, the spread of a disease, a chemical reaction, or the motion of an object with air resistance. We describe them with differential equations, solve them, and use the solution to make predictions.

Sign convention Not in the formula booklet

If \(x\) is the amount of a substance at time \(t\), and the rate of change of \(x\) is proportional to \(x\), then

\[ \frac{\mathrm{d}x}{\mathrm{d}t} = kx \ \text{ if } x \text{ increases}, \qquad \frac{\mathrm{d}x}{\mathrm{d}t} = -kx \ \text{ if } x \text{ decreases}, \qquad \text{where } k > 0 . \]

  • \(x\): the amount of the substance at time \(t\)
  • \(t\): the time
  • \(k\): a positive constant of proportionality

“Proportional to” means “equal to a constant times”. “The rate of decrease” means \(-\dfrac{\mathrm{d}x}{\mathrm{d}t}\).

The modelling process

  1. Formulate the differential equation.
  2. Find the general solution.
  3. Use the given conditions to find the constant of proportionality \(k\) and the constant of integration.
  4. Interpret the particular solution in the context (and say whether the model is realistic).

To formulate the equation, ask yourself:

  1. Which quantity is changing? Choose letters for the variables (for example \(x\) and \(t\)).
  2. What are the units of the quantity and of the time?
  3. What are the initial conditions? (For example \(x = x_0\) when \(t = 0\).)

Example 3 A metal block is taken out of an oven at \(180\ ^\circ\mathrm{C}\) and placed in a workshop where the temperature is a constant \(25\ ^\circ\mathrm{C}\). The rate of decrease of its temperature \(\theta\ ^\circ\mathrm{C}\) after \(t\) minutes is proportional to the temperature difference \((\theta - 25)\). When the temperature is \(100\ ^\circ\mathrm{C}\), the block is cooling at \(3\ ^\circ\mathrm{C}\) per minute.

(a) Set up a differential equation. Find the rate of cooling when the temperature is \(60\ ^\circ\mathrm{C}\).

(b) Show that \(\theta = 25 + 155\,\mathrm{e}^{-0.04t}\).

(c) Find the time taken for the block to cool to \(50\ ^\circ\mathrm{C}\).

(d) Comment on whether this is a good model in the real world.

(a) \(\dfrac{\mathrm{d}\theta}{\mathrm{d}t} = -k(\theta - 25)\), \(k > 0\). When \(\theta = 100\): \(-3 = -k(75)\), so \(k = 0.04\).

When \(\theta = 60\): \(\dfrac{\mathrm{d}\theta}{\mathrm{d}t} = -0.04(35) = -1.4\). It is cooling at \(1.4\ ^\circ\mathrm{C}\) per minute.

(b) \(\displaystyle\int \frac{1}{\theta - 25}\,\mathrm{d}\theta = \int -0.04\,\mathrm{d}t \Rightarrow \ln(\theta - 25) = -0.04t + c\).

\(t = 0\), \(\theta = 180\): \(c = \ln 155\). So \(\theta - 25 = 155\,\mathrm{e}^{-0.04t}\), i.e. \(\theta = 25 + 155\,\mathrm{e}^{-0.04t}\).

(c) \(25 = 155\,\mathrm{e}^{-0.04t} \Rightarrow t = \dfrac{\ln 6.2}{0.04} = 45.6\) minutes.

(d) The model says the block never quite reaches \(25\ ^\circ\mathrm{C}\), which is acceptable because the difference becomes too small to measure. But it assumes the room temperature stays exactly constant and that the block cools evenly; in reality the block warms the air near it, and air movement changes the cooling rate. So the model is a good approximation, not exact.

Example 4 Water drains out of a tank through a hole in the bottom. The rate at which the depth \(h\) m of the water decreases is proportional to the square root of the depth. Initially the depth is 4 m, and after 10 minutes it is 2.25 m.

(a) Write down a differential equation for \(h\).

(b) Solve it, and find when the tank is empty.

(a) \(\dfrac{\mathrm{d}h}{\mathrm{d}t} = -k\sqrt{h}\), \(k > 0\), with \(t\) in minutes.

(b) \(\displaystyle\int h^{-\frac{1}{2}}\,\mathrm{d}h = \int -k\,\mathrm{d}t \Rightarrow 2\sqrt{h} = -kt + c\).

\(t = 0\), \(h = 4\): \(c = 4\). \(\;t = 10\), \(h = 2.25\): \(2(1.5) = -10k + 4 \Rightarrow k = 0.1\).

\(\sqrt{h} = 2 - 0.05t\), so \(h = (2 - 0.05t)^2\). Empty when \(\sqrt{h} = 0\): \(t = 40\) minutes.

Common errors

✗ Wrong ✓ Right Why
Stopping at \(y' = \ldots\) and substituting before differentiating Differentiate the general formula first, then substitute \(y''(0)\) is not the derivative of the number \(y'(0)\).
Forgetting the chain rule on \(y^2\) \(\frac{\mathrm{d}}{\mathrm{d}x}(y^2) = 2y\,y'\) \(y\) is a function of \(x\).
Missing \(\frac{1}{n!}\) in the series Term is \(\frac{y^{(n)}(0)}{n!}x^n\) The Maclaurin formula has factorials.
“Rate of decrease is \(kx\)” written as \(\frac{\mathrm{d}x}{\mathrm{d}t} = kx\) \(\frac{\mathrm{d}x}{\mathrm{d}t} = -kx\), \(k > 0\) Decreasing means a negative derivative.
No comment on the context Interpret the answer and the model The last step of modelling is interpretation.

Exercises

1 Given \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = \mathrm{e}^{-y}\) and \(y(0) = 0\):

(a) find the first three non-zero terms of the Maclaurin series of \(y\);

(b) solve the equation exactly and compare.

(a) \(y' = \mathrm{e}^{-y}\), \(y'' = -\mathrm{e}^{-y}y' = -\mathrm{e}^{-2y}\), \(y''' = 2\mathrm{e}^{-2y}y' = 2\mathrm{e}^{-3y}\). At \(0\): \(1, -1, 2\). \(\qquad y \approx x - \dfrac{x^2}{2} + \dfrac{x^3}{3}\).

(b) \(\int \mathrm{e}^y\,\mathrm{d}y = \int 1\,\mathrm{d}x \Rightarrow \mathrm{e}^y = x + 1\), so \(y = \ln(1 + x)\), whose series is \(x - \frac{x^2}{2} + \frac{x^3}{3} - \cdots\) ✓

2 Given \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = 1 + y^2\) and \(y(0) = 0\), find the first three non-zero terms of the Maclaurin series of \(y\). Identify the exact solution.

\(y'' = 2yy'\), \(\;y''' = 2(y')^2 + 2yy''\), \(\;y^{(4)} = 6y'y'' + 2yy'''\), \(\;y^{(5)} = 6(y'')^2 + 8y'y''' + 2yy^{(4)}\).

At \(0\): \(y = 0, y' = 1, y'' = 0, y''' = 2, y^{(4)} = 0, y^{(5)} = 16\).

\(y \approx x + \dfrac{2}{6}x^3 + \dfrac{16}{120}x^5 = x + \dfrac{x^3}{3} + \dfrac{2x^5}{15}\). Exactly, \(\arctan y = x\), so \(y = \tan x\).

3 Given \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = x - y\) and \(y(0) = 2\), find the Maclaurin series of \(y\) up to the term in \(x^3\).

\(y'(0) = 0 - 2 = -2\); \(\;y'' = 1 - y'\), so \(y''(0) = 3\); \(\;y''' = -y''\), so \(y'''(0) = -3\).

\(y \approx 2 - 2x + \dfrac{3}{2}x^2 - \dfrac{1}{2}x^3\). (The exact solution is \(y = x - 1 + 3\mathrm{e}^{-x}\).)

4 Given \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = x^2 + y^2\) and \(y(0) = 1\), find the Maclaurin series up to \(x^3\) and use it to estimate \(y(0.1)\).

\(y'' = 2x + 2yy'\), \(\;y''' = 2 + 2(y')^2 + 2yy''\). At \(0\): \(y' = 1\), \(y'' = 2\), \(y''' = 2 + 2 + 4 = 8\).

\(y \approx 1 + x + x^2 + \dfrac{4}{3}x^3\). \(\qquad y(0.1) \approx 1 + 0.1 + 0.01 + 0.001\,33 = 1.111\).

5 Given \(\dfrac{\mathrm{d}y}{\mathrm{d}x} = y\cos x\) and \(y(0) = 1\):

(a) find the Maclaurin series of \(y\) up to \(x^2\);

(b) solve exactly.

(a) \(y'(0) = 1\); \(\;y'' = y'\cos x - y\sin x\), so \(y''(0) = 1\). \(\qquad y \approx 1 + x + \dfrac{x^2}{2}\).

(b) \(\displaystyle\int \frac{1}{y}\,\mathrm{d}y = \int \cos x\,\mathrm{d}x \Rightarrow \ln y = \sin x + c\), \(c = 0\). \(\qquad y = \mathrm{e}^{\sin x}\).

6 The number of bacteria \(N\) in a culture increases at a rate proportional to \(N\). There are 1000 bacteria at first and 3000 after 2 hours. Write down a differential equation, solve it, and find when there are 10 000 bacteria.

\(\dfrac{\mathrm{d}N}{\mathrm{d}t} = kN \Rightarrow N = 1000\,\mathrm{e}^{kt}\). \(\;3 = \mathrm{e}^{2k} \Rightarrow k = \dfrac{\ln 3}{2} = 0.5493\).

\(10 = \mathrm{e}^{kt} \Rightarrow t = \dfrac{2\ln 10}{\ln 3} = 4.19\) hours.

7 Carbon-14 decays at a rate proportional to the amount present, and its half-life is 5730 years. A piece of old wood has \(30\%\) of its original carbon-14. Estimate its age.

\(\dfrac{\mathrm{d}m}{\mathrm{d}t} = -km \Rightarrow m = m_0\mathrm{e}^{-kt}\). Half-life: \(\mathrm{e}^{-5730k} = \dfrac{1}{2} \Rightarrow k = \dfrac{\ln 2}{5730}\).

\(0.3 = \mathrm{e}^{-kt} \Rightarrow t = \dfrac{5730\ln(10/3)}{\ln 2} = 9950\) years (3 s.f.).

8 The depth \(h\) cm of water in a tank decreases at a rate proportional to \(\sqrt{h}\). At first \(h = 9\), and after 5 minutes \(h = 4\). Find when the tank is empty.

\(\dfrac{\mathrm{d}h}{\mathrm{d}t} = -k\sqrt{h} \Rightarrow 2\sqrt{h} = -kt + c\). \(\;t = 0\): \(c = 6\). \(\;t = 5\): \(4 = -5k + 6\), \(k = 0.4\).

\(\sqrt{h} = 3 - 0.2t = 0\) when \(t = 15\) minutes.

9 A pie is taken out of an oven at \(200\ ^\circ\mathrm{C}\) into a kitchen at \(20\ ^\circ\mathrm{C}\). The rate of cooling is proportional to the difference between the pie’s temperature and \(20\ ^\circ\mathrm{C}\). When the pie is at \(110\ ^\circ\mathrm{C}\) it is cooling at \(9\ ^\circ\mathrm{C}\) per minute. Find the temperature as a function of time, and the time for the pie to reach \(50\ ^\circ\mathrm{C}\).

\(\dfrac{\mathrm{d}\theta}{\mathrm{d}t} = -k(\theta - 20)\); \(\;-9 = -k(90) \Rightarrow k = 0.1\).

\(\theta = 20 + 180\,\mathrm{e}^{-0.1t}\). \(\;50\): \(\mathrm{e}^{-0.1t} = \dfrac{1}{6} \Rightarrow t = 10\ln 6 = 17.9\) minutes.

10 A plant grows so that the rate of increase of its height \(h\) cm is proportional to \((120 - h)\). The plant is 20 cm tall at \(t = 0\) and 60 cm tall after 4 weeks.

(a) Show that \(h = 120 - 100\,\mathrm{e}^{-kt}\) and find \(k\).

(b) Find the height after 10 weeks.

(c) What does the model predict in the long term?

(a) \(\dfrac{\mathrm{d}h}{\mathrm{d}t} = k(120 - h) \Rightarrow -\ln(120 - h) = kt + c\). \(\;t = 0\): \(120 - h = 100\), so \(120 - h = 100\,\mathrm{e}^{-kt}\).

\(t = 4\): \(60 = 100\,\mathrm{e}^{-4k} \Rightarrow k = \dfrac{1}{4}\ln\dfrac{5}{3} = 0.128\).

(b) \(h(10) = 120 - 100(0.6)^{2.5} = 120 - 27.9 = 92.1\) cm.

(c) \(h \to 120\) cm: the plant approaches a maximum height of 120 cm.