### Subsection3.4.5Still Better Approximations — Taylor Polynomials

We can use the same strategy to generate still better approximations by polynomials  8 Polynomials are generally a good choice for an approximating function since they are so easy to work with. Depending on the situation other families of functions may be more appropriate. For example if you are approximating a periodic function, then sums of sines and cosines might be a better choice; this leads to Fourier series. of any degree we like. As was the case with the approximations above, we determine the coefficients of the polynomial by requiring, that at the point $x=a\text{,}$ the approximation and its first $n$ derivatives agree with those of the original function.

Rather than simply moving to a cubic polynomial, let us try to write things in a more general way. We will consider approximating the function $f(x)$ using a polynomial, $T_n(x)\text{,}$ of degree $n$ — where $n$ is a non-negative integer. As we discussed above, the algebra is easier if we write

\begin{align*} T_n(x) &= c_0 + c_1(x-a) + c_2 (x-a)^2 + \cdots + c_n (x-a)^n\\ &= \sum_{k=0}^n c_k (x-a)^k & \text{using } \Sigma \text{ notation} \end{align*}

The above form  9 Any polynomial in $x$ of degree $n$ can also be expressed as a polynomial in $(x-a)$ of the same degree $n$ and vice versa. So $T_n(x)$ really still is a polynomial of degree $n\text{.}$  10 Furthermore when $x$ is close to $a\text{,}$ $(x-a)^k$ decreases very quickly as $k$ increases, which often makes the "high $k$" terms in $T_n(x)$ very small. This can be a considerable advantage when building up approximations by adding more and more terms. If we were to rewrite $T_n(x)$ in the form $\ds \sum_{k=0}^n b_k x^k$ the "high $k$" terms would typically not be very small when $x$ is close to $a\text{.}$ makes it very easy to evaluate this polynomial and its derivatives at $x=a\text{.}$ Before we proceed, we remind the reader of some notation (see Notation 2.2.8):

• Let $f(x)$ be a function and $k$ be a positive integer. We can denote its $k^\mathrm{th}$ derivative with respect to $x$ by
\begin{align*} \ddiff{k}{f}{x} && \left( \diff{}{x}\right)^k f(x) && f^{(k)}(x) \end{align*}

###### Definition3.4.9Factorial

Let $n$ be a positive integer  11 It is actually possible to define the factorial of positive real numbers and even negative numbers but it requires more advanced calculus and is outside the scope of this course. The interested reader should look up the Gamma function. , then $n$-factorial, denoted $n!\text{,}$ is the product

\begin{align*} n! &= n \times (n-1) \times \cdots \times 3 \times 2 \times 1 \end{align*}

Further, we use the convention that

\begin{align*} 0! &= 1 \end{align*}

The first few factorials are

\begin{align*} 1! &=1 & 2! &=2 & 3! &=6\\ 4! &=24 & 5! &=120 & 6! &=720 \end{align*}

Now consider $T_n(x)$ and its derivatives:

\begin{alignat*}{4} T_n(x) &=& c_0 &+ c_1(x-a) & + c_2 (x-a)^2 & + c_3(x-a)^3 &+ \cdots+ & c_n (x-a)^n\\ T_n'(x) &=& &c_1 & + 2 c_2 (x-a) & + 3c_3(x-a)^2 &+ \cdots +& n c_n (x-a)^{n-1}\\ T_n''(x) &=& & & 2 c_2 & + 6c_3(x-a) &+ \cdots +& n(n-1) c_n (x-a)^{n-2}\\ T_n'''(x) &=& & & & 6c_3 &+ \cdots + & n(n-1)(n-2) c_n (x-a)^{n-3}\\ & \vdots\\ T_n^{(n)}(x) &=& & & & & & n! \cdot c_n \end{alignat*}

Now notice that when we substitute $x=a$ into the above expressions only the constant terms survive and we get

\begin{align*} T_n(a) &= c_0\\ T_n'(a) &= c_1\\ T_n''(a) &= 2\cdot c_2\\ T_n'''(a) &= 6 \cdot c_3\\ &\vdots\\ T_n^{(n)}(a) &= n! \cdot c_n \end{align*}

So now if we want to set the coefficients of $T_n(x)$ so that it agrees with $f(x)$ at $x=a$ then we need

\begin{align*} T_n(a) &= c_0 = f(a) & c_0 &= f(a) = \frac{1}{0!} f(a)\\ \end{align*}

We also want the first $n$ derivatives of $T_n(x)$ to agree with the derivatives of $f(x)$ at $x=a\text{,}$ so

\begin{align*} T_n'(a) &= c_1 = f'(a) & c_1 &= f'(a) = \frac{1}{1!} f'(a)\\ T_n''(a) &= 2\cdot c_2 = f''(a) & c_2 &= \frac{1}{2} f''(a) = \frac{1}{2!}f''(a)\\ T_n'''(a) &= 6\cdot c_3 = f'''(a) & c_3 &= \frac{1}{6} f'''(a) = \frac{1}{3!} f'''(a)\\ \end{align*}

More generally, making the $k^\mathrm{th}$ derivatives agree at $x=a$ requires :

\begin{align*} T_n^{(k)}(a) &= k!\cdot c_k = f^{(k)}(a) & c_k &= \frac{1}{k!} f^{(k)}(a)\\ \end{align*}

And finally the $n^\mathrm{th}$ derivative:

\begin{align*} T_n^{(n)}(a) &= n!\cdot c_n = f^{(n)}(a) & c_n &= \frac{1}{n!} f^{(n)}(a) \end{align*}

Putting this all together we have

Let us formalise this definition.

###### Definition3.4.11Taylor polynomial

Let $a$ be a constant and let $n$ be a non-negative integer. The $n^\mathrm{th}$ degree Taylor polynomial for $f(x)$ about $x=a$ is

\begin{align*} T_n(x) &= \sum_{k=0}^n \frac{1}{k!} f^{(k)}(a) \cdot (x-a)^k. \end{align*}

The special case $a=0$ is called a Maclaurin  12 The polynomials are named after Brook Taylor who devised a general method for constructing them in 1715. Slightly later, Colin Maclaurin made extensive use of the special case $a=0$ (with attribution of the general case to Taylor) and it is now named after him. The special case of $a=0$ was worked on previously by James Gregory and Isaac Newton, and some specific cases were known to the 14th century Indian mathematician Madhava of Sangamagrama. polynomial.

Before we proceed with some examples, a couple of remarks are in order.

• While we can compute a Taylor polynomial about any $a$-value (providing the derivatives exist), in order to be a useful approximation, we must be able to compute $f(a),f'(a),\cdots,f^{(n)}(a)$ easily. This means we must choose the point $a$ with care. Indeed for many functions the choice $a=0$ is very natural — hence the prominence of Maclaurin polynomials.
• If we have computed the approximation $T_n(x)\text{,}$ then we can readily extend this to the next Taylor polynomial $T_{n+1}(x)$ since
\begin{align*} T_{n+1}(x) &= T_n(x) + \frac{1}{(n+1)!} f^{(n+1)}(a) \cdot (x-a)^{n+1} \end{align*}
This is very useful if we discover that $T_n(x)$ is an insufficient approximation, because then we can produce $T_{n+1}(x)$ without having to start again from scratch.