maths.free › Calculus › 8. Taylor Polynomials and Taylor Series › Taylor series
Taylor series
Approximating a function by polynomials built from its derivatives.
A Taylor series rebuilds a function from its derivatives at one point: f(x₀) + f′(x₀)(x − x₀) + f″(x₀)(x − x₀)²/2! + …. The dashed curve is the polynomial; watch how it hugs the function near the centre and drifts away from it.
Introduction
In Activity, we investigated several Taylor polynomials centered at \(0\) for the function \(f(x) = \frac{1}{1-x}\) and found that \[\begin{aligned}\end{aligned}\]. Moreover, we saw that it is natural to extend the degree \(n\) Taylor polynomial to an infinite Taylor series (which will be formally defined in Definition). For \(f(x) = \frac{1}{1-x}\), its corresponding Taylor series is \[\begin{aligned}\end{aligned}\]. Because \(T(x)\) is an infinite geometric series with \(a = 1\) and \(r = x\), whenever \(|r| = |x| \lt 1\), the series converges and by Equation its sum is \[\begin{aligned}\end{aligned}\]. Remarkably, this shows that the original function, \(f(x) = \frac{1}{1-x}\), is equal to its Taylor series for all values of \(x\) that satisfy \(|x| \lt 1\). So, not only do Taylor polynomials provide increasingly better approximations to a function as the degree \(n\) increases, but it appears that if we let \(n\) increase without bound we arrive at a new representation of the original function through its Taylor series. We note that this new representation may only be valid for a limited set of \(x\)-values, such as \(|x| \lt 1\) in the case of \(f(x) = \frac{1}{1-x}\).
In Preview Activity, we consider an infinite geometric series and explore the function to which the series is related and that function's Taylor polynomials.
Exploration
Exploration
Taylor series and the Ratio Test
From our work in Activity and Preview Activity, we have seen two examples where the Taylor polynomials of a given function lead to a corresponding infinite Taylor series that is actually equal to the original function itself. This suggests that one reason Taylor series are important is that they give rise to polynomial-like representations of non-polynomial functions.
Next we formally define the Taylor series of a function and introduce a tool for determining where its Taylor series converges.
In the special case where \(a=0\) in Definition, the Taylor series is also sometimes called the Maclaurin series for \(f\).
From Activity, we know the degree \(n\) Taylor polynomial centered at \(0\) for the function \(f(x) = \frac{1}{1-x}\) is \[\begin{aligned}\end{aligned}\], and thus the Maclaurin series for \(f(x) = \frac{1}{1-x}\) is \[\begin{aligned}\end{aligned}\]. As we noted earlier in Equation, because this particular series is geometric (with common ratio \(r = x\)), we are able to easily find a shortcut formula for its value and understand the values of \(x\) for which the infinite sum makes sense. In particular, for \(|x| \lt 1\), \[\begin{aligned}\end{aligned}\], which shows that the Taylor series is equal to the original function \(f(x)\) for this set of \(x\) values.
It turns out that while most Taylor series are not geometric series, we can compare any Taylor series to a geometric series in order to determine an interval of \(x\)-values for which the Taylor series converges. To see how to approach this issue, we consider the following example with a particular function with a known Taylor series and determine the \(x\)-values for which its Taylor series should converge.
We next introduce a more formal way to test how geometric a Taylor series is in an effort to understand where the Taylor series is guaranteed to converge.
Condensed — the full section is in Boelkins, Active Calculus.
Taylor series of several important functions
So far, we have established that the Taylor series of two important functions, \(\frac{1}{1-x}\) and \(\ln(1+x)\), converge on an open interval of \(x\)-values and on that interval converge to the respective functions. For these functions,
if \(|x| \lt 1\), then \[\begin{aligned}\end{aligned}\]
if \(|x| \lt 1\), thenIt turns out that this representation is also valid when \(x = 1\) because the series \(1 - \frac{1}{2} + \frac{1}{3} - \frac{1}{4} + \cdots\) converges, and does so to the exact value \(\ln(2)\). This means that while the open interval of convergence is \(-1 \lt x \lt 1\) for this series, the complete interval of convergence is actually \(-1 \lt x \le 1\). \[\begin{aligned}\end{aligned}\].
Following Activity, we noted some of the higher degree Taylor polynomials centered at \(a = 0\) for \(\sin(x)\), \(\cos(x)\), and \(e^x\). For the sine function, we observed that \[\begin{aligned}\end{aligned}\]. In the next example, we determine the Taylor series of \(f(x) = \sin(x)\) and investigate the \(x\)-values for which the series converges.
In Example, we found that the Taylor series for the sine function appears to converge to the sine function, and to do so for every real number \(x\). This result can be proven formally using a famous theorem called the Lagrange Error Bound, a theorem that quantifies how accurate a Taylor polynomial approximation is on an interval, which we will study in Section. To summarize, we now know the remarkable result that the sine function is equal to its Taylor series for every value of \(x\), so \[\begin{aligned}\end{aligned}\]
Nearly identical reasoning shows a similar result for the cosine function: that its Taylor series centered at \(a = 0\) converges for every real number \(x\) and converges to the cosine function itself. Thus, for any real number \(x\), \[\begin{aligned}\end{aligned}\]
In the next activity, we conduct a similar investigation for \(f(x) = e^x\).
A function such as \(f(x) = \sin(x)\) that is infinitely differentiable and has a power series that converges on some interval to the function itself is said to be analytic. Analytic functions are amazing and among the nicest functions in all of mathematics: they are completely determined by what happens at a single point.
Condensed — the full section is in Boelkins, Active Calculus.
Summary
Provided that \(f\) is a function for which every derivative of \(f\) exists at \(x = a\), the Taylor series centered at \(a\) of \(f\) is the series \(T_f(x)\) defined by \[\begin{aligned}T_f(x) =\mathstrut \amp \sum_{k=0}^{\infty} \frac{f^{(k)}(a)}{k!}(x-a)^k \\ =\mathstrut \amp f(a) + f'(a)(x-a) + \frac{f''(a)}{2!}(x-a)^2 + \cdots + \frac{f^{(n)}(a)}{n!}(x-a)^n + \cdots\end{aligned}\].
We know that an infinite geometric series converges whenever its common ratio, \(r\), satisfies \(|r| \lt 1\). The Ratio Test enables us to consider a Taylor series and determine an open interval of \(x\)-values on which the series converges, essentially by comparing the Taylor series to a geometric series. By letting \(r_n(x)\) be the ratio of consecutive terms in the series and taking the limit \[\begin{aligned}\end{aligned}\], we can say that for all \(x\) for which \(|r(x)| \lt 1\), the Taylor series converges to a finite value.
We have found the Taylor series for five important functions, determined an open interval of \(x\)-values on which each converges, and seen the striking result that where each Taylor series converges, it converges to original function \(f(x)\) that we used to generate the Taylor series. These results are summarized in Table.
Worked example: taylor series of e^x
Step by step
- f(x) = e^{x}
Taylor series about x = 0: f(x) = Σ fᵏ(x₀)/k! · (x − x₀)ᵏ.
- f^{(0)}(0) = e^{x}\big|_{x=0} = 1
Derivative 0 at the centre.
- f^{(1)}(0) = e^{x}\big|_{x=0} = 1
Derivative 1 at the centre.
- f^{(2)}(0) = e^{x}\big|_{x=0} = 1
Derivative 2 at the centre.
- f^{(3)}(0) = e^{x}\big|_{x=0} = 1
Derivative 3 at the centre.
- f^{(4)}(0) = e^{x}\big|_{x=0} = 1
Derivative 4 at the centre.
- f^{(5)}(0) = e^{x}\big|_{x=0} = 1
Derivative 5 at the centre.
- \frac{x^{5}}{120} + \frac{x^{4}}{24} + \frac{x^{3}}{6} + \frac{x^{2}}{2} + x + 1
Assemble the terms up to degree 5.
Reveal the answer
Practice (4)
Try each one on paper first. Reveal the answer to check; verified ones can be opened in the solver for every step.
-
The examples we have considered so far in this section have all been for Taylor polynomials and series centered at 0, but Taylor polynomials and series can be centered at any value of \(a\).
Let \(f(x) = \cos(x)\). Find the Taylor polynomials up through order four of \(f\) centered at \(a = \frac{\pi}{2}\). Then find the Taylor series for \(f(x)\) centered at \(a = \frac{\pi}{2}\). Why is the result not surprising?
Let \(f(x) = \frac{1}{1+x} = (1+x)^{-1}\). Find the Taylor polynomials up through order four of \(f\) centered at \(a = 1\). Then find the Taylor series for \(f(x)\) centered at \(a = 1\).
Reveal the answer
Let \(f(x) = \cos(x)\).
We know that \(f'(x) = -\sin(x)\), \(f''(x) = -cos(x)\), \(f'''(x) = \sin(x)\), and \(f^{(4)}(x) = cos(x)\), so \(f'\left(\frac{\pi}{2}\right) = -\sin\left(\frac{\pi}{2}\right) = -1\), \(f''\left(\frac{\pi}{2}\right) = -cos\left(\frac{\pi}{2}\right) = 0\), \(f'''\left(\frac{\pi}{2}\right) = \sin\left(\frac{\pi}{2}\right) = 1\), and \(f^{(4)}(x) = cos\left(\frac{\pi}{2}\right) = 0\). We also note that \(f\left(\frac{\pi}{2}\right) = \cos\left(\frac{\pi}{2}\right) = 0\)
It follows that the degree four Taylor polynomial of \(f\) centered at \(x = \frac{\pi}{2}\) is \[\begin{aligned}\end{aligned}\], from which we can also easily determine \(T_3(x)\), \(T_2(x)\), and \(T_1(x)\).
From the pattern in \(T_4(x)\), we find that the Taylor series for \(f(x)\) centered at \(x = \frac{\pi}{2}\) is \[\begin{aligned}\end{aligned}\]
This result is not surprising, because \(f(x) = \cos(x) = -\sin\left( x - \frac{\pi}{2} \right)\). So, if we stated with the Taylor series for \(g(x) = \sin(x)\) centered at \(a = 0\), we'd have \[\begin{aligned}\end{aligned}\] from which it follows that \[\begin{aligned}\end{aligned}\]. Noting that \(-1 \cdot (-1)^k = -1^{k+1}\), we have established that \[\begin{aligned}\end{aligned}\] which matches our earlier result.
With \(f(x) = \frac{1}{1+x} = (1+x)^{-1}\), we observe that \(f'(x) = -(1+x)^{-2}\), \(f''(x) = (-1)(-2)(1+x)^{-3}\), \(f'''(x) = (-1)(-2)(-3)(1+x)^{-4}\), and \(f^{(4)}(x) = (-1)(-2)(-3)(-4)(1+x)^{-5}\). Evaluating each of these functions at \(a = 1\), we find \(f(1) = \frac{1}{2}\), \(f'(1) = (-1) \cdot \frac{1}{2^2}\), \(f''(1) = \frac{2!}{2^3}\), \(f'''(1) = (-1) \cdot \frac{3!}{2^4}\), and \(f^{(4)}(1) = \frac{4!}{2^5}\).
From these derivative values and the fact that \(c_k = \frac{f^{(k)}(1)}{k!}\), it follows that \[\begin{aligned}\end{aligned}\], from which we can also easily find \(T_3(x)\), \(T_2(x)\), and \(T_1(x)\).
Finally, from the patterns in our preceding work, we see the Taylor series for \(f(x)\) centered at \(a = 1\) is \[\begin{aligned}\end{aligned}\].
-
As we will see in more detail in the next section, we can use known Taylor series to obtain other Taylor series, and we preview that idea in this exercise.
Calculate the first four derivatives of \(\sin(x^2)\) and hence find the fourth order Taylor polynomial for \(\sin(x^2)\) centered at \(a=0\).
Part (a) demonstrates the direct approach to finding Taylor polynomials and series. Next we utilize a known Taylor series to make the process simpler. Recall that the Taylor series centered at 0 for \(f(x) = \sin(x)\) is \[\begin{aligned}\end{aligned}\].
Substitute \(x^2\) for \(x\) in the Taylor series \(T(x)\) in Equation. Write out the first several terms and compare to your work in part (a). Explain why the substitution in this problem should result in the Taylor series for \(\sin(x^2)\) centered at 0.
For what interval of \(x\)-values should we expect the Taylor series for \(\sin(x^2)\) to converge?
Reveal the answer
Let \(f(x) = \sin(x^2)\). Then
\(\sin(x^2)\) \(f(0) = 0\) \(f'(x) = 2x\cos(x^2)\) \(f'(0) = 0\) \(f''(x) = -4x^2\sin(x^2) + 2\cos(x^2)\) \(f''(0) = 0\) \(f'''(x) = -8x^3\cos(x^2) - 12x\sin(x^2)\) \(f'''(0) = 0\) \(f^{(4)}(x) = 16x^4\sin(x^2) - 48x^2\cos(x^2) - 12\sin(x^2)\) \(f^{(4)}(0) = 0\) so the fourth order Taylor polynomial for \(f\) centered at \(a=0\) is \[\begin{aligned}\end{aligned}\].
Substituting \(x^2\) for \(x\) in the Taylor series for \(\sin(x)\), we find that since \[\begin{aligned}\end{aligned}\], we have \[\begin{aligned}\end{aligned}\] which should be the Taylor series for \(\sin(x^2)\) since \(\sin(x) = x - \frac{1}{3!}x^3 + \frac{1}{5!}x^5 - \cdots\) for every value of \(x\).
We expect the interval of convergence of the series for \(\sin(x^2)\) to be the same as the series for \(\sin(x)\), since \(\sin(x) = x - \frac{1}{3!}x^3 + \frac{1}{5!}x^5 - \cdots\) for every value of \(x\).
-
The examples we have considered so far in this section have all been for Taylor polynomials and series centered at 0, but Taylor polynomials and series can be centered at any value of \(a\).
Let \(f(x) = \cos(x)\). Find the Taylor polynomials up through order four of \(f\) centered at \(a = \frac{\pi}{2}\). Then find the Taylor series for \(f(x)\) centered at \(a = \frac{\pi}{2}\). Why is the result not surprising?
Let \(f(x) = \frac{1}{1+x} = (1+x)^{-1}\). Find the Taylor polynomials up through order four of \(f\) centered at \(a = 1\). Then find the Taylor series for \(f(x)\) centered at \(a = 1\).
Reveal the answer
Let \(f(x) = \cos(x)\).
We know that \(f'(x) = -\sin(x)\), \(f''(x) = -cos(x)\), \(f'''(x) = \sin(x)\), and \(f^{(4)}(x) = cos(x)\), so \(f'\left(\frac{\pi}{2}\right) = -\sin\left(\frac{\pi}{2}\right) = -1\), \(f''\left(\frac{\pi}{2}\right) = -cos\left(\frac{\pi}{2}\right) = 0\), \(f'''\left(\frac{\pi}{2}\right) = \sin\left(\frac{\pi}{2}\right) = 1\), and \(f^{(4)}(x) = cos\left(\frac{\pi}{2}\right) = 0\). We also note that \(f\left(\frac{\pi}{2}\right) = \cos\left(\frac{\pi}{2}\right) = 0\)
It follows that the degree four Taylor polynomial of \(f\) centered at \(x = \frac{\pi}{2}\) is \[\begin{aligned}\end{aligned}\], from which we can also easily determine \(T_3(x)\), \(T_2(x)\), and \(T_1(x)\).
From the pattern in \(T_4(x)\), we find that the Taylor series for \(f(x)\) centered at \(x = \frac{\pi}{2}\) is \[\begin{aligned}\end{aligned}\]
This result is not surprising, because \(f(x) = \cos(x) = -\sin\left( x - \frac{\pi}{2} \right)\). So, if we stated with the Taylor series for \(g(x) = \sin(x)\) centered at \(a = 0\), we'd have \[\begin{aligned}\end{aligned}\] from which it follows that \[\begin{aligned}\end{aligned}\]. Noting that \(-1 \cdot (-1)^k = -1^{k+1}\), we have established that \[\begin{aligned}\end{aligned}\] which matches our earlier result.
With \(f(x) = \frac{1}{1+x} = (1+x)^{-1}\), we observe that \(f'(x) = -(1+x)^{-2}\), \(f''(x) = (-1)(-2)(1+x)^{-3}\), \(f'''(x) = (-1)(-2)(-3)(1+x)^{-4}\), and \(f^{(4)}(x) = (-1)(-2)(-3)(-4)(1+x)^{-5}\). Evaluating each of these functions at \(a = 1\), we find \(f(1) = \frac{1}{2}\), \(f'(1) = (-1) \cdot \frac{1}{2^2}\), \(f''(1) = \frac{2!}{2^3}\), \(f'''(1) = (-1) \cdot \frac{3!}{2^4}\), and \(f^{(4)}(1) = \frac{4!}{2^5}\).
From these derivative values and the fact that \(c_k = \frac{f^{(k)}(1)}{k!}\), it follows that \[\begin{aligned}\end{aligned}\], from which we can also easily find \(T_3(x)\), \(T_2(x)\), and \(T_1(x)\).
Finally, from the patterns in our preceding work, we see the Taylor series for \(f(x)\) centered at \(a = 1\) is \[\begin{aligned}\end{aligned}\].
-
As we will see in more detail in the next section, we can use known Taylor series to obtain other Taylor series, and we preview that idea in this exercise.
Calculate the first four derivatives of \(\sin(x^2)\) and hence find the fourth order Taylor polynomial for \(\sin(x^2)\) centered at \(a=0\).
Part (a) demonstrates the direct approach to finding Taylor polynomials and series. Next we utilize a known Taylor series to make the process simpler. Recall that the Taylor series centered at 0 for \(f(x) = \sin(x)\) is \[\begin{aligned}\end{aligned}\].
Substitute \(x^2\) for \(x\) in the Taylor series \(T(x)\) in Equation. Write out the first several terms and compare to your work in part (a). Explain why the substitution in this problem should result in the Taylor series for \(\sin(x^2)\) centered at 0.
For what interval of \(x\)-values should we expect the Taylor series for \(\sin(x^2)\) to converge?
Reveal the answer
Let \(f(x) = \sin(x^2)\). Then
\(\sin(x^2)\) \(f(0) = 0\) \(f'(x) = 2x\cos(x^2)\) \(f'(0) = 0\) \(f''(x) = -4x^2\sin(x^2) + 2\cos(x^2)\) \(f''(0) = 0\) \(f'''(x) = -8x^3\cos(x^2) - 12x\sin(x^2)\) \(f'''(0) = 0\) \(f^{(4)}(x) = 16x^4\sin(x^2) - 48x^2\cos(x^2) - 12\sin(x^2)\) \(f^{(4)}(0) = 0\) so the fourth order Taylor polynomial for \(f\) centered at \(a=0\) is \[\begin{aligned}\end{aligned}\].
Substituting \(x^2\) for \(x\) in the Taylor series for \(\sin(x)\), we find that since \[\begin{aligned}\end{aligned}\], we have \[\begin{aligned}\end{aligned}\] which should be the Taylor series for \(\sin(x^2)\) since \(\sin(x) = x - \frac{1}{3!}x^3 + \frac{1}{5!}x^5 - \cdots\) for every value of \(x\).
We expect the interval of convergence of the series for \(\sin(x^2)\) to be the same as the series for \(\sin(x)\), since \(\sin(x) = x - \frac{1}{3!}x^3 + \frac{1}{5!}x^5 - \cdots\) for every value of \(x\).
Symbols used here
Add a_k for k = 1 up to n.
n × (n−1) × … × 1; the number of orderings of n things. 0! = 1.
Not a number: "grows without bound" in limits and intervals.
Ratio of a circle's circumference to its diameter, 3.14159…
The exponent b must be raised to for x; ln uses base e.
Ratios of sides in a right triangle; coordinates on the unit circle.
2.71828…, the base whose exponential is its own derivative.
Inequalities that allow equality; < and > exclude it.
Least upper bound, greatest lower bound.
Grows no faster than n² (up to a constant), for large n.
The value f(x) approaches as x approaches a.
Instantaneous rate of change; slope of the graph.
Antiderivative (indefinite) or signed area from a to b (definite).
Prime notation for derivatives with respect to x (or t).
Constants of integration fixed by initial conditions.
How to: Taylor series
- What is the Taylor series centered at a of a function f?
- What does it mean for an infinite Taylor series to converge to a finite sum, and how can we determine for which x-values the series converges?
- What are the Taylor series centered at a = 0 for \frac{1}{1-x}, \ln(1+x), \sin(x), \cos(x), and e^x, and for which x-values do these series converge?
Questions people ask
What is a derivative in one sentence?
The slope of the graph at a point — the rate at which the output is changing there. Speed is the derivative of position.
What is an integral in one sentence?
The accumulated total of a rate — the area under the curve. Distance travelled is the integral of speed.
Why are derivatives and integrals opposites?
That is the fundamental theorem of calculus: accumulating a rate and then measuring how fast the accumulation grows gets you back the rate. Integration undoes differentiation up to a constant.
When do I use substitution and when integration by parts?
Substitution when part of the integrand is the derivative of another part (u and du both present). Parts when the integrand is a product of two unrelated kinds of function — a polynomial times an exponential, log or trig function.
Try your own
Parts of this page are adapted from Boelkins, Active Calculus (CC BY-SA 4.0). Condensed and re-explained here; errors are ours.
More in Calculus
LimitsDerivativesIntegralsDefinite integralsSeries and sumsMaxima and minimaThe chain ruleImplicit differentiationRelated rates and optimisationIntegration techniques: substitution, parts, partial fractionsApplications of integration: area, volume, arc lengthInfinite series and convergence tests