There are many types of approximations, among them are Taylor polynomials. In this article, you will learn what a Taylor polynomial is, how it is calculated and how it can be used.
Taylor Polynomials Overview
Sometimes to avoid working with very complex functions, people use approximations. The most commonly used approximation is the linear or first order approximation (see the article linear approximations and differentials, for more information about this).
Given a function \(f(x)\), the linear approximation of \(f(x)\) at the point \(x=c\) is given by the function
\[L(x)=f(c)+f'(c)(x-c).\]
Let's look at a quick example.
For instance, let \(f(x)=\ln(x)\), then the linear approximation of \(f(x)\) at the point \(x=1\) is given by
\[\begin{align} L(x)&=\ln (1)+\frac{1}{1}(x-1)\\ &=x-1. \end{align}\]
Figure 1. Graph of the function \(\ln(x)\) with its linear approximation.
As you can see in the graph, the linear approximation is accurate only for values very close to \(x=c\) (in the case close to \(x=1\)).
So, how can you get a better approximation that works for values farther away?
Well, you can think of the following: the linear approximation works because you know the rate of change at a point, if you knew how the rate of change varies (i.e., the second derivative), that might provide you more information about what the function is like.
In general, if you knew how “all” the derivatives of the function behave, you could know exactly what the function is like. That is the idea behind Taylor polynomials.
Taylor Polynomials Formula
Let's state the definition of the Taylor polynomial.
Let \(f\) be a function with at least \(n\) derivatives at \(x=c\). Then, the \(n^{th}\) order Taylor polynomial centered at \(x=c\) is given by
\[\begin{align} T_n(x)&=f(c)+\frac{f'(c)(x-c)}{1!}+\frac{f''(c)(x-c)^2}{2!}+\dots\\ & \quad +\frac{f^{(n)}(c)(x-c)^n}{n!}.\end{align}\]
This polynomial of degree \(n\) has the property that
\[T_n^{(k)}(c)=f^{(k)}(c)\]
for \(k=0,\dots,n\), and approximates \(f(x)\) near \(x=c\).
Note that the first degree Taylor polynomial is the same as the linear approximation (also called the tangent line)!
There is a special case when \(x=0\) because it is much easier to write.
Let \(f\) be a function with at least \(n\) derivatives at \(x=0\). Then, the \(n^{th}\) order Maclaurin polynomial centered at \(x=0\) is given by
\[\begin{align}M_n(x)&=f(0)+\frac{f'(0)x}{1!}+\frac{f''(0)x^2}{2!}+\dots\\ & \quad +\frac{f^{(n)}(0)x^n}{n!}.\end{align}\]
It is worth mentioning that the Taylor polynomials allow you to approximate any function using powers of \(x\). How good an approximation is it? That will depend on how many derivatives you calculate, the more derivatives, the more accurate the approximation.
To learn how to calculate the error in the approximation, visit our article called Lagrange Error Bound.
Second Degree Taylor Polynomial
A particular case is when you want to approximate a function using the second derivative.
Let \(f\) be a function with at least \(2\) derivatives at \(x=c\). The second degree Taylor polynomial, or quadratic approximation, centered at \(x=c\) is given by the function\[T_2(x)=f(c)+\frac{f'(c)(x-c)}{1!}+\frac{f''(c)(x-c)^{2}}{2!}.\]
To see how a quadratic approximation is better than a linear approximation, let's approximate the function \(f(x)=\sin x\) at \(x=\dfrac{\pi}{2}\). First, let's calculate the derivatives and evaluate the functions at \(x=\dfrac{\pi}{2}\).
Table 1. Function and derivative values for \(\sin x\) at \(\dfrac{\pi}{2}\).
\(f(x)=\sin x\) | \(f\left( \dfrac{\pi}{2}\right)=1\) |
\(f'(x)=\cos x\) | \(f'\left( \dfrac{\pi}{2}\right) =0\) |
\(f''(x)=-\sin x\) | \(f''\left( \dfrac{\pi}{2}\right) =-1\) |
Thus, the first degree Taylor polynomial for \(f(x)=\sin x\) at \(x=\dfrac{\pi}{2}\) is
\[T_1(x)=1,\]
and the second degree Taylor polynomial for \(f(x)=\sin x\) at \(x=\dfrac{\pi}{2}\) is
\[T_2(x)=1-\frac{(x-\frac{\pi}{2})^2}{2!}.\]
Figure 2. Graph of the function \(f(x)=\sin x\) with its first and second degree Taylor polynomial.
Note that approximations also allow you to estimate values of a function at points where it is difficult to evaluate. For example, you know that \(\sin(\frac{\pi}{2})\) is equal to \(1\), but what about the value of \(\sin 2\)? Using the quadratic approximation, you get
\[\begin{align} \sin 2 &\approx T_2(2) \\ &=1-\frac{(2-\frac{\pi}{2})^2}{2!} \\ &\approx 0.9. \end{align}\]
❗❗ Remember that a Taylor polynomial centered at \(x=a\), only allows you to estimate values near \(x=a\).
Third Degree Taylor Polynomial
You could also approximate a function using the third derivative.
Let \(f\) be a function with at least \(3\) derivatives at \(x=c\). The third degree Taylor polynomial, or cubic approximation, centered at \(x=c\) is \[\begin{align} T_3(x)&=f(c)+\frac{f'(c)(x-c)}{1!}+\frac{f''(c)(x-c)^{2}}{2!}\\ &\quad +\frac{f'''(c)(x-c)^{3}}{3!}.\end{align}\]
Let's calculate the third degree Taylor polynomial for the function \(g(x)=\sqrt{x}\) at \(x=1\).
Table 2. Derivatives and function values for \(g(x) = \sqrt{x}\).
\(g(x)=\sqrt{x}\) | \(g(1)=1\) |
\(g(x)=\dfrac{1}{2\sqrt{x}}\) | \(g(1)=\dfrac{1}{2}\) |
\(g(x)=-\dfrac{1}{4x^{3/2}}\) | \(g(1)=-\dfrac{1}{4}\) |
\(g(x)=\dfrac{3}{8x^{5/2}}\) | \(g(1)=\dfrac{3}{8}\) |
Thus, its third degree Taylor polynomial centered at \(x=1\) is
\[T_3(x)=1+\frac{(x-1)}{2}-\frac{(x-1)^2}{8}+\frac{3(x-1)^3}{48}.\]
Figure 3. Graph of the function \(g(x)=\sqrt{x}\) with its Taylor polynomial of third degree.
Taylor Polynomials Examples
Let's look at more examples of how to use Taylor polynomials to estimate values of a function.
Calculate the fourth degree Taylor polynomial for the function \(f(x)=\cos x\) at \(x=0\) and use it to approximate \(\cos\left(\dfrac{\pi}{2}\right)\).
Solution:
Remember that a Taylor polynomial at \(x=0\) is called a Maclaurin polynomial! First, calculate the first \(4\) derivatives of \(f(x)=\cos x\) and evaluate them at \(x=0\).
Table 3. Derivatives and function values for \(\cos x\).
\(f(x)=\cos{x}\) | \(f(0)=1\) |
\(f'(x)=-\sin{x}\) | \(f'(0)=0\) |
\(f''(x)=-\cos{x}\) | \(f''(0)=-1\) |
\(f'''(x)=\sin{x}\) | \(f'''(0)=0\) |
\(f^{(iv)}(x)=\cos{x}\) | \(f^{(4)}(0)=1\) |
Then, the fourth degree Taylor polynomial around \(x=0\) is
\[\begin{align}T_4(x) &=f(0)+\frac{f'(0)(x-0)}{1!}+\frac{f''(0)(x-0)^{2}}{2!}\\ & \quad+\frac{f'''(0)(x-0)^{3}}{3!}+\frac{f^{(4)}(0)(x-0)^{4}}{4!} \\ &= 1+0-\frac{x^2}{2!}+0+\frac{x^4}{4!} \\ &=1-\frac{x^2}{2!}+\frac{x^4}{4!}.\end{align}\]
So, evaluating at \(x=2\), you have
\[\begin{align} \cos\left(\frac{\pi}{2}\right) &\approx T_4\left(\frac{\pi}{2}\right)\\ &=1-\frac{\frac{\pi}{2}}{2!}+\frac{\frac{\pi}{2}^4}{4!} \\ &=0.02.\end{align}\]
Let's look at another example.
Calculate the value of \(\sqrt{24}\) using a quadratic approximation.
Solution:
In this case, you need to calculate the second degree Taylor polynomial of the function \(g(x)=\sqrt{x}\) since you want a quadratic approximate of \(\sqrt{24}\).
Since Taylor polynomials only allow you to approximate values close to the value at which they are centered, you need a value close to \(24\) where you can actually find the square root easily. So let's take \(25\) since \(\sqrt{25}=5\).
Table 4. Table of derivatives and function values for \(\sqrt{x}\).
\(g(x)=\sqrt{x}\) | \(g(25)=\sqrt{25}=5\) |
\(g'(x)=\dfrac{1}{2\sqrt{x}}\) | \(g'(25)=\dfrac{1}{2\sqrt{25}}=\dfrac{1}{10}\) |
\(g''(x)=-\dfrac{1}{4x^{3/2}}\) | \(g''(25)=-\dfrac{1}{4(25)^{3/2}}=-\dfrac{1}{1000}\) |
Thus, the quadratic (another way of saying second degree) Taylor polynomial of \(\sqrt{x}\) centered at \(x=25\) is
\[T_2(x)=5+\frac{(x-25)}{10}-\frac{(x-25)^2}{1000}.\]
Using the \(T_2(x)\) approximation you get
\[\begin{align} \sqrt{24}&\approx 5+\frac{(24-25)}{10}-\frac{(24-25)^2}{1000} \\ &= 4.899.\end{align}\]
❗❗ Note that the Taylor polynomial calculated in the previous example was not used because it was centered on \(1\), and \(1\) is very far from \(24\), so using it would have given you a very bad approximation.
Taylor Polynomials - Key takeaways
- Let \(f\) be a function with at least \(n\) derivatives at \(x=c\). Then, the \(n^{th}\) order Taylor polynomial centered at \(x=c\) is \[\begin{align}T_n(x)&=f(c)+\frac{f'(c)(x-c)}{1!}+\frac{f''(c)(x-c)^2}{2!}+\cdots\\ &\quad +\frac{f^{(n)}(c)(x-c)^n}{n!}. \end{align}\]
- If the Taylor polynomial is centered at \(x=0\), it is also known as a Maclaurin polynomial.
- Taylor polynomials are used to approximate complex functions and allow you to calculate values that are difficult to compute.
How we ensure our content is accurate and trustworthy?
At StudySmarter, we have created a learning platform that serves millions of students. Meet
the people who work hard to deliver fact based content as well as making sure it is verified.
Content Creation Process:
Lily Hulatt is a Digital Content Specialist with over three years of experience in content strategy and curriculum design. She gained her PhD in English Literature from Durham University in 2022, taught in Durham University’s English Studies Department, and has contributed to a number of publications. Lily specialises in English Literature, English Language, History, and Philosophy.
Get to know Lily
Content Quality Monitored by:
Gabriel Freitas is an AI Engineer with a solid experience in software development, machine learning algorithms, and generative AI, including large language models’ (LLMs) applications. Graduated in Electrical Engineering at the University of São Paulo, he is currently pursuing an MSc in Computer Engineering at the University of Campinas, specializing in machine learning topics. Gabriel has a strong background in software engineering and has worked on projects involving computer vision, embedded AI, and LLM applications.
Get to know Gabriel