Power Series Solution for an ODE which has trigonometric coefficient functions

The ODE for which we seek a power series solution is: $$y''+ \cos(x)y' + x\sin(x)y = 0,\hspace{0.4cm} y(0) = 1,\hspace{.1cm} y'(0) = 0$$

I need to find the partial sum up to five, from the initial conditions I know $a_0=1$ and $a_1=0$, I also know I need to find the recurrence relation to get the coefficients but therein lies my issue. I'm as far as:

$$\sum_{n=2}^{\infty}n(n-1)a_n x^{n-2} + \cos (x)\sum_{n=1}^{\infty} n a_n x^{n-1} + x\sin(x)\sum_{n=0}^{\infty}a_nx^n = 0$$

I believe I need to use the power series representation of cosine and sine then take the Cauchy product to simplify. Is this the right track? If so could someone help me understand how exactly the algebra of the Cauchy product in this case works out, I've only ever used it in the simple cases before.

So I figured I'd update this post so anyone who may have a similar question somewhere down the line isn't left hanging. Thanks again to Ian for helping with this.

First of all rather than using the full series representation of sine and cosine you really only need:

$$\cos (x) = 1 - \frac{x^2}{2} + \frac {x^4}{24} + ..., \hspace{0.4cm} x\sin (x) = x^2 - \frac {x^4}{6}+ ...$$

You only need these terms because you're looking for the partial sum up to five. Now bear with me the next part is long. Substitute this along with the power series for $y =\sum_{n=0}^{5}a_nx^n$ again just use the first five terms. Then:

\begin{align} y & = (2a_2 +6a_3 +12 a_x^2 + 20a_3x^3)\\ &\hspace{.4cm} +(1 - \frac{x^2}{2} + \frac {x^4}{24})(2a_2x+3a_3x^2 +4a_4x^3+5a_5x^4)\\ &\hspace{.4cm} +(x^2-\frac{x^4}{6})(1+ a_2x^2+a_3x^3+a_4x^4+a_5x^5) \end{align} Now just collect the constants on like-ordered terms, for example: $$x^0 \to 2a_2 = 0 \Rightarrow a_2 = 0$$ or $$x^2 \to 12a_4 +3a_3 +1 + a_2 = 0 \Rightarrow a_4 = \frac {-1}{12}$$ Just remember to do them in order since the constants "build". That isa_0, a_1, \text{and } a_2 \text{ are needed to get } a_3 $. Finally just stick the constants into$y = \sum_{n=0}^{5}a_nx^n$and then you can use it to approximate some value for$y(x)\$.

Sorry about the sort of messy formatting, I'm not overly familiar with MathJax formatting.

• Formally you need the Cauchy product but informally this just means distributing the multiplication and collecting all terms of a given order. Doing this by hand for a few orders would probably help you guess a recurrence. – Ian Nov 8 '17 at 1:38
• Okay, I'll give that a try! Thanks for the suggestion. – R. Arctor Nov 8 '17 at 3:47
• That worked, wasn't able to derive the formula for the recurrence as nicely as other problems but I got the necessary coefficients for the partial sum. Thanks again Ian. – R. Arctor Nov 9 '17 at 1:42