1.5. Series expansion#

Example: Taylor series

Find the two-term Taylor series for

(1.1)#\[\begin{equation} f(x) = xe^{2 x^2} \end{equation}\]

about \(x = 0\).


We will evaluate the required derivatives. This will be a series of product rule calculations.

The value of the function is \(f(0) = 0\). The first derivative is:

(1.2)#\[\begin{align} f'(x) &= x(e^{2x^2}4x) + e^{2x^2} \\ &= (4x^2 + 1)e^{2x^2} \end{align}\]

so \(f'(0) = 1\). The second derivative is:

(1.3)#\[\begin{align} f''(x) &= (4x^2+1)(e^{2x^2}4x)+8xe^{2x^2} \\ &= (16x^3+12x)e^{2x^2} \end{align}\]

so \(f''(0) = 0\). This means we need to keep going! The third derivative is:

(1.4)#\[\begin{align} f'''(x) &= (16x^3+12x)(e^{2x^2}4x)+(48x^2+12)e^{2x^2} \\ &= (64x^4+96x^2+12)e^{2x^2} \end{align}\]

so \(f'''(0) = 12\).

Putting it all together,

(1.5)#\[\begin{equation} f(x) \approx 0 + 1 \cdot x + \frac{1}{2} \cdot 0 \cdot x^2 + \frac{1}{6} \cdot 12 \cdot x^3 + \cdots = x + 2x^3 + \cdots \end{equation}\]

1.5.1. Combining series#

Some of these calculations can sometimes be avoided by combining series together. For example, the Taylor series for \(e^x\) is well known

(1.6)#\[\begin{equation} e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!} = 1 + x + \frac{x^2}{2} + \cdots \end{equation}\]

The argument of e in f is \(2x^2\), which is also zero when x is zero, so we can substitute it in the known series to obtain

(1.7)#\[\begin{equation} e^{2x^2} \approx 1 + 2x^2 + \frac{(2x^2)^2}{2} + \cdots \end{equation}\]

Finally, inserting this series into f and expanding

(1.8)#\[\begin{align} f(x) &= x e^{2x^2} \approx x (1 + 2x^2 + 2x^4 + \cdots) \\ &= x + 2x^3 + \cdots \end{align}\]

When doing this process, it can be helpful to keep track of dropped terms using \(O\)-notation

(1.9)#\[\begin{align} e^x &= \sum_{n=0}^{\infty} \frac{x^n}{n!} = 1 + x + \frac{x^2}{2} + O(x^3) \\ e^{2x^2} &= 1 + 2x^2 + 2x^4 + O(x^6) \\ xe^{2x^2} &= x + 2x^3 + O(x^5) \end{align}\]

1.5.2. Skill builder problems#

Expand the following to two terms:

  1. \(f(x)=\cos x\) at \(x=0\)

    Solution

    The function and its derivatives at \(x=0\) are:

    (1.10)#\[\begin{align} f(x) &= \cos(x) & f(0) &= 1 \\ f'(x) &= -\sin(x) & f'(0) &= 0 \\ f''(x) &= -\cos(x) & f''(0) &= -1 \end{align}\]

    So:

    (1.11)#\[\begin{equation} \cos x \approx 1-\frac{x^2}{2} \end{equation}\]
  2. \(f(x)=\sin x\) at \(x=0\)

    Solution

    The function and its derivatives at \(x=0\) are:

    (1.12)#\[\begin{align} f(x) &= \sin(x) & f(0) &= 0\\ f'(x) &= \cos(x) & f'(0) &= 1 \\ f''(x) &= -\sin(x) & f''(0) &= 0 \\ f^{(3)}(x) &= -\cos(x) & f^{(3)}(0) &= -1 \end{align}\]

    So:

    (1.13)#\[\begin{equation} \sin x \approx x-\frac{x^3}{6} \end{equation}\]
  3. \(f(x)=e^x\) at \(x=0\)

    Solution

    The function and its derivatives at \(x=0\) are:

    (1.14)#\[\begin{align} f(x)&=e^x & f(0) &= 1\\ f'(x)&=e^x & f'(0) &= 1 \end{align}\]

    So:

    (1.15)#\[\begin{equation} e^x \approx 1+x \end{equation}\]
  4. \(f(x)=\ln(1+x)\) at \(x=0\)

    Solution

    The function and its derivatives at \(x=0\) are:

    (1.16)#\[\begin{align} f(x)&=\ln(1+x) & f(0) &= 0\\ f'(x)&=\frac{1}{1+x} & f'(0) &= 1\\ f''(x)&=-\frac{1}{(1+x)^2} & f''(0) &= -1 \end{align}\]

    So:

    (1.17)#\[\begin{equation} \ln(1+x) \approx x-\frac{x^2}{2} \end{equation}\]
  5. \(f(x)=\dfrac{1}{1+x}\) at \(x=0\)

    Solution

    The function and its derivatives at \(x=0\) are:

    (1.18)#\[\begin{align} f(x)&=\frac{1}{1+x} & f(0) &= 1\\ f'(x)&=-\frac{1}{(1+x)^2} & f'(0) &= -1 \end{align}\]

    So:

    (1.19)#\[\begin{equation} \frac{1}{1+x} \approx 1-x \end{equation}\]
  6. \(f(x)=\cos(4x)\) at \(x=0\)

    Solution

    Recall:

    (1.20)#\[\begin{equation} \cos x \approx 1-\frac{x^2}{2} \end{equation}\]

    So:

    (1.21)#\[\begin{equation} \cos(4x) \approx 1-\frac{(4x)^2}{2} = 1-8x^2 \end{equation}\]
  7. \(f(x)=\cos(x-\pi)\) at \(x=\pi\)

    Solution

    Recall:

    (1.22)#\[\begin{equation} \cos(x) \approx 1-\frac{x^2}{2} \end{equation}\]

    So:

    (1.23)#\[\begin{equation} \cos(x-\pi) \approx 1-\frac{(x-\pi)^2}{2} \end{equation}\]

    about \(x_0 = \pi\).

  8. \(f(x)=e^x \sin x\) at \(x=0\)

    Solution

    Recall:

    (1.24)#\[\begin{align} e^x &\approx 1+x \\ \sin(x) &\approx x-\frac{x^3}{6} \end{align}\]

    So:

    (1.25)#\[\begin{equation} e^x \sin x \approx (1+x+\cdots)(x-\frac{x^3}{6}+\cdots) = x+x^2 \end{equation}\]
  9. \(f(x)=\cos x\) at \(x=\pi\)

    Solution

    The function and its derivatives at \(x=\pi\) are:

    (1.26)#\[\begin{align} f(x) &= \cos(x) & f(\pi) &= -1 \\ f'(x) &= -\sin(x) & f'(\pi) &= 0 \\ f''(x) &= -\cos(x) & f''(\pi) &= 1 \end{align}\]

    So:

    (1.27)#\[\begin{equation} \cos x \approx -1+\frac{1}{2}(x-\pi)^2 \end{equation}\]

    at \(x = \pi\).

  10. \(f(x)=7x^2-6x+1\) at \(x=2\)

    Solution

    The function and its derivatives at \(x=2\) are:

    (1.28)#\[\begin{align} f(x)&=7x^2-6x+1 & f(2) &= 17\\ f'(x)&=14x-6 & f'(2) &= 22 \end{align}\]

    So:

    (1.29)#\[\begin{equation} f(x) \approx 17+22(x-2) \end{equation}\]