<s>[INST] Initial value problem with $x^2u''-2xu'+2u=24/x^2$ I have some trouble finding the coefficients and powers of $x$ in the following problem.
Solve  $x^2u''-2xu'+2u=\frac{24}{x^2}$ with $u(1)=2$ and $u'(1)=-5$. 
I first set $$Lu_H=x^2u''-2xu'+2u=0$$ to find the homogeneous solution. After differentiating and substituting into the homogeneous equation I obtain $$Lu_H=\sum_{k=0}^{\infty}\left[x^k\left(A_{k+2}k(k-1)x^2-2A_{k+1}kx+2A_k\right)\right].$$ (This seems to be the problem as I get one coefficient correct later on but another one incorrect).
For the particular solution, I try $$u_P=\frac{C}{x^2}$$ for some constant $C$, which yields $C=2$. (By the way, this part seems to be correct as there is a term in the answers which matches up).
We now have $$u=u_H+u_P=\sum_{k=0}^{\infty}\left[x^k\left(A_{k+2}k(k-1)x^2-2A_{k+1}kx+2A_k\right)\right] +\frac{2}{x^2}.$$
Differentiating and substituting the initial values implies that $$\sum_{k=0}^{\infty}\left[A_{k+2}k(k-1)-2A_{k+1}k+2A_k \right]=0 \qquad (\ast)$$ and $$\sum_{k=0}^{\infty}A_{k+1}\left[k(k-1)(k-2)-2k(k+1)+2k \right]=-1.$$
I seem to have done something wrong somewhere, however, as the answers give $u=x-x^2+2x^{-2}$. The first thing is the equation $(\ast)$, which gives me the wrong value for the coefficient. The second thing I don't understand is where the terms in $x$ and $x^2$ come from in the answers. 
I can see where my coefficients should be going and that substituting this back in will solve the original equation, but if someone could explain why we know that these are the terms that go with the coefficients that would be just dandy. 
Many thanks.
 [/INST] Easier way to see the solution:
$$\frac{d}{dx} \frac{u}{x} = \frac{u'}{x}-\frac{u}{x^2}$$
$$\frac{d^2}{dx^2} \frac{u}{x} = \frac{u''}{x}-2 \frac{u'}{x^2} + 2 \frac{u}{x^3}$$
So...divide both sides of the ODE by $x^3$ and get
$$\frac{u''}{x}-2 \frac{u'}{x^2} + 2 \frac{u}{x^3} = \frac{d^2}{dx^2} \frac{u}{x} = \frac{24}{x^5}$$
Integrate twice w.r.t $x$:
$$\frac{d}{dx} \frac{u}{x} = -\frac{6}{x^4} + C_1$$
$$\frac{u}{x} = \frac{2}{x^3}+C_1 x+C_2 \implies u(x) = \frac{2}{x^2}+C_1 x^2+C_2 x$$
Apply initial conditions:
$$u(1)=2 \implies C_1+C_2=0$$
$$u'(1) = -5 \implies 2 C_1+C_2 = -1 \implies C_1=-1 \quad C_2=1$$
Therefore
$$u(x) = \frac{2}{x^2}-x^2+x$$
</s>