# Taylor and Maclaurin series

## Towards Taylor series

• Suppose that the power series $$f(x)=c_0+c_1(x-a)+c_2(x-a)^2+c_3(x-a)^3+\dotsb$$ has radius of convergence $$R$$.
• Then we get $$f(x=a)=c_0$$.
• Also, if $$|x-a|<R$$, then we get $f'(x)=c_1+2c_2x+3x_3x^2+\dotsb.$
• This gives $$f'(x=a)=c_1$$.
• Also, we get $f''(x)=2c_2+6c_3x+\dotsb.$
• Therefore, we get $$f''(x=a)=2c_2$$.
• In general, we get $c_n=\frac{f^{(n)}(x=a)}{n!}.$
• The formula stays valid for $$n=0$$ if we set $$0!=1$$.
• Theorem. If $$f(x)$$ has a power series representation at $$a$$, that is if we have $f(x)=\sum_{n=0}^\infty c_n(x-a)^n\text{ for |x-a|<R for some R>0},$ then we have $$c_n=\frac{f^{(n)}(x=a)}{n!}$$ for $$n\ge0$$.
• Definition. The series $$\sum_{n=0}\frac{f^{(n)}(x=a)}{n!}(x-a)^n$$ is called the Taylor series centred at $$a$$ of $$f$$.
• For $$a=0$$, the series $$\sum_{n=0}\frac{f^{(n)}(x=0)}{n!}x^n$$ is also called the Maclaurin series of $$f$$.

## Basic examples of Taylor series.

• Now we'll see some canonical examples of Taylor series. Although we'll show how to calculate them, I recommend memorizing them, as they come up a lot in calculations.
• Let $$f(x)=e^x$$.
• Then we have $$f^{(n)}=e^x$$ for all $$n\ge0$$.
• Therefore, we get $e^x=\sum_{n=0}^\infty\frac{f^{(n)}(x=0)}{n!}x^n=\sum_{n=0}^\infty\frac{x^n}{n!}.$
• Note that since we have $\lim_{n\to\infty}\frac{|a_{n+1}|}{|a_n|}=\lim_{n\to\infty}\frac{|x|}{n+1}=0$ for all $$x$$, the radius of convergence is $$R=\infty$$, that is the formula is valid for all $$x$$.
• Using this, we can get an antiderivative for $$f(x)=e^{-x^2}$$!
• We have $e^{-x^2}=\sum_{n=0}^\infty\frac{(-1)^nx^{2n}}{n!},$ which is a power series with radius of convergence $$R=\infty$$, therefore can get an antiderivative in the form of a power series: $\int e^{-x^2}\,\mathrm dx=C+\sum_{n=0}^\infty\frac{(-1)^nx^{2n+1}}{(2n+1)\cdot n!}$
• Let $$f(x)=\sin x$$.
• We have $f^{(n)}(x)=\begin{cases} \sin x & n=0,4,8,\dotsc\\ \cos x & n=1,5,9,\dotsc\\ -\sin x & n=2,6,10,\dotsc\\ -\cos x & n=3,7,11,\dotsc \end{cases}$
• This gives $f^{(n)}(x=0)=\begin{cases} 0 & n=0,2,4,6,\dotsc\\ 1 & n=1,5,9,\dotsc\\ -1 & n=3,7,11,\dotsc \end{cases}$
• Therefore, the Maclaurin series is $\sin(x)=\sum_{n=0}^\infty\frac{f^{(n)}(x=0)}{n!}x^n=x-\frac{x^3}{6}+\frac{x^5}{120}-\dotsb=\sum_{n=0}^\infty(-1)^n\frac{x^{2n+1}}{(2n+1)!}.$
• Similarly, we get $\cos(x)=1-\frac{x^2}{2}+\frac{x^4}{24}-\dotsb=\sum_{n=0}^\infty(-1)^n\frac{x^{2n}}{(2n)!}.$
• You can check with the ratio test that the radius of convergence for both sin and cos is $$R=\infty$$.
• Let $$f(x)=\ln(1+x)$$.
• We have $f'(x)=\frac{1}{1+x}=\frac{1}{1-(-x)}=\sum_{n=0}^\infty(-1)^nx^n.$
• This gives $f(x)=f(x=0)+\sum_{n=0}^{\infty}\int(-1)^nx^n\,\mathrm dx=\sum_{n=0}^\infty(-1)^n\frac{x^{n+1}}{n+1}$
• Let $$f(x)=\tan^{-1}x$$.
• We have $f'(x)=\frac{1}{1+x^2}=\sum_{n=0}^\infty(-1)^nx^{2n}.$
• This gives $f(x)=f(x=0)+\sum_{n=0}^\infty\int(-1)^nx^{2n}\,\mathrm dx=\sum_{n=0}\infty(-1)^n\frac{x^{2n+1}}{2n+1}.$
• Let $$f(x)=(1+x)^k$$ where $$k$$ is any real number.
• Then we have \begin{alignat*}{1} f(x)&=(1+x)^k & f(x=0)&=1\\ f'(x)&=k(1+x)^{k-1} & f'(x=0)&=k \\ f''(x)&=k(k-1)(1+x)^{k-2} & f''(x=0)&=k(k-1)\\ &\vdots & &\vdots \\ f^{(n)}(x)&=k(k-1)\dotsb(k-n+1)(1+x)^{k-n} \quad & f^{(n)}(x=0)&=k(k-1)\dotsb(k-n+1). \end{alignat*}
• Therefore, the Maclaurin series is $(1+x)^k=\sum_{n=0}^\infty\frac{k(k-1)\dotsb(k-n+1)}{n!}x^n.$
• Note that if $$k$$ is a nonnegative integer, then starting from $$n=k$$, the coefficients are zeroes.
• If $$k$$ is not a nonnegative integer, then we can run the Ratio test: $\left|\frac{a_{n+1}}{a_n}\right|=\left|\frac{k(k-1)\dotsb(k-n+1)(k-n)}{k(k-1)\dotsb(k-n+1)}\frac{1}{n+1}x\right|=\frac{|k-n|}{|n|}|x|\to|x|\text{ as n\to\infty}.$
• Therefore, if $$k$$ is not a nonnegative integer, then the radius of convergence is $$R=1$$.
• Definition. Let $$k$$ be a real number and $$n$$ a nonnegative integer. The binomial coefficients are $\binom{k}{n}= \begin{cases} 1 & n=0,\\ \frac{k(k-1)\dotsb(k-n+1)}{n!} & n>0. \end{cases}$ For this reason, the series $(1+x)^k=\sum_{n=0}^\infty\binom{k}{n}x^n$ is called the binomial series.
• Exercises. 11.10: 5, 7, 11, 15, 19, 25, 31, 33, 35, 37

## Applications of Taylor series

• Let $$f$$ be a function which has a Taylor series centred at $$a$$ $$\sum_{n=0}^\infty c_n(x-a)^n$$.
• For a Taylor series, we also denote the partial sum as $$T_n(x)=\sum_{i=0}^\infty c_i(x-a)^i$$, and call it the $$n$$-the Taylor polynomial of $$f$$ centred at $$a$$.
• Suppose that the radius of convergence is $$R$$. Then for any $$x$$ such that $$|x-a|<R$$, we have $$\lim_{n\to\infty}T_n(x)=f(x)$$.
• To measure how good approximations the Taylor polynomials are, we again use the error term or remainder $$R_n(x)=f(x)-T_n(x)=\sum_{i=n+1}^\infty c_i(x-a)^i$$.
• Example. $$\int_0^1 e^{-x^2}\,\mathrm dx$$.
• We have seen that by substituting into $$e^x=\sum_{n=0}^\infty\frac{x^n}{n!}$$, we get $e^{-x^2}=\sum_{n=0}^\infty(-1)^n\frac{x^{2n}}{n!}.$
• Since the radius of convergence is $$R=\infty$$, we can use differentiate or integrate into this series in all the real line.
• Therefore, we have $\int_0^1e^{-x^2}\,\mathrm dx=\sum_{n=0}^\infty\int_0^1(-1)^n\frac{x^{2n}}{n!}\,\mathrm dx=\sum_{n=0}^\infty(-1)^n\frac{1}{(2n+1)n!}.$
• That is, the value of the definite integral is given as the alternating series $$\sum_{n=0}^\infty(-1)^n\frac{1}{(2n+1)n!}$$.
• We know that the absolute value of the $$n$$-th error term $$\sum_{i=n+1}^\infty(-1)^nb_n$$ of an alternating series is at most the absolute value $$b_{n+1}$$ of the $$(n+1)$$-st term.
• Since we can check with a computer that $$b_7<0.0005$$, we get that the 6-th partial sum $$s_6\approx0.7468$$ is precise up to three decimal degrees.
• If the particular Taylor series we're looking at is not an alternating series, we need another method to measure how precise the Taylor polynomials are.
• Taylor's inequality. Suppose that $$|f^{(n+1)}(x)|\le M$$ for $$|x-a|\le M$$. Then we have $|R_n(x)|\le\frac{M}{(n+1)!}|x-a|^{n+1}\text{ for }|x-a|\le d.$
• Example. Approximating $$e$$.
• The Taylor series shows us that $$e^1=\sum_{n=0}^\infty\frac{1}{n!}$$.
• We have $$|(e^x)^{(n+1)}|=e^x<3$$ for $$|x|\le1$$.
• Therefore, Taylor's inequality gives $$|R_n(x)|\le\frac{3}{(n+1)!}|x-a|^{n+1}$$ for $$|x|\le d$$.
• Thus, having checked that $$|R_8(x=1)|<0.0005|$$, we can see that $$\sum_{n=0}^7\frac{1}{n!}\approx2.7182$$ gives an approximation of $$e$$ precise up to 3 decimal degrees.
• Calculating limits.
• Series can be used to calculate limits also.
• Since in their domain, power series are continuous functions, you can exchange the sum and the limit.
• For example, we have $\lim_{x\to\infty}\frac{e^x}{x^2}=\lim_{x\to\infty}\frac{\sum_{n=0}^\infty \frac{x^n}{n!}}{x^2}=\sum_{n=0}^\infty\lim_{x\to\infty}\frac{x^{n-2}}{n!}=\infty$
• Exercises. 11.10: 49, 51, 53, 57, 61, 63