# What is wrong with my series expansion of $\cos(\sin(x))$

I need to expand the Maclaurin series for $$f(x)=\cos(\sin(x))$$

I take the first derivative of this function and I obtain $$f'(x)=\sin(\sin(x))\cdot -\cos(x)$$

I then assume that the series of $$f(x)=\cos(\sin(x))$$ takes the form: $$b_0+b_1x+b_2x^2+b_3x^3+b_4x^4+b_5x^5+b_6x^6+b_7x^7+O(x^8)$$

The series for $$-\cos(x)=-1+\dfrac{x^2}{2}-\dfrac{x^4}{24}+\dfrac{x^6}{720}-\dfrac{x^8}{40320}+\dfrac{x^{10}}{3628800}-\dfrac{x^{12}}{479001600}$$

I let $$a_0$$ through $$a_n$$ denotes the coefficients of $$-cos(x)$$, so I have: $$a_0=-1, a_1=0, a_2=\dfrac{1}{2}, a_3=0, a_4=-\dfrac{1}{24},...$$

The series for $$f'(x)=\sin(\sin(x))\cdot -\cos(x)=b_1+2b_2x+3b_3x^2+4b_4x^3+5b_5x^4+6b_6x^5+7b_7x^6+8b_8x^7$$ This means the differentiate the series of $$f(x)=\cos(\sin(x))$$

The Cauchy product of two power series is defined as:

$$A= a_0+a_1x+a_2x^2+a_3x^3+a_4x^4+...$$

$$B= b_0+b_1x+b_2x^2+b_3x^3+b_4x^4+...$$

$$A\cdot B=a_0b_0+(a_0b_1+a_1b_0)x+(a_0b_2+a_1b1_1+a_2b_0)x^2...$$

I equate the coefficients of $$f'(x)=\sin(\sin(x))\cdot -\cos(x)$$

It is here that I am lost, this method works well for series expansion of $$e^{cos(x)}$$ and $$e^{sin(x)}$$, but it doesn't seem to work here. I don't know the series expansion of $$\sin(\sin(x))$$

Is there any better method than employing directly the Taylor formula for $$x=0$$. An elegant way of expanding this functions rather than brute force calculation.

• One possibility is to apply one Taylor series inside another one and simplify the double sum – gt6989b Nov 26 '19 at 21:00
• If you take the second derivative you find $f''(x) = - \cos(\sin(x)) \cos^2(x) + \sin(\sin(x)) \sin(x) = - f(x) \cos^2(x) - f'(x) \tan(x)$ which should give you a two-term recurrence relation (as opposed to the simple recurrence you get with $e^{\cos(x)}$). – Willie Wong Nov 26 '19 at 21:05
• @WillieWong: Can you do a complete answer so I can learn? How does one obtain the result by employing the second derivative? – James Warthington Nov 26 '19 at 21:11

Rather than calculating derivatives. Substitute $$\begin{eqnarray*} \sin(x)=x-\frac{x^3}{6}+\frac{x^5}{120}-\frac{x^7}{5040}+\cdots \end{eqnarray*}$$ into $$\begin{eqnarray*} \cos(x)=1-\frac{x^2}{2}+\frac{x^4}{24}-\frac{x^6}{720}+\cdots. \end{eqnarray*}$$ This gives $$\begin{eqnarray*} \cos(\sin(x))=1 &-& \frac{1}{2} \left( x-\frac{x^3}{6}+\frac{x^5}{120}-\frac{x^7}{5040}+\cdots \right)^2 \\ & +& \frac{1}{24}\left( x-\frac{x^3}{6}+\frac{x^5}{120}-\frac{x^7}{5040}+\cdots \right)^4 \\ &-& \frac{1}{720} \left( x-\frac{x^3}{6}+\frac{x^5}{120}-\frac{x^7}{5040}+\cdots \right)^6+\cdots. \end{eqnarray*}$$ and expand upto the order you require $$\begin{eqnarray*} \cos(\sin(x))=1 -\frac{x^2}{2} +\frac{5x^4}{24}+\cdots. \end{eqnarray*}$$

• How does one simply for example $(x-\dfrac{x^3}{6}+\dfrac{x^5}{120}-\dfrac{x^7}{5040}+O(x^9))^2$. I have seen this method before I am always unsure of how to simplify the sum up to higher powers. How do you simplify them? – James Warthington Nov 26 '19 at 21:15
• \begin{eqnarray*} (a+b+c+\cdots)^2=a^2+2ab+b^2+2ac+2bc+c^2+ \cdots . \end{eqnarray*} It gets tougher for larger powers than $2$. Look up Multinomial expansions. – Donald Splutterwit Nov 26 '19 at 21:18
• So this method is as complicated if not more than successively taking derivative, right? – James Warthington Nov 26 '19 at 21:19
• Personally I would prefer calculating the terms in the expansion above, rather than keep track of the function of a function & products entailed by successive differentiation. Either way, the higher the order, the more complicated it will become. – Donald Splutterwit Nov 26 '19 at 21:22
• I guess there is no simple way to find the series expansion for this function, brute force calculation is the way to go, it seems. – James Warthington Nov 26 '19 at 21:25

Set $$f(x) = \cos(\sin(x))$$. Compute $$f'(x) = - \sin(\sin(x)) \cos(x) \qquad f''(x) = - \cos(\sin(x)) \cos^2(x) + \sin(\sin(x)) \sin(x)$$ So $$f''(x) = - f(x) \cos^2(x) - f'(x) \tan(x)$$

Assume $$f(x)$$ has Maclaurin series $$\sum a_n x^n$$, and denote the Maclaurin series expansions $$- \cos^2(x) = \sum b_n x^n \qquad -\tan(x) = \sum c_n x^n$$ the relation gives $$\sum (n+2)(n+1) a_{n+2} x^n = \sum a_n b_m x^{n+m} + \sum (n+1)a_{n+1} c_m x^{n+m}$$

Setting the coefficients equal to each other you have $$a_{n+2} = \frac{1}{(n+1)(n+2)}\sum_{m = 0}^n (a_m b_{n-m} + (m+1) a_{m+1} c_{n-m})$$

So if you know what $$a_0$$ and $$a_1$$ are, you can use this formula to compute successively the higher order $$a_n$$s, provided you know the coefficients $$b_n$$ and $$c_n$$. (This is essentially the procedure you described in your post.)

(Notice that $$a_0 = f(0) = \cos(0) = 1$$ and $$a_1 = f'(0) = 0$$. In fact, since $$f(x)$$ is an even function of $$x$$, we know that its Maclaurin expansion should have no odd terms.)

The only thing that is not so convenient for this procedure, however, is the fact that the explicit formula for the Maclaurin coefficients of $$\tan(x)$$ is somewhat obscure.

• just a small question how does $\sin(\sin(x))\sin(x)=-f'(x)\tan(x)$ – James Warthington Nov 26 '19 at 21:38
• $\cos(x) \tan(x) = \cos(x) \frac{\sin(x)}{\cos(x)} = \sin(x)$? – Willie Wong Nov 26 '19 at 21:42
• I still don't understand where does $(n+2)(n+1)$ in $\sum (n+2)(n+1) a_{n+2} x^n$ come from, can you explain further? – James Warthington Nov 26 '19 at 23:00
• If $f(x)$ has the Taylor series $\sum a_n x^n$, then $f''(x)$ has Taylor series $\sum a_{n+2} (n+2)(n+1) x^n$. You obtain this through term-by-term differentiation which gives $\sum a_n n (n-1) x^{n-2}$ and then relabeling changing $n$ to $n+2$ so that instead of $x^{n-2}$ we see $x^n$. – Willie Wong Dec 2 '19 at 14:17