I am trying to compute the $L_2$ scalar product between (probabilists’) Hermite polynomials (defined as in Wiki) with Gaussian weight and different scales, i.e. for some constants $c, d$:
$$\frac{1}{\sqrt{2\pi}}\int \,{He}_{n}(cx)\,{He}_m(dx)\,e^{-\frac{x^2}{2}}\,\text{d}x.$$
Of course, the answer is well known when $c=1=d$, and in particular it is non-zero only if $n=m$.
Trying out a few values in WolframAlpha it appears that for any $c$ and $d$ there is an exact answer at least for small $n$, $m$. Therefore, I suppose that there must be a known algorithmic way to compute it for every $n$ and $m$ (be it a closed or a recursive formula). Could anyone point me to any reference on how this result can be obtained?
Thanks in advance!
[EDIT]: an earlier version of this question also mentioned the result being zero when $n+m$ is odd; as remarked in the comments, this is simply because the integrand is odd in that case ($He_n$ is an even, resp. odd, function iff $n$ is even, resp odd)
I will assume $n\ge m$, which we can always enforce by relabeling. The Hermite multiplication theorem (which can be found on the wiki) says $$ He_n(\gamma x) = \sum_{k=0}^{\left \lfloor \frac{n}{2} \right \rfloor}\Gamma_n(k,\gamma) He_{n-2k}(x) $$ where I have defined $$ \Gamma_n(k,\gamma)=n!\frac{1}{2^kk!(n-2k)!}\gamma^{n-2k}\left(\gamma^2-1\right)^k $$ for ease of notation.
I define the inner product $$ \langle f(x),g(x)\rangle = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^\infty f(x)g(x)e^{-\frac{1}{2}x^2}dx. $$
Using the Hermite multiplication theorem twice gives $$ \langle He_n(cx),He_m(dx)\rangle = \sum_{\alpha =0}^{\left \lfloor \frac{n}{2} \right \rfloor}\sum_{\beta=0}^{\left \lfloor \frac{m}{2} \right \rfloor} \Gamma_n(\alpha,c)\Gamma_m(\beta,d)\langle He_{n-2\alpha}(x)He_{m-2\beta}(x)\rangle. $$
This inner produce in the double sum gives a delta function that constrains $$ \beta = \alpha - \frac{n-m}{2} > 0 $$ As noted in the comments, $\mod(n,2)-\mod(m,2)=0$, ie they $n,m$ are both simultaneously odd or simultaneously even so $\frac{n-m}{2}$ is an integer, which we will denote as $\Delta=\frac{n-m}{2}$.
The constraint of $\beta>0$ gives a lower bound for the $\alpha=\Delta$ and the desired integral becomes $$ \langle He_n(cx),He_m(dx)\rangle = \sum_{\alpha=\Delta}^{\left \lfloor \frac{n}{2} \right \rfloor} n!m!\frac{(cd)^{n-2\alpha}(c^2-1)^\alpha(d^2-1)^{\alpha - \Delta}}{2^{2\alpha-\Delta}\alpha!(n-2\alpha)!(\alpha-\Delta)!} $$