# Recognizing recursion relation of series that is solutions of $y'' + y' + x^2 y = 0$ around $x_0 = 0$.

I have been tried to find the general solution for the ODE above, but its recursion relation became so complex that I doesn't can construct its power series solution. Below is my attempt, assuming $y = \sum_{n = 0}^{\infty} a_n x^n$ is the solution.

\begin{equation*} y = \sum_{n = 0}^{\infty} a_n x^n; \quad y' = \sum_{n = 1}^{\infty} n a_n x^{n-1}; \quad y'' = \sum_{n = 2}^{\infty} n (n - 1) a_n x^{n - 2}. \end{equation*} \begin{equation*} \Rightarrow \sum_{n = 2}^{\infty} n (n - 1) a_n x^{n - 2} + \sum_{n = 1}^{\infty} n a_n x^{n-1} + x^2 \sum_{n = 0}^{\infty} a_n x^n = 0 \end{equation*} \begin{equation*} \sum_{n = 0}^{\infty} (n + 2) (n + 1) a_{n + 2} x^{n} + \sum_{n = 0}^{\infty} (n + 1) a_{n + 1} x^{n} + \sum_{n = 2}^{\infty} a_{n - 2} x^{n} = 0 \end{equation*} \begin{equation*} 2 \cdot 1 \cdot a_2 + 3 \cdot 2 a_3 \cdot x + \sum_{n = 2}^{\infty} (n + 2) (n + 1) a_{n + 2} x^{n} + 1 \cdot a_1 + 2 a_2 x + \sum_{n = 2}^{\infty} (n + 1) a_{n + 1} x^{n} + \sum_{n = 2}^{\infty} a_{n - 2} x^{n} = 0 \end{equation*} \begin{equation*} a_1 + 2 a_2 + x(2 a_2 + 3 \cdot 2 a_3) + \sum_{n = 2}^{\infty} [(n + 2) (n + 1) a_{n + 2} + (n + 1) a_{n + 1} + a_{n - 2}] x^n = 0 \end{equation*} And the recursion relation: \begin{equation*} \begin{split} & a_1 + 2 a_2 = 0 \Rightarrow a_1 = -2 a_2 \\ & 2 a_2 + 3 \cdot 2 a_3 = 0 \Rightarrow a_3 = - \frac{a_2}{3}\\ & a_{n + 2} = \frac{- (n + 1) a_{n + 1} - a_{n - 2}}{(n + 2) (n + 1)} = - \frac{(n + 1) a_{n + 1} + a_{n - 2}}{(n + 2) (n + 1)} \end{split} \end{equation*} Starting from here, I calculate the coefficients until $n = 7$( $a_9$ ) but its recognition is being difficult for me. The following coefficients are

$n = 2$: \begin{equation*} a_4 = \frac{- 3 a_3 - a_0}{4 \cdot 3} = \frac{a_2 - a_0}{4 \cdot 3} \end{equation*} $n = 3$: \begin{equation*} \begin{split} a_5 & = - \frac{4 a_4 + a_1}{5 \cdot 4} = - \frac{1}{5 \cdot 4} \bigg[4 \bigg( \frac{a_2 - a_0}{4 \cdot 3}\bigg) - 2 a_2\bigg] = - \frac{1}{5 \cdot 4 \cdot 3} \bigg[ a_2 - a_0 - 3 \cdot 2 a_2\bigg] \\ & = \frac{a_2 (3 \cdot 2 - 1) + a_0}{5 \cdot 4 \cdot 3} \end{split} \end{equation*} $n = 4$: \begin{equation*} \begin{split} a_6 & = - \frac{5 a_5 + a_2}{6 \cdot 5} = - \frac{1}{6 \cdot 5} \bigg[5 \bigg( \frac{a_2 (3 \cdot 2 - 1) + a_0}{5 \cdot 4 \cdot 3} \bigg) + a_2\bigg] = - \frac{a_2 (4 \cdot 3 + 3 \cdot 2 - 1) + a_0 }{6 \cdot 5 \cdot 4 \cdot 3} \end{split} \end{equation*} \begin{equation*} \vdots \end{equation*} $n = 7$: \begin{equation*} \begin{split} a_9 & = - \frac{8 a_8 + a_5}{9 \cdot 8} \\ & = - \frac{a_2 (7 \cdot 6 \cdot 3 \cdot 2 - 7 \cdot 6 + 6 \cdot 5 + 5 \cdot 4 + 4 \cdot 3 + 3 \cdot 2 - 1) + a_0 (1 - 6 \cdot 5 + 6 \cdot 7)}{9 \cdot 8 \cdot 7 \cdot 6 \cdot 5 \cdot 4 \cdot 3} \end{split} \end{equation*} Note that in $n = 7$, the coefficient is similar, but it's getting different of the $n = 2, 3, 4$ because the factor of $a_0$ is growing since $n = 6$.

Since you have two arbitrary constants, let them to be $a_0$ and $a_1$. So, doing the same as you did $$a_2=-\frac {a_1}2\qquad a_3=\frac {a_1}6$$ and just continue with the recurrence relation you built $$a_{n+2}=- \frac{(n + 1)\, a_{n + 1} + a_{n - 2}}{(n + 2) (n + 1)}$$ which could "better" write $$a_n=-\frac{a_{n-1}} n-\frac{a_{n-4}}{n(n-1)}$$ Do not try to be more explicit. You would probably be wasting your time.

In here the general solution to this very ODE is found using different methods rather than by using a power series expansion. Firstly we eliminate the coefficient at the second derivative by substituting $$y(x)=\exp(-x/2) v(x)$$. Inserting this into the ODE gives: $$$$v^{''}(x) + (-\frac{1}{4} + x^2) v(x)=0$$$$ which is a Schroedinger type of equation and as such we know how to solve it. We know that for big values of $$x$$ the function $$v(x)$$ has to have a Gaussian type of behavior (in order to cancel the term $$x^2$$ at the zeroth derivative) and therefore we write $$v(x)=\exp(A x^2) u(x)$$. We choose the constant $$A$$ appropriately so that the $$x^2$$ term cancels and we end up with an equation that is mapped to the confluent hypergeometric equation. In summary we have: $$$$y(x) = \exp(-\frac{x}{2}-\imath \frac{x^2}{2})\cdot \left( C_1 H_{-\frac{1}{2}+\imath\frac{1}{8}}((-1)^{1/4} x) + C_2 F_{1,1}(1/4-\imath/16,1/2,\imath x^2)\right)$$$$ where $$H_n()$$ are Hermite polynomials.

Now we have to express the constants $$C_{1,2}$$ through $$y(0)=a_0$$ and $$y^{'}(0)=a_1$$. This boils down to solving a pair of linear equations and yields: $$\begin{eqnarray} C_1&=&-\frac{(1-i) 2^{-2-\frac{i}{8}} \Gamma \left(\frac{1}{4}-\frac{i}{16}\right) (a_0+2 a_1)}{\sqrt{\pi }}\\ C_2&=&a_0+\frac{64 (-1)^{3/4} \Gamma \left(\frac{5}{4}-\frac{i}{16}\right) (a_0+2 a_1)}{17 \Gamma \left(-\frac{1}{4}-\frac{i}{16}\right)} \end{eqnarray}$$

and now we have a "closed form" for our recursion relation:

$$$$a_n= \left.\frac{d^n}{d x^n} y(x)\right|_{x=0}$$$$

as the code below demonstrates:

In[35]:= y[x_] =
Exp[-x/2] Exp[-I/2 x^2] (
C[1] HermiteH[-(1/2) + I/8, (-1)^(1/4) x] +
C[2] Hypergeometric1F1[1/4 - I/16, 1/2, I x^2]);
FullSimplify[(y''[x] + y'[x] + x^2 y[x])]

a0 =.; a1 =.;
subst = FullSimplify[
ComplexExpand[Solve[{y[0], y'[0]} == {a0, a1}, {C[1], C[2]}]]]
l1 = First@
CoefficientList[
Collect[Normal[Series[y[x], {x, 0, 8}] /. subst], x, FullSimplify],
x]

a = Table[0, {9}];
a[[1]] = a0; a[[2]] = a1;
a[[3]] = -a1/2;
a[[4]] = a1/6;
Do[
a[[1 + n]] = -a[[n]]/n - a[[n - 3]]/(n (n - 1));
, {n, 4, 8}];
l2 = Simplify[a]

Out[36]= 0

Out[38]= {{C[
1] -> -(((1 - I) 2^(-2 - I/8) (a0 + 2 a1) Gamma[1/4 - I/16])/
Sqrt[\[Pi]]),
C[2] -> a0 + (64 (-1)^(3/4) (a0 + 2 a1) Gamma[5/4 - I/16])/(
17 Gamma[-(1/4) - I/16])}}

Out[39]= {a0, a1, -(a1/2), a1/6, 1/24 (-2 a0 - a1),
1/120 (2 a0 - 5 a1), 1/720 (-2 a0 + 17 a1), (2 a0 - 37 a1)/5040, (
58 a0 + 67 a1)/40320}

Out[45]= {a0, a1, -(a1/2), a1/6, 1/24 (-2 a0 - a1),
1/120 (2 a0 - 5 a1), 1/720 (-2 a0 + 17 a1), (2 a0 - 37 a1)/5040, (
58 a0 + 67 a1)/40320}


Note: Interestingly enough if we were to replace $$x^2$$ in the original ODE by $$x^{2 n}$$ then we would have gotten $$y(x) =\exp(-x/2) \exp(\imath/(n+1) x^{n+1}) \cdot u(x)$$ where the function $$u(x)$$ satisfies: $$$$u^{''}(x)+2 \imath x^n u^{'}(x)+ (-\frac{1}{4} +\imath n x^{-1+n}) u(x)$$$$ which in the case $$n=2$$ matches the tri-confluent Heun equation https://dlmf.nist.gov/31.12.