How can I solve $y'' + \left(4x-\tfrac{2}{x}\right)y' + 4x^2y= 3xe^{x^2}$? The DE is 
$$y'' + \left(4x-\frac{2}{x}\right)y' + 4x^2y= 3xe^{x^2}.$$
I've been told to use $t = x^2$ along with change of variable to solve it, but it's clear that's not possible due to the singularity on $x = 0$ on the term $\frac{2}{x}$. I tried using  Frobenius method, but not luck with the solution. I would appreciate any help on how to solve it. 
Thanks in advance. 
 A: A fundamental set of solutions of the homogeneous equation is
$(\sqrt{2}\cos(\sqrt{2}x)x-\sin(\sqrt{2} x))\exp(-x^2)$ and
$(\sqrt{2}\sin(\sqrt{2}x)x+\cos(\sqrt{2} x))\exp(-x^2)$.
You can then use Variation of Parameters to get a solution of the non-homogeneous equation.  However, this will involve integrals that can't be done in closed form.
A: $$y'' + \left(4x-\frac{2}{x}\right)y' + 4x^2y= 3xe^{x^2}$$
If this ODE is a classroom exercise, there is probably a typo. This is solvable, but of high level. The most likely the equation might be :
$$y'' + \left(4x-\frac{1}{x}\right)y' + 4x^2y= 3xe^{-x^2}$$
SOLVING THE HOMOGENEOUS ODE :
$$y'' + \left(4x-\frac{1}{x}\right)y' + 4x^2y=0$$
Let $\quad t=x^2\quad\implies\quad dt=2xdx\quad\implies\quad \frac{dt}{dx}=2x$
$\frac{dy}{dx}=\frac{dy}{dt}\frac{dt}{dx}=2x\frac{dy}{dt}$
$\frac{d^2y}{dx^2}=2x\frac{d^2y}{dt^2}\frac{dt}{dx}+2\frac{dy}{dt}=4x^2\frac{d^2y}{dt^2}+2\frac{dy}{dt}=4t\frac{d^2y}{dt^2}+2\frac{dy}{dt}$
$4t\frac{d^2y}{dt^2}+2\frac{dy}{dt} + \left(4x-\frac{1}{x}\right)2x\frac{dy}{dt} + 4x^2y=0$
$4t\frac{d^2y}{dt^2}+2\frac{dy}{dt} + \left(4x^2-1\right)2\frac{dy}{dt} + 4x^2y=0$
$4t\frac{d^2y}{dt^2}+2\frac{dy}{dt} + \left(4t-1\right)2\frac{dy}{dt} + 4ty=0$
After simplification :
$$\frac{d^2y}{dt^2} + 2\frac{dy}{dt} + y=0$$
This ODE is easy to solve :$\quad y=c_1e^{-t}+c_2te^{-t}$
$$y=c_1e^{-x^2}+c_2x^2e^{-x^2}$$
SOLVING THE INHOMOGENEOUS ODE :
$$y'' + \left(4x-\frac{1}{x}\right)y' + 4x^2y= 3xe^{-x^2}$$
The form of the equation and above solutions suggest the change $\quad y(x)=u(x)e^{-x^2}$
$y'= (u'-2xu)e^{-x^2}$
$y''= (u''-4xu'-2u+4x^2u)e^{-x^2}$
$(u''-4xu'-2u+4x^2u)e^{-x^2} + \left(4x-\frac{1}{x}\right)(u'-2xu)e^{-x^2} + 4x^2ue^{-x^2}= 3xe^{x^2}$
$(u''-4xu'-2u+4x^2u) + \left(4x-\frac{1}{x}\right)(u'-2xu) + 4x^2u= 3x$
$u''-4xu'-2u+4x^2u + 4xu'-8x^2u - \frac{1}{x}u'+2u + 4x^2u= 3x$
After simplification : $$u'' - \frac{1}{x}u' = 3x$$
No need to solve for the general solution. Only one particular solution is sufficient.
Obviously $u'=3x^2$ , then $u=x^3$ is a particular solution. Thus, the general solution of the inhomogeneous ODE is :
$$y=c_1e^{-x^2}+c_2x^2e^{-x^2}+x^3e^{-x^2}$$
NOTE :
If the above supposition was not fully true, another supposition might be : 
$$y'' + \left(4x-\frac{1}{x}\right)y' + 4x^2y= 3xe^{x^2}$$
It is solvable with the same method, but the final computation of a particular solution would be a little more complicated, involving the special function erfi : http://mathworld.wolfram.com/Erfi.html
