### Differentiation, derivatives and Taylor approximations: Taylor approximations

### Taylor series

The derivative of the exponential function \(e^x\) is the function itself. We take \(a=0, x>0\) and find with Taylor's theorem \[e^x=1+x+\frac{1}{2!}\!x^2+\frac{1}{3!}\!x^3+\cdots + \frac{1}{k!}\!x^k+R_k(x)\] where \(R_k(x)=\frac{1}{(k+1)!}e^{\xi} x^{k+1}\) for some \(0<\xi<x\).

We now take \(x=1, k=6\) and take into account that the base of the natural logarithm is less than 3 (ie \(e<3\) ). So then we get \[e=1+ 1+\frac{1}{2}+\frac{1}{6}+\frac{1}{24}+\frac{1}{120}+\frac{1}{720}+R_6(1)\] with \(0<R_6(1)<\frac{3}{5040}=\frac{1}{1680}<0.0006\). So we have approximated \(e\) with \(\frac{1957}{720}\approx 2.7180\ldots\) up to four significant digits.

In this last example, you could of course take as many terms as you want and you could write the following series expansion: \[\begin{aligned}e^x&=1+x+\frac{1}{2!}\!x^2+\frac{1}{3!}\!x^3+ \frac{1}{4!}\!x^4+\frac{1}{5!}\!x^5+\cdots\\ \\ &=\sum_{k=0}^{\infty}\frac{1}{k!}x^k\end{aligned}\] This is called the **Taylor series** of \(e^x\) about \(x=0\).

Note that the following is true in particular: \[e= \sum_{k=0}^{\infty}\frac{1}{k!}\]

The Taylor series of sine and cosine about the origin are:

\[\begin{aligned}\sin x&=x-\frac{1}{3!}\!x^3+ \frac{1}{5!}\!x^5-\frac{1}{7!}\!x^7+\cdots\\ \\ &=\sum_{k=0}^{\infty}\frac{(-1)^k}{(2k+1)!}x^{2k+1}\\ \\ \cos x &=1-\frac{1}{2!}\!x^2+ \frac{1}{4!}\!x^4-\frac{1}{6!}\!x^6+\cdots\\ \\ &=\sum_{k=0}^{\infty}\frac{(-1)^k}{(2k)!}x^{2k} \end{aligned}\]

The Taylor series for the exponential function, sine and cosine function are not only valid for all values near \(x=0\), but even for all values of \(x\). This is not always the case.

For the Taylor series of \(\ln(1+x)\) we have \[\begin{aligned}\ln(1+x) &= x -\frac{1}{2}\!x^2+\frac{1}{3}\!x^3 - \frac{1}{4}\!x^4 +\cdots\\ \\ &= \sum_{k=1}^{\infty}\frac{(-1)^{k+1}}{k} x^k\end{aligned}\] but this is only valid for \(-1<x\le 1\).

You can numerically approximate \(\ln(2)\) by adding the first terms of \(1-\frac{1}{2}+\frac{1}{3} - \frac{1}{4}+\cdots\) But a really good approximation is only obtained by using a lot of terms: even after using 1000 terms you only get two correct decimals.

It can be done in a more clever way by taking \(x=-\tfrac{1}{2}\) and realizing that \[\ln\bigl(1+(-\tfrac{1}{2})\bigr)=\ln(\tfrac{1}{2})=-\ln(2)\tiny.\] Then you get after 10 terms in the Taylor series an approximation of \(\ln(2)\) that is correct in four decimals.