Taylor Polynomials

A Taylor polynomial is a polynomial constructed from the derivatives of a function at a given point. It provides a local approximation of the function and can be used, among other applications, to evaluate limits, estimate function values and to study the behavior of a function near a critical point.

The idea behind this polynomial is to approximate a complex function with a polynomial whose coefficients are determined by the derivatives of the function at a chosen point. The accuracy of this approximation depends on the degree of the polynomial and on the behavior of the approximation error.

Taylor Polynomials

Let us begin by considering a function $f : (a, b) \to \mathbb{R}$ differentiable at $x_0 \in (a, b)$.

By definition, the derivative $f'(x_0)$ represents the slope of the tangent line to the graph of $f$ at $x_0$. Recall that the equation of a line passing through $(x_0, y_0)$ with slope $m$ can be determined using the following pencil of lines:

$$ y - y_0 = m(x - x_0) \iff y = y_0 + m(x - x_0) $$

In our case, the point is $(x_0, f(x_0))$ and the slope is $f'(x_0)$. Therefore, the equation of the tangent line is:

$$ T_1(x) = f(x_0) + f'(x_0) (x - x_0) $$

This first-degree polynomial provides a local approximation of $f$ near $x_0$. In other words, we can write:

$$ f(x) \approx f(x_0) + f'(x_0) (x - x_0), \qquad x \to x_0 $$

More precisely, we want to establish what we mean by the symbol “$\approx$”. To do so, let us introduce a function representing the difference between the two sides of the previous expression:

$$ E(x) = f(x) - T_1(x) $$

This function denotes the approximation error of the $f(x)$. Saying that $T_1(x)$ approximates $f(x)$ means that the error tends to zero faster than $| x - x_0|$. Thus, we can express $f$ as:

$$ f(x) = f(x_0) + f'(x_0) (x - x_0) + E(x), \qquad x \to x_0 $$

whether:

$$ \lim_{x \to x_0} \frac{E(x)}{x - x_0} = 0 $$

To convey this idea more concisely, we introduce the following notation.

Let $f$ and $g$ be two functions defined on a punctured neighborhood of $x_0 \in \mathbb{R}$ with $g(x) \neq 0$ for all sufficiently close $x \neq x_0$. Then, we can write: $$ f(x) = o(g(x)), \quad x \to x_0 $$ if and only if $$ \lim_{x \to x_0} \frac{f(x)}{g(x)} = 0 $$ In this case, we say that $f$ is “little-o” of $g$ as $x \to x_0$.

By using this notation (which is part of Landau’s asymptotic notations), we can rewrite our approximation as:

$$ f(x) = \underbrace{f(x_0) + f'(x_0)(x - x_0)}_{T_1(x)} + o(x - x_0), \qquad x \to x_0 $$

This expression represents a first-order approximation of $f$ using a first-degree polynomial. Notice that $T_1$ is determined by the following two conditions:

Although this linear approximation matches both the value and the first derivative of $f$ at $x_0$, it does not capture its second-order behavior; that is, the curvature of the function. This is caused by the fact that its accuracy is not guaranteed to remain high far from $x_0$.

One way to improve this approximation is to introduce a second-degree polynomial:

$$ T_2(x) = c_0 + c_1(x - x_0) + c_2(x - x_0)^2 $$

We now want $T_2(x)$ to match not only the value and the first derivative of $f$, but also its second derivative at $x_0$. To determine the coefficients $c_0, c_1, c_2$, we evaluate the polynomial and its derivatives at $x_0$. Let us start by evaluating the polynomial itself:

$$ T_2(x_0) = c_0 = f(x_0) $$

Next, let’s find out the first derivative:

$$ T'_2(x) = c_1 + 2c_2(x - x_0) \implies T'_2(x_0) = c_1 = f'(x_0) $$

Finally, the second derivative yields:

$$ T''_2(x) = 2c_2 \implies T''_2(x_0) = 2c_2 = f''(x_0) \implies c_2 = \frac{f''(x_0)}{2} $$

If we substitute these coefficients back into the original polynomial, we get:

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

Thus, we obtain a second-degree polynomial that provides a more refined local approximation of $f$. More precisely, the approximation error now vanishes even faster than $(x - x_0)^2$:

$$ f(x) = \underbrace{f(x_0) + f'(x_0)(x - x_0) + \frac{f''(x_0)}{2} (x - x_0)^2}_{T_2(x)} + o \left((x - x_0)^2 \right), \qquad x \to x_0 $$

Let’s now consider the general case. Suppose that $f$ is $n$ times differentiable at $x_0$. We want to construct a polynomial $T_n$ of degree at most $n$ such that its derivatives up to order $n$, including the function itself, match those of $f$ at $x_0$. That is:

$$ T_n^{(k)}(x_0) = f^{(k)}(x_0), \quad k = 0, 1, \ldots, n $$

where $f^{(0)} = f$ and $T_n^{(0)} = T_n$. Consider now the general polynomial:

$$ T_n(x) = c_0 + c_1(x - x_0) + c_2(x - x_0)^2 + c_3(x - x_0)^3 + \cdots + c_n(x - x_0)^n $$

We have already seen how the first few coefficients are determined; the same reasoning applies to every other coefficient. When we differentiate the polynomial $k$ times and evaluate the result at $x_0$, all terms of degree less than $k$ vanish because their $k$-th derivatives are zero. All terms of degree greater than $k$ also vanish because their $k$-th derivatives still contain a positive power of $x - x_0$.

Consequently, only the term $c_k(x - x_0)^k$ contributes. Moreover, since we require that $T_n^{(k)}(x_0) = f^{(k)}(x_0)$, we get:

$$ T_n^{(k)}(x_0) = k! c_k = f^{(k)}(x_0) $$

Which implies that:

$$ c_k = \frac{f^{(k)} (x_0)}{k!} $$

We can now use this formula to derive the general case of the polynomial:

$$ \begin{aligned} T_n(x) &= f(x_0) + f'(x_0)(x-x_0)\\ &+ \frac{f''(x_0)}{2!} (x - x_0)^2\\ &+ \frac{f'''(x_0)}{3!} (x - x_0)^3\\ &+ \ldots + \frac{f^{(n)}(x_0)}{n!} (x - x_0)^n\\ &= \boxed{\sum_{k=0}^n \frac{f^{(k)}(x_0)}{k!} (x - x_0)^k} \end{aligned} $$

This is the Taylor polynomial of degree $n$ centered at $x_0$. In the special case $x_0 = 0$, the Taylor polynomial is called Maclaurin polynomial and takes the following form:

$$ T_n(x) = \sum_{k = 0}^n \frac{f^{(k)}(0)}{k!} x^k $$

Taylor’s Theorem

We can now define the $n$th-order approximation error of $f$ as:

$$ E_n(x) = f(x) - T_n(x) $$

We therefore have the following identity:

$$ f(x) = \sum_{k=0}^n \frac{f^{(k)}(x_0)}{k!} (x - x_0)^k + E_n(x) $$

This result is the Taylor’s formula of $f$ of order $n$ centered at $x_0$.

The next question we want to answer is how to characterize the approximation error $E_n$, that is, how rapidly it approaches zero as $x \to x_0$. There are two ways of doing it. The first one we will study on this lesson is known as Peano form of the remainder and can be formulated as follows:

Let $f : (a, b) \to \mathbb{R}$ be $n$ times differentiable at $x_0 \in (a, b)$ and let $T_n(x)$ be the Taylor polynomial of degree $n$ centered at $x_0$, then we have that $\forall n \geq 1$: $$ E_n(x) = o \left( (x - x_0)^n \right), \quad x \to x_0 $$

The other way to characterize $E_n(x)$ is known as Lagrange form of the remainder, which can be instead stated as follows:

Let $f : (a, b) \to \mathbb{R}$ be $(n + 1)$ times differentiable on $(a, b)$ with $n \geq 0$. Furthermore, let $x_0 \in (a, b)$ and let $T_n$ be the Taylor polynomial of degree $n$ of $f$ centered at $x_0$. Then $\forall x \in (a, b)$ with $x \neq x_0$, there exists a point $\xi_L$ between $x_0$ and $x$ such that: $$ E_n(x) = \frac{f^{(n+1)}(\xi_L)}{(n+1)!} (x - x_0)^{n+1} $$

The proofs of both formulation are omitted for brevity. However, it is worth noting their distinct applications: the Peano form is particularly useful for evaluating limits of functions, whereas the Lagrange form is primarily used for numerical approximation at a given point.

Approximation of Common Functions

Let us now try to approximate some common functions using Maclaurin’s formula. Consider the following function:

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

If we evaluate its derivatives, we get:

$$ \begin{matrix} &f'(x) = \cos(x), &f''(x) = - \sin(x), &f'''(x) = - \cos(x)\\ &f^{(4)}(x) = f(x), &f^{(5)}(x) = f'(x), &f^{(6)}(x) = f''(x) \end{matrix} $$

This means that $$ f^{(2k)}(0) = 0 $$

and that

$$ f^{(2k + 1)}(0) = (-1)^k $$

Therefore, we can approximate $\sin(x)$ using the following Taylor polynomial centered at the point $x = 0$:

$$ \sin(x) = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \frac{x^7}{7!} + \ldots = \sum_{k = 0}^n (-1)^k \frac{x^{2k+1}}{(2k + 1)!} + o \left(x^{2n + 2} \right) $$

Graphically, this corresponds to:

As you can see, as the degree of $T_n$ increases, the approximation becomes more and more accurate.

Let us try another one:

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

If we evaluate its derivative, we obtain:

$$ \begin{matrix} &f'(x) = -\sin(x), &f''(x) = - \cos(x), &f'''(x) = \sin(x)\\ &f^{(4)}(x) = f(x), &f^{(5)}(x) = f'(x), &f^{(6)}(x) = f''(x) \end{matrix} $$

Exactly the same pattern! In this case, however, we have:

$$ f^{(2k)}(0) = (-1)^k $$

and:

$$ f^{(2k + 1)}(0) = 0 $$

Therefore, the Maclaurin polynomial for $\cos(x)$ will be:

$$ \cos(x) = 1 - \frac{x^2}{2} + \frac{x^4}{4!} - \frac{x^6}{6!} + \ldots = \sum_{k = 0}^n (-1)^k \frac{x^{2k}}{(2k)!} + o \left( x^{2n+1} \right) $$

Graphically, this corresponds to:

Using the same reasoning, we can derive the Maclaurin polynomials for the following functions:

$$ e^x = 1 + x + \frac{x^2}{2} + \frac{x^3}{3!} + \ldots = \sum_{k = 0}^n \frac{x^k}{k!} + o(x^n) $$

$$ \log(1 + x) = x - \frac{x^2}{2} + \frac{x^3}{3} - \frac{x^4}{4} + \ldots = \sum_{k=1}^n (-1)^{k+1} \frac{x^k}{k} + o(x^n) $$

Applications

In this last section we will apply everything we’ve learned so far to solve practical problems. Specifically, we will use Taylor polynomials to evaluate limits, calculate derivatives and study the nature of critical points. We will start with limit evaluation.

Evaluating Limits

Consider the following limit:

$$ \lim_{x \to 0} \frac{x^3 e^{2x} - \sin(x^3) - 2x^4}{x^2 \log(1 + 5x^3)} $$

If we would evaluate it by substitution, we would end up with an indeterminate form of the type $[ 0/0 ]$. Instead, let’s use Taylor polynomials to expand each function around a given point $x = 0$.

We start with $e^{2x}$:

$$ \begin{aligned} e^{2x} &= 1 + 2x + \frac{(2x)^2}{2!} + \frac{(2x)^3}{3!} + o(x^3)\\ &= 1 + 2x + 2x^2 + \frac{4}{3} x^3 + o(x^3) \end{aligned} $$

Now let’s multiply it by $x^3$:

$$ x^3 e^{2x} = x^3 + 2x^4 + 2x^5 + \frac{4}{3} x^6 + o(x^6) $$

Let’s move to the sine:

$$ \sin(x^3) = x^3 - \frac{x^9}{6} + o(x^9) $$

And finally the logarithm:

$$ \log(1 + 5x^3) = 5x^3 - \frac{25}{2} x^6 + \frac{125}{3} x^9 + o(x^9) $$

Multiplying by $x^2$, we get:

$$ x^2 \log(1 + 5x^3) = 5x^5 - \frac{25}{2} x^8 + \frac{125}{3} x^{11} + o(x^{11}) $$

Now let’s substitute this back to the numerator:

$$ \begin{aligned} x^3 e^{2x} - \sin(x^3) - 2x^4 &= x^3 + 2x^4 + 2x^5 + \frac{4}{3} x^6 + o(x^6)\\ &- \left( x^3 - \frac{x^9}{6} + o(x^9) \right) - 2x^4 \end{aligned} $$

Notice that the first nonzero term is $2x^5$, therefore:

$$ x^3 e^{2x} - \sin(x^3) - 2x^4 = 2x^5 + o(x^5) $$

And if we express the denominator up to $o(x^5)$, we get:

$$ \lim_{x \to 0} \frac{2x^5 + o(x^5)}{5x^5 + o(x^5)} = \lim_{x \to 0} \frac{x^5 (2 + o(1))}{x^5 (5 + o(1))} = \boxed{\frac{2}{5}} $$

Calculating Derivatives

We can also use Taylor polynomials to find the derivative of a function. For example, let’s try to calculate the third derivative at $x = 0$ of:

$$ f(x) = \frac{\sin(x)}{1 - x} $$

Since we want the third derivative, we will consider the Taylor expansions up to $o(x^3)$. For the sine, this is:

$$ \sin(x) = x - \frac{x^3}{6} + o(x^3) $$

While for the denominator, we can use the geometric series:

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

Thus, if we multiply them, we obtain:

$$ f(x) = \left( x - \frac{x^3}{6} + o(x^3) \right) \left(1 + x + x^2 + x^3 + o(x^3) \right) $$

But since we only need terms up to the third degree, we end up with:

$$ \begin{aligned} f(x) &= x + x^2 + x^3 - \frac{x^3}{6} + o(x^3)\\ &= \boxed{x + x^2 + \frac{5}{6} x^3 + o(x^3)} \end{aligned} $$

This is the third degree Taylor polynomial of $f$ centered at $x = 0$. Now, let’s recall the general Taylor expansion up to the third degree:

$$ f(x) = f(0) + f'(0)x + \frac{f''(0)}{2} x^2 + \frac{f'''(0)}{6} x^3 + o(x^3) $$

In our case:

Thus, we conclude that:

$$ \frac{f'''(0)}{6} = \frac{5}{6} \implies \boxed{f'''(0) = 5} $$

Critical Points Classification

As we saw from Fermat’s theorem, if a function $f : [a, b] \to \mathbb{R}$ has a relative maximum or relative minimum at $x_0 \in (a, b)$ and is differentiable there, its first derivative vanishes, meaning that $f'(x_0) = 0$. However, this theorem alone does not tell us whether the critical point is a relative maximum or a relative minimum; in order to do so, we need further analysis of the nature of the point.

Our first approach for classifying these critical points came from the Mean Value Theorem, which relies on the function’s monotonicity to give an interpretation of the behavior near the point. While this result was already a perfectly suitable tool for the purpose, we want to do even better. Therefore, in this final section we will introduce some additional methods using Taylor polynomials. As we will see, these criteria will be both necessary and sufficient.

(necessary condition for a relative critical point): Let $f: (a, b) \to \mathbb{R}$ be twice differentiable at $x_0 \in (a, b)$. If: $$ f'(x_0) = 0, \ \ f''(x_0) \geq 0 $$ Then, $x_0$ is a relative minimum. If, instead: $$ f'(x_0) = 0, \ \ f''(x_0) \leq 0 $$ Then, $x_0$ is a relative maximum.

We will only prove the first case since it is equivalent to the second one.

If $x_0$ is a relative minimum, then there exists $\epsilon > 0$ such that $f(x) \geq f(x_0)$ in the open interval $(x_0 - \epsilon, x_0 + \epsilon)$. Furthermore, as Fermat’s theorem, we have that $f'(x_0) = 0$. Thus, Taylor’s formula for $f$ centered at $x_0$ becomes:

$$ f(x) = f(x_0) + \frac{f''(x_0)}{2} (x - x_0)^2 + o \left( (x - x_0)^2 \right), \ \ x \to x_0 $$

And, for $x \neq 0$ and $| x - x_0 | < \epsilon$, we have:

$$ 0 \leq \frac{f(x) - f(x_0)}{(x - x_0)^2} = \frac{f''(x_0)}{2} + \frac{o \left( ( x - x_0)^2 \right)}{(x - x_0)^2} $$

If we then, take the limit as $x \to x_0$, we get:

$$ \frac{f''(x_0)}{2} = \lim_{x \to x_0} \frac{f(x) - f(x_0)}{(x - x_0)^2} \geq 0.\\ \blacksquare $$

If we proceed by tightening the previous criteria, we obtain a sufficient condition.

(sufficient condition for a relative critical point): Let $f: (a, b) \to \mathbb{R}$ be twice differentiable at $x_0 \in (a, b)$. If: $$ f'(x_0) = 0, \ \ f''(x_0) > 0 $$ Then, $x_0$ is a relative minimum. If, instead: $$ f'(x_0) = 0, \ \ f''(x_0) < 0 $$ Then, $x_0$ is a relative maximum.

Just like before, since $f'(x_0) = 0$, we have: $$ \lim_{x \to x_0} \frac{f(x) - f(x_0)}{(x - x_0)^2} = \frac{f''(x_0)}{2} > 0 $$

Then, by the sign-preserving property, there exists a $\epsilon > 0$ such that: $$ \frac{f(x) - f(x_0)}{(x - x_0)^2} \geq 0, \quad \forall | x - x_0 | < \epsilon $$

Which implies that $x_0$ is a relative minimum. That is:

$$ f(x) - f(x_0) \geq 0, \quad \forall | x - x_0 | < \epsilon $$

By following the same reasoning we prove the other case. $\blacksquare$

Last but not least, we can also establish another sufficient criteria by generalizing the previous statements.

(sufficient condition for a relative critical point): Let $f: (a, b) \to \mathbb{R}$ be twice differentiable at $x_0 \in (a, b)$. If: $$ f'(x_0) = f''(x_0) = \ldots = f^{(k-1)} (x_0) = 0, \quad f^{(k)}(x_0) \neq 0 $$ Then:

  1. If $k$ is even and $f^{(k)}(x_0) > 0$, then $x_0$ is a relative minimum;
  2. If $k$ is even and $f^{(k)}(x_0) < 0$, then $x_0$ is a relative maximum;
  3. If $k$ is odd, then $x_0$ is not a relative critical point.

To prove it, let us write down Taylor’s formula centered at $x_0$:

$$ f(x) = f(x_0) + \frac{f^{(k)}(x_0)}{k!} (x - x_0)^k + o \left( (x - x_0)^k \right) $$

Therefore:

$$ \lim_{x \to x_0} \underbrace{\frac{f(x) - f(x_0)}{(x - x_0)^k}}_{\clubsuit} = \frac{f^{(k)} (x_0)}{k!} $$

This means that at any given neighborhood of $x_0$, the quotient $\clubsuit$ has constant sign which proves all three propositions. $\blacksquare$