Let me change your notation and put $y_h(x)$ as the solution you have obtained. Then:

$$y(x) = c_1 y_1(x) + c_2 y_2(x) + y_p(x),$$

where $y_p(x)$ is the particular solution of your ode. Then make use of variation of parameters and try solutions $y(x) = C(x) y_1(x)$ (for example; you could have chosen $y = C y_2$). Substitute back in the ode and you will have:

$$x^2 (C''y_1 + 2 C' y_1' + C y_1'') - 2 C y_1 = C'' x^2 + C'(2y_1' x^2/y_1) + C(x^2 y''_1 - 2 y_1) =x^3 e^x,$$

the coefficient in $C$ must vanish since $y_1$ is a solution of the homogenous part of the equation. Simplify a bit and obtain a "false" second order differential equation for $C(x)$:

$$ C'' + C' 2y'_1/y_1 = x e^x/y_1,$$

which can be solved in terms of an integrating factor, $u = e^{\int 2y'_1/y_1 \,dx} = y_1^2$, as follows:

$$\frac{d}{dx}\left( C' u\right) = u x e^x/y_1 = y_1 x e^x \Leftrightarrow C' = \frac{1}{y_1^2} \int y_1 x e^x \, dx + \frac{A}{y_1^2},$$

and hence the solution for $C$:

$$C = B + A \int\frac{dx}{y_1^2} + \int\left(\frac{1}{y_1^2} \int y_1 x e^x \, dx\right) \, dx,$$

where $A$ and $B$ are constants of integration. This readily leads you to the solution, $y(x) = C(x) y_1$:

$$y(x) =\frac{A x^2}{3}+\frac{B}{x}+\frac{2 e^x}{x}+e^x( x -2 ),$$

where you can make $c_1 = \frac{A}{3}$ (and $c_2 = B$).

I hope this may be useful to you.

Cheers!

To eliminate the first constant, write

$$\frac yx=C_1+C_2\frac{\sin x}x$$

then taking the derivative,

$$\frac{y'x-y}{x^2}=C_2\frac{\cos x\, x-\sin x}{x^2}.$$

To eliminate the second constant, now write

$$\frac{y'x-y}{\cos x\,x-\sin x}=C_2.$$

After differentiation and simplification, the numerator yields

$$y''(\cos x\,x-\sin x)+(y'x-y)\sin x=0.$$

## Best Answer

The differential equation has a singularity at $x=0$, so the Existence and Uniqueness Theorem doesn't apply there. On each of the intervals $(-\infty, 0)$ and $(0,\infty)$ where the theorem does apply, you have two-parameter families of solutions. But it turns out any solution on $(-\infty, 0)$ and any solution on $(0,\infty)$ with the same $c_2$ can be put together to make a solution on $\mathbb R$.