# How to solve this differential equation via power series

Studying Quantum Mechanics, I encountered the following differential equation:

how to solve $$y''-x^2y=0$$ Griffiths, the author of the book, just said that its solutions are $$y=Ae^{x^2/2}+Be^{-x^2/2}$$ I can immediatelly see that this is true, but I do not know how to get to this solution, and I cannot find it solved anywhere else. I tried to use the power series method: $$y=\sum_{n=0}^{\infty}c_n x^n$$ So the equation becomes: $$\sum_{n=0}^{\infty}c_{n+2}x^n(n+1)(n+2)-\sum_{n=0}^{\infty}c_n x^{n+2}=0$$ Here I need to get both sums to the same power of n, so I removed the first two terms from the first sum, so that I can later change the index: $$2c_2+6c_3x+\sum_{n=2}^{\infty}c_{n+2}x^n(n+1)(n+2)-\sum_{n=0}^{\infty}c_n x^{n+2}=0$$ now I change the index in the fist sum: $$2c_2+6c_3x+\sum_{n=2}^{\infty}c_{n+4}x^{n+2}(n+4)n(n+3)-\sum_{n=0}^{\infty}c_n x^{n+2}=0$$ Now I factor out the sum: $$2c_2+6c_3x+\sum_{n=2}^{\infty}x^{n+2}(c_{n+4}(n+4)(n+3)-c_n)=0$$ Now all three terms must be zero at the same time, so $$c_2=c_3=0$$, and: $$c_{n+4}(n+4)(n+3)-c_n=0$$ $$c_{n+4}=\frac{c_n}{(n+4)(n+3)}$$ The first terms of the series are: $$c_4=\frac{c_0}{4\times 3}$$, $$c_8=\frac{c_4}{8\times 7}=\frac{c_0}{8\times 7\times 4\times 3}$$ However, I don't really know how to proceed from here. I tried putting the coefficients into the sum for $$y$$, but I can't really come close to the answer. Could you please guide me as how to advance from here?

• A great number of differential equations are solved by guessing. Probably the author saw this DE and said "hmmm, I bet something like $y(x)=e^{p(x)}$ would work here", tried it out, and saw that $p(x)=x^2/2$ works. – K.defaoite Jan 25 at 14:54
• If $y(x) = e^{\pm x^2/2}$, then $y''(x) = (x^2 \pm 1) y(x)$, so I don't see how these solve the given differential equation -- is there a typo? – jwimberley Jan 25 at 14:59

Check that

$$y(x)=A e^{-x^2/2}$$ is solution of $$\frac{y''(x)}{y(x)}=x^2-1$$ and $$y(x)=B e^{x^2/2}$$ is solution of $$\frac{y''(x)}{y(x)}=x^2+1$$ It is in this sense Griffith has claimed that $$\psi(x)=A e^{-x^2/2}+ B e^{x^2/2}~~~~(1)$$ is only APPROXIMATE solution of $$\psi''(x)-x^2\psi(x)=0~~~~~~~(2)$$

So please note that (1) is not the exact solution of (2) instead it is an APPROXIMATE solution of (2).

There is something wrong somewhere since, if $$y=A e^{\frac{x^2}{2}}+B e^{-\frac{x^2}{2}}$$ then $$y''-x^2 y=A e^{\frac{x^2}{2}}-B e^{-\frac{x^2}{2}}$$ which is obviously not $$0$$.

If fact, the solution of the given differential equation is much more complex $$y=c_1 D_{-\frac{1}{2}}\left(\sqrt{2} x\right)+c_2 D_{-\frac{1}{2}}\left(i \sqrt{2} x\right)$$ where appear the parabolic cylinder functions. It can also write $$y=c_1 e^{-\frac{x^2}{2}} H_{-\frac{1}{2}}(x)+c_2 e^{\frac{x^2}{2}} H_{-\frac{1}{2}}(ix)$$ where appear Hermite polynomials.

So, the series solution is really the best way (at least, for the time being).

Edit

Coefficients $$c_m$$ are given by $$c_m=\frac{2^{-m} \Gamma \left(\frac{3}{4}\right) \left(k_1+k_2 (-1)^m+\left(k_1-k_2\right) \sin \left(\frac{\pi m}{2}\right)+\left(k_1+k_2\right) \cos \left(\frac{\pi m}{2}\right)\right)}{\Gamma \left(\frac{m}{4}+1\right) \Gamma \left(\frac{m+3}{4}\right)}$$ which make $$y=\frac{2 \pi \sqrt{x}}{\Gamma \left(\frac{1}{4}\right)}\left(\left(k_1-k_2\right) I_{\frac{1}{4}}\left(\frac{x^2}{2}\right)+\left(k_1+k_2\right) I_{-\frac{1}{4}}\left(\frac{x^2}{2}\right)\right)$$

HINT

Perhaps easier to write $$\begin{split} c_n &= \frac{c_{n-4}}{n(n-1)}\\ &= \frac{c_{n-8}}{n(n-1)(n-4)(n-5)} \\ &= \frac{c_{n-12}}{n(n-1)(n-4)(n-5)(n-8)(n-9)} \end{split}$$ So you can try to write a closed form for $$c_n$$ and you have 4 series driven by $$c_0,c_1,c_2,c_3$$ but $$c_2=c_3=0$$ makes life much simpler. You can finish it that way.

A different approach is to note that if differentiating twice adds two powers of $$x$$ in the front, perhaps differentiating once would add one, getting $$y'=xy$$ which is separable and implies $$\frac{dy}{y} = xdx \iff \ln y = \frac{x^2}{2}+C$$ which is equivalent to one family of your solutions.

• About your approach "guessing" that $y' = xy$, is there a way to do it rigorously or is it just a way to guess the solution ? Can it be generalized ? – StratosFair Jan 25 at 23:53
• @StratosFair I am not sure. I have never learned differential equations in depth, beyond an undergraduate class. However, in my experience, solving ODEs is very similar to integration in the sense that there is no science, it is just an art form of finding the correct pattern to see and/or template to use. Sometimes there are multiple approaches which lead to the same place. – gt6989b Jan 26 at 11:51

Since $$c_2=0$$ and $$c_{n+4}=\frac {c_n}{(n+3)(n+4)}$$, it follows that $$c_6, c_{10},c_{14} ...=0$$ and similarly $$c_7, c_{11},c_{15} ...=0$$. You can separate the remaining terms into $$c_0x^0+c_4x^4+c_8x^8...$$ and $$c_1x^1+c_5x^5+c_9x^9...$$. By relabeling the coefficients, we can get $$y= \sum_{n=0}^{\infty}a_nx^{4n}+\sum_{n=0}^{\infty}b_nx^{4n+1}$$. Each of these sums has only one degree of freedom; the sequence $$a_n$$ is defined recursively from $$a_0$$ and similarly for $$b_n$$. This shows that $$y = c_0f_0(x)+c_1f_1(x)$$ for some $$f_0,f_1$$ that can be calculated numerically, if not in closed form.

• There is closed form. – Claude Leibovici Jan 28 at 2:49