6

The orthogonality relation for Hermite polynomials is:

$$\int\limits_{-\infty}^\infty e^{-x^2} H_n(x) H_m(x)\ dx = 2^n n! \sqrt{\pi} \delta_{nm}$$

where $\{ n, m \} \in \mathbb{Z}_{\geq 0}$, $H_n(x)$ is the Hermite polynomial of order $n$, and $\delta_{nm}$ is the Kroneker delta indicator, which is $1$ if and only if $n=m$.

The straightforward approach does not work for arbitrary (but unspecified) $n$ and $m$:

Assuming[{n, m} ∈ NonNegativeIntegers,
 Integrate[
  E^(-x^2) HermiteH[n, x] HermiteH[m, x], 
  {x, -∞, ∞}]]

but will work for any specified such orders (see related question).

How can I computationally derive the orthogonality relation for arbitrary $n$ and $m$?

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
David G. Stork
  • 41,180
  • 3
  • 34
  • 96
  • 1
    Perhaps interesting is that even with one number fixed and the other a free parameter, mathematica can only give the 0 with the appropriate condition; for example Assuming[Element[{n}, PositiveIntegers], Integrate[ E^(-x^2) HermiteH[n, x] HermiteH[1, x], {x, -Infinity, Infinity}, GenerateConditions -> True]] returns 0 if $n >1$. No mention for $n=1$. – bmf Feb 14 '23 at 04:55
  • 5
    $\delta_{ij}$ is the Kronecker delta. – Ghoster Feb 14 '23 at 05:28
  • Yep... thanks.. – David G. Stork Feb 14 '23 at 08:04
  • 2
    @DavidG.Stork just a clarification. How much of this can we do by hand? I mean, if I re-write the equivalent integrals for generic ${m,n}$ after some integrations by parts would that be helpful to you or do you want a fully coded solution? – bmf Feb 14 '23 at 08:14
  • Your question seems to be a legitimate one, but what if the Wolfram developers of Mathematica decided to implements a special case of Integrate[] which detects such an integral and returns the expected result? Would you be satisfied with that? – Somos May 13 '23 at 19:34
  • @Somos: Yes I would. I teach a course at Stanford, Computational symbolic mathematics, where we rely on computer algebra (Mathematica) almost exclusively. I'd be happy if the general orthogonality conditions were implemented. Part of my course is on testing and validating computer algebra, so in this case I'd have students perform a few sample orthogonality integral tests for specific values of parameters. Also, perhaps, some numerical validation. And so on. – David G. Stork May 13 '23 at 23:35
  • 1
    @DavidG.Stork I would suggest that you communicate with the Wolfram developers to request a special case treatment of such integrals. – Somos May 14 '23 at 00:06

5 Answers5

8

Since I got a thumbs up, I will present something. To the author of the OP, please let me know whether this is useful or not. If not, I am happy to delete it.

We begin by recording the Rodrigues' formula for the Hermite polynomials

$$ \begin{equation} H_n (x) = (-1)^n e^{x^2} \frac{d^n}{dx^n} \left( e^{-x^2} \right) \end{equation} $$

Using the above we can re-write the integral of interest as follows:

$$ \begin{equation} \int^{\infty}_{-\infty} ~ dx ~ e^{-x^2} ~ H_m(x) ~ H_n(x) = (-1)^n \int^{\infty}_{-\infty} ~ dx ~ H_m(x) ~ \frac{d^n}{dx^n} \left( e^{-x^2} \right) \end{equation} $$

And now we can separate two cases:

Case 1 We examine $m \neq n$. We will choose $m < n$ without loss of generality and integrate by parts to take all derivatives on the Hermite polynomial.

Assuming[{n, m} ∈ NonNegativeIntegers && m > n, 
 Integrate[
  D[HermiteH[m, x], {x, n}] Exp[-x^2], {x, -Infinity, Infinity}]]

0

Case 2 here we have $m=n$. Here, Mathematica provides us with the following

Assuming[{n} ∈ NonNegativeIntegers && n >= 0, 
 Integrate[
  D[HermiteH[n, x], {x, n}] Exp[-x^2], {x, -Infinity, Infinity}]]

res

The first bit is easy to see that is what we want, since

Factorial[n] == Gamma[1 + n] == FactorialPower[n, n] // FullSimplify

true

The thing that I have not understood as of yet, is why Mathematica is giving a 0. If I do

Integrate[
 D[HermiteH[0, x], {x, 0}] Exp[-x^2], {x, -Infinity, Infinity}]

I get

pi

Edit thanks to @BobHanlon for reminding me.

With

res = Assuming[{n} ∈ NonNegativeIntegers && n >= 0, 
  Integrate[
   D[HermiteH[n, x], {x, n}] Exp[-x^2], {x, -Infinity, Infinity}]]

FunctionExpand will automatically convert FactorialPower to a Gamma.

Then, we can change the ComplexityFunction

gammatofac[expr_, n_] := 
  FullSimplify[expr, n ∈ Integers && n > 0, 
   ComplexityFunction -> ((LeafCount@# + 
        10 Count[#, _Gamma | _Pochhammer, {0, \[Infinity]}]) &)];

to convert the Gamma to a Factorial. Altogether it reads

gammatofac[Flatten[(res // FunctionExpand)[[1]]][[1]], n]

and returns

f

To the mathematicians: please do not hunt me down and kill for writing $\int dx ~ \texttt{stuff}$. We do it all the time in Physics.

bmf
  • 15,157
  • 2
  • 26
  • 63
  • 1
    +1 Note that FunctionExpand will convert FactorialPower[n, n] to Gamma[1+n] – Bob Hanlon Feb 14 '23 at 15:04
  • @BobHanlon thanks for the (+1) and for reminding me of FunctionExpand. And of course, after that, we can modify ComplexityFunction to get the factorial. I will update :-) – bmf Feb 14 '23 at 15:13
  • 1
    Thanks so much for all the work... very helpful indeed ($+1$). Perhaps someone (or I) can build upon this to get a full, general answer. I have the sense that some form of *Option ->* in integration, or contour integral in complex analysis may work, but that will take a bit of trial and error. Incidentally, I'm confident that a full answer here will be useful for numerous other cases, such as the spherical harmonics. (Oh... as a PhD in physics, I agree: Integral stuff is fine!) – David G. Stork Feb 14 '23 at 17:29
  • @DavidG.Stork glad that this was helpful. It's quite likely that complex analysis might be key here as you mentioned. As for options in integration, not so sure, but perhaps I am missing something. At least I cannot see it from the initial integration to show orthogonality. – bmf Feb 15 '23 at 04:32
1

Here us a simple analytical proof of the orthogonality of Hermite polynomials.

Physicists know well, that the Hermite functions are eigenfunctions of the harmonic oscillator. The Hermite function is:

psi[n,x]= Exp[-x^2/2] HermiteH[n,x]

where, for simplicity, I did not write the normalization factor. The Eigen equation reads:

(-d^2/dx^2 + x^2) psi[n,x] == (2n+1) psi[n,x]

Now, it is well know that Eigen functions to different Eigen values are orthogonal (matrix element of 2 different Eigen functions of the Eigen operator must be zero).

Daniel Huber
  • 51,463
  • 1
  • 23
  • 57
  • @DanialHuber.... Hmmm... yes. Correct. ($+1$) But I'd really like to figure out the algorithmics of integration under discrete variables. – David G. Stork Feb 14 '23 at 18:13
1

Surely you know this, and probably not fully addressing your question ...

 p[{n_, m_}] :=  Integrate[Exp[-x^2] 
                 HermiteH[n, x] HermiteH[m,x], {x, -\[Infinity], \[Infinity]}];
 Timing[Map[p, Tuples[{Range[10], Range[10]}]]]

returns:

enter image description here

That is, you can calculate the integral for any finite set, but it will take a long time.

It took 17 seconds to compute 100 of them on M1 chip!

mjw
  • 2,146
  • 5
  • 13
  • Thanks (and yes I knew that!)... ($+1$). The trick is to then derive the general equation from such results. Perhaps *FindSequenceFunction* or other "wrapper" might infer the general results. – David G. Stork Feb 14 '23 at 20:30
  • Well empirically we see that $$\int\limits_{-\infty}^\infty e^{-x^2} H_n(x) H_m(x)\ dx = f(n) \delta_{nm},$$ and FindSequenceFunction was used in the previous question pointed to, so that's more or less it (other than using fancy Mathematica syntax to combine the results). – mjw Feb 15 '23 at 03:41
  • "Empirically" is nice... but we seek "algorithmically." – David G. Stork Feb 15 '23 at 04:31
1

I've never quite figured out an efficient way to apply MathematicalFunctionData to any problem. Often I cannot even figure out any way to apply it. The following shows some of the convolutions I feel are necessary for a simple table lookup:

orthoRule = Extract[
   MathematicalFunctionData["HermiteH:Polynomial", 
    "RelatedIdentities"],
   Position[
     ToExpression@ ToBoxes@ (*is this really necessary?*)
       MathematicalFunctionData["HermiteH:Polynomial", 
        "RelatedIdentities"],
     HoldPattern[Integrate[
       HermiteH[_, x_] HermiteH[_, x_] Power[
         Power[E, Power[x_, 2]], -1],
       {x_, _, _}]]
     ][[1, {1}]]] /.
  HoldPattern@Function[v_, Inactivate[a_ == b_]] :>
   RuleDelayed[
    Hold[a] /.
        Integrate -> Inactive[Integrate] /.
       Thread[v -> (Pattern[#, Blank[]] & /@ v)] /.
       \[FormalT] -> (x_) // ReleaseHold,
    b]

Inactivate[ Integrate[ E^(-x^2) HermiteH[n, x] HermiteH[m, x], {x, -[Infinity], [Infinity]}], Integrate] /. orthoRule PiecewiseExpand[%, {n, m} [Element] NonNegativeIntegers] // Simplify

Mathematica graphics

Some of the nutty things like ToExpression@ ToBoxes@... and Hold[a]... // ReleaseHold have to do with the evaluation and parsing of the integrand into a standard form. This was needed to construct a pattern that matched. The other constraint was blocking the evaluation of Integrate, which takes a long time just to return unevaluated.

Michael E2
  • 235,386
  • 17
  • 334
  • 747
0

You can also use the recursive formulas for the Hermite polynomials to proof the orthogonality property. Remember that $H_n'(t)=2nH_{n-1}(t)$ and $H_{n+1}(t)=2tH_n(t)-2nH_{n-1}(t)$

Then you can use partial integration to evaluate $$2(n+1)I_{n,m}=2(n+1)\int_{-\infty}^{\infty}H_n(t)H_m(t)e^{-t^2}dt=\int_{-\infty}^{\infty}H_{n+1}'(t)H_m(t)e^{-t^2}dt=\left[H_{n+1}(t)H_m(t)e^{-t^2}\right]_{-\infty}^{\infty}-\int_{-\infty}^{\infty}H_{n+1}\left(2mH_{m-1}(t)-2tH_m(t)\right)e^{-t^2}dt=\int_{-\infty}^{\infty}H_{n+1}(t)H_{m+1}(t)e^{-t^2}dt=I_{n+1,m+1}$$ Notice that the expression on the bottom is symmetrical, therefore we can conclude that $$2(n+1)I_{n,m}=2(m+1)I_{n,m}\ \forall n,m\in\mathbb{N}$$ and because $I_{n,m}$ is a convergent integral we can see that the Integral vanishes for $n\neq m$ and as a byproduct we obtained a recursive formula for the case of equality between n and m. With this recursion at hand and the gaussian error-integral we can inductively prove the orthogonality relation in all its glory.

Victor
  • 9
  • 2
  • 5
    I have no criticism of the math, but since the OP asked, "How can I computationally derive...?" and since this is a site about using Mathematica, I think they want to get Mathematica to do the math. Any ideas for that? – Michael E2 May 07 '23 at 17:06