in wolfram alpha input u have given rhs as -2/x^3 while in ur soln u have computed for -2/x^2
The integrating factor is , so multiply both sides by that:
Integrating both sides:
Multiply both sides by :
Integrate both sides:
Fold the into a single constant:
When you entered the problem into WolframAlpha, you entered . Notice the RHS of that differential equation has in the denominator. Your original problem has in the denominator.
You are correct that the general solution to the associated homogeneous equation is but you are doing the "variation of parameters" incorrectly.
Yes, we look for a solution to the entire equation of the form , allowing the "parameters", and to "vary".
Then we have . We simplify the equation (there are many different possible functions for and ) by requiring that leaving . Differentiating again, and now the differential equation becomes .
There is your error- you have, although you don't say how you arrived at it, on the left rather than .