Last modified on November 8th, 2024

chapter outline

 

Taylor Polynomial

Taylor polynomial is a polynomial that approximates a function near a specific point, often denoted by a. By taking a finite number of terms from the function’s derivatives, a Taylor polynomial provides a close approximation to the actual function in a neighborhood around that point. 

The Taylor polynomial of degree n for a function f(x) centered at a point a is given by:

${P_{n}\left( x\right) =f\left( a\right) +f’\left( a\right) \left( x-a\right) +\dfrac{f”\left( a\right) }{2!}\left( x-a\right) ^{2}+\ldots +\dfrac{f^{n}\left( a\right) }{a!}\left( x-a\right) ^{n}}$ 

Here,

  • fn(a) represents nth derivative of f(x) at a
  • n! is the factorial of n

By including terms up to degree n, the Taylor polynomial provides a finite approximation of f(x) near a. The more terms added, the more accurately Pn(x) represents f(x) around a.

It is widely used in many fields like physics, engineering, and economics to approximate functions, such as potential energy functions, signal processing equations, and utility-cost functions.

Difference Between Taylor Polynomial and Taylor Series

While the Taylor polynomial is a finite sum, the Taylor series takes the process further by adding terms infinitely. In general, the Taylor series can provide a near-exact representation of a function in an interval around a, where the series converges.

The form of the Taylor series for f(x) at a is:

${f\left( x\right) =\sum ^{\infty }_{n=0}\dfrac{f^{n}\left( a\right) }{n!}\left( x-a\right) ^{n}}$

⇒  ${f\left( x\right) =f\left( a\right) +f’\left( a\right) \left( x-a\right) +\dfrac{f”\left( a\right) }{2!}\left( x-a\right) ^{2}+\ldots}$

If a = 0, the Taylor series is known as a Maclauurin series for f(x), given by:

${f\left( x\right) =f\left( 0\right) +f’\left( 0\right) x+\dfrac{f”\left( 0\right) }{2!}x^{2}+\ldots}$

Here,

Maclaurin polynomial (a Taylor polynomial centered at a = 0) is expressed as: ${P_{n}\left( x\right) =f\left( 0\right) +f’\left( 0\right) x+\dfrac{f”\left( 0\right) }{2!}x^{2}+\ldots \dfrac{f^{n}\left( 0\right) }{n!}x^{n}}$

However, it is important to note that not all Taylor series converges to the function they approximate, particularly if evaluated far from the center point a. A Taylor series converges to a function within a specific interval around a, known as the radius of convergence, which varies based on the function.

Taylor Polynomial of Two Variables

In addition to approximating functions of a single variable, Taylor polynomials can also be used to approximate functions of two variables, f(x, y). The Taylor polynomial of degree n for a function f(x,y) centered at a point (a,b) takes into account partial derivatives with respect to both x and y.

The general form of the Taylor polynomial of degree n for a function f(x, y) around (a, b) is given by:

${P_{n}\left( x,y\right) =f\left( a,b\right) +f_{x}\left( a,b\right) \left( x-a\right) +f_{y}\left( a,b\right) \left( y-b\right) +\dfrac{f_{x,x}\left( a,b\right) }{2!}\left( x-a\right) ^{2}+\dfrac{f_{y,y}\left( a,b\right) }{2!}\left( y-b\right) ^{2}+f_{x,y}\left( a,b\right) \left( x-a\right) \left( y-b\right) +\ldots}$

Here,

  • fx and fy are the 1st-order partial derivatives with respect to x and y
  • fxx, fyy, and fxy are the 2nd-order partial derivatives

Higher-order terms involve mixed partial derivatives up to the nth degree.

Approximating

Let us consider a function y = ln(x) and approximate the value of ln(1.2) using P5(x). 

Since 1 is very near to 1.2, we first find the nth Taylor polynomial of y = ln(x) at x = 1

Starting with derivatives of ln(x) at x = 1:

${\begin{aligned}f\left( x\right) =\ln \left( x\right) \Rightarrow f\left( 1\right) =0\\ f’\left( x\right) =\dfrac{1}{x}\Rightarrow f’\left( 1\right) =1\\ f”\left( x\right) =-\dfrac{1}{x^{2}}\Rightarrow f”\left( 1\right) =-1\end{aligned}}$

${f^{n}\left( x\right) =\dfrac{\left( -1\right) ^{n+1}}{x^{n}}\left( n-1\right) !\Rightarrow f^{n}\left( 1\right) =\left( -1\right) ^{n+1}\left( n-1\right) !}$

Thus, ${P_{n}\left( x\right) =f\left( a\right) +f’\left( a\right) \left( x-a\right) +\dfrac{f”\left( a\right) }{2!}\left( x-a\right) ^{2}+\ldots +\dfrac{f^{n}\left( a\right) }{a!}\left( x-a\right) ^{n}}$

⇒ Pn(x) = ${0+\left( x-1\right) -\dfrac{1}{2}\left( x-1\right) ^{2}+\ldots +\dfrac{\left( -1\right) ^{n+1}}{n}\left( x-1\right) ^{n}}$

Now, the Taylor polynomial P5(x) for ln(x) by substituting x = 1.2 becomes:

P5(x) = ${\left( 1.2-1\right) -\dfrac{1}{2}\left( 1.2-1\right) ^{2}+\ldots +\dfrac{\left( -1\right) ^{5+1}}{5}\left( 1.2-1\right) ^{5}}$

⇒ P5(x) = ${0\cdot 2-\dfrac{1}{2}\left( 0\cdot 2\right) ^{2}+\ldots +\dfrac{1}{5}\left( 0\cdot 2\right) ^{5}}$ = ${\dfrac{34187}{187500}}$ ≈ 0.18233

Also, ln(1.2) ≈ 0.18232

Finding Errors

To determine the accuracy of approximation, we calculate the error bound using Taylor’s Theorem, which states:

If f(x) is a polynomial function that is differentiated n + 1 times on an open interval I containing a, then for each positive integer n and for each x ∈ I,

${f\left( x\right) =f\left( a\right) +f’\left( a\right) \left( x-a\right) +\dfrac{f”\left( a\right) }{2!}\left( x-a\right) ^{2}+\ldots +\dfrac{f^{n}\left( a\right) }{n!}\left( x-a\right) ^{n} +R_{n}\left( x\right)}$

⇒ ${f\left( x\right) =P_{n}\left( x\right) +R_{n}\left( x\right)}$, 

Here, 

Pn(x) is the Taylor polynomial of f(x) at a, and 

${R_{n}\left( x\right) =\dfrac{f^{n+1}\left( c\right) }{\left( n+1\right) !}\left( x-a\right) ^{n+1}}$ 

⇒ ${\left| R_{n}\left( x\right) \right| \leq \dfrac{M}{\left( n+1\right) !}\left| x-a\right| ^{n+1}}$

M = max|fn + 1(x)|

Now, using this theorem, we can find the error bounds for approximating ln(1.2) with P5(x).

Here, we calculate R5(x) at x = 1.2 and a = 1 to get the error bounds

${\left| R_{5}\left( 1.2\right) \right| \leq \dfrac{M}{\left( 5+1\right) !}\left| 1.2-1\right| ^{5+1}}$

${\left| R_{5}\left( 1.2\right) \right| \leq \dfrac{M}{\left( 6\right) !}\left| 0.2\right| ^{6}}$

Calculating the value of M, we get

M = max|fn + 1(x)|

fn + 1(x) = ${\dfrac{\left( -1\right) ^{n}n!}{x^{n+1}}}$

⇒ f6(x) = ${-\dfrac{5!}{x^{6}}}$

⇒ f6(x) = ${-\dfrac{120}{x^{6}}}$ 

⇒ |f6(x)| = ${\dfrac{120}{x^{6}}}$

Now, using the interval 1 ≤ c ≤ 1.2, R5(1.2) = ${\dfrac{\left| f^{1}\left( c\right) \right| }{6!}\left( 1\cdot 2-1\right) ^{6}}$

Since |f6(c)| = ${\dfrac{120}{c^{6}}}$, M = 120

Thus, ${\left| R_{5}\left( 1.2\right) \right| \leq \dfrac{120}{\left( 6\right) !}\left| 0.2\right| ^{6}}$

⇒ ${\left| R_{5}\left( 1.2\right) \right| \leq \dfrac{120}{720}\left| 0.2\right| ^{6}}$

⇒ ${\left| R_{5}\left( 1.2\right) \right| \leq \dfrac{120}{720}\cdot 0.000064}$

= ${\dfrac{1}{6}\cdot 0.000064}$

≈ 0.00001067

Thus, the error bound for approximating ln(1.2) with P5(x) is approximately 0.00001067, which indicates a very close approximation.

Given the function y = ex
a) Find the Taylor series 
b) Find the 4th-degree Taylor polynomial, P4​(x) 
c) Approximate the value of e0.1 using P4​(x), centered at x = 0​ 
d) Calculate the error bound for this approximation using the remainder R4(x).

Solution:

a) As we know, the Taylor series of a function f(x) centered at x = a is
${f\left( x\right) =f\left( a\right) +f’\left( a\right) \left( x-a\right) +\dfrac{f”\left( a\right) }{2!}\left( x-a\right) ^{2}+\ldots}$
Given, f(x) = ex 
f(0) = e0 = 1 ⇒ f’(0) = e0 = 1, f”(0) = e0 = 1, …
Thus, the Taylor series expansion for f(x) = ex centered at x = 0 is
ex = ${1+x+\dfrac{x^{2}}{2!}+\ldots}$
b) The 4th-degree polynomial is P4(x) = ${1+x+\dfrac{x^{2}}{2}+\dfrac{x^{3}}{6}+\dfrac{x^{4}}{24}}$
c) Now that we have the 4th-degree Taylor polynomial, we use it to approximate e0.1 by substituting x = 0.1
P4(0.1) = ${1+0.1+\dfrac{\left( 0.1\right) ^{2}}{2}+\dfrac{\left( 0.1\right) ^{3}}{6}+\dfrac{\left( 0.1\right) ^{4}}{24}}$
⇒ P4(0.1) = ${1+0.1+\dfrac{0.01}{2}+\dfrac{0.001}{6}+\dfrac{0.0001}{24}}$
⇒ P4(0.1) ≈ 1 + 0.1 + 0.005 + 0.000167 + 0.00000417 = 1.10517117
⇒ e0.1 ≈ 1.10517 using P4(x)
d) The error bound for a Taylor polynomial approximation is given by the remainder term Rn(x)
${R_{n}\left( x\right) =\dfrac{f^{n+1}\left( c\right) }{\left( n+1\right) !}\left( x-a\right) ^{n+1}}
For our approximation of e0.1 using P4(x), we have n = 4, a = 0, and x = 0.1
Since all derivatives of ex are fk(x) = ex, the 5th derivative is f5(x) = ex, and thus, f5(c) = ec 
Thus, R4(0.1) = ${\dfrac{e^{c}}{5!}\left( 0.1\right) ^{5}}$
Since 0 ≤ c ≤ 0.1, the maximum value of ec in this interval is e0.1 ≈ 1.10517
Calculating 5! = 120 and (0.1)5 = 0.00001
Thus, R4(0.1) ≤ ${\dfrac{1.1057}{120}\cdot 0.00001}$ = 0.0000000921
Thus, the error in this approximation is at most 0.0000000921

Problem: Finding MINIMUM n for APPROXIMATION ACCURACY

Determine the smallest integer n such that the nth Taylor polynomial of f(x) = ex at x = 0 approximates e0.5 to within 0.001 of its actual value.

Solution:

Given f(x) = ex 
The Taylor series expansion for ex around x = 0 is given by:
ex = ${1+x+\dfrac{x^{2}}{2!}+\dfrac{x^{3}}{3!}+\ldots +\dfrac{x^{n}}{n!}+R_{n+1}\left( x\right)}$
The nth Taylor polynomial is Pn(x) = ${1+x+\dfrac{x^{2}}{2!}+\dfrac{x^{3}}{3!}+\ldots +\dfrac{x^{n}}{n!}}$
The upper bound on the error of approximation is Rn + 1(x)
For f(x) = ex, the remainder term Rn + 1(x) is 
Rn + 1(x) = ${\dfrac{\left| f^{n+1}\left( c\right) \right| }{\left( n+1\right) !}\left| x\right| ^{n+1}}$
Here, 0 ≤ c ≤ x
Since all derivatives of ex are fk(x) = ex, the maximum value of 
∣fn + 1(c)∣ = ec ≤ e0.5 ≈ 1.6487
Thus, |Rn + 1(0.5)| ≤ ${\dfrac{e^{0.5}}{\left( n+1\right) !}\left( 0.5\right) ^{n+1}}$
Since this remainder is less than 0.001, we have
${\dfrac{1.6487}{\left( n+1\right) !}\left( 0.5\right) ^{n+1}}$ < 0.001
For n = 3, 
R4(0.5) ≤ ${\dfrac{1.6487}{4!}\left( 0.5\right) ^{4}}$ = ${\dfrac{1.6487}{24}\cdot 0.0625}$ ≈ 0.00429
This is not within 0.001, and thus, n = 3 is insufficient.
For n = 4, 
R5(0.5) ≤ ${\dfrac{1.6487}{5!}\left( 0.5\right) ^{5}}$ = ${\dfrac{1.6487}{120}\cdot 0.03125}$ ≈ 0.000429
This is less than 0.001, and thus, n = 4 is sufficient.Thus, the smallest integer n such that Pn(x) approximates e0.5 within 0.001 is n = 4

Last modified on November 8th, 2024