### 2 The Maclaurin series

Consider a function $f\left(x\right)$ which can be differentiated at $x=0$ as often as we please. For example ${e}^{x},cosx,sinx$ would fit into this category but $\left|x\right|$ would not.

Let us assume that $f\left(x\right)$ can be represented by a power series in $x$ :

$\phantom{\rule{2em}{0ex}}f\left(x\right)={b}_{0}+{b}_{1}x+{b}_{2}{x}^{2}+{b}_{3}{x}^{3}+{b}_{4}{x}^{4}+\cdots ={\sum }_{p=0}^{\infty }{b}_{p}{x}^{p}$

where ${b}_{0},{b}_{1},{b}_{2},\dots$ are constants to be determined.

If we substitute $x=0$ then, clearly $\phantom{\rule{1em}{0ex}}f\left(0\right)={b}_{0}$

The other constants can be determined by further differentiating and, on each differentiation, substituting $x=0$ . For example, differentiating once:

$\phantom{\rule{2em}{0ex}}{f}^{\prime }\left(x\right)=0+{b}_{1}+2{b}_{2}x+3{b}_{3}{x}^{2}+4{b}_{4}{x}^{3}+\cdots$

so, putting $x=0$ , we have ${f}^{\prime }\left(0\right)={b}_{1}$ .

Continuing to differentiate:

$\phantom{\rule{2em}{0ex}}{f}^{″}\left(x\right)=0+2{b}_{2}+3\left(2\right){b}_{3}x+4\left(3\right){b}_{4}{x}^{2}+\cdots$

so

$\phantom{\rule{2em}{0ex}}{f}^{″}\left(0\right)=2{b}_{2}\phantom{\rule{2em}{0ex}}\text{or}\phantom{\rule{2em}{0ex}}{b}_{2}=\frac{1}{2}{f}^{″}\left(0\right)$

Further:

$\phantom{\rule{2em}{0ex}}{f}^{‴}\left(x\right)=3\left(2\right){b}_{3}+4\left(3\right)\left(2\right){b}_{4}x+\cdots$ so $\phantom{\rule{2em}{0ex}}{f}^{‴}\left(0\right)=3\left(2\right){b}_{3}\phantom{\rule{2em}{0ex}}\text{implying}\phantom{\rule{2em}{0ex}}{b}_{3}=\frac{1}{3\left(2\right)}{f}^{‴}\left(0\right)$

Continuing in this way we easily find that (remembering that $0!=1$ )

$\phantom{\rule{2em}{0ex}}{b}_{n}=\frac{1}{n!}{f}^{\left(n\right)}\left(0\right)\phantom{\rule{2em}{0ex}}n=0,1,2,\dots$

where ${f}^{\left(n\right)}\left(0\right)$ means the value of the ${n}^{th}$ derivative at $x=0$ and ${f}^{\left(0\right)}\left(0\right)$ means $f\left(0\right)$ .

Bringing all these results together we have:

##### Key Point 14

Maclaurin Series

If $f\left(x\right)$ can be differentiated as often as required:

$f\left(x\right)=f\left(0\right)+x{f}^{\prime }\left(0\right)+\frac{{x}^{2}}{2!}{f}^{″}\left(0\right)+\frac{{x}^{3}}{3!}{f}^{‴}\left(0\right)+\cdots =\underset{p=0}{\overset{\infty }{\sum }}\frac{{x}^{p}}{p!}{f}^{\left(p\right)}\left(0\right)$
This is called the Maclaurin expansion of $f\left(x\right)$ .
##### Example 4

Find the Maclaurin expansion of   $cosx$ .

##### Solution

Here $f\left(x\right)=cosx$ and, differentiating a number of times:

$\phantom{\rule{2em}{0ex}}f\left(x\right)=cosx,\phantom{\rule{2em}{0ex}}{f}^{\prime }\left(x\right)=-sinx,\phantom{\rule{2em}{0ex}}{f}^{″}\left(x\right)=-cosx,\phantom{\rule{2em}{0ex}}{f}^{‴}\left(x\right)=sinx\phantom{\rule{1em}{0ex}}\text{etc.}$

Evaluating each of these at $x=0$ :

$\phantom{\rule{2em}{0ex}}f\left(0\right)=1,\phantom{\rule{1em}{0ex}}{f}^{\prime }\left(0\right)=0,\phantom{\rule{1em}{0ex}}{f}^{″}\left(0\right)=-1,\phantom{\rule{1em}{0ex}}{f}^{‴}\left(0\right)=0\phantom{\rule{1em}{0ex}}\text{etc.}$

Substituting into $f\left(x\right)=f\left(0\right)+x{f}^{\prime }\left(0\right)+\frac{{x}^{2}}{2!}{f}^{″}\left(0\right)+\frac{{x}^{3}}{3!}{f}^{‴}\left(0\right)+\cdots$ , gives:

$\phantom{\rule{2em}{0ex}}cosx=1-\frac{{x}^{2}}{2!}+\frac{{x}^{4}}{4!}-\frac{{x}^{6}}{6!}+\cdots$

The reader should confirm (by finding the radius of convergence) that this series is convergent for all values of $x$ . The geometrical approximation to $cosx$ by the first few terms of its Maclaurin series are shown in Figure 6.

Figure 6 :

Find the Maclaurin expansion of $ln\left(1+x\right)$ .

(Note that we cannot find a Maclaurin expansion of the function $lnx$ since $lnx$ does not exist at $x=0$ and so cannot be differentiated at $x=0$ .)

Find the first four derivatives of $f\left(x\right)=ln\left(1+x\right)$ :

$\phantom{\rule{2em}{0ex}}{f}^{\prime }\left(x\right)=\frac{1}{1+x},\phantom{\rule{2em}{0ex}}{f}^{″}\left(x\right)=\frac{-1}{{\left(1+x\right)}^{2}},\phantom{\rule{2em}{0ex}}{f}^{‴}\left(x\right)=\frac{2}{{\left(1+x\right)}^{3}},$

$\text{generally:}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}{f}^{\left(n\right)}\left(x\right)=\frac{{\left(-1\right)}^{n+1}\left(n-1\right)!}{{\left(1+x\right)}^{n}}$

Now obtain $f\left(0\right),\phantom{\rule{1em}{0ex}}{f}^{\prime }\left(0\right),\phantom{\rule{1em}{0ex}}{f}^{″}\left(0\right),\phantom{\rule{1em}{0ex}}{f}^{‴}\left(0\right)$ :

$f\left(0\right)=0$ ${f}^{\prime }\left(0\right)=1,\phantom{\rule{2em}{0ex}}{f}^{″}\left(0\right)=-1,\phantom{\rule{2em}{0ex}}{f}^{‴}\left(0\right)=2,$

$\text{generally:}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}{f}^{\left(n\right)}\left(0\right)={\left(-1\right)}^{n+1}\left(n-1\right)!$

Hence, obtain the Maclaurin expansion of $ln\left(1+x\right)$ :

$ln\left(1+x\right)=x-\frac{{x}^{2}}{2}+\frac{{x}^{3}}{3}\dots +\frac{{\left(-1\right)}^{n+1}}{n}{x}^{n}+\cdots$ (This was obtained in Section 16.4, page 37.)

Now obtain the radius of convergence and consider the situation at the boundary values:

$R=1$ . Also at $x=1$ the series is convergent (alternating harmonic series) and at $x=-1$ the series is divergent. Hence this Maclaurin expansion is only valid if $-1 . The geometrical closeness of the polynomial terms with the function $ln\left(1+x\right)$ for $-1 is displayed in Figure 7:

Figure 7 :

Note that when $x=1$ $ln2=1-\frac{1}{2}+\frac{1}{3}-\frac{1}{4}\cdots$ so the alternating harmonic series converges to $ln2\simeq 0.693$ , as stated in Section 16.2, page 17.

The Maclaurin expansion of a product of two functions: $f\left(x\right)g\left(x\right)$ is obtained by multiplying together the Maclaurin expansions of $f\left(x\right)$ and of $g\left(x\right)$ and collecting like terms together. The product series will have a radius of convergence equal to the smaller of the two separate radii of convergence.

##### Example 5

Find the Maclaurin expansion of  ${e}^{x}ln\left(1+x\right)$ .

##### Solution

Here, instead of finding the derivatives of $f\left(x\right)={e}^{x}ln\left(1+x\right)$ , we can more simply multiply together the Maclaurin expansions for ${\text{e}}^{x}$ and $ln\left(1+x\right)$ which we already know:

$\phantom{\rule{2em}{0ex}}{e}^{x}=1+x+\frac{{x}^{2}}{2!}+\frac{{x}^{3}}{3!}+\cdots \phantom{\rule{2em}{0ex}}\text{all}\phantom{\rule{1em}{0ex}}x$

and

$\phantom{\rule{2em}{0ex}}ln\left(1+x\right)=x-\frac{{x}^{2}}{2}+\frac{{x}^{3}}{3}+\cdots \phantom{\rule{2em}{0ex}}-1

The resulting power series will only be convergent if $-1 . Multiplying:

$\begin{array}{rcll}{e}^{x}ln\left(1+x\right)& =& \left(1+x+\frac{{x}^{2}}{2!}+\frac{{x}^{3}}{3!}+\cdots \phantom{\rule{0.3em}{0ex}}\right)\left(x-\frac{{x}^{2}}{2}+\frac{{x}^{3}}{3}+\cdots \phantom{\rule{0.3em}{0ex}}\right)\phantom{\rule{2em}{0ex}}\phantom{\rule{2em}{0ex}}\phantom{\rule{2em}{0ex}}\phantom{\rule{2em}{0ex}}& \text{}\\ & & & \text{}\\ & =& x-\frac{{x}^{2}}{2}+\frac{{x}^{3}}{3}-\frac{{x}^{4}}{4}+\cdots & \text{}\\ & & & \text{}\\ & & \phantom{\rule{1em}{0ex}}+\phantom{\rule{1em}{0ex}}{x}^{2}-\frac{{x}^{3}}{2}+\frac{{x}^{4}}{3}+\cdots & \text{}\\ & & & \text{}\\ & & \phantom{\rule{2em}{0ex}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}+\phantom{\rule{1em}{0ex}}\frac{{x}^{3}}{2}-\frac{{x}^{4}}{4}\cdots & \text{}\\ & & & \text{}\\ & & \phantom{\rule{2em}{0ex}}\phantom{\rule{2em}{0ex}}\phantom{\rule{1em}{0ex}}\phantom{\rule{1em}{0ex}}+\frac{{x}^{4}}{6}\cdots & \text{}\\ & & & \text{}\\ & =& x+\frac{{x}^{2}}{2}+\frac{{x}^{3}}{3}+\frac{3{x}^{5}}{40}+\cdots \phantom{\rule{2em}{0ex}}-1

(You must take care not to miss relevant terms when carrying through the multiplication.)

Find the Maclaurin expansion of $\phantom{\rule{1em}{0ex}}{cos}^{2}x$ up to powers of ${x}^{4}$ . Hence write down the expansion of $\phantom{\rule{1em}{0ex}}{sin}^{2}x$ to powers of ${x}^{6}$ .

First, write down the expansion of $cosx$ :

$cosx=1-\frac{{x}^{2}}{2!}+\frac{{x}^{4}}{4!}+\cdots$

Now, by multiplication, find the expansion of ${cos}^{2}x$ :

${cos}^{2}x=\left(1-\frac{{x}^{2}}{2!}+\frac{{x}^{4}}{4!}\cdots \phantom{\rule{0.3em}{0ex}}\right)\left(1-\frac{{x}^{2}}{2!}+\frac{{x}^{4}}{4!}\cdots \phantom{\rule{0.3em}{0ex}}\right)$

$\phantom{\rule{1em}{0ex}}\phantom{\rule{2em}{0ex}}=\left(1-\frac{{x}^{2}}{2!}+\frac{{x}^{4}}{4!}\cdots \phantom{\rule{0.3em}{0ex}}\right)+\left(-\frac{{x}^{2}}{2!}+\frac{{x}^{4}}{4}\cdots \phantom{\rule{0.3em}{0ex}}\right)+\left(\frac{{x}^{4}}{4!}\cdots \phantom{\rule{0.3em}{0ex}}\right)+\cdots =1-{x}^{2}+\frac{{x}^{4}}{3}-\frac{2{x}^{6}}{45}\cdots$

Now obtain the expansion of ${sin}^{2}x$ using a suitable trigonometric identity:

${sin}^{2}x=1-{cos}^{2}x=1-\left(1-{x}^{2}+\frac{{x}^{4}}{3}-\frac{2{x}^{6}}{45}+\cdots \phantom{\rule{0.3em}{0ex}}\right)={x}^{2}-\frac{{x}^{4}}{3}+\frac{2{x}^{6}}{45}+\cdots$ As an alternative approach the reader could obtain the power series expansion for ${cos}^{2}x$ by using the trigonometric identity ${cos}^{2}x\equiv \frac{1}{2}\left(1+cos2x\right)$ .

##### Example 6

Find the Maclaurin expansion of $tanhx$ up to powers of ${x}^{5}$ .

##### Solution

The first two derivatives of $f\left(x\right)=tanhx$ are

$\phantom{\rule{2em}{0ex}}{f}^{\prime }\left(x\right)={\text{sech}}^{2}x\phantom{\rule{2em}{0ex}}{f}^{″}\left(x\right)=-2{\text{sech}}^{2}xtanhx\phantom{\rule{2em}{0ex}}{f}^{‴}\left(x\right)=4{\text{sech}}^{2}x{tanh}^{2}x-2{\text{sech}}^{4}x\phantom{\rule{1em}{0ex}}\cdots$

giving $\phantom{\rule{2em}{0ex}}f\left(0\right)=0,\phantom{\rule{1em}{0ex}}{f}^{\prime }\left(0\right)-1,\phantom{\rule{1em}{0ex}}{f}^{″}\left(0\right)=0\phantom{\rule{1em}{0ex}}{f}^{‴}\left(0\right)=-2\phantom{\rule{1em}{0ex}}\cdots$

This leads directly to the Maclaurin expansion as $\phantom{\rule{2em}{0ex}}tanhx=1-\frac{1}{3}{x}^{3}+\frac{2}{15}{x}^{5}\phantom{\rule{1em}{0ex}}\cdots$

##### Example 7

The relationship between the wavelength, $L$ , the wave period, $T$ , and the water depth, $d$ , for a surface wave in water is given by: $\phantom{\rule{2em}{0ex}}L=\frac{g{T}^{2}}{2\pi }tanh\left(\frac{2\pi d}{L}\right)$

In a particular case the wave period was 10 s and the water depth was 6.1 m. Taking the acceleration due to gravity, $g$ , as $9.81\text{m}{\text{s}}^{-2}$ determine the wave length.

[Hint: Use the series expansion for $tanhx$ developed in Example 6.]

##### Solution

Substituting for the wave period, water depth and $g$ we get

$\phantom{\rule{2em}{0ex}}L=\frac{9.81×1{0}^{2}}{2\pi }tanh\left(\frac{2\pi ×6.1}{L}\right)=\frac{490.5}{\pi }tanh\left(\frac{12.2\pi }{L}\right)$

The series expansion of $tanhx$ is given by $\phantom{\rule{2em}{0ex}}tanhx=x-\frac{{x}^{3}}{3}+\frac{2{x}^{5}}{15}+\cdots$

Using the series expansion of $tanhx$ we can approximate the equation as

$\phantom{\rule{2em}{0ex}}L=\frac{490.5}{\pi }\left\{\left(\frac{12.2\pi }{L}\right)-\frac{1}{3}{\left(\frac{12.2\pi }{L}\right)}^{3}+\cdots \phantom{\rule{0.3em}{0ex}}\right\}$

Multiplying through by $\pi {L}^{3}$ the equation becomes

$\phantom{\rule{2em}{0ex}}\pi {L}^{4}=490.5×12.2\pi {L}^{2}-\frac{490.5}{3}×{\left(12.2\pi \right)}^{3}$

This equation can be rewritten as $\phantom{\rule{2em}{0ex}}{L}^{4}-5984.1{L}^{2}+2930198=0$

Solving this as a quadratic in ${L}^{2}$ we get $L=74$ m.

Using Newton-Raphson iteration this can be further refined to give a wave length of 73.9 m.