How to solve $f''+c x f' +c f = 0$ type differential equation? I am trying to solve a self-similarity fluid dynamics problem, which led me to have the following problem. I have a differential equation that reads as
$$ f(x)''+c x f'(x) +c f(x) = 0,\quad f(0) = 1 $$
I know that
$$ \exp\left(\frac{-c x^2}{2}\right) $$
is a solution by lucky guessing, but I cannot prove it. How can one solve such a systemwith non constant coefficients?
 A: Solve
\begin{gather*}
\boxed{f^{\prime \prime}+c x f^{\prime}+c f=0}
\end{gather*}
Integrating both sides of the ODE w.r.t $x$ gives
\begin{align*}
\int \left(f^{\prime \prime}\left(x \right)+c x f^{\prime}\left(x \right)+c f \left(x \right)\right)d x &= 0 \\ 
f'(x)  + c x f(x)= c_2
\end{align*}
Which is now solved for $f \left(x \right)$. This is first order linear ode.
The integrating factor $\mu$ is
\begin{align*}
\mu &= {\mathrm e}^{\int c x d x}\\
   &= {\mathrm e}^{\frac{c \,x^{2}}{2}}
\end{align*}
The ode becomes
\begin{align*}
\frac{\mathop{\mathrm{d}}}{ \mathop{\mathrm{d}x}}\left( \mu f\right) &= \mu c_{2} \\ 
\frac{\mathop{\mathrm{d}}}{ \mathop{\mathrm{d}x}} \left({\mathrm e}^{\frac{c \,x^{2}}{2}} f\right) &= \left({\mathrm e}^{\frac{c \,x^{2}}{2}}\right) c_{2}\\ 
\mathrm{d} \left({\mathrm e}^{\frac{c \,x^{2}}{2}} f\right)  &= \left(c_{2} {\mathrm e}^{\frac{c \,x^{2}}{2}}\right)\, \mathrm{d} x
\end{align*}
Integrating gives
\begin{align*}
{\mathrm e}^{\frac{c \,x^{2}}{2}} f &= \int{c_{2} {\mathrm e}^{\frac{c \,x^{2}}{2}}\,\mathrm{d} x}\\ 
{\mathrm e}^{\frac{c \,x^{2}}{2}} f &= \frac{c_{2} \sqrt{\pi}\, \operatorname{erf} \left(\frac{\sqrt{-2 c}\, x}{2}\right)}{\sqrt{-2 c}} + c_1 
\end{align*}
Dividing both sides by the integrating factor $\mu={\mathrm e}^{\frac{c \,x^{2}}{2}}$ results in
\begin{align*}
f(x) &= \frac{{\mathrm e}^{-\frac{c \,x^{2}}{2}} c_{2} \sqrt{\pi}\, \operatorname{erf} \left(\frac{\sqrt{-2 c}\, x}{2}\right)}{\sqrt{-2 c}}+c_{1} {\mathrm e}^{-\frac{c \,x^{2}}{2}}
\end{align*}
Initial conditions can now be used to find $c_1,c_2$
