Is my second order ODE solution correct? $$xy'' + 2y' - xy = e^x$$
Now, I solved the homogenous equation correctly using reduction of order, I even verified my solution on wolframalpha.
$$y_h = \frac{e^xC_1}{x} + \frac{e^{-x}C_1}{x}$$
However, next I tried to find the particular solution using variation of parameters.
I calculated that the wronskian is $$W = \frac{-2}{x^2}$$
and that $$W_1 = -\frac{1}{x^2}$$ and $$W_2 = \frac{e^{2x}}{x^2}$$
This means that $C_1' = \frac{1}{2}$ and $C_2' = -\frac{e^{2x}}{2}.$
So that $$C_1 = \frac{x}{2} + K_1$$ $$C_2 = -\frac{e^{2x}}{4} + K_2$$
Plugging this into my solution I get that $$\frac{K_1 e^x}{x} + \frac{K_2 e^{-x}}{x} + \frac{e^x}{2} - \frac{e^x}{4 x}$$
However, the WolframAlpha solution is $$\frac{K_1 e^x}{x} + \frac{K_2 e^{-x}}{x} + \frac{e^x}{2}$$
Where did I go wrong? I tried to find my mistake so I can't rule out an error made due to lack of concentration but I seriously can't find it.
 A: $$xy'' + 2y' - xy = e^x$$
It's more easy to rexrite the differential equation as:
$$(xy)''-xy=e^x$$
Substitute  $z=xy$:
$$z''-z=e^x$$
Then use variation of parameters.
A: Notice that in your answer the first and the last term can be combined into a single term, which is then exactly the WolframAlpha solution. ($K_1-\frac{1}{4}$ is just a constant)
A: You didn't make any mistakes.
As Left Hand mentioned, the term $-\frac{e^x}{4 x}$ already appears in the solution to the homogenous equation, so can be combined to form the general solution
$$y(x)=\frac{C_1 e^x}{x} + \frac{C_2 e^{-x}}{x} + \frac{e^x}{2} - \frac{e^x}{4 x}$$
$$=\left(C_{1}-\frac{1}{4}\right)\frac{e^{x}}{x}+C_{2}\frac{e^{-x}}{x}+\frac{e^x}{2}$$
$$=K_1\frac{e^{x}}{x}+K_{2}\frac{e^{-x}}{x}+\frac{e^x}{2}=y_{h}(x)+y_{p}(x)$$
where $K_1=C_1-\frac{1}{4}$ and $K_{2}=C_2$ are constants.

In fact since we have $y_{1}(x)=\frac{e^x}{x}$ for a solution of the homogenous equation then
$$xy_{1}'' + 2y_{1}' - xy_{1} = 0$$
but the term $-\frac{e^x}{4x}=-\frac{1}{4}y_{1}(x)$ and substituting into the equation we have $$x\left(-\frac{1}{4}y_{1}''\right) + 2\left(-\frac{1}{4}y_{1}'\right) - x\left(-\frac{1}{4}y_{1}\right) = 0.$$
So the term $-\frac{e^x}{4x}$ doesn't have any effect on the non-homogenous problem and the particular solution is
$$y_{p}(x)=\frac{e^x}{2}.$$

Note: Both
$$y(x)=\frac{C_1 e^x}{x} + \frac{C_2 e^{-x}}{x} + \frac{e^x}{2} - \frac{e^x}{4 x}$$
and
$$y(x)=\frac{K_1 e^x}{x} + \frac{K_2 e^{-x}}{x} + \frac{e^x}{2}$$
are correct solutions , but if the question says that you need to simply as far as you can, I would write
$$y(x) = \frac{K_1 e^x}{x} + \frac{K_2 e^{-x}}{x} + \frac{e^x}{2}$$
