Solve second order linear ODE if particular solution of the homogenous part is known Here's this ODE: $$x(x-1)y'' -(2x-1)y' + 2y = 2x^3 -3x^2$$
and $$y_1 =x^2$$
I know that I have to consider the homogenous part of the ODE first, which is $$x(x-1)y'' -(2x-1)y' + 2y = 0$$
If one solution is already known, then the second one can be calculated as:
$$y_2(x) = y_1(x)\int \frac{e^{-\int P(x)dx}}{y_1^2(x)}dx$$, after which the solution of the homogenous part is $$C_1y_1(x) + C_2y_2(x)$$
After I divided my equation by $x(x-1)$ I solved the first part and got $$C_1x^2 + C_2(-x+\frac{1}{2})$$
Now I need to find the rest of the solution (By the way, the full solution is: $$C_1x^2 + C_2(-x+\frac{1}{2}) +x^3 -\frac{x^2}{2}+x-\frac{1}{2}$$
I tried the variation of constants by forming the following system of equations:
$$C_1'(x)x^2 + C_2'(x)(-x+\frac{1}{2})=0$$
$$C_1'(x)2x - C_2'(x)=\frac{x(2x-3)}{x-1}$$
I used Cramer's method of solving the system and got that
$C_1' = \frac{-(2x-3)(-2x+1)}{2(x-1)^2}$ and
$C_2' = \frac{x^2(2x-3)}{(x-1)^2}$
Now if I integrate both I get:
$C_1 = 2x + \frac{1}{2(x-1)} -2$
and
$C_2 = \frac{x^3 -3x +3}{x-1}$
However, when I add these two $C_1$ and $C_2$ I don't get anything that resembles the $x^3 -\frac{x^2}{2}+x-\frac{1}{2}$ part of the solution.
Can anyone please help me with this? Have I correctly calculated $C_1$ and $C_2$? What do I do with them?
 A: Since we have a linear equation, we can make use of the reduction of order method, a sort of proto-variation of parameters method. With $x^2$ as our given solution, we try to find solutions of the form $c(x)x^2$, and substituting this into our equation should lead us to a first order linear equation we can use to get the rest of our solution.
$$ (c(x)x^2)' = x^2 c'(x) + 2x c(x) \\ (c(x)x^2)'' = x^2c''(x) + 4xc'(x) + 2c(x) $$
After the substitution and some rearrangement, we get the surprisingly nice equation
$$ x(x-1)c''(x) + (2x-3)(c'(x)-1) = 0 $$
This is separable in $c'(x)$
$$ \frac{[c'(x)]'}{[c'(x)]-1} = \frac{3-2x}{x(x-1)} $$
which can be integrated to get (for a smart choice of arbitrary constant)
$$ c'(x) = c_2\left(\frac{2}{x^3} - \frac{2}{x^2}\right) + 1 $$
Then we can integrate again to get
$$ c(x) = c_1 + c_2\left(\frac{2}{x} - \frac{1}{x^2}\right) + x $$
and then multiply to get our general solution
$$ y(x) = c(x)x^2 = c_1x^2 + c_2(2x-1) + x^3 $$
You might be asking: "where did the rest of the solution go?"
Notice that $-\dfrac{x^2}{2}$ can be absorbed into the $c_1$ term, and $x-\dfrac{1}{2}$ can be absorbed into the $c_2$ term. The only inhomogeneous solution that contributes independently from the homogeneous solution is $x^3$. The fact that my solution arrived here directly is a consequence of the "smart choice of arbitrary constant".
A: First, after considering $y_1 = c_1 x^2$ as a particular solution for the homogeneous
$$
x(x-1)y_h'' -(2x-1)y_h' + 2y_h = 0
$$
we have by constants variation (Lagrange)
$$
y_h = \left(\frac{c_2 (2 x-1)}{2 x^2}+c_3\right)x^2 = \frac{c_2}{2}(2x-1)+c_3 x^2
$$
now, using the Lagrange method again we propose for the complete ODE a particular solution with the structure
$$
y_p = \frac{c_2(x)}{2}(2x-1)+c_3(x) x^2
$$
and after substitution into
$$
x(x-1)y_p'' -(2x-1)y_p' + 2y_p = 2x^3 -3x^2
$$
we obtain
$$
\frac{1}{2} x (x (2 x-3)+1) c_2''(x)-\frac{c_2'(x)}{2}+(x-1) x^3 c_3''(x)+(2 x-3) x^2 c_3'(x)+(3-2 x) x^2 = 0
$$
as long as $c_2(x), c_3(x)$ are independent functions we can establish
$$
\cases{
\frac{1}{2} x (x (2 x-3)+1) c_2''(x)-\frac{c_2'(x)}{2}=0\\
(x-1) x^3 c_3''(x)+(2 x-3) x^2 c_3'(x)+(3-2 x) x^2 = 0
}
$$
We are looking for a particular solution then $c_2(x) = 0$ satisfies this condition. Regarding $c_3(x)$ we find
$$
c_3(x) = -\frac{3}{2 x^2}+x+\frac{3}{x}
$$
and finally
$$
y = y_h+y_p = \frac{c_2}{2}(2x-1)+c_3 x^2 + x^3+3 x-\frac{3}{2}
$$
The constants are $c_2, c_3$
