<s>[INST] ODE series solution with IVP I am a little rusty with initial conditions. If anyone can confirm that I nailed this then I would be very happy. i need to write about five terms in my series to the solution of
$xy'' + y = 0$
$y(1) = 5$
$y'(1) = 0$
So my solution will look something like $y = \sum_{n=0}^{\infty}a_n (x - 1)^n$
$y' = \sum_{n=1}^{\infty}na_n (x - 1)^{n-1}$
$y'' = \sum_{n=2}^{\infty}n(n-1)a_n (x - 1)^{n-2}$
$\begin{align}xy'' + y & = x\sum_{n=2}^{\infty}n(n-1)a_n (x - 1)^{n-2}  + \sum_{n=0}^{\infty}a_n (x - 1)^n \\
& = (x - 1 + 1) \sum_{n=2}^{\infty}n(n-1)a_n (x - 1)^{n-2} + \sum_{n=0}^{\infty}a_n (x - 1)^n \\
& = \sum_{n=2}^{\infty}n(n-1)a_n (x - 1)^{n-1} + \sum_{n=2}^{\infty}n(n-1)a_n (x - 1)^{n-2} + \sum_{n=0}^{\infty}a_n (x - 1)^n  \\
& = \sum_{n=1}^{\infty}n(n+1)a_{n+1} (x - 1)^n + \sum_{n=0}^{\infty}(n+2)(n+1)a_{n+2} (x - 1)^n + \sum_{n=0}^{\infty}a_n (x - 1)^n \\
& = \sum_{n=0}^{\infty}n(n+1)a_{n+1} (x - 1)^n + \sum_{n=0}^{\infty}(n+2)(n+1)a_{n+2} (x - 1)^n + \sum_{n=0}^{\infty}a_n (x - 1)^n \\
& = \sum_{n=0}^{\infty}(x - 1)^n[n(n+1)a_{n+1} +(n+2)(n+1)a_{n+2} +a_n]\\
& = 0
\end{align}$
So it is 0 if and only if $n(n+1)a_{n+1} +(n+2)(n+1)a_{n+2} +a_n = 0 \iff a_{n+2} = -\dfrac{a_n}{(n+1)(n+2)} -\dfrac{na_n}{n+2}$
After solving I got this pattern
$a_2 = \dfrac{-a_0}{2}$
$a_3 = \dfrac{-a_1}{2\cdot 3}-\dfrac{a_2}{3}$
$a_4 = \dfrac{-a_2}{3\cdot 4}-\dfrac{2a_3}{4}$
For the initial conditions, is this correct?
$y(1) = \sum_{n=0}^{\infty}a_n (1 - 1)^n = a_0 = 5$ because all the other terms go to 0 and the limit of $0^0$ is 1
Same process
$y'(1) = y' = \sum_{n=1}^{\infty}na_n (1 - 1)^{n-1}= a_1 = 0$ because all the other terms go to 0 and the limit of $0^0$ is 1
If I am correct with I am doing so far then my solution should be $y \approx 5  - \frac{5}{2}x^2 + \frac{5}{6}x^3 - \frac{5}{24}x^4$
Thank you very much for taking the time to read 
 [/INST] Your solution is correct. When the number of terms to determine is given in advance, I prefer not to write out the entire series at all. My quick-and-dirty solution would be
$$y=5+a(x-1)^2+b(x-1)^3+c(x-1)^4+O((x-1)^5)$$
$$y''=2a+6b(x-1)+12c(x-1)^2+O((x-1)^3)$$
$$xy''=y+(x-1)y''=2a+(2a+6b)(x-1)+(6b+12c)(x-1)^2+O((x-1)^3)$$
Hence $2a+5=0$, $2a+6b=0$, $a+6b+12c=0$, and the solution is $a=-5/2$, $b=5/6$, $c=-5/24$.
</s>