# Need help with the general formula for the Taylor series of $e^x+\sin(x)$

A while ago, I asked about ways to derive the sigma notation for the infinite series of $$e^x+sin(x)$$.

$$e^x+\sin(x) = 1+2x+\dfrac{x^2}{2!}+\dfrac{x^4}{4!}+\dfrac{2x^5}{5!}+\dfrac{x^6}{6!}+\dfrac{x^8}{8!}+\dfrac{2x^9}{9!}+...$$

Clive Newstead brilliantly gave me two formulas.

There, he said that the pattern of the series, regarding the coefficient of the numerators, is as followed: 1,2,1,0,1,2,1,0

He said that the pattern is "is periodic with period 4"

This comment still puzzles me. I have tried to validate his formula and it is true, they are all correct, but I don't know why he can come up with succinct representation of the pattern:

$$\sum_{k=0}^{\infty} \left( \dfrac{x^{4k}}{(4k)!} + \dfrac{2x^{4k+1}}{(4k+1)!} + \dfrac{x^{4k+2}}{(4k+2)!} \right)$$

How does one realize that the power is related to $$4k, 4k+1$$ and $$4k+2$$ and $$4k+3$$?

This seems to relate to finding the general formula for a sequence or series of number, for example, trivially

$$1, 3, 5, 7, ...$$ can be represented as $$2k+1$$

$$0, 2, 4, 6, ...$$ can be represented as $$2k$$

with $$k$$ as the position of the term in the sequence.

So my thought is you to count the terms that have the numerator's coefficient as $$1$$, $$2$$ and $$0$$

The ones that have $$1$$ is $$1^{st}$$, $$3^{sd}$$, $$5^{th}$$, $$7^{th}$$, etc.

The ones that have $$2$$ is $$2^{sd}$$, $$6^{th}$$, $$10^{th}$$, $$14^{th}$$, etc.

The ones that have $$0$$ is $$4^{th}$$, $$8^{th}$$, $$12^{th}$$, $$16^{th}$$, etc.

So the difference between the positions of the terms that contain the coefficient $$1$$ is $$2$$

So the difference between the positions of the terms that contain the coefficient $$2$$ is $$4$$

So the difference between the positions of the terms that contain the coefficient $$0$$ is $$4$$

I find that the general term for terms that contain $$1$$ is $$2k+1$$

I find that the general term for terms that contain $$2$$ is $$4k-2$$

I find that the general term for terms that contain $$0$$ is $$4k$$

But I don't know how to derive these into $$4k$$, $$4k+1$$, $$4k+2$$, $$4k+3$$

I realize that this is similar to finding patterns of a sequence on an IQ test, but I don't know how to derive it. One my friend said I should look into Lagrange's interpolation, but I don't why this technique has anything to do with writing down the general terms for sequences and series.

Could you help me on this?

Methinks, this is a simple question. I am not good at writing down general term of a sequence yet.

• note that the coefficients of the Maclaurin series for $\sin x$ are periodic with period $4$ – J. W. Tanner Jan 24 at 22:33
• The general formula for $\sin(x)$ is $$\sum_{k=0}^{\infty}\dfrac{x^{2n+1}}{(2n+1)!}$$, the coefficients of the numerators are all ones, so I don't quite understand what are you trying to say? Sorry, could you clarify more? – James Warthington Jan 24 at 23:17
• I realize that he breaks terms that contain $1$ in the numerators into 2, $4k$ and $4k+2$, quite clever. – James Warthington Jan 24 at 23:23
• @JamesWarthington: That is the formula for $\sinh x$, not $\sin x$. – TonyK Jan 24 at 23:39
• Yeah, thanks, I forgot to add $(-1)^{n}$ – James Warthington Jan 24 at 23:44

$$e^x = 1 + x + \frac {x^2}{2} + \frac {x^3}{3!} + \cdots$$

It seem pretty natural to write this as
$$e^x = \sum_\limits{n=0}^\infty \frac {x^n}{n!}$$

But we could look at pairs of terms.

$$e^x = \sum_\limits{n=0}^\infty \left(\frac {x^{2n}}{2n!}+\frac {x^{2n+1}}{(2n+1)!}\right)$$

Or, even triples of terms.

$$e^x = \sum_\limits{n=0}^\infty \left(\frac {x^{3n}}{3n!}+\frac {x^{3n+1}}{(3n+1)!}+\frac {x^{3n+2}}{(3n+3)!}\right)$$

And do the same thing with $$\sin x$$

$$\sin x = \sum_\limits{n=0}^\infty (-1)^n \frac {x^{2n+1}}{(2n+1)!} = \sum_\limits{n=0}^\infty \left(\frac {x^{4n+1}}{(4n+1)!} - \frac {x^{4n+3}}{(4n+3)!}\right)$$

Now find a representation of $$e^x$$ that plays nicely with our representation of $$\sin x$$ add them together and you have what you show above.

• Thanks, very instructive.I've understood! – James Warthington Jan 24 at 23:34

Remember that for the series centered around the point b, the coefficient $$a_{n} = \frac{f^{(n)}(b)}{n!}$$. So if $$f^{(4)}(x) = f(x)$$ then $$f^{(n)}(b)$$ is periodic with not necessarily prime period 4.

This is why you can be sure that the $$f^{(n)}(b)$$ is periodic with period 4 in your case.

Let $$f(x) = e^{x}$$, then $$f'(x) = e^{x}$$, and so continuing to take derivatives $$f^{(4)}(x)=e^{x}$$.

Let $$g(x) = sin(x)$$ then $$g''(x)=-sin(x)$$ and so $$g^{(4)}(x) = sin(x)$$

So for $$h(x)=f(x) + g(x)$$ we have $$h^{(4)}(x) = (f(x)+g(x))'''' = f^{(4)}(x) + g^{(4)}(x) = f(x) + g(x) = h(x)$$.

In this way you can see that the $$f^{(n)}(b)$$ has the period 4 structure.

• What if, by continuously taking the derivatives, the function we are dealing with do not have periodic derivatives? For example $\tan(x)$? – James Warthington Jan 25 at 0:06
• Insightful comment, thank you, BTW! :) – James Warthington Jan 25 at 0:07
• @JamesWarthington Then the coefficients will likely not have this periodic form, Of course what they do will depend on the function you are working with, they could still have some sort of pattern. – open problem Jan 25 at 0:09
• So I guess it is not always possible to write a general formula for all power series? Am I correct? Or is it otherwise? – James Warthington Jan 25 at 0:11
• To do so you will need a formula for the evaluation of the nth derivative of the function at the point you have centered your power series around. – open problem Jan 25 at 0:14

The mod $$4$$ periodicity can perhaps be most easily understood using the formula $$e^{ix}=\cos x+i\sin x$$, so that $$\sin x={e^{ix}-e^{-ix}\over2i}$$, which gives

$$e^x+\sin x={1\over2i}\sum_{n=0}^\infty{(2i+i^n-(-i)^n)x^n\over n!}$$

Since $$i^4=1$$, the coefficients $$2i+i^n-(-i)^n$$ cycle through the values

\begin{align} 2i+i^0-(-i)^0&=2i+1-1=2i\\ 2i+i^1-(-i)^1&=2i+i-(-i)=4i\\ 2i+i^2-(-i)^2&=2i-1-(-1)=2i\\ 2i+i^3-(-i)^3&=2i-i-i=0 \end{align}