Maclaurin series (HL)

This requires working knowledge of sigma notation and familiarity with calculus.

Whereas a line segment can approximate a function at a small interval, a Maclaurin series can approximate the same function at a larger interval, by using a high-order polynomial.

Contents

Formula

f(x)=f(0)+f(0)1!x+f(0)2!x2+f(x) = f(0) + \frac{f^\prime(0)}{1!}x + \frac{f^{\prime\prime}(0)}{2!}x^2 + \dots

where k!k! is the factorial of positive integer kk.

In sigma notation

f(0)+n=1f(n)(0)n!xnf(0) + \sum_{n = 1}^\infty \frac{f^{(n)}(0)}{n!} x^n

In practice, a few terms is sufficient, as long as x0x_0 is within the radius of convergence of 00. Factorials grow faster than polynomials; if the series converges for all real numbers, then there will most likely be a factorial in the denominator of each term.

sketch of proof

Suppose a power series representation of a function exists, centered at x=0x = 0, with the xnx^n term being cnxnc_n x^n.

When taking the nnth derivative, all the terms of lower degree go to 00, and the higher terms stay, but upon evaluating at x=0x = 0, they become zero as well.

From differentiation of polynomials, the exponent is brought down and reduced by one. So with each higher derivatives the new factor also decreases by one.

f(n)(0)=n!cnf^{(n)}(0) = n! \cdot c_n

Hence,

cn=f(n)(0)n!c_n = \frac{f^{(n)}(0)}{n!}

A few examples

ex=1+x+x22!+x33!=n=0xnn!\e^x = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} \dots = \sum_{n=0}^\infty \frac{x^n}{n!}
sinx=xx33!+x55!=n=0(1)nx2n+1(2n+1)!\sin x = x - \frac{x^3}{3!} + \frac{x^5}{5!} \dots = \sum_{n=0}^\infty \frac{(-1)^n x^{2n+1}}{(2n + 1)!}
11x=1+x+x2=n=0xn,    x<1\frac{1}{1-x} = 1 + x + x^2 \dots = \sum_{n=0}^\infty x^n, \;\; \lvert x\rvert < 1

The last series has a radius of convergence of x<1\lvert x\rvert < 1. Testing radius of convergence is beyond scope of this course. However, this last one is a geometric series, which converges for x<1\lvert x\rvert < 1.

Reminder that the generalized binomial theorem is

(1+x)n=1+nx+n(n1)2!x2+(1+x)^n = 1 + nx + \frac{n(n-1)}{2!}x^2 +\dots

This also converges for x<1\lvert x \rvert < 1.

Example: Find the Maclaurin series expansion for

e22x+1\e^{2\sqrt{2x + 1}}

up to and including the x2x^2 term.


Let f(x)=e22x+1f(x) = \e^{2\sqrt{2x + 1}} with f(0)=e2f(0) = \e^2.

f(x)=e22x+1222x+12=2e22x+12x+1f(0)=2e2\begin{align*} f^\prime(x) &= \e^{2\sqrt{2x + 1}} \cdot \frac{2}{2\sqrt {2x + 1}} \cdot 2 \\ &= \frac{2\e^{2\sqrt{2x + 1}}}{\sqrt{2x + 1}} \\ f^\prime(0) &= 2\e^2 \end{align*}
f(x)=2(f(x)2x+1f(x)12x+12x+1)f(0)=2(f(0)1f(0)1)=2(2e2e2)=2e2\begin{align*} f^{\prime\prime}(x) &= 2\left(\frac{f'(x)\sqrt{2x+1} - f(x)\frac{1}{\sqrt{2x+1}}}{2x+1}\right)\\ f^{\prime\prime}(0) &= 2\left(f'(0)\cdot 1 - f(0)\cdot 1\right)\\ &= 2\left(2\e^2 - \e^2\right) \\ &= 2\e^2 \end{align*}
series=e2+2e2x1!+2e2x22!+=e2+2e2x+e2x2+\begin{align*} \text{series} &= \e^2 + \frac{2\e^2x}{1!} + \frac{2\e^2x^2}{2!} + \dots \\ &= \e^2 + 2\e^2x+\e^2x^2 +\dots \qed \end{align*}

Look to reuse numerical values of prior derivatives whenever possible.

Arithmetics

substitution

Example: Find the Maclaurin series expansion for 11+x\displaystyle\frac{1}{1+x}.


Here xx in 11x\frac{1}{1-x} and its expansion are all replaced with x-x. This means for x<1\lvert x\rvert < 1

11+x=1x+x2=n=0(x)n\frac{1}{1+x} = 1 - x + x^2 \dots = \sum_{n=0}^\infty(-x)^n \qed

(1)n(-1)^n means positive for even nn and negative for odd nn.

In some cases, you may be asked to substitute in a Maclaurin series as xx of another series.

Theorem: For the Maclaurin series of f(g(x))f(g(x)), you can substitute in the Maclaurin series expansion for g(x)g(x) into ff, if g(0)=0g(0) = 0.

Example: Find the Maclaurin series expansion for

2ex+2\frac{2}{\e^x + 2}

up to and including the x3x^3 term.


We define an inner function through the origin, namely

g(x)=ex1=x+x22+x36+g(x) = \e^x - 1 = x + \frac{x^2}{2} + \frac{x^3}{6} +\dots

and an outer function

f(x)=2x+3=23x3+1=23(113x+19x2127x3+)\begin{align*} f(x) &= \frac{2}{x + 3} \\ &= \frac{\frac{2}{3}}{\frac{x}{3} + 1} \\ &= \frac{2}{3}\left(1 - \frac13x + \frac{1}{9}x^2 - \frac{1}{27}x^3 + \dots\right) \end{align*}

… using the series for 1x+1\frac{1}{x+1} found in the previous example.

f(g(x))=2329g(x)+227g(x)2281g(x)3+\begin{align*} f(g(x)) &= \frac{2}{3} - \frac29g(x) + \frac{2}{27}g(x)^2 - \frac{2}{81}g(x)^3 + \dots \end{align*}
f(g(x))=2329x19x2127x3+227x2+227x3281x3+=2329x127x2+181x3+\begin{align*} f(g(x)) = &\frac{2}{3} & & & & \\ & &-\frac29x &- \frac{1}{9}x^2 &- \frac{1}{27}x^3 & \\ & & &+\frac{2}{27}x^2 &+\frac{2}{27}x^3 & \\ & & & &-\frac{2}{81}x^3 &+ \dots\\ = &\frac23 &-\frac29x &-\frac{1}{27}x^2 &+\frac{1}{81}x^3 &+ \dots \qed \end{align*}

This can be verified by applying the definition of Maclaurin series.

Note that in the expansions, we ignored all the x4x^4 and higher terms. The 227x3\frac{2}{27}x^3 comes from 227(xx22+x22x).{\frac{2}{27}\left(x\cdot\frac{x^2}{2} + \frac{x^2}{2}\cdot x\right)}.

differentiation

Example: Find the Maclaurin series expansion for cosx\displaystyle\cos x.


cosx=ddxsinx=ddxn=0(1)n(2n+1)!x2n+1\begin{align*} \cos x &= \frac{\d }{\d x} \sin x \\ &= \frac{\d }{\d x} \sum_{n = 0}^\infty \frac{(-1)^n}{(2n + 1)!}x^{2n+1} \end{align*}

Note that same series can be expressed with different starting index. Here the general form above starts with n=0n = 0. Just make sure first index evaluates to first term, which is xx in this case. nn is a constant with respect to xx.

cosx=n=0(1)n(2n+1)!ddxx2n+1=n=0(1)n(2n+1)!(2n+1)x2n=n=0(1)n(2n+1)(2n)!(2n+1)x2n=n=0(1)n(2n)!x2n=1x22!+x44!\begin{align*}\cos x &= \sum_{n = 0}^\infty \frac{(-1)^n}{(2n + 1)!}\frac{\d }{\d x}x^{2n+1} \\ &= \sum_{n = 0}^\infty \frac{(-1)^n}{(2n + 1)!}(2n+1)x^{2n} \\ &= \sum_{n = 0}^\infty \frac{(-1)^n}{(2n+1)(2n)!}(2n+1) x^{2n}\\ &= \sum_{n = 0}^\infty \frac{(-1)^n}{(2n)!} x^{2n} \qed \\ &= 1 - \frac{x^2}{2!} + \frac{x^4}{4!} - \dots \end{align*}

integration

Example: Find the Maclaurin series expansion for ln(1+x)\displaystyle\ln(1+x).


We start from the series for 11+x\frac{1}{1+x} above in an example. Because the radius of convergence is x<1\lvert x\rvert < 1 for series expansion of 11+x\frac{1}{1+x}, there is no need for absolute value when taking the integral.

ln(1+x)=11+xdx=n=0(x)ndx=n=0(x)ndx=n=0(1)(x)n+1n+1=n=0(1)n+2(x)n+1n+1=m=1(1)m+1(x)mm=xx22!+x33!\begin{align*}\ln(1+x) &= \int \frac{1}{1 + x} \d x\\ &= \int \sum_{n = 0}^\infty (-x)^n \d x \\ &= \sum_{n = 0}^\infty \int(-x)^n \d x \\ &= \sum_{n = 0}^\infty \frac{(-1)(-x)^{n+1}}{n+1} \\ &= \sum_{n = 0}^\infty \frac{(-1)^{n+2}(x)^{n+1}}{n+1} \\ &= \sum_{m = 1}^\infty \frac{(-1)^{m+1}(x)^{m}}{m}\qed \\ &= x - \frac{x^2}{2!} + \frac{x^3}{3!} - \dots \end{align*}

The last step was a nifty trick using the substitution m=n+1m = n + 1. Since nn does not exist outside the summation, and is a placeholder variable, the summation can be also written as

ln(1+x)=n=1(1)n+1(x)nn=n=1(x)nn\begin{align*} \ln(1+x) &= \sum_{n = 1}^\infty \frac{(-1)^{n+1}(x)^{n}}{n} \\ &= -\sum_{n = 1}^\infty \frac{(-x)^{n}}{n} \end{align*}

Tip: lnx=ln1x=ln(1x1x)\ln x = -\ln \frac1x = -\ln \left(1 - \frac{x-1}{x}\right), which makes this series expansion way more powerful than it seems.

Tip: If the sigma notations are throwing you off, you can often just write a few terms of the series and manipulate it that way, whenever you do not need the general term.

Use in limits

An alternative way to evaluate limits of the indeterminate form as xx approaches 00 is to calculate the Maclaurin series and find the limit for the first few terms of the resulting series.

Example: Evaluate

limx0sin(x2)x2x3ln(1+x3)\lim_{x\to 0}\frac{\sin(x^2) - x^2} {x^3 \ln(1+ x^3)}

This involves

sinx=xx33!+x55!\sin x = x - \frac{x^3}{3!} + \frac{x^5}{5!} - \dots

and

ln(1+x)=xx22+x33\ln (1 + x) = x - \frac{x^2}{2} + \frac{x^3}{3} - \dots

where we replace each xx by x2x^2 and x3x^3 respectively.

L=limx0(x2)(x2)33!+(x2)55!x2x3(x3(x3)22!+)=limx0x2x66+x10120x2x3(x3x62+)=limx0x6(16+x4120)x6(1x32+)=limx0(16+x4120)limx0(1x32+)=16\begin{align*} L &= \lim_{x\to 0}\frac{(x^2) - \frac{(x^2)^3}{3!} + \frac{(x^2)^5}{5!} - \dots - x^2}{x^3 \left(x^3 - \frac{(x^3)^2}{2!} + \dots\right)} \\ &= \lim_{x\to 0}\frac{x^2 - \frac{x^6}{6} + \frac{x^{10}}{120} - \dots - x^2}{x^3 \left(x^3 - \frac{x^6}{2} + \dots\right)} \\ &= \lim_{x\to 0} \frac{x^6\left(-\frac{1}{6} + \frac{x^{4}}{120} - \dots\right)}{x^6 \left(1 - \frac{x^3}{2} + \dots\right)} \\ &= \frac{\displaystyle\lim_{x\to 0}\left(-\frac{1}{6} + \frac{x^{4}}{120} - \dots\right)}{\displaystyle\lim_{x\to 0} \left(1 - \frac{x^3}{2} + \dots\right)} \\ &= -\frac{1}{6} \qed \end{align*}

After writing out the Maclaurin expansions, we factored out a x6x^6 out of both numerator and denominator. Then we were able to split LL into a ratio of two finite limits.

Use in differential equations

For a differential equation

dydx=f(x,y)\frac{\d y}{\d x} = f(x, y)

Repeated implicit differentiation of f(x,y)f(x, y) allow one to find the higher derivatives used in the definition of Maclaurin series. Substitute values of (0,y(0))(0, y(0)) and lower derivatives to find the next derivative.

This is not exactly a satisfying answer, but the series (with infinite number of terms) is a solution to the differential equation. Typically you will be asked to differentiate once or twice, depending on the complexity of the derivatives.

Example: Find Maclaurin series solution to

dydx=exy,y(0)=1\frac{\d y}{\d x} = \e^{xy}, y(0) = 1

up to and including the x3x^3 term.


y(0)=1,y(0)=e01=1y(0) = 1,\, y^\prime(0) = \e^{0\cdot1} = 1
d2ydx2=exy(y+xdydx)y(0)=1(1+0)=1\begin{align*} \frac{\d^2y}{\d x^2} &= \e^{xy}\left(y + x\frac{\d y}{\d x}\right) \\ y^{\prime\prime}(0) &= 1(1 + 0) = 1 \end{align*}
d3ydx3=exy(y+xdydx)2+exy(dydx+(dydx+xd2ydx2))y(0)=1(1+0)2+1(1+1+0)=3\begin{align*} \frac{\d^3y}{\d x^3} &= \e^{xy}\left(y + x\frac{\d y}{\d x}\right)^2 + \e^{xy}\left(\frac{\d y}{\d x} + \left(\frac{\d y}{\d x} + x \frac{\d^2y}{\d x^2}\right)\right) \\ y^{\prime\prime\prime}(0) &= 1(1 + 0)^2 + 1(1 + 1 + 0) = 3 \end{align*}
y=1+x+x22!+3x33!y=1+x+x22+x32\begin{align*} y &= 1 + x + \frac{x^2}{2!} + \frac{3x^3}{3!} \dots \\ y &= 1 + x + \frac{x^2}{2} + \frac{x^3}{2} \dots \qed \end{align*}