Solution of ordinary linear differential equation with variable coefficients Is it possible to solve a second order ordinary linear differential equation with variable coefficients (Polynomials) by using Laplace transform method? If possible please guide.
$$y''+2xy'+8y=0,     \\y(0)=3,  y'(0)=0. $$
 A: The rules for Laplace transform are as follows:
$$L(y(x))=f(s)$$
$$L(y'(x))=sf(s)-y(0)$$
$$L(y''(x))=s^2f(s)-sy(0)-y'(0)$$
Sor far so good, we have all the data. However, the $x$ in the coefficients makes things more complicated. Now there's a rule, which can be proved integrating by parts the integral used in Laplace transfrom:
$$L(x~ y(x))=-f'(s)$$
Which, as applied to the derivative instead should look like this:
$$L(x~ y'(x))=-\frac{d}{ds} L(y'(x))=-\frac{d}{ds} (s f(s)-3)=-f(s)-s f'(s)$$
In other words, we will have to solve another ODE, though this one first order:
$$s^2 f(s)-3s-2f(s)-2s~f'(s)+8f(s)=0$$

$$f'(s)-\left( \frac{s}{2}+\frac{3}{s} \right) f(s)=-\frac{3}{2} \tag{*}$$

We solve it with usual methods. First, we solve the homogeneous equation:
$$f_1'(s)-\left( \frac{s}{2}+\frac{3}{s} \right) f_1(s)=0$$
$$\ln f_1= \frac{s^2}{4}+3 \ln s+\text{const}$$
$$f_1(s)=C s^3 e^{s^2/4}$$
Now we use method of undetermined coefficients:
$$f(s)=C(s) s^3 e^{s^2/4}$$
$$C' s^3  e^{s^2/4}=-\frac{3}{2}$$
$$C(s)=-\frac{3}{2} \int \frac{1}{s^3} e^{-s^2/4} ds=\frac{3}{4} \left(\frac{1}{4} \text{Ei}\left(-\frac{s^2}{4}\right)+\frac{1}{s^2} e^{-s^2 / 4} \right)$$
Finally (Ei - exponential integral):

$$f(s)=\frac{3}{4} \left( s + \frac{s^3}{4} e^{s^2/4} \text{Ei}\left(-\frac{s^2}{4}\right)\right)$$

This is the correct solution of (*), checked by Mathematica.
Now the only thing we have left is the inverse Laplace transform, the most complicated part. The only thing to do here is to look up some tables.

I will cheat here and use Mathematica. First, the solution it gives for the original equation (using DSolve):

$$y(x)=3 \left( \sqrt{\pi } e^{-x^2} \left(x^2-\frac{3}{2}\right) x~ \text{erfi}(x)- x^2+1 \right)$$

Using Laplace transform on this expression (again in Mathematica, though it can be easily done by definition) we get the same function $f(s)$. So the solution is correct.
You'd think I could use inverse Laplace transform in Mathematica, but it can't do it with the function above. Obviously, inverse Laplace transform is much more complicated than the direct one.
Here's the plot of the solution for $x>0$.

