[Math] Solving a non-homogeneous differential equation via series solution

ordinary differential equationspower series

I have been set a question which asks me to solve:

$$y''-2y=x^2e^{x^2}$$

by using a power series method. In trying to do it by brute force I end up with an non-homogeneous recurrence relation which is annoying to solve by hand.

Is there a simple trick to solving this kind of non-homogeneous differential equation via series solution?

Best Answer

My first comment is that, using brute force, you could waste a lot of time and probably not get any result.

Let us apply the method to the differential equation $$y''-2y=x^2e^{x^2}$$ using $$y=\sum_{n=0}^\infty a_nx^n\implies y''=\sum_{n=0}^\infty n(n-1)a_nx^{n-2}$$ For the rhs, we shall use the classical $$e^z=\sum_{n=0}^\infty\frac {z^n}{n!}$$ in which we shall replace $z$ by $x^2$. Using all the above, the differential equation write $$\sum_{n=0}^\infty n(n-1)a_nx^{n-2}-2\sum_{n=0}^\infty a_nx^n=\sum_{n=0}^\infty\frac {x^{2n+2}}{n!}$$ The very first thing we can notice is that the rhs only contains even powers of $x$; this means that we shall have two recurrence relations, one for even values of the exponent and another one for the odd values of the exponent.

Let us start with an odd value of the exponent $m$ and consider the terms. To have $x^m$ in the first summation we need to make $n-2=m$ that is to say $n=m+2$. So, for this case, $$(m+1)(m+2)a_{m+2}-2a_m=0$$ which gives $$a_{m+2}=\frac{2}{(m+1)(m+2)}a_m$$

For an even value of the exponent $m$, the same will apply but the term to be used in the rhs will be such that $2n+2=m$ that is to say $n=\frac m2-1$. So,for this case, $$(m+1)(m+2)a_{m+2}-2a_m=\frac 1{(\frac m2 -1)!}$$which gives$$a_{m+2}=\frac{2a_m+\frac 1{(\frac m2 -1)!}}{(m+1)(m+2)}$$

To make it clearer, let us replace $m$ by $2k-1$ for odd values of $m$ and by $2k-2$ for even values of $m$. So,$$a_{2k+1}=\frac{1}{k(2k+1)}a_{2k-1}$$ $$a_{2k}=\frac{2a_{2k-2}+\frac 1{(k-2)!}}{2k(2k-1)}$$ and, as usual, $a_0$ and $a_1$ would be later fixed by conditions.

I hope and wish that this will clarify things for you. If this is not the case, just post.