# What are some good or neat examples of computing a function's Taylor series?

Starting from \begin{equation*} \frac{1}{1-x} = 1 + x + x^2 + x^3 + \cdots, \end{equation*} which holds when $|x| < 1$, we can conclude that \begin{equation*} \frac{1}{1 + x^2} = 1 - x^2 + x^4 - x^6 + \cdots \end{equation*} when $|x| < 1$. Now taking antiderivatives of both sides, we discover that \begin{equation*} \tan^{-1}(x) = C + x - \frac{x^3}{3} + \frac{x^5}{5} - \frac{x^7}{7} + \cdots \end{equation*} when $|x| < 1$. By plugging in $x = 0$, we see that $C = 0$, and we have found the Taylor series (centered at $0$) for $\tan^{-1}$.

This is a pretty neat calculation. Computing the derivatives of $\tan^{-1}$ at $0$ directly would have been laborious. What are some other neat or good examples of calculations like this (where a Taylor series is computed in an efficient way)?

A couple other examples would be computing the Maclaurin series for $x \sin(x)$ by just multiplying the Maclaurin series for $\sin(x)$ by $x$, or computing the Maclaurin series for $\sin(x) \cos(x)$ by multiplying the series for $\sin(x)$ by the series for $\cos(x)$. (You could also use the identity $\sin(x) \cos(x) = \frac12 \sin(2x)$.)

• See the examples here and here. You can also find some neat calculations in 19th century algebra and calculus texts, nearly all of which are freely available on the internet. – Dave L Renfro Feb 3 '15 at 21:56
• Here's an example I just happened to come across yesterday in an 1868 book I was looking through for something I've been working on. The expansion of $\frac{1}{1+x+x^2 + x^3}$ can easily be found by multiplying numerator and denominator by $1-x,$ which gives you $1-x$ times $\frac{1}{1-x^4}$ (easy to expand geometric series, which is then easy to multiply by $1$ and then by $-x,$ adding the results). See the top of p. 226 here. – Dave L Renfro Feb 7 '15 at 15:20
• For examples of books worth flipping through the pages to find these kinds of examples, see [2] through [8] in my answer here and the books by Chrystal, Hall/Knight, Loomis, Smith, Steadman, and Todhunter that I posted in this 5 November 2009 sci.math post. – Dave L Renfro Feb 7 '15 at 15:25

One of my favorites also provides a useful way to do an integral.

From the usual Taylor Series of $$e^x = \sum_{n=0}^{\infty} \frac{x^n}{n!}$$ we can plug in $x^2$ to obtain $$e^{x^2} = \sum_{n=0}^{\infty} \frac{x^{2n}}{n!}.$$ As a note, this convergence is uniform on all compact subsets of $\mathbb{R}$ as the radius of convergence $R$ is $\infty$ (using the usual analytic notation).

Now, I know in lower level calculus classes that $\int e^{x^2}dx$ is mentioned to not have a closed form solution, that is, it is not a derivative of some composition of 'standard' functions. The issue lies in that many students do have to integrate on intervals to obtain values when they have to study normal distributions. So instead of yielding to pre-computed tables, it can be analytically computed, using uniform convergence where necessary or viewing as the generic antiderivative we teach calculus students, as such:

\begin{align*} \int e^{x^2} dx &= \int \sum_{n=0}^{\infty} \frac{x^{2n}}{n!} dx \\ &= \sum_{n=0}^{\infty} \int \frac{x^{2n}}{n!} dx \\ &= \sum_{n=0}^{\infty} \frac{x^{2n+1}}{n! (2n+1)} \end{align*}

Furthermore, we can do computations: \begin{align*} \int_a ^b e^{x^2} dx &\approx \sum_{n=0}^{N} \frac{b^{2n+1} - a^{2n+1}}{n! (2n+1)} \end{align*} with error $|\dfrac{d^{N+1} e^{x^2}}{dx^{N+1}} \dfrac{b^{N+1}-a^{N+1}}{(N+1)!}|$ for a $x \in [a,b]$.

• Convergence is not uniform on the whole real line. A power series is only guaranteed to converge uniformly on compact subsets of its interval of convergence (or disc of convergence if you work over the complex numbers). As a concrete example, the power series at $0$ for the functions $e^x$ and $\sin x$ have infinite radius of convergence but these power series do not converge uniformly on the whole real line. – KCd Feb 4 '15 at 13:53
• @KCd I don't believe I said it was uniform over the entire real line, but just that the radius of convergence is the real line. It is uniform over every compact set of $\mathbb{R}$ though, which is good enough, and the general antiderivative above still holds. I've modified it to make it a little more clear. – Chris C Feb 4 '15 at 14:48

$f(x) = \begin{cases}\exp(-\frac1{x^2}) & x \neq 0 \cr 0 & x = 0 \end{cases}$

If only to disabuse the students of the idea that smooth implies analytic.

The Fabius function or $F(x) := \sum_{n=0}^\infty \frac{\exp(i2^nx)}{n!}$ (or its real part) would be better examples since they're nowhere analytic, but that's a bit harder to verify. I have an answer over on MSE attempting to show non-analyticity of $F$, but I might have gotten the application of the Cauchy–Hadamard formula wrong.