<s>[INST] Solving a second order ODE of the form $y'' + P(x)y' + Q(x)y = f(x)$, given one part of the solution I have the following ODE
$$x(x-1)y'' - (2x-1)y' + 2y = 2x^3-3x^2$$ where I'm given
$$y_1 = x^2$$
Now, my workbook states that if we encounter such an ODE, where one part of the solution is given, the other part $y_2$ is $$y_2 = y_1 \int \frac{e^{-\int P(x)dx}}{y_1^2}dx$$
After I divide my equation by $x(x-1)$ and substituting into the formula for $y_2$, I get
$$y_2 = x^2\int\frac{(x-1)x}{x^4}$$
$$y_2 = \frac{1-2x}{2}$$
Now, $$y=c_1x^2 + c_2\frac{1-2x}{2}$$
Which is the solution of the homogenous equation. In order to find the particular solution, I used variation of constants, where I got the system:
$$
\left\{ 
\begin{array}{c}
c_1'x^2 + c_2'\frac{1-2x}{2} = 0 \\
c_1' 2x - c_2' = \frac{2x^2 - 3x}{x-1}
\end{array}
\right. 
$$
The solution for which are
$c_1' = \frac{(2x-3)(1-2x)}{x-1}$
and
$c_2' = \frac{x^3(2x-3)}{x(x-1)^2}$
Which after integrating end up being
$$c_1 = \ln|x-1| - 2(x-1)^2 + C_1$$
and $$c_2 = \frac{x^3}{x-1} + C_2$$
After plugging in into the solution, I get
$$y = x^2 ( \ln|x-1| - 2(x-1)^2 + C_1) + \frac{1-2x}{2}(\frac{x^3}{x-1}+C_2)$$
However, this is not the same as the solution in my workbook which is
$$y=C_1x^2 + C_2(-x+\frac{1}{2}) + x^3 - \frac{x^2}{2} + x-\frac{1}{2}$$
Where did I go wrong?
 [/INST] Your equations for $c_1'$ and $c_2'$ are
$$
\begin{pmatrix}
x^2 & \frac12 (1-2x) \\
2x & -1
\end{pmatrix}
\begin{pmatrix}
c_1' \\
c_2'
\end{pmatrix}
=
\begin{pmatrix}
0 \\
\frac{2x^2-3x}{x-1}
\end{pmatrix}
,
$$
and with the help of the useful formula
$$
\begin{pmatrix} a & b \\ c & d \end{pmatrix}^{-1}
=
\frac{1}{ad-bc}
\begin{pmatrix} d & -b \\ -c & a \end{pmatrix}
$$
we get
$$
\begin{split}
\begin{pmatrix}
c_1' \\
c_2'
\end{pmatrix}
&=
\frac{1}{x(x-1)}
\begin{pmatrix}
-1 & -\frac12 (1-2x) \\
-2x & x^2
\end{pmatrix}
\begin{pmatrix}
0 \\
\frac{2x^2-3x}{x-1}
\end{pmatrix}
\\ &
=
\frac{2x-3}{(x-1)^2}
\begin{pmatrix}
\frac12 (2x-1) \\
x^2
\end{pmatrix}
.
\end{split}
$$
So you're missing a factor of $1/2$ and the square in the denominator in your formula for $c_1'$.
</s>