Problem proving $\int_{-\infty}^{\infty}x^2e^{-x^2}H_n(x)H_m(x)dx$ I am trying to show that the value of the following integral is:
$$\int_{-\infty}^{\infty}x^2e^{-x^2}H_n(x)H_m(x)dx=2^{n-1}\pi^{\frac{1}{2}}(2n+1)n!\delta_{mn}+2^n\pi^{\frac{1}{2}}(n+2)!\delta_{(n+2)m}+2^{n-2}\pi^{\frac{1}{2}}n!\delta_{(n-2)m},$$
where $H_n$ is the $n$-th Hermite polynomial.
My attempt is the following:
Suppose that the value of the integral is already known and that:
\begin{equation*}
\int_{-\infty}^{\infty}x^2e^{-x^2}H_n(x)H_m(x)dx=\lambda    
\end{equation*}
From the recurrence relation we have to:
\begin{equation*}
H_{n+1}(x)=2xH_{n}(x)-2nH_{n-1}(x)    
\end{equation*}
Therefore, since it is valid for any $ n $ then it will also be valid for any $ m $, that is:
\begin{equation*}
H_{m+1}(x)=2xH_m(x)-2mH_{m-1}(x)    
\end{equation*}
Solving for the terms $2xH_ {m} (x)$ and $2xH_ {n} (x)$ we have:
\begin{align}
2xH_ {n} (x) & = H_ {n + 1} (x) + 2nH_ {n-1} (x) \\
2xH_ {m} (x) & = H_ {m + 1} (x) + 2mH_ {m-1} (x)
\end{align}
And multiplying the \ textcolor {red} {\ textbf {equation 1}} by $ 2xH_m (x) $ and substituting the cleared value we have:
\begin{align*}
4x^2H_{n}(x)H_{m}(x)&=2xH_m(x)\left[H_{n+1}(x)+2nH_{n-1}(x)\right]\\
4x^2H_{n}(x)H_{m}(x)&=\left[H_{m+1}(x)+2mH_{m-1}(x)\right]\left[H_{n+1}(x)+2nH_{n-1}(x)\right]\\
4x^2H_{n}(x)H_{m}(x)&= H_{m+1}(x)H_{n+1}(x)+2nH_{m+1}(x)H_{n-1}(x)+2mH_{m-1}(x)H_{n+1}(x)+4mnH_{m-1}(x)H_{n-1}(x)\\
\end{align*}
And from what we have just found we can conclude that:
{\begin{align*}
4\lambda&=\int_{-\infty}^{\infty}e^{-x^2}\left[H_{m+1}(x)H_{n+1}(x)\right]dx+\int_{-\infty}^{\infty}e^{-x^2}2nH_{m+1}(x)H_{n-1}(x)dx+\int_{-\infty}^{\infty}2me^{-x^2}H_{m-1}(x)H_{n+1}(x)+\int_{-\infty}^{\infty}4mne^{-x^2}H_{m-1}(x)H_{n-1}(x)dx  
\end{align*}
So going back to the integral that we already had:
\begin{align*}
\cfrac{1}{4}\times4\lambda&=\cfrac{1}{4}\times \sqrt{\pi}\left\{2^{n+1}(n+1)!\left[\delta_{(m+1)(n+1)}+2m\delta_{(m-1)(n+1)}\right]+2^{n-1}(n-1)!\left[\delta_{(m+1)(n-1)}2n+4mn\delta_{(m-1)(n-1)}\right]\right\}\\
\lambda&=\cfrac{\sqrt{\pi}}{4}\left\{2^{n+1}(n+1)!\left[\delta_{(m+1)(n+1)}+2m\delta_{(m-1)(n+1)}\right]+2^{n-1}(n-1)!\left[\delta_{(m+1)(n-1)}2n+4mn\delta_{(m-1)(n-1)}\right]\right\}\\
\end{align*}
And as it was supposed from the beginning:
\begin{equation*}
\int_{-\infty}^{\infty}x^2e^{-x^2}H_n(x)H_m(x)dx=\lambda      
\end{equation*}
Then finally it will come to:
$\int_{-\infty}^{\infty}x^2e^{-x^2}H_n(x)H_m(x)dx=\cfrac{\sqrt{\pi}}{4}\left\{2^{n+1}(n+1)!\left[\delta_{(m+1)(n+1)}+2m\delta_{(m-1)(n+1)}\right]+2^{n-1}(n-1)!\left[\delta_{(m+1)(n-1)}2n+4mn\delta_{(m-1)(n-1)}\right]\right\}$
But I can't find the way to give the answer $2^{n-1}\pi^{\frac{1}{2}}(2n+1)n!\delta_{mn}+2^n\pi^{\frac{1}{2}}(n+2)!\delta_{(n+2)m}+2^{n-2}\pi^{\frac{1}{2}}n!\delta_{(n-2)m}$

Starting from here
$$
\cfrac{\sqrt{\pi}}{4}\left\{2^{n+1}(n+1)!\left[\delta_{(m+1)(n+1)}+2m\delta_{(m-1)(n+1)}\right]+2^{n-1}(n-1)!\left[\delta_{(m+1)(n-1)}2n+4mn\delta_{(m-1)(n-1)}\right]\right\}
$$
First, rewrite the $\delta$s so that they all have only $m$. We do this by noting that, for example, if $m-1 = n+1$, then $m = n+2$, so $\delta_{(m-1)(n+1)} = \delta_{m(n+2)}$. We can then also use $m\delta_{m(n+2)} = (n+2)\delta_{m(n+2)}$ to further simplify. This gives
$$
\cfrac{\sqrt{\pi}}{4}\left\{2^{n+1}(n+1)!\left[\delta_{mn}+2(n+2)\delta_{m(n+2)}\right]+2^{n-1}(n-1)!\left[\delta_{m(n-2)}2n+4n^2\delta_{mn}\right]\right\}
$$
Now expand the products:
$$
\sqrt{\pi}\left[2^{n-1}(n+1)!\delta_{mn}+2^{n}(n+2)(n+1)!\delta_{m(n+2)}+2^{n-2}n(n-1)!\delta_{m(n-2)}+2^{n-1}n^2(n-1)!\delta_{mn}\right]
$$
Finally, collect terms and simplify the factorials to get
$$
\sqrt{\pi}\left[2^{n-1}(2n+1)n!\delta_{mn}+2^{n}(n+2)!\delta_{m(n+2)}+2^{n-2}n!\delta_{m(n-2)}\right]
$$
