ODE No. 1007

\[ -4 e^{x^2} x^2+y''(x)-2 y(x)=0 \] Mathematica : cpu = 0.0880372 (sec), leaf count = 135

DSolve[-4*E^x^2*x^2 - 2*y[x] + Derivative[2][y][x] == 0,y[x],x]
 

\[\left \{\left \{y(x)\to \frac {e^{-\sqrt {2} x} \left (-2 e^{x \left (x+\sqrt {2}\right )} x+2 e^{\left (x-\sqrt {2}\right ) x+2 \sqrt {2} x} x+\sqrt {2} e^{x \left (x+\sqrt {2}\right )}+\sqrt {2} e^{\left (x-\sqrt {2}\right ) x+2 \sqrt {2} x}\right )}{2 \sqrt {2}}+c_1 e^{\sqrt {2} x}+c_2 e^{-\sqrt {2} x}\right \}\right \}\] Maple : cpu = 0.018 (sec), leaf count = 26

dsolve(diff(diff(y(x),x),x)-2*y(x)-4*x^2*exp(x^2)=0,y(x))
 

\[y \left (x \right ) = {\mathrm e}^{\sqrt {2}\, x} c_{2}+{\mathrm e}^{-\sqrt {2}\, x} c_{1}+{\mathrm e}^{x^{2}}\]

Hand solution

\begin {equation} y^{\prime \prime }-2y=4x^{2}e^{x^{2}}\tag {1} \end {equation} We start by solving the homogeneous equation \[ y^{\prime \prime }-2y=0 \] Let \(y=e^{\lambda x}\), substitution in above gives\begin {align*} \lambda ^{2}e^{\lambda x}-2e^{\lambda x} & =0\\ \lambda ^{2}-2 & =0 \end {align*}

Hence \(\lambda =\pm \sqrt {2}\), therefore the solution is\begin {align*} y_{h} & =Ae^{\sqrt {2}x}+Be^{\sqrt [-]{2}x}\\ & =Ay_{1}+By_{2} \end {align*}

Now we solve for the particular solution using variation of parameters.

\[ y_{p}=u_{1}y_{1}+u_{2}y_{2}\]

wronskian is

\[ W=\begin {vmatrix} y_{1} & y_{2}\\ y_{1}^{\prime } & y_{2}^{\prime }\end {vmatrix} =\begin {vmatrix} e^{\sqrt {2}x} & e^{\sqrt [-]{2}x}\\ \sqrt {2}e^{\sqrt {2}x} & -\sqrt {2}e^{-\sqrt {2}x}\end {vmatrix} =-\sqrt {2}-\sqrt {2}=-2\sqrt {2}\]

Hence, using \(f=4x^{2}e^{x^{2}}\), which is the RHS of the ODE, and noting that \(a_{0}\) is the coefficient of \(y^{\prime \prime }\) which is one here, then

\begin {align*} u_{1} & =\int \frac {-y_{2}}{W}\frac {f}{a_{0}}dx=-\int \frac {e^{\sqrt [-]{2}x}}{-2\sqrt {2}}4x^{2}e^{x^{2}}dx\\ & =\frac {2}{\sqrt {2}}\int x^{2}e^{x^{2}\sqrt [-]{2}x}dx\\ & =\frac {2}{\sqrt {2}}\left ( \frac {1}{4}e^{x\left ( x-\sqrt {2}\right ) }\left ( \sqrt {2}+2x\right ) \right ) \end {align*}

And

\begin {align*} u_{2} & =\int \frac {y_{1}}{W}\frac {f}{a_{0}}dx=\int \frac {e^{\sqrt {2}x}}{-2\sqrt {2}}4x^{2}e^{x^{2}}dx\\ & =\frac {-2}{\sqrt {2}}\int x^{2}e^{x^{2}\sqrt [+]{2}x}dx\\ & =\frac {-2}{\sqrt {2}}\left ( -\frac {1}{4}e^{x\left ( x+\sqrt {2}\right ) }\left ( \sqrt {2}-2x\right ) \right ) \end {align*}

Since \(y_{p}=u_{1}e^{\sqrt {2}x}+u_{2}e^{\sqrt [-]{2}x}\) then\begin {align*} y_{p} & =\frac {2}{\sqrt {2}}\left ( \frac {1}{4}e^{x\left ( x-\sqrt {2}\right ) }\left ( \sqrt {2}+2x\right ) \right ) e^{\sqrt {2}x}-\frac {2}{\sqrt {2}}\left ( -\frac {1}{4}e^{x\left ( x+\sqrt {2}\right ) }\left ( \sqrt {2}-2x\right ) \right ) e^{\sqrt [-]{2}x}\\ & =\frac {2}{\sqrt {2}}\frac {1}{4}e^{x^{2}}\left ( \sqrt {2}+2x\right ) +\frac {2}{\sqrt {2}}\frac {1}{4}e^{x^{2}}\left ( \sqrt {2}-2x\right ) \\ & =\frac {1}{2}e^{x^{2}}+\frac {1}{2}e^{x^{2}}\\ & =e^{x^{2}} \end {align*}

Therefore, the full solution is \begin {align*} y & =y_{h}+y_{p}\\ & =Ae^{\sqrt {2}x}+Be^{\sqrt [-]{2}x}+e^{x^{2}} \end {align*}

restart; 
ode:=diff(y(x),x$2)-2*y(x)=4*x^2*exp(x^2); 
y0:=_C1*exp(sqrt(2)*x)+_C2*exp(-sqrt(2)*x)+exp(x^2); 
odetest(y(x)=y0,ode); 
0