As a series, y=∑aᵣxʳ=a₀+a₁x+a₂x²+a₃x³+... where the range for the summation is r=0 to r=n.
We can write the derivatives similarly: y'=∑raᵣxʳ⁻¹, y''=∑r(r-1)aᵣxʳ⁻².
The DE can therefore be written:
2y''-xy'+(x²-1)y=0=2∑r(r-1)aᵣxʳ⁻²-x∑raᵣxʳ⁻¹+(x²-1)∑aᵣxʳ.
That is: ∑2r(r-1)aᵣxʳ⁻²-∑raᵣxʳ+∑aᵣxʳ⁺²-∑aᵣxʳ=0.
We can start to group terms with the same power of x:
∑2r(r-1)aᵣxʳ⁻²-∑(raᵣ+aᵣ)xʳ+∑aᵣxʳ⁺²=0 or
∑2r(r-1)aᵣxʳ⁻²-∑aᵣ(r+1)xʳ+∑aᵣxʳ⁺²=0.
By adjusting the subscripts we can write:
∑2(r+2)(r+1)aᵣ₊₂xʳ-aᵣ(r+1)xʳ+aᵣ₋₂xʳ=0 which groups all xʳ terms.
So the series can now be expressed in terms of powers of x, with coefficient:
2(r+2)(r+1)aᵣ₊₂-aᵣ(r+1)+aᵣ₋₂ for xʳ.
(Substitute n for r to get the coefficient for xⁿ.)
EXAMPLES
Coefficient for x⁰: 4a₂-a₀
Coefficient for x: 12a₃-2a₁
Coefficient for x²: 24a₄-3a₂+a₀
Coefficient for x³: 40a₅-4a₃+a₁