TITLE: Solving a challenging differential equation
QUESTION [5 upvotes]: How would one go about finding a closed form analytic solution to the following differential equation?
$$\frac{d^2y}{dx^2} +(x^4 +x^2+x+c)y(x) =0 $$
where $c\in\mathbb{R}$

REPLY [2 votes]: This is the way I would do it. 
Let $p(x)=x^4+x^2+x+c$. Put $z=y'$. Then the equation is equivalent to the system 
$$
\begin{bmatrix}y\\ z\end{bmatrix}'=\begin{bmatrix}0&1\\-p(x)&0\end{bmatrix}\,\begin{bmatrix}y\\ z\end{bmatrix}.
$$
Let us write $A(x)$ for the $2\times 2$ matrix above. For a given vector $\begin{bmatrix}c_1\\ c_2\end{bmatrix}$, a solution will be given by 
$$
e^{B(x)}\,\begin{bmatrix}c_1\\ c_2\end{bmatrix},
$$
where $B'(x)=A(x)$. That is $B(x)=\begin{bmatrix}0&x\\-q(x)&0\end{bmatrix}$, with $q(x)=x^5/5+x^3/3+x^2/2+cx$. If I didn't make a mistake, the exponential is 
$$
e^{B(x)}=\begin{bmatrix}\cos\sqrt{xq(x)}&\sqrt\frac{x}{q(x)}\,\sin\sqrt{xq(x)}\\
-\sqrt\frac{q(x)}{x}\,\sin\sqrt{xq(x)}&\cos\sqrt{xq(x)}\end{bmatrix}.
$$
As $y$ will be the first coordinate of $e^{B(x)}\begin{bmatrix}c_1\\ c_2\end{bmatrix}$, we get
$$
y(x)=c_1\,\cos\sqrt{\frac{x^6}5+\frac{x^4}3+\frac{x^3}2+cx^2}+c_2\,\frac{\sin\sqrt{\frac{x^6}5+\frac{x^4}3+\frac{x^3}2+cx^2}}{\sqrt{\frac{x^5}5+\frac{x^3}3+\frac{x^2}2+cx}}.
$$