TITLE: Solving a Second Order Order linear ODE when one solution is known
QUESTION [5 upvotes]: The following problem is from the book "Introduction to Ordinary Differential Equations" by
Shepley L. Ross.
Problem:
Given that $y = x$ is a solution of
$$ (x^2 -2x + 2)y'' - x^2y' + xy = 0$$
find a linearly independent solution by reducing the order. Write the general solution.
Answer:
Let $f(x)$ represent the solution we have.
\begin{align*}
f(x) &= x \\
y &= f(x) v = xv \\
y' &= x v' + v \\
y'' &= x v'' + v' + v' = xv'' + 2v' \\
\end{align*}
\begin{align*}
(x^2 -2x + 2)( xv'' + 2v') - x^2(x v' + v ) + x^2 v  &= 0 \\
(x^2 -2x + 2)( xv'' + 2v') - x^3 v'  &= 0 \\
(x^3 -2x^2 + 2x)xv'' + (-x^3 + 2x^2 -4x + 4)v'  &= 0 \\
(x^4 -2x^3 + 2x^2)v'' + (-x^3 + 2x^2 -4x + 4)v'  &= 0 \\
\end{align*}
Now we let $w = \frac{dv}{dx}$ and this gives us a separable differential equation.
\begin{align*}
(x^4 -2x^3 + 2x^2)w' + (-x^3 + 2x^2 -4x + 4)w  &= 0 \\
(x^4 -2x^3 + 2x^2)w' &= (x^3 - 2x^2 + 4x - 4)w  \\
(x^4 -2x^3 + 2x^2) \,\, dw &= (x^3 - 2x^2 + 4x - 4)w \,\, dx  \\
\frac{dw}{w} &= \frac{ (x^3 - 2x^2 + 4x - 4) \, dx }{ x^4 -2x^3 + 2x^2 } \\
\end{align*}
Now we perform the following integration using an online integral calculator:
$$ \int \frac{ x^3 - 2x^2 + 4x - 4 }{x^4 -2x^3 + 2x^2} \,\, dx  =
 \frac{\ln{| x^2 - 2x + 2 |}}{2}  + \arctan{ \frac{ 2x - 2 }{2 } } + \frac{2}{x} + C_1 $$
\begin{align*}
\ln{|w|} &= \frac{\ln{| x^2 - 2x + 2 |}}{2}  + \arctan{ \frac{ 2x - 2 }{2 } } + \frac{2}{x} + C_1 \\
\end{align*}
At this point, I am confident that my attempt to solve the problem is wrong.
The book's answer is:
$$ y = (x-2)e^{x} $$
I would expect the book's answer to have at least one constant if not two in the answer since there were no initial conditions given.
Thanks,
Bob
Here is my second attempt to solve the problem. I think I go wrong in the last step but I am not sure where.
Answer:
Let $f(x)$ represent the solution we have.
\begin{align*}
f(x) &= x \\
y &= f(x) v = xv \\
y' &= x v' + v \\
y'' &= x v'' + v' + v' = xv'' + 2v' \\
\end{align*}
\begin{align*}
(x^2 -2x + 2)( xv'' + 2v') - x^2(x v' + v ) + x^2 v  &= 0 \\
(x^2 -2x + 2)( xv'' + 2v') - x^3 v'  &= 0 \\
(x^3-2x^2+2x)v'' + ( -x^3 + 2x^2 -4x +4)v' &= 0 \\ 
\end{align*}
Now we let $w = \frac{dv}{dx}$ and this gives us a separable differential equation.
\begin{align*}
(x^3-2x^2+2x)w' + ( -x^3 + 2x^2 -4x +4)w  &= 0 \\
\frac{dw}{w} &= \frac{x^3 - 2x^2 + 4x - 4}{x^3-2x^2+2x} \, dx \\
\end{align*}
Now we need to integrate the right hand side. We perform long division on the right
hand side and get:
\begin{align*}
 \frac{x^3 - 2x^2 + 4x - 4}{x^3-2x^2+2x} &= 1 + \frac{2x - 4}{ x^3-2x^2+2x } \\
\end{align*}
Now we use the technique of partial fractions:
\begin{align*}
\frac{4x - 6}{ x^3-2x^2+2x } &= \frac{2x - 4}{ x(x^2-2x+2  ) } = \frac{A}{x} + \frac{Bx + C}{x^2-2x+2} \\
2x - 4 &= A(x^2-2x + 2) + (Bx+C)x \\
\text{ We set  $x = 0$ and find } A &= -2 \\
2x - 4 &= -2(x^2-2x + 2) + (Bx+C)x  = -2x^2 + 4x - 4 + Bx^2 + Cx \\
0 &= -2 + B \\
B &= 2 \\
2x - 4 &= -2(x^2-2x + 2) + (Bx+C)x  = -2x^2 + 4x - 4 + 2x^2 + Cx \\
2x &= -2(x^2-2x + 2) + (Bx+C)x  = -2x^2 + 4x + 2x^2 + Cx \\
C + 4 &= 2 \\
C &= -2 \\
\frac{x^3 - 2x^2 + 4x - 4}{x^3-2x^2+2x} &= 1 - \frac{2}{x} + \frac{2x - 2}{x^2-2x+2} 
\end{align*}
We need to integrate the following:
$$ \frac{2x - 2}{x^2-2x+2} $$
This can be done with the substitution $u = x^2  - 2x + 2$ which gives us $du = (2x - 2) dx$.
\begin{align*}
\ln{|w|} &= x - 2 \ln{|x|} + \ln{|x^2-2x+2|} + C_1 \\
\ln{|w|} &= \ln{e^x} - 2 \ln{|x|} + \ln{|x^2-2x+2|} + \ln{ e^{C_1} } \\
w &= C_2 \left( \frac{e^x(x^2-2x+2)}{x^2} \right) \\
\frac{dv}{dx} &= C_2 \left( \frac{e^x(x^2-2x+2)}{x^2} \right) \\
v &= \int \,\, C_2 \frac{e^x(x^2-2x+2)}{x^2} dx \\
\end{align*}
At this point, I am confident that my attempt to solve the problem is wrong.
The book's answer is:
$$ y = (x-2)e^{x} $$

REPLY [3 votes]: I think that there are small mistakes.
Doing the same as you did, I arrived at
$$(x^3-2 x^2+2 x)v''-(x^3-2 x^2+4 x-4)v'=0$$ making
$$\frac{w'}w=\frac{x^3-2 x^2+4 x-4 } {x^3-2 x^2+2 x }=\frac{2x-2}{x^2-2 x+2}-\frac{2}{x}+1$$ Integrating
$$\log(w)=\log \left(x^2-2 x+2\right)+x-2 \log (x)+c_1$$
Just continue and you should arrive for the general solution at
$$y=c_1 x+c_2 e^x (x-2)$$