# Math 141, Lesson 34: Taylor Polynomials

The lesson page, with interactive tools and R in the browser: https://tangentspace.org/lessons/34/

This lesson is marked "Updates coming": parts of it are still being written.

Reading: [Supplemental Reading](https://jeichholz-taylorpolynomialsupplement.share.connect.posit.cloud/)

Practice: Optional HW 34 **[Q?? and Q??]**.

Interactive tools: [Taylor Polynomials](https://tangentspace.org/tools/taylor-polynomials/)

## Objectives

1. Compute a Taylor polynomial of a given degree, centered at a given input, by hand and in R; understand that a linear approximation is a degree-one Taylor polynomial.
2. Understand how a Taylor polynomial uses derivatives to match certain behaviors of a function at a given input (value, slope, concavity, etc.).
3. Use a Taylor polynomial to estimate a function value at a given input, and compute the error, by hand and in R.
4. Understand how the degree and the distance from the “center” affect accuracy.

## 1. Computing a Taylor Polynomial

*Objective.* Compute a Taylor polynomial of a given degree, centered at a given input, by hand and in R; understand that a linear approximation is a degree-one Taylor polynomial.

For a whole number $n$, the notation $f^{(n)}$ means the $n$th derivative of $f$, with $f^{(0)} = f$. The number $n!$ (“$n$ factorial”) is the product $n \cdot (n-1) \cdots 2 \cdot 1$, with $0! = 1$ and $1! = 1$. For example, $2! = 2$, $3! = 6$, and $4! = 24$.

**Definition 1** (Taylor polynomial).

Let $f$ have $n$ derivatives at $x = a$. The *degree $n$ Taylor polynomial* of $f$ centered at $x = a$ is the polynomial $T_n$ of degree at most $n$ whose value and first $n$ derivatives at $x = a$ match those of $f$:

$$T_n(x) = f(a) + f'(a)(x - a) + \frac{f''(a)}{2!}(x - a)^2 + \frac{f'''(a)}{3!}(x - a)^3 + \dots + \frac{f^{(n)}(a)}{n!}(x - a)^n.$$

The function $f(x) = |x|$ has no degree 1 Taylor polynomial centered at $x = 0$, because the definition requires one derivative at $x = 0$ and $f'(0)$ does not exist. The average rates of change of $|x|$ near 0 are 1 from the right and $-1$ from the left ([Lesson 25 section 2](https://tangentspace.org/lessons/25/#section-2)).

**Definition 2** (Center).

The *center* of $T_n$ is the input $a$ at which $f$ and every derivative in $T_n$ are evaluated.

In $T_1(x) = f(4) + f'(4)(x - 4)$ evaluated at $x = 4.2$, the input 4.2 is not the center, because $f$ and its derivative are evaluated at 4 and 4.2 enters only through the factor $x - 4$.

A Taylor polynomial centered at $x = 0$ is also called a *Maclaurin polynomial*.

The degree 1 Taylor polynomial is the linear approximation of [Lesson 30 section 1](https://tangentspace.org/lessons/30/#section-1):

$$T_1(x) = f(a) + f'(a)(x - a) = L(x).$$

To compute the degree $n$ Taylor polynomial $T_n$ of $f$ centered at $x = a$ by hand:

1. Take the derivatives of $f$ up to the $n$th.
2. Evaluate $f$ and each derivative at the center $a$.
3. For each $k$ from 0 to $n$, divide the $k$th derivative’s value by $k!$ and multiply by $(x - a)^k$.
4. Add the $n + 1$ terms.

### Example 1

Find the degree 3 Taylor polynomial centered at $x = 0$ of

$$f(x) = e^x.$$

**Solution.**

By the definition of a Taylor polynomial with $n = 3$ and $a = 0$, the degree 3 Taylor polynomial centered at $x = 0$ is

$$T_3(x) = f(0) + f'(0)x + \frac{f''(0)}{2!}x^2 + \frac{f'''(0)}{3!}x^3.$$

Every derivative of $e^x$ is $e^x$. By the definition of center, evaluate $f$ and its first three derivatives at $a = 0$:

$$f(0) = f'(0) = f''(0) = f'''(0) = e^0 = 1.$$

Substitute the four values into the formula for $T_3$:

$$T_3(x) = 1 + 1 \cdot x + \frac{1}{2!}x^2 + \frac{1}{3!}x^3 = 1 + x + \frac{x^2}{2} + \frac{x^3}{6}.$$

### Example 2

Find the degree 1 and degree 2 Taylor polynomials centered at $x = 4$ of

$$f(x) = \sqrt{x}.$$

**Solution.**

The degree 2 Taylor polynomial centered at $x = 4$ is

$$T_2(x) = f(4) + f'(4)(x - 4) + \frac{f''(4)}{2!}(x - 4)^2,$$

and $T_1$ is its first two terms. With $f(x) = x^{1/2}$, $f'(x) = \tfrac{1}{2}x^{-1/2}$, and $f''(x) = -\tfrac{1}{4}x^{-3/2}$, evaluate at the center:

$$f(4) = 4^{1/2} = 2, \qquad f'(4) = \frac{1}{2}\cdot 4^{-1/2} = \frac{1}{2}\cdot\frac{1}{2} = \frac{1}{4},
\qquad f''(4) = -\frac{1}{4}\cdot 4^{-3/2} = -\frac{1}{4}\cdot\frac{1}{8} = -\frac{1}{32}.$$

Substitute the three values into the formula for $T_2$:

$$T_2(x) = 2 + \frac{1}{4}(x - 4) + \frac{-1/32}{2!}(x - 4)^2 = 2 + \frac{1}{4}(x - 4) - \frac{1}{64}(x - 4)^2.$$

Its first two terms give

$$T_1(x) = 2 + \frac{1}{4}(x - 4).$$

The polynomial $T_1$ is the linear approximation of $\sqrt{x}$ when $x = 4$, because it is $L(x) = f(a) + f'(a)(x - a)$ with $a = 4$.

### Example 3

Find the degree 3 Taylor polynomial centered at $x = 1$ of

$$f(x) = \ln x.$$

**Solution.**

The derivative is $f'(x) = \tfrac{1}{x} = x^{-1}$, and the power rule gives $f''(x) = -x^{-2} = -\tfrac{1}{x^2}$ and $f'''(x) = 2x^{-3} = \tfrac{2}{x^3}$. Evaluate at the center:

$$f(1) = \ln 1 = 0, \qquad f'(1) = \frac{1}{1} = 1, \qquad f''(1) = -\frac{1}{1^2} = -1, \qquad f'''(1) = \frac{2}{1^3} = 2.$$

Substitute the four values into the formula for $T_3$:

$$T_3(x) = 0 + 1(x - 1) + \frac{-1}{2!}(x - 1)^2 + \frac{2}{3!}(x - 1)^3
= (x - 1) - \frac{(x - 1)^2}{2} + \frac{(x - 1)^3}{3}.$$

### Example 4

Find the degree 2 Taylor polynomial centered at $x = 0$ of

$$f(x) = e^{2x}.$$

**Solution.**

By the chain rule, $f'(x) = 2e^{2x}$ and $f''(x) = 4e^{2x}$. Evaluate at the center:

$$f(0) = e^0 = 1, \qquad f'(0) = 2e^0 = 2, \qquad f''(0) = 4e^0 = 4.$$

Substitute the three values into the formula for $T_2$:

$$T_2(x) = 1 + 2x + \frac{4}{2!}x^2 = 1 + 2x + 2x^2.$$

*Taylor polynomials in R.* The command `D(f(x) ~ x)` returns the derivative, and `D(f(x) ~ x & x)` returns the second derivative ([Lesson 29 section 5](https://tangentspace.org/lessons/29/#section-5)). Each added `& x` gives one more derivative: the third derivative is `D(f(x) ~ x & x & x)`. The command `factorial(k)` returns $k!$. Build the Taylor polynomial with `makeFun` from the derivative values.

### Example 5

Find the degree 3 Taylor polynomial centered at $x = 0$ of

$$f(x) = e^x$$

in R, and plot it with $f$.

**Solution.**

Define $f$ and its first three derivatives, and evaluate each at the center 0. Used R.

```r
f = makeFun(exp(x) ~ x)
df = D(f(x) ~ x)
d2f = D(f(x) ~ x & x)
d3f = D(f(x) ~ x & x & x)
c(f(0), df(0), d2f(0), d3f(0))
#> [1] 1 1 1 1
```

Build $T_3$ from the four values with `makeFun`, and plot it in orange over the graph of $f$.

```r
T3 = makeFun(f(0) + df(0)*(x - 0) + d2f(0)/factorial(2)*(x - 0)^2
+ d3f(0)/factorial(3)*(x - 0)^3 ~ x)
plotFun(f(x) ~ x, xlim = range(-3, 3))
plotFun(T3(x) ~ x, add = TRUE, col = "darkorange")
```

The R steps are the hand steps of Example 1. The line `c(f(0), df(0), d2f(0), d3f(0))` prints $f(0)$, $f'(0)$, $f''(0)$, and $f'''(0)$. In the definition of `T3`, the term `d2f(0)/factorial(2)*(x - 0)^2` is R’s form of the term $\frac{f''(0)}{2!}(x - 0)^2$. With the four values equal to 1, `T3` is the polynomial $T_3(x) = 1 + x + \frac{x^2}{2} + \frac{x^3}{6}$ of Example 1.

The figure in section 2 shows the same two graphs for $-2 \le x \le 2$: $e^x$ is the solid black curve, and $T_3$ is the orange dotted curve. The figure also shows the degree 1 and degree 2 Taylor polynomials $T_1$ and $T_2$ of $e^x$.

*The center in `makeFun`.* Write the center as a number. Inside `makeFun`, a letter such as `a` in place of 4 becomes a second input of the function:

```r
> T1 = makeFun(f(4) + df(4)*(x - a) ~ x)
> T1(4.2)
Error in T1(4.2) : argument "a" is missing, with no default
```

## 2. Matching the Behavior of a Function

*Objective.* Understand how a Taylor polynomial uses derivatives to match certain behaviors of a function at a given input (value, slope, concavity, etc.).

**Theorem 3** (Matching at the center).

Let $f$ have $n$ derivatives at $x = a$. At the center $x = a$, the Taylor polynomial $T_n$ has the same value as $f$ and the same first $n$ derivatives:

$$T_n(a) = f(a), \qquad T_n'(a) = f'(a), \qquad T_n''(a) = f''(a), \qquad \dots, \qquad T_n^{(n)}(a) = f^{(n)}(a).$$

The table lists the behavior that $T_n$ and $f$ share at $a$ under each matched condition.

| Condition at the center | Behavior matched | Shared by $T_n$ and $f$ at $a$ |
| --- | --- | --- |
| $T_n(a) = f(a)$ | value | both graphs pass through $(a, f(a))$ |
| $T_n'(a) = f'(a) > 0$ | slope | both increasing at $a$ |
| $T_n'(a) = f'(a) < 0$ | slope | both decreasing at $a$ |
| $T_n''(a) = f''(a) > 0$ | concavity | both concave up at $a$ |
| $T_n''(a) = f''(a) < 0$ | concavity | both concave down at $a$ |

The slope rows apply when $n \ge 1$, and the concavity rows apply when $n \ge 2$.

The graph of $T_1$ is the tangent line to the graph of $f$ at $(a, f(a))$, because $T_1$ matches value and slope. When $f''(a) \neq 0$, the graph of $T_2$ has the same concavity as the graph of $f$ at $x = a$, because $T_2$ also matches the second derivative. The polynomial $T_{n+1}$ matches one more derivative than $T_n$.

The figure shows $e^x$ with its degree 1, 2, and 3 Taylor polynomials centered at $x = 0$; the degree 3 polynomial is the $T_3$ of Example 1.

![Figure](https://tangentspace.org/lessons/fig/b9a7d5e071c3.svg)

The function $f(x) = e^{-x}$ shows the decreasing case. Its derivatives $f'(x) = -e^{-x}$ and $f''(x) = e^{-x}$ give $f(0) = 1$, $f'(0) = -1 < 0$, and $f''(0) = 1 > 0$. The Taylor polynomials centered at $x = 0$ are

$$T_1(x) = 1 - x, \qquad T_2(x) = 1 - x + \frac{x^2}{2}.$$

Both graphs fall through $(0, 1)$ with $e^{-x}$, and $T_2$ is concave up there like $e^{-x}$.

![Figure](https://tangentspace.org/lessons/fig/497e74440ea4.svg)

*Factorial coefficients.* Let $A$ be the coefficient of $(x - a)^k$ in $T_n$. The $k$th derivative of $A(x - a)^k$ is $k!\,A$, and each of the remaining terms of $T_n$ has $k$th derivative 0 at $x = a$. For a term of lower degree, the $k$th derivative is 0. For a term of higher degree, the $k$th derivative still has a factor $x - a$, which is 0 at $x = a$. As a result, $T_n^{(k)}(a) = k!\,A$, and matching $f^{(k)}(a)$ requires $k!\,A = f^{(k)}(a)$. The coefficient of $(x - a)^k$ is therefore $\tfrac{f^{(k)}(a)}{k!}$.

### Example 6

The degree 2 Taylor polynomial of a function $f$ centered at $x = 2$ is

$$T_2(x) = 5 - 3(x - 2) + 4(x - 2)^2.$$

Find $f(2)$, $f'(2)$, and $f''(2)$. Determine whether $f$ is increasing or decreasing at $x = 2$, and whether it is concave up or concave down there.

**Solution.**

By the definition of a Taylor polynomial, the coefficient of $(x - 2)^k$ is $\tfrac{f^{(k)}(2)}{k!}$. The constant term is $f(2) = 5$, and the coefficient of $x - 2$ is $f'(2) = -3$. Since the coefficient of $(x - 2)^2$ is $\tfrac{f''(2)}{2!} = 4$,

$$f''(2) = 2! \cdot 4 = 8.$$

The function $f$ is decreasing at $x = 2$, because $f'(2) < 0$. It is concave up there, because $f''(2) > 0$.

### Example 7

Find the degree 4 Taylor polynomial centered at $x = 0$ of

$$f(x) = \cos x.$$

Then explain why it has no odd powers of $x$.

**Solution.**

The derivatives of $\cos x$ are $f'(x) = -\sin x$, $f''(x) = -\cos x$, $f'''(x) = \sin x$, and $f^{(4)}(x) = \cos x$. Evaluate $f$ and its first four derivatives at the center:

$$f(0) = \cos 0 = 1, \quad f'(0) = -\sin 0 = 0, \quad f''(0) = -\cos 0 = -1, \quad f'''(0) = \sin 0 = 0, \quad f^{(4)}(0) = \cos 0 = 1.$$

Substitute the five values into the formula for $T_4$:

$$T_4(x) = 1 + 0x + \frac{-1}{2!}x^2 + \frac{0}{3!}x^3 + \frac{1}{4!}x^4 = 1 - \frac{x^2}{2} + \frac{x^4}{24}.$$

The odd powers drop out because the odd-order derivatives $f'(0)$ and $f'''(0)$ are both 0 at the center.

### Example 8

Find the degree 2 Taylor polynomial centered at $x = \tfrac{\pi}{2}$ of

$$f(x) = \sin x.$$

**Solution.**

With $f'(x) = \cos x$ and $f''(x) = -\sin x$, evaluate $f$ and its first two derivatives at the center, where $\sin\tfrac{\pi}{2} = 1$ and $\cos\tfrac{\pi}{2} = 0$:

$$f\!\left(\tfrac{\pi}{2}\right) = 1, \qquad f'\!\left(\tfrac{\pi}{2}\right) = \cos\tfrac{\pi}{2} = 0,
\qquad f''\!\left(\tfrac{\pi}{2}\right) = -\sin\tfrac{\pi}{2} = -1.$$

Substitute the three values into the formula for $T_2$:

$$T_2(x) = 1 + 0\left(x - \tfrac{\pi}{2}\right) - \frac{1}{2!}\left(x - \tfrac{\pi}{2}\right)^2
= 1 - \frac{1}{2}\left(x - \tfrac{\pi}{2}\right)^2.$$

Since $f'\bigl(\tfrac{\pi}{2}\bigr) = 0$ and $f''\bigl(\tfrac{\pi}{2}\bigr) < 0$, the function $\sin x$ has a maximum at $x = \tfrac{\pi}{2}$. The polynomial $T_2$ shares its value, slope, and concavity there. On the graph, $T_2$ is a parabola that is concave down like $\sin x$. It passes through the maximum point $\bigl(\tfrac{\pi}{2}, 1\bigr)$ with a horizontal tangent line there.

![Figure](https://tangentspace.org/lessons/fig/b541f8c44f74.svg)

## 3. Estimating a Value and Its Error

*Objective.* Use a Taylor polynomial to estimate a function value at a given input, and compute the error, by hand and in R.

For an input $b$ near the center, the value $T_n(b)$ estimates $f(b)$.

**Definition 4** (Error).

The *error* of the estimate $T_n(b)$ is the distance between the true value and the estimate:

$$\text{error} = \left| f(b) - T_n(b) \right|.$$

The distance $|T_2(b) - T_1(b)|$ between two estimates is not an error, because an error is the distance from the true value $f(b)$.

### Example 9

For $f(x) = \sqrt{x}$ centered at $x = 4$, the degree 1 and degree 2 Taylor polynomials are

$$T_1(x) = 2 + \frac{1}{4}(x - 4), \qquad T_2(x) = 2 + \frac{1}{4}(x - 4) - \frac{1}{64}(x - 4)^2.$$

Estimate $\sqrt{4.2}$ with each, and compute the error of each estimate.

**Solution.**

By the definition of error, the error of an estimate is

$$\text{error} = \left| f(b) - T_n(b) \right|.$$

Both errors are computed with the true value at full precision, $\sqrt{4.2} = 2.04939015\ldots$ from a calculator. Evaluate $T_1$ at $b = 4.2$, then compute its error:

$$T_1(4.2) = 2 + \frac{1}{4}(0.2) = 2.05, \qquad \text{error} = |2.04939015\ldots - 2.05| \approx 0.000610.$$

Evaluate $T_2$ at $b = 4.2$, then compute its error:

$$T_2(4.2) = 2 + \frac{1}{4}(0.2) - \frac{1}{64}(0.2)^2 = 2.05 - 0.000625 = 2.049375,$$

$$\text{error} = |2.04939015\ldots - 2.049375| \approx 0.000015.$$

### Example 10

For $f(x) = e^{2x}$ centered at $x = 0$, the degree 2 Taylor polynomial is

$$T_2(x) = 1 + 2x + 2x^2.$$

Estimate $e^{0.2}$ with $T_2$, and compute the error.

**Solution.**

The input for the estimate is $b = 0.1$, because

$$e^{0.2} = e^{2(0.1)} = f(0.1).$$

Evaluate $T_2$ at $b = 0.1$:

$$T_2(0.1) = 1 + 2(0.1) + 2(0.1)^2 = 1 + 0.2 + 0.02 = 1.22.$$

With the true value $e^{0.2} = 1.22140276\ldots$ from a calculator, the error is

$$|1.22140276\ldots - 1.22| = 0.00140276\ldots \approx 0.001403.$$

### Example 11

For $f(x) = \sqrt{x}$ centered at $x = 4$, estimate $\sqrt{4.2}$ with the degree 1 and degree 2 Taylor polynomials in R, and compute the error of each estimate.

**Solution.**

Build both Taylor polynomials from the derivatives of $f$ at 4, evaluate each at $x = 4.2$, and compute each error. Used R.

```r
f = makeFun(sqrt(x) ~ x)
df = D(f(x) ~ x)
d2f = D(f(x) ~ x & x)
T1 = makeFun(f(4) + df(4)*(x - 4) ~ x)
T2 = makeFun(f(4) + df(4)*(x - 4) +
d2f(4)/factorial(2)*(x - 4)^2 ~ x)
T1(4.2)
#> [1] 2.05
T2(4.2)
#> [1] 2.049375
abs(f(4.2) - T1(4.2))
#> [1] 0.0006098468
abs(f(4.2) - T2(4.2))
#> [1] 1.515319e-05
```

The lines `T1(4.2)` and `T2(4.2)` compute the estimates, and each line with `abs()` computes the error $|f(4.2) - T_n(4.2)|$ of the definition. The estimates and the errors match Example 9: $T_1(4.2) = 2.05$ with error about 0.000610, and $T_2(4.2) = 2.049375$ with error about 0.000015.

*Scientific notation.* R prints a very small number in scientific notation: `1.515319e-05` means $1.515319 \times 10^{-5} \approx 0.00001515$.

## 4. Degree, Distance, and Accuracy

*Objective.* Understand how the degree and the distance from the “center” affect accuracy.

An estimate is *more accurate* than another when its error is smaller. The table gives the error $|e^b - T_n(b)|$, rounded to four significant digits, for the Taylor polynomials of $e^x$ centered at $x = 0$. Every derivative of $e^x$ is 1 at $x = 0$. As a result, each entry is the distance between $e^b$ and $T_n(b) = 1 + b + \frac{b^2}{2!} + \dots + \frac{b^n}{n!}$.

| $\|e^b - T_n(b)\|$ | $b = 0.1$ | $b = 0.5$ | $b = 1$ | $b = 2$ |
| --- | --- | --- | --- | --- |
| $T_1$ | 0.005171 | 0.1487 | 0.7183 | 4.389 |
| $T_2$ | 0.0001709 | 0.02372 | 0.2183 | 2.389 |
| $T_3$ | 0.000004251 | 0.002888 | 0.05162 | 1.056 |
| $T_4$ | 0.00000008474 | 0.0002838 | 0.009948 | 0.3891 |

*Degree.* Near the center, a higher-degree polynomial matches more derivatives of $f$ at the center and often gives a smaller error. Each column of the $e^x$ table shows this.

An added term with coefficient 0 leaves the error unchanged. For $\cos x$ centered at $x = 0$, the polynomials satisfy $T_3 = T_2$, because $f'''(0) = 0$ (Example 7).

Far from the center, a higher degree can give a larger error. For $\ln x$ centered at $x = 1$, the error at $b = 3$ grows with each added degree. One more derivative of $f(x) = \ln x$ from Example 3 is $f^{(4)}(x) = -6x^{-4}$, with $f^{(4)}(1) = -6$. The degree 4 term is therefore $\frac{-6}{4!}(x - 1)^4 = -\frac{(x - 1)^4}{4}$. At $b = 3$, the factor $x - 1$ is 2. Substitute 2 for $x - 1$ in each polynomial:

$$T_1(3) = 2, \qquad T_2(3) = 2 - \frac{2^2}{2} = 0, \qquad T_3(3) = 0 + \frac{2^3}{3} = \frac{8}{3}, \qquad T_4(3) = \frac{8}{3} - \frac{2^4}{4} = -\frac{4}{3}.$$

With $\ln 3 = 1.098612\ldots$ from a calculator, the estimates and their errors are:

|  | $T_1$ | $T_2$ | $T_3$ | $T_4$ |
| --- | --- | --- | --- | --- |
| $T_n(3)$ | 2 | 0 | 2.667 | $-1.333$ |
| $\|\ln 3 - T_n(3)\|$ | 0.9014 | 1.099 | 1.568 | 2.432 |

*Distance from the center.* At a fixed degree, an input farther from the center often gives a larger error, as each row of the $e^x$ table shows. The error of $T_4$ grows from about 0.00000008474 at $b = 0.1$ to about 0.3891 at $b = 2$.

### Example 12

For $f(x) = \ln x$ centered at $x = 1$, the degree 3 Taylor polynomial is

$$T_3(x) = (x - 1) - \frac{(x - 1)^2}{2} + \frac{(x - 1)^3}{3}.$$

Estimate $\ln(1.1)$, $\ln(1.5)$, and $\ln(2)$ with $T_3$, and determine which estimate is most accurate.

**Solution.**

For each input $b$, substitute $b$ into $T_3$, then compute the error with the true value $\ln(b)$ from a calculator. For $b = 1.1$,

$$\begin{align*}
T_3(1.1) &= 0.1 - \frac{0.1^2}{2} + \frac{0.1^3}{3} = 0.1 - 0.005 + 0.000333\ldots = 0.095333\ldots,\\
\text{error} &= |0.095310\ldots - 0.095333\ldots| \approx 0.000023.
\end{align*}$$

For $b = 1.5$,

$$\begin{align*}
T_3(1.5) &= 0.5 - \frac{0.5^2}{2} + \frac{0.5^3}{3} = 0.5 - 0.125 + 0.041666\ldots = 0.416666\ldots,\\
\text{error} &= |0.405465\ldots - 0.416666\ldots| \approx 0.011202.
\end{align*}$$

For $b = 2$,

$$\begin{align*}
T_3(2) &= 1 - \frac{1^2}{2} + \frac{1^3}{3} = 1 - 0.5 + 0.333333\ldots = 0.833333\ldots,\\
\text{error} &= |0.693147\ldots - 0.833333\ldots| \approx 0.140186.
\end{align*}$$

The estimate of $\ln(1.1)$ is the most accurate, because it has the smallest error. The input 1.1 is also the input closest to the center 1. On the graph, each error is the vertical gap between $\ln x$ and $T_3$ at $b$: too small to see at $b = 1.1$ and $b = 1.5$, and visible at $b = 2$.

![Figure](https://tangentspace.org/lessons/fig/66838f91788d.svg)

### Example 13

For $f(x) = \cos x$ centered at $x = 0$, the degree 2 and degree 4 Taylor polynomials are

$$T_2(x) = 1 - \frac{x^2}{2}, \qquad T_4(x) = 1 - \frac{x^2}{2} + \frac{x^4}{24}.$$

Estimate $\cos(1)$ with each, and determine which degree gives the more accurate estimate.

**Solution.**

For each polynomial, substitute $b = 1$, then compute the error with the true value $\cos(1) = 0.540302\ldots$ from a calculator. For $T_2$,

$$\begin{align*}
T_2(1) &= 1 - \frac{1^2}{2} = 0.5,\\
\text{error} &= |0.540302\ldots - 0.5| \approx 0.040302.
\end{align*}$$

For $T_4$,

$$\begin{align*}
T_4(1) &= 1 - \frac{1^2}{2} + \frac{1^4}{24} = 1 - 0.5 + 0.041666\ldots = 0.541666\ldots,\\
\text{error} &= |0.540302\ldots - 0.541666\ldots| \approx 0.001364.
\end{align*}$$

The degree 4 estimate is more accurate: its error 0.001364 is about $\tfrac{1}{30}$ of the error 0.040302 of $T_2$. The polynomial $T_4$ also matches two more derivatives of $\cos x$ at the center than $T_2$ does.
