Weird differential equation How to solve the given differential equation(given $ f(1)=e$ and  $f(0)=0$, $f'(0)=1$,$f''(0)=0.$)
$$f''(x)=2xf'(x)+4f(x).$$
Where $f'(x)$ is first derivative and $f''(x)$ is second derivative.
I was trying to guess that the function is exponential(of form of $e^{x^2}$) but couldn't get the final function.
 A: For $x>0$, let $u(x):=f(x)/(xe^{x^2})$ then by Hopital
$$\lim_{x\to 0^+} u(x)=\lim_{x\to 0^+} \frac{f(x)}{xe^{x^2}}=
\lim_{x\to 0^+} \frac{f'(x)}{e^{x^2}+2x^2e^{x^2}}=1$$
and in a similar way we get $\lim_{x\to 0^+} u'(x)=\frac{1}{2}f''(0)=0.$
Hence
$f(x)=xe^{x^2}u(x)$ and 
$f″(x)-2xf′(x)-4f(x)=0$ implies
$$2(x^2+1)u'(x)+xu''(x)=0.$$ 
By solving this linear ODE with respect to $u'$ we obtain the stationary solution $u'(x)=0$ or
$u'(x)=C_1 \frac{e^{-x^2}}{x^2}$. 
By the above conditions $u'(x)=0$ and $u(x)=1$. Therefore $f(x)=xe^{x^2}$.
P.S. Note that it follows that the general solution of $f″(x)-2xf′(x)-4f(x)=0$ is
$$f(x)=xe^{x^2}\left(C_2+C_1\int \frac{e^{-t^2}}{t^2}\, dt\right).$$
A: Frobenius Method: 
To solve $y''-2xy'-4y=0$ consider Frobenius solution $y = \sum_{n=0}^{\infty} a_n x^{n+r}$ hence $y' = \sum_{n=0}^{\infty} (n+r)a_n x^{n+r-1}$ and $y'' = \sum_{n=0}^{\infty} (n+r)(n+r-1)a_n x^{n+r-2}$ hence:
$$ \sum_{n=0}^{\infty} (n+r)(n+r-1)a_n x^{n+r-2}-2x\sum_{n=0}^{\infty} (n+r)a_n x^{n+r-1}-4\sum_{n=0}^{\infty} a_n x^{n+r}=0 $$
Let $k+r=n+r-2$ so $n=k+2$ and we find:
$$ \sum_{k=-2}^{\infty} (k+2+r)(k+1+r)a_{k+2} x^{k+r}-\sum_{n=0}^{\infty} 2(n+r)a_n x^{n+r}-4\sum_{n=0}^{\infty} a_n x^{n+r}=0 $$
Splitting off the $k=-2,-1$ terms we form a common sum for $n=0,1,...$
$$ r(r-1)a_0x^{r-2} + (1+r)ra_1x^{r-1} +
\sum_{n=0}^{\infty} \left( (n+2+r)(n+1+r)a_{n+2} - 2(n+r)a_n -4a_n \right)x^{n+r}=0 $$
cleaning it up a bit,
$$ r(r-1)a_0x^{r-2}+r(1+r)a_1x^{r-1}+
\sum_{n=2}^{\infty} \left( (n+2+r)(n+1+r)a_{n+2} - 2(n+r+2)a_n \right)x^{n+r}=0 $$
So, apparently, $r=0$ or $r=1$. We want $y(0)=0$ and $y'(0)=1$ and $y''(0)=0$. I'll investigate the $r=1$ case which implies $a_1=0$. Moreover, for $n=0,1,\dots $
$$ (n+3)(n+2)a_{n+2} - 2(n+3)a_n = 0 \ \ \Rightarrow \ \ a_{n+2} = \frac{2a_n}{n+2} $$
Thus, $a_1=0$ implies $a_{2k+1}=0$ for $k=1,2,\dots$. On the other hand,
$$ a_2 = \frac{2a_0}{2}=a_0, \ \ a_4 = \frac{2a_2}{4} = \frac{a_0}{2},  \ \ a_6 = \frac{2a_4}{6} = \frac{a_0}{6}, \ \ a_8 = \frac{2a_6}{8} = \frac{a_0}{24}  $$
Thus,
\begin{align}
 y &= a_0x+a_2x^3+a_4x^5+a_6x^7+a_8x^9+ \cdots \\ \notag
&= a_0x\left( 1+x^2+\frac{1}{2}x^4+\frac{1}{6}x^6+\frac{1}{24}x^8+ \cdots \right) \\ \notag
\end{align}
Note $y''(0)=0$ is true for this solution and you can see the term in parenthesis above is simply the power series of $e^{x^2}$ hence
$$ y = a_0xe^{x^2} $$
finally, as $y(1)=a_0(1)e = e$ we deduce $a_0=1$ and conclude $y=xe^{x^2}$.
