Taylor Series

DOWNLOAD Mathematica Notebook EXPLORE THIS TOPIC IN the MathWorld Classroom

A Taylor series is a series expansion of a function about a point. A one-dimensional Taylor series is an expansion of a real function f(x) about a point x=a is given by

 f(x)=f(a)+f^'(a)(x-a)+(f^('')(a))/(2!)(x-a)^2+(f^((3))(a))/(3!)(x-a)^3+...+(f^((n))(a))/(n!)(x-a)^n+....
(1)

If a=0, the expansion is known as a Maclaurin series.

Taylor's theorem (actually discovered first by Gregory) states that any function satisfying certain conditions can be expressed as a Taylor series.

The Taylor (or more general) series of a function f(x) about a point a up to order n may be found using Series[f, {x, a, n}]. The nth term of a Taylor series of a function f can be computed in the Wolfram Language using SeriesCoefficient[f, {x, a, n}] and is given by the inverse Z-transform

 a_n=Z^(-1)[1/(z-a)](n).
(2)

Taylor series of some common functions include

1/(1-x)=1/(1-a)+(x-a)/((1-a)^2)+((x-a)^2)/((1-a)^3)+...
(3)
cosx=cosa-sina(x-a)-1/2cosa(x-a)^2+1/6sina(x-a)^3+...
(4)
e^x=e^a[1+(x-a)+1/2(x-a)^2+1/6(x-a)^3+...]
(5)
lnx=lna+(x-a)/a-((x-a)^2)/(2a^2)+((x-a)^3)/(3a^3)-...
(6)
sinx=sina+cosa(x-a)-1/2sina(x-a)^2-1/6cosa(x-a)^3+...
(7)
tanx=tana+sec^2a(x-a)+sec^2atana(x-a)^2+sec^2a(sec^2a-2/3)(x-a)^3+....
(8)

To derive the Taylor series of a function f(x), note that the integral of the (n+1)st derivative f^((n+1)) of f(x) from the point x_0 to an arbitrary point x is given by

 int_(x_0)^xf^((n+1))(x)dx=[f^((n))(x)]_(x_0)^x=f^((n))(x)-f^((n))(x_0),
(9)

where f^((n))(x_0) is the nth derivative of f(x) evaluated at x_0, and is therefore simply a constant. Now integrate a second time to obtain

 int_(x_0)^x[int_(x_0)^xf^((n+1))(x)dx]dx 
=int_(x_0)^x[f^((n))(x)-f^((n))(x_0)]dx 
=[f^((n-1))(x)]_(x_0)^x-(x-x_0)f^((n))(x_0) 
=f^((n-1))(x)-f^((n-1))(x_0)-(x-x_0)f^((n))(x_0),
(10)

where f^((k))(x_0) is again a constant. Integrating a third time,

 int_(x_0)^xint_(x_0)^xint_(x_0)^xf^((n+1))(x)(dx)^3=f^((n-2))(x)-f^((n-2))(x_0)
 -(x-x_0)f^((n-1))(x_0)-((x-x_0)^2)/(2!)f^((n))(x_0),
(11)

and continuing up to n+1 integrations then gives

 int...int_(x_0)^x_()_(n+1)f^((n+1))(x)(dx)^(n+1)=f(x)-f(x_0)-(x-x_0)f^'(x_0) 
 -((x-x_0)^2)/(2!)f^('')(x_0)-...-((x-x_0)^n)/(n!)f^((n))(x_0).
(12)

Rearranging then gives the one-dimensional Taylor series

f(x)=f(x_0)+(x-x_0)f^'(x_0)+((x-x_0)^2)/(2!)f^('')(x_0)+...+((x-x_0)^n)/(n!)f^((n))(x_0)+R_n
(13)
=sum_(k=0)^(n)((x-x_0)^kf^((k))(x_0))/(k!)+R_n.
(14)

Here, R_n is a remainder term known as the Lagrange remainder, which is given by

 R_n=int...int_(x_0)^x_()_(n+1)f^((n+1))(x)(dx)^(n+1).
(15)

Rewriting the repeated integral then gives

 R_n=int_(x_0)^xf^((n+1))(t)((x-t)^n)/(n!)dt.
(16)

Now, from the mean-value theorem for a function g(x), it must be true that

 int_(x_0)^xg(x)dx=(x-x_0)g(x^*)
(17)

for some x^* in [x_0,x]. Therefore, integrating n+1 times gives the result

 R_n=((x-x_0)^(n+1))/((n+1)!)f^((n+1))(x^*)
(18)

(Abramowitz and Stegun 1972, p. 880), so the maximum error after n terms of the Taylor series is the maximum value of (18) running through all x^* in [x_0,x]. Note that the Lagrange remainder R_n is also sometimes taken to refer to the remainder when terms up to the (n-1)st power are taken in the Taylor series (Whittaker and Watson 1990, pp. 95-96).

Taylor series can also be defined for functions of a complex variable. By the Cauchy integral formula,

f(z)=1/(2pii)int_C(f(z^')dz^')/(z^'-z)
(19)
=1/(2pii)int_C(f(z^')dz^')/((z^'-z_0)-(z-z_0))
(20)
=1/(2pii)int_C(f(z^')dz^')/((z^'-z_0)(1-(z-z_0)/(z^'-z_0))).
(21)

In the interior of C,

 (|z-z_0|)/(|z^'-z_0|)<1
(22)

so, using

 1/(1-t)=sum_(n=0)^inftyt^n,
(23)

it follows that

f(z)=1/(2pii)int_Csum_(n=0)^(infty)((z-z_0)^nf(z^')dz^')/((z^'-z_0)^(n+1))
(24)
=1/(2pii)sum_(n=0)^(infty)(z-z_0)^nint_C(f(z^')dz^')/((z^'-z_0)^(n+1)).
(25)

Using the Cauchy integral formula for derivatives,

 f(z)=sum_(n=0)^infty(z-z_0)^n(f^((n))(z_0))/(n!).
(26)

An alternative form of the one-dimensional Taylor series may be obtained by letting

 x-x_0=Deltax
(27)

so that

 x=x_0+Deltax.
(28)

Substitute this result into (◇) to give

 f(x_0+Deltax)=f(x_0)+Deltaxf^'(x_0)+1/(2!)(Deltax)^2f^('')(x_0)+....
(29)

A Taylor series of a real function in two variables f(x,y) is given by

 f(x+Deltax,y+Deltay)=f(x,y)+[f_x(x,y)Deltax+f_y(x,y)Deltay]+1/(2!)[(Deltax)^2f_(xx)(x,y)+2DeltaxDeltayf_(xy)(x,y)+(Deltay)^2f_(yy)(x,y)]+1/(3!)[(Deltax)^3f_(xxx)(x,y)+3(Deltax)^2Deltayf_(xxy)(x,y)+3Deltax(Deltay)^2f_(xyy)(x,y)+(Deltay)^3f_(yyy)(x,y)]+....
(30)

This can be further generalized for a real function in n variables,

 f(x_1,...,x_n)=sum_(j=0)^infty{1/(j!)[sum_(k=1)^n(x_k-a_k)partial/(partialx_k^')]^jf(x_1^',...,x_n^')}_(x_1^'=a_1,...,x_n^'=a_n).
(31)

Rewriting,

 f(x_1+a_1,...,x_n+a_n)=sum_(j=0)^infty{1/(j!)(sum_(k=1)^na_kpartial/(partialx_k^'))^jf(x_1^',...,x_n^')}_(x_1^'=x_1,...,x_n^'=x_n).
(32)

For example, taking n=2 in (31) gives

f(x_1,x_2)=sum_(j=0)^(infty){1/(j!)[(x_1-a_1)partial/(partialx_1^')+(x_2-a_2)partial/(partialx_2^')]^jf(x_1^',x_2^')}_(x_1^'=a_1,x_2^'=a_2)
(33)
=f(a_1,a_2)+[(x_1-a_1)(partialf)/(partialx_1)+(x_2-a_2)(partialf)/(partialx_2)]+1/(2!)[(x_1-a_1)^2(partial^2f)/(partialx_1^2)+2(x_1-a_1)(x_2-a_2)(partial^2f)/(partialx_1partialx_2)+(x_2-a_2)^2(partial^2f)/(partialx_2^2)]+....
(34)

Taking n=3 in (32) gives

 f(x_1+a_1,x_2+a_2,x_3+a_3) 
=sum_(j=0)^infty{1/(j!)(a_1partial/(partialx_1^')+a_2partial/(partialx_2^')+a_3partial/(partialx_3^'))^jf(x_1^',x_2^',x_3^')}_(x_1^'=x_1,x_2^'=x_2,x_3^'=x_3),
(35)

or, in vector form

 f(r+a)=sum_(j=0)^infty[1/(j!)(a·del _(r^'))^jf(r^')]_(r^'=r).
(36)

The zeroth- and first-order terms are f(r) and (a·del _(r^'))f(r^')|_(r^'=r), respectively. The second-order term is

1/2(a·del _(r^'))(a·del _(r^'))f(r^')|_(r^'=r)=1/2a·del _(r^')[a·(del f(r^'))]_(r^'=r)
(37)
=1/2a·[a·del _(r^')(del _(r^')f(r^'))]|_(r^'=r),
(38)

so the first few terms of the expansion are

 f(r+a)=f(r)+(a·del _(r^'))f(r^')|_(r^'=r)+1/2a·[a·del _(r^')(del _(r^')f(r^'))]|_(r^'=r).
(39)

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.