# Maclaurin series of $f(x) = e^x \sin x$

$$f(x) = e^x \sin x$$

I tried applying the given formula in my book but it didn't work.

The maclaurin for $e^x$ is given as $\displaystyle \sum \frac{x^n}{n!}$ and $\sin x$ $\displaystyle \sum \frac{(-1)^n x^{2n + 1}}{(2n+1)!}$

I attempted to multiply them together, failed teh books answer. I tried inputting values for them and then multiplying and that fails as well. Why?

$\displaystyle \frac{x^n}{n!} \frac{(-1)^n x^{2n + 1}}{(2n+1)!}$

Fails

-
Multiplying them together works. Why your attempt didn't work is impossible for us to know without seeing how you attempted to multiply them. Here is a reference: en.wikipedia.org/wiki/Power_series#Multiplication_and_division – Jonas Meyer Jul 24 '13 at 20:35
(Try writing them out term-by-term, and then multiplying as you would for polynomials, as in the reference Jonas supplied.) – user84413 Jul 24 '13 at 20:36
Hint: $\sin x = \dfrac{e^{ix}-e^{-ix}}{2i}$. Multiply it out. – Thomas Andrews Jul 24 '13 at 20:37
I don't know complex numbers. – Paul the Pirate Jul 24 '13 at 20:50

It’s just like multiplying polynomials.

Just as

$$(a+b+c)(d+e+f)=ad+ae+af+bd+be+bf+cd+ce+cf$$

is the sum of all possible products of one term from the first factor and one term from the second factor, so also is the product

$$\left(1+x+\frac{x^2}2+\frac{x^3}6+\ldots\right)\left(x-\frac{x^3}6+\frac{x^5}{120}-\frac{x^7}{5040}+\ldots\right)\;.$$

Thus, it must be

\begin{align*} x&-\frac{x^3}6+\frac{x^5}{120}-\frac{x^7}{5040}+\ldots\\ &+x^2-\frac{x^4}6+\frac{x^6}{120}-\frac{x^8}{5040}+\ldots\\ &+\frac{x^3}2-\frac{x^5}{12}+\frac{x^7}{240}-\frac{x^9}{10080}+\ldots\\ &+\frac{x^4}6-\frac{x^6}{36}+\frac{x^8}{720}-\frac{x^{10}}{30240}+\ldots\\ &+\ldots\;. \end{align*}

Of course some of these terms can be combined, since they involve the same power of $x$, but we can already see that the first four powers of $x$ that will appear in this product are $x,x^2,x^3$, and $x^4$: the constant term is $0$. What products of one term of

$$1+x+\frac{x^2}2+\frac{x^3}6+\frac{x^4}{24}+\ldots$$

and one term of $$x-\frac{x^3}6+\frac{x^5}{120}-\frac{x^7}{5040}+\ldots$$ are of the form $ax^k$ with $k=1,2,3$, or $4$? Obviously the second factor can’t be an $x^5$ term or higher. The second factor is always at least $x$, so the first factor can’t be an $x^4$ term or higher. Thus, the only partial products that contribute to the first four terms of the product are ones found in the polynomial product

$$\left(1+x+\frac{x^2}2+\frac{x^3}6\right)\left(x-\frac{x^3}6\right)\;,$$

and not all of those will be needed. Specifically, we need only

$$1\cdot x-1\cdot\frac{x^3}6+x\cdot x-x\cdot\frac{x^3}6+\frac{x^2}2\cdot x+\frac{x^3}6\cdot x\;;$$

every other partial product yields a power of $x$ higher than the fourth power and therefore does not contribute to the first four terms of the desired series.

-

First of all, note that $$\left(\sum_{n=0}^{\infty} \frac{x^n}{n!}\right) \left(\sum_{n=0}^{\infty} \frac{(-1)^n x^{2n + 1}}{(2n+1)!}\right) \neq \left(\sum_{n=0}^{\infty} \frac{x^n}{n!} \cdot \frac{(-1)^n x^{2n + 1}}{(2n+1)!}\right)$$ Your question is "why not?", well my question in turn is "why should it be"? Remember that when you take the product of two sums, you have to distribute. A simple example would be $$(a+b)(c+d)=ac+ad+bc+bd\neq ac + bd$$ What you need to do instead is take the Cauchy product, which has been explained and linked to by several other answers. Alternatively, you could just take the successive derivatives at $x=0$ and look for a pattern.

If you can't use the Cauchy product (which, honestly, I think you can justify having "figured out" since it's not so counterintuitive) and you can't use Euler's formula (that is, $e^{ix}=\cos(x)+i\sin(x)$ where $i=\sqrt{-1}$), then the only option left is to try to look for some pattern in the successive derivatives. So let's give that a try:

\begin{align} f(0) &= e^0\sin(0)=0\\ f'(0) &= e^0(\sin(0)+\cos(0))=1\\ f''(0) &= e^0((\sin(0)+\cos(0)) + (\cos(0)-\sin(0)))\\ &=e^0(\sin(0)+2\cos(0)-\sin(0)) = 2 \end{align} So what's the general pattern here? It's not so obvious, but I will point you to the following result: first of all, by the product rule, we have $$\frac{d}{dx}\left(e^x g(x)\right)=e^x\left(g(x)+g'(x)\right)$$ and, as you calculate successive derivatives, you find \begin{align} \frac{d^n}{dx^n}\left(e^x g(x)\right)&=e^x\left(\frac{d}{dx}+1\right)^n g(x)\\ &=e^x\left(\binom{n}{0}g^{(n)}(x)+\binom{n}{1}g^{(n-1)}(x)+\dots + \binom{n}{n}g(x) \right) \end{align} Which is a strange and interesting result, but if you'll take my word for it for now, we can find the $n^{th}$ derivative at $0$ as \begin{align} f^{(n)}(0)&=\sum_{k=1}^n (-1)^{k}\binom{n}{2k+1}\\ \end{align} ...And what does this expression come out to? Certainly nothing obvious. Plugging in for a view terms gives you $0, 0, -1, -4, -9, -14, -15, -8, 7, 22,\dots$.

As it ends up, the underlying pattern is most conveniently expressed as

$$f^{(n)}(0)=-n+2^{n/2}\sin\left[\frac{n\pi}{4}\right]$$

Would they expect you to figure this out? Probably not. My best guess is that the question only asks for the first few terms of the expansion. At any rate, the full form would then be

$$f(x) = \sum_{n=0}^{\infty} \frac{1}{n!}\left(-n+2^{n/2}\sin\left[\frac{n\pi}{4}\right]\right)x^n$$

I think I made some mistakes in there (for what I believe to be a correct version, see el_tenedor's answer below). The point is: given the apparent scope of your textbook, it should be enough to just give the first few terms.

-
I dont know what a cauchy product is and I want to solve this with what my book has taught me so far. – Paul the Pirate Jul 24 '13 at 20:47
I don't get it, if I sum a series of $1/n$ and add it to the series $1/2n$ wouldn't I just add their seperate sums? Why doesn't that work for the product? – Paul the Pirate Jul 24 '13 at 20:52
@PaulthePirate Why should it work? $$(a_1+a_2+a_3+\cdots)(b_1+b_2+b_3+\cdots)\neq(a_1b_1+a_2b_2+a_3b_3+\cdots)$$ – Ian Mateus Jul 24 '13 at 21:02
It's allmost right. Continuing from above: $$\mathbf{D}_x^n(\mathbf{e}^x F)=\mathbf{e}^x(\mathbf{D}_x+1)^nF=\mathbf{e}^x\left(\sum_{i=0}^n\binom{n}{i} \mathbf{D}_x^iF\right)$$ Sines derivatives at zero is: $$[\mathbf{D}_x^i\sin x]_{x=0}=\cases{(-1)^{(i-1)/2}&i odd\\0&i even}$$ Setting $F=\sin x$, we have:$$[\mathbf{D}_x^n(\mathbf{e}^x \sin x)]_{x=0}=\mathbf{e}^0\left(\sum_{i=0}^n\binom{n}{i}[\mathbf{D}_x^i\sin x]_{x=0}\right)=\sum_{k=0}^{\lceil{n/2}\rceil}\binom{n}{2k+1}(-1)^k$$ with $i=2k+1$ in the last step, realizing that only odd terms contribute. I haven't tripple-checked it... – JohanE Dec 16 '14 at 3:32
@Omnomnomnom; regarding the sudden attention: I'm doing the latter part of a MSc in applied physics, so this is rather basic for me. However, going around the "long way" and showing a general result for derivatives of $e^xf(x)$ that have such a nice form really speaks to me. I really think math can be beautiful! It also reminded me of doing matrix exponentials in an Ordinary Differential Equations course. And other matrix exponentials (and, of course, the operator manipulations) in Quantum Mechanics... Well, to sum up, I just liked reading your answer, and I thought I'd share that with you. – JohanE Dec 16 '14 at 3:49

Writing $$\sin x = \dfrac{e^{ix}-e^{-ix}}{2i}$$ we see that $$e^{x}\sin x = \dfrac{e^{(1+i)x}-e^{(1-i)x}}{2i} = \sum_{n=0}^\infty \frac{1}{n!}\left(\dfrac{(1+i)^n-(1-i)^n}{2i}\right)x^n$$

But $\dfrac{(1+i)^n-(1-i)^n}{2i}$ is just the imaginary part of $(1+i)^n$. Work out what that sequence looks like.

-
I don't know complex numbers. – Paul the Pirate Jul 24 '13 at 20:48
Ah, well then this trick won't work for you, sorry. @PaulthePirate – Thomas Andrews Jul 24 '13 at 20:50

It is the imaginary part of $$e^xe^{ix}=e^{(1+i)x}=\sum_{k\geqslant0}\frac{(1+i)^kx^k}{k!}.$$ Expand it out.

-
I don't know complex numbers. – Paul the Pirate Jul 24 '13 at 20:48

Hints

First method: Use the Cauchy product of the series

Second method: Notice that $e^x\sin x=\mathrm{Im}\left(e^{(1+i)x}\right)$.

-
I don't know complex numbers. – Paul the Pirate Jul 24 '13 at 20:47

Since you are looking for the Maclaurin Series of $f(x):=\exp(x)\sin(x)$ you can start by looking at $f(0)$ and higher derivatives of $f$ at $x=0$. Let $f^{(n)}$ denote the $n$-th derivative of $f$:

\begin{alignat}{2} f(0) &= \exp(0)\sin(0) &&{}= 0 \\ f^{(1)}(0) &= \exp(0)\sin(0)+ \exp(0)\cos(0) &&{}= 1 \\ f^{(2)}(0) &= 2\exp(0)\cos(0) &&{}= 2 \\ f^{(3)}(0) &= 2\exp(0)\cos(0) - 2\exp(0)\sin(0) &&{}= 2 \\ f^{(4)}(0) &= -4\exp(0)\sin(0) &&{}= 0 \\ f^{(5)}(0) &= -4\exp(0)\sin(0) - 4\exp(0)\cos(0) &&{}= -4 \\ f^{(6)}(0) &= -8\exp(0)\cos(0) &&{}= -8 \\ f^{(6)}(0) &= -8\exp(0)\cos(0) + 8\exp(0)\sin(0) &&{}= -8 \\ \dots \end{alignat}

One can now identify the pattern: Define a real sequence $(a_n)_{n \in \mathbb{N}_0}$ with terms $a_n:= f^{(n)}(0)$. If one now consults the On-Line Encyclopedia of Integer Sequences, one can find an explicit, real, non-recursive expression for former sequence, namely:

$a_n = 2^{\frac{n}{2}}\sin(\frac{n\pi}{4})$

Knowing this, one can write the Maclaurin Series as follows:

\begin{align} \exp(x)\sin(x) &= \sum_{n=0}^\infty \frac{f^{(n)}(0)}{n!}x^n\\ &= \sum_{n=0}^\infty \frac{a_n}{n!}x^n \\ &= \sum_{n=0}^\infty \frac{2^{\frac{n}{2}}\sin(\frac{n\pi}{4})}{n!}x^n \\ &= x + x^2 + \frac{1}{3}x^3 - \frac{1}{30}x^5 - \frac{1}{90}x^6 - \frac{1}{630}x^7 + \frac{1}{22680}x^9 + \frac{1}{113400}x^{10} + \dots \\ \end{align}

-

A much simpler way of doing this is to take the Maclaurin series given in a table and to multiply them out.

$(1 + x + \frac{x^2}{2!}) * (x - \frac{x^3}{3!} + \frac {x^5}{5!})$

Multiply that out and you will have the first few terms of the Maclaurin series.

I am not sure what this represents but it is what my book does for a similar problem later on in the book. Confusion arises when trying to add strange terms like $\frac{x^n}{n!} + \frac{x^{n+1}}{n!}$

-