Solution (source code)

= Solution

Write $g=e^{-q^2/2}$ and $f=2q^2-a$. Product differentiation for the reduced <quantum harmonic oscillator> gives
$$
\hat H(fg)=\left[-\tfrac12 f''+qf'+\tfrac12 f\right]g
=\left(5q^2-2-\frac a2\right)g.
$$
For an <eigenfunction>, this must equal $E(2q^2-a)g$ at every $q$. Matching the $q^2$ coefficients gives $E=5/2$, and matching constants then gives $5a/2=2+a/2$. Hence \b[$a=1$ and $E=5/2$]. This is the even $n=2$ oscillator state. Its normalized <wavefunction> is $\phi_2=(2q^2-1)e^{-q^2/2}/(\sqrt2\,\pi^{1/4})$.