1. Taylor series#

Recommended reference: Strang [Str17], in particular Section 10.4.

Taylor series are a useful way of approximating a function by simpler functions, namely polynomials.

1.1. Definition and basic properties#

Recall that a power series is like a polynomial, but with possibly infinitely many powers of \(x\):

\[ g(x) = c_0 + c_1 x + c_2 x^2 + c_3 x^3 + \cdots \]

where the \(c_i\) are scalars (usually real or complex numbers).

Definition 1.1 (Taylor series)

Let \(f\) be a (real or complex) function that is infinitely differentiable at a point \(a\). The Taylor series of \(f\) at \(a\) is the power series

\[ f(a) + f'(a) (x - a) + \frac{f''(a)}{2}(x - a)^2 + \cdots = \sum_{n=0}^\infty \frac{f^{(n)}(a)}{n!}(x-a)^n. \]

For almost all functions \(f\) that one encounters in practice, the Taylor series of \(f\) will converge to \(f\). This means that the polynomials

\[ f(a) + f'(a) (x - a) + \frac{f''(a)}{2}(x - a)^2 + \cdots + \frac{f^{(n)}(a)}{n!}(x-a)^n \]

of degree \(n\) obtained by truncating the Taylor series to a finite number of terms give successively better approximations to \(f\) as \(n\to\infty\), at least for \(x\) sufficiently close to \(a\). However, there are exceptions; see the exercises.

1.2. Important examples#

1.2.1. The exponential function#

Consider the function \(f(x)=\exp(x)\). To compute its Taylor series at \(x=0\), note that all derivatives of \(f\) are equal to \(f\) itself, and take the value \(1\) at \(x=0\). This gives

\[\begin{split} \begin{aligned} \exp(x) &= 1 + x + \frac{1}{2}x^2 + \frac{1}{6}x^3+\cdots\\ &= \sum_{n=0}^\infty\frac{1}{n!}x^n. \end{aligned} \end{split}\]

1.2.2. The logarithm#

Now consider the function \(f(x)=\log(1-x)\). We have

\[ f'(x) = -\frac{1}{1-x} \]

and more generally

\[ f^{(n)}(x) = -\frac{(n-1)!}{(1-x)^n}\quad\text{for all }n\ge1. \]

This gives

\[\begin{split} \begin{aligned} \log(1-x) &= -x-\frac{1}{2}x^2-\frac{1}{3}x^3-\cdots\\ &= -\sum_{n=1}^\infty\frac{1}{n}x^n. \end{aligned} \end{split}\]

1.2.3. Trigonometric functions#

The Taylor series of the cosine and sine functions are given by

\[\begin{split} \begin{aligned} \cos x &= \sum_{n=0}^\infty\frac{(-1)^n}{(2n)!}x^{2n},\\ \sin x &= \sum_{n=0}^\infty\frac{(-1)^n}{(2n+1)!}x^{2n+1}. \end{aligned} \end{split}\]

This can be proved directly using the familiar expressions for the derivatives of these functions. It is also instructive to derive the above formulae by taking the Taylor series of \(\exp(ix)\), splitting it into the real and imaginary parts and using Euler’s formula

\[ \exp(ix) = \cos x + i\sin x. \]

1.3. Exercises#

Exercise 1.1

Compute the Taylor series at \(x=0\) of the function

\[ f(x) = \frac{1}{1-x}. \]

Exercise 1.2

Derive the Taylor series for the sine and cosine functions using the two different methods sketched in Trigonometric functions.

Exercise 1.3

Consider the function

\[\begin{split} f(x) = \begin{cases} \exp(-1/x^2)& \text{if }x\ne0,\\ 0& \text{if }x=0. \end{cases} \end{split}\]

Show that the Taylor series of \(f\) at \(0\) is identically zero.