2 /2 CAN WE INTEGRATE x2 e−x ? MICHAEL ANSHELEVICH . Not every nice function has an integral given by a formula. The standard example is RA BSTRACT 2 e−x /2 dx which is not an “elementary” function. On the other hand, Z 2 2 xe−x /2 dx = −ex /2 . R R 2 2 What about x2 e−x /2 dx? Is this a calculus integral? What about x3 e−x /2 dx? In this talk, I will give a complete answer to this question. The answer involves Hermite polynomials. The arguments do not use anything beyond calculus, but connect to a number of more advanced topics. 1. T HE PROBLEM Every calculus textbook (for example Stewart, page 493) points out that not every integral can be “done”, that is, can be expressed in terms of the usual (“elementary”) functions. A standard example is Z 2 e−x /2 dx, which cannot be computed by calculus methods, no matter how clever you are, despite its importance in probability and statistics (this is the famous Bell Curve). On the other hand, the integral Z 2 xe−x /2 dx is easy: substitution u = x2 /2, du = x dx shows that it equals Z 2 /2 e−u du = −e−u + C = −e−x What about Z x2 e−x 2 /2 + C. dx? I claim that it is not elementary. But note that d 2 −x2 /2 −xe = (x2 − 1)e−x /2 , dx so Z 2 2 (x2 − 1)e−x /2 dx = −xe−x /2 + C. Also Z x3 e−x 2 /2 2 /2 dx = −(x2 + 2)e−x Date: March 5, 2010. 1 + C. 2 How did I guess that? 2. T HE SOLUTION USING H ERMITE POLYNOMIALS Definition 1. For each n, define the Hermite polynomial Hn (x) by dn −x2 /2 2 e = (−1)n Hn (x)e−x /2 . n dx Example 1. For example, H0 (x) = 1, d −x2 /2 2 e = −xe−x /2 dx so H1 (x) = x, 2 d −x2 /2 2 2 e = −e−x /2 + x2 e−x /2 2 dx so H2 (x) = x2 − 1, d3 −x2 /2 2 e = (x + 2x − x3 )e−x /2 3 dx so H3 (x) = x3 − 3x etc. Clearly Hn (x) is a polynomial of degree n, with the highest term xn . Hermite polynomials appear in many contexts. If you know Linear Algebra: Hermite polynomials are orthogonal polynomials. If we define the inner product between two functions Z ∞ 2 hf, gi = f (x)g(x) e−x /2 dx, −∞ then Z ∞ hHn , Hk i = Hn (x)Hk (x) e−x 2 /2 dx = 0 −∞ for n 6= k, so that Hn and Hk are orthogonal to each other. In quantum mechanics, Hermite polynomials are closely connected to the eigenfunctions for the harmonic oscillator. How do they help us? Let us compute the derivative of a Hermite polynomial times the exponential function. n n+1 d d 2 2 −x2 /2 n d −x2 /2 n d = Hn (x) e (−1) e = (−1) e−x /2 = −Hn+1 (x) e−x /2 ! n n+1 dx dx dx dx In other words, we proved 3 Lemma 1. Z Hn+1 (x) e−x 2 /2 dx = −Hn (x) e−x 2 /2 + C. Example 2. For example, Z Z Z xe−x 2 /2 dx = −e−x 2 /2 (x2 − 1)e−x (x3 − 3x)e−x 2 /2 2 /2 + C, dx = −xe−x 2 /2 + C, dx = −(x2 − 1)e−x 2 /2 + C, etc. Exercise 1. What about the derivative of Hn itself? One can check that in fact, d Hn (x) = nHn−1 (x) dx Note that this is the same rule as d n x = nxn−1 ! dx Are there any other polynomials with this property? What about our original question, for Z xn e−x 2 /2 dx? Well, Z e−x 2 /2 dx cannot be done (so says Stewart, so it must be true). We know how to do Z 2 xe−x /2 dx. Also, by our calculation Z 2 −x2 /2 xe Z dx = e−x 2 /2 dx − xe−x 2 /2 + C. Since the right-hand-side cannot be done, neither can the left-hand-side. For general n? We can write 1 = 1 = H0 (x), x = x = H1 (x), x2 = (x2 − 1) + 1 = H2 (x) + H0 (x), x3 = (x3 − 3x) + 3x = H3 (x) + 3H1 (x), 4 and in general xn = Hn (x) + an−1 Hn−1 (x) + an−2 Hn−2 (x) + . . . + a1 H1 (x) + a0 H0 (x). And we know Z Hk (x) e−x 2 /2 dx = −Hk−1 (x)e−x 2 /2 + C. Not quite: only for k ≥ 1. 2 /2 So: can integrate xn e−x if and only if xn “contains no H0 ”, that is, if a0 = 0. How to find a0 ? In Linear Algebra: {H0 , H1 , H2 , H3 , . . .} form an orthogonal basis. It is not orthonormal: Z ∞ √ 2 hH0 , H0 i = e−x /2 dx = 2π. −∞ So Z ∞ 1 hxn , H0 i 2 =√ xn e−x /2 dx. a0 = hH0 , H0 i 2π −∞ Note this is a number, not a function. We do not know this number. But: If n is odd, xn e−x 2 /2 is an odd function, so that Z ∞ 1 2 a0 = √ xn e−x /2 dx = 0 2π −∞ so can integrate. 2 /2 If n is even, xn e−x > 0 is a positive function, so that Z ∞ 1 2 a0 = √ xn e−x /2 dx > 0 2π −∞ and we cannot integrate. Theorem 2. We can integrate xn e−x 2 /2 if n is odd, and cannot integrate it if n is even. More generally, we can integrate P (x)e−x 2 /2 if and only if Pn (x) is a linear combination of {H1 , H2 , . . .} (excluding H0 ). We also discussed that the moments of the Gaussian distribution are zero for odd n and Z ∞ 1 2 √ x2n e−x dx = (2n − 1)!! = (2n − 1) · (2n − 3) . . . 5 · 3 · 1. 2π −∞ R EFERENCE : Persi Diaconis and Sandy Zabell, C LOSED FORM SUMMATION FOR CLASSICAL DISTRIBUTIONS : VARIATIONS ON A THEME OF DE M OIVRE , Statistical Science 6 n. 3 (Aug. 1991) 284–302. 5 3. M ORE ON H ERMITE POLYNOMIALS 3.1. Solution of Exercise 1. For the first part: look at the generating function ∞ X 1 F (x, z) = Hn (x)z n . n! n=0 Using Taylor series P 1 (n) f (a)bn n! = f (a + b), ∞ ∞ X X 1 dn 1 2 2 n Hn (x)z = (−1)n ex /2 n e−x /2 z n F (x, z) = n! n! dx n=0 n=0 = ex 2 /2 = ex 2 /2 ∞ X 1 dn −x2 /2 e (−z)n n n! dx n=0 2 /2 e−(x−z) = exz−z 2 /2 . We showed Lemma 3 (Generating function). ∞ X 1 2 F (x, z) = Hn (x)z n = exz−z /2 . n! n=0 Differentiating with respect to x, we get ∂ xz−z2 /2 2 e = zexz−z /2 . ∂x Thus ∞ X 1 0 ∂ Hn (x)z n = F (x, z) = zF (x, z) n! ∂x n=0 ∞ ∞ ∞ X X X 1 1 n n+1 n = Hn (x)z = Hn−1 (x)z = Hn−1 (x)z n . n! (n − 1)! n! n=0 n=1 n=1 Comparing coefficients of z n , we get Lemma 4 (Differential recursion). Hn0 (x) = nHn−1 (x). Exercise 2. Use the lemma just above to show that the Hermite polynomials are orthogonal. In fact, use induction to compute Z ∞ 2 hHn , Hk i = Hn (x)Hk (x) e−x /2 dx. −∞ 6 For the second part of Exercise 1 (other polynomials with Pn0 (x) = nPn (x), look up terms such as Bernoulli polynomials, Euler polynomials, and Appell polynomials. Try to write out polynomials {Pn (x)} such that ∞ X 1 Pn (x)z n = exz ef (z) n! n=0 for some simple functions f . Dave asked: what about polynomials with some other relation Pn0 (x) = bn Pn (x), for example Pn0 = n2 Pn ? Note that the Hermite polynomials are monic, that is, their leading coefficient is 1. For monic polynomials, we can only hope to have Pn0 = nPn (why?) But there is a class of polynomials satisfying a similar more general property, called the Boas-Buck polynomials (Boas is Ralph Boas, father of our Harold Boas). This is class is far from completely understood, and in fact I am interested in it for my research. 3.2. Discrete Math. How to compute Hn quickly? Recursively! Differentiating F (x, z) with respect to z, we get ∂ xz−z2 /2 2 2 e = xexz−z /2 − zexz−z /2 . ∂z Thus xF (x, z) = or ∂ F (x, z) + zF (x, z), ∂z ∞ ∞ ∞ X X X 1 1 1 (xHn (x))z n = nHn (x)z n−1 + Hn (x)z n+1 n! n! n! n=0 n=0 n=0 ∞ ∞ X X 1 n n = Hn+1 (x)z + Hn−1 (x)z n . n! n! n=0 n=0 So Lemma 5 (Three-term recursion). xHn (x) = Hn+1 (x) + nHn−1 (x). Exercise 3 (Discrete math). Show that Hn (x) = cn,n xn − cn,n−2 xn−2 + cn,n−4 xn−4 − cn,n−6 xn−6 + . . . , where cn,k is the total number of partitions of n elements into pairs and singletons, with k singletons. In fact, show that n! cn,n−2k = . (n − 2k)!2k k! 7 3.3. Differential Equations. We compute Hn00 − xHn0 = n(n − 1)Hn−2 − nxHn−1 = n[(n − 1)Hn−2 − xHn−1 ] = −nHn . So Lemma 6 (Differential equation). Hn is a solution of the second-order linear differential equation Hn00 − xHn0 + nHn = 0 , or: Hn is an eigenfunction of the differential operator y 00 − xy 0 with eigenvalue −n. 3.4. Linear Algebra. Look at the matrix .. . 0 1 0 0 0 1 0 2 ... 0 0 . . . .. .. .. 0 1 0 . Mn = . . . . . . . . . . . n−2 . 0 0 0 ... 1 0 n − 1 .. . 0 0 0 1 0 8 What are the eigenvalues of Mn ? Expand with respect to the last row: .. . −λ 1 0 0 0 1 −λ 2 . . . 0 0 ... ... . . . 0 1 −λ det(Mn+1 − λI) = . .. .. .. . . . n−1 0 .. ... 0 0 1 −λ n .. 0 . 0 0 1 −λ ... .. . 0 0 0 −λ 1 0 −λ 1 1 −λ 2 . . . 1 −λ 2 . . . 0 0 ... . . . . . . . . . − = −λ 0 1 −λ 1 −λ 0 ... ... ... ... ... ... ... ... n − 1 0 ... ... 0 0 1 −λ 0 0 1 n .. .. . . 0 −λ 1 0 0 −λ 1 0 ... 1 −λ 2 . . . 1 −λ 2 0 0 . . .. . . − n .. = −λ 0 . . . . 1 −λ 1 −λ 0 ... ... ... ... ... ... ... ... n − 2 n − 1 .. .. 0 0 . 1 . 1 −λ 0 −λ 0 = −λ det(Mn − λI) − n det(Mn−1 − λI). Recall Hn+1 (x) = xHn (x) − nHn−1 (x). So det(Mn − λI) = Hn (−x). So Lemma 7. eigenvalues of Mn = (−) zeros of Hn . Exercise 4. The Hermite polynomials {H0 (x), H1 (x), H2 (x), . . .} form a basis for the vector space of polynomials P. In this basis, the matrix M∞ is a matrix of some linear operator. What is that operator on P? Lemma 8. Each Hn has n real, simple zeroes. Moreover, these zeros are interlacing: if Hn has zeros x1 < x2 < . . . < xn and Hn−1 has zeroes y1 < y2 < . . . < yn−1 , 9 then x1 < y1 < x2 < y2 < . . . < xn−1 < yn−1 < xn . Proof. We can factor Hn (x) = (x − a1 )k1 (x − a2 )k2 . . . (x − am )km Q(x) where ai are real roots, and Q does not have any real roots. Say the product is written in such an order that k1 , k2 , . . . , kj are odd and kj+1 , . . . , km are even. Denote P (x) = (x − a1 )(x − a2 ) . . . (x − aj ). Then the polynomial P (x)Hn (x) never changes sign (since all its real roots have even multiplicity), so it either always positive or always negative. So in particular, Z ∞ 2 P (x)Hn (x)e−x /2 dx 6= 0. −∞ But since the Hermite polynomials are orthogonal, such a product is zero for any polynomial of degree less than n. So deg P = n, which means that all the roots of P are real and different. Why interlacing: Hn0 (x) = nHn−1 (x). So roots of Hn−1 are maxima and minima of Hn . Zero of the Hermite polynomials also appear in numerical integration in Numerical Analysis (the term is Gaussian quadrature). 4. G ENERAL ORTHOGONAL POLYNOMIALS For other orthogonal polynomials: {P0 (x), P1 (x), P2 (x), . . .} , Pn (x) = xn + . . . , Orthogonal with respect to w(x), meaning that Z ∞ hPn , Pk i = Pn (x)Pk (x)w(x) dx = 0 −∞ if n 6= k. Examples: w(x) = e−x on [0, ∞), w(x) = 1 on [−1, 1]. There are also discrete weights, such as the Poisson distribution. Which of the properties of Hermite polynomials hold for more general orthogonal polynomials? Recursion: always xPn (x) = Pn+1 (x) + βn Pn (x) + γn Pn−1 (x), for some βi and some non-negative γi . Derivative Pn0 = nPn : only Hermite. Second-order differential equation: Hermite, Laguerre, Jacobi. The eigenvalue problem is (p(x)y 0 (x))0 + q(x)y 0 (x) = λy(x). The operator on the left-hand-side is called a Sturm-Liouville operator; such operators are studied in many differential equations books. 10 Exercise 5. Check that for this differential operator to have polynomial eigenfunctions, we for sure need that p is a polynomial of degree 2, q is a polynomial of degree 1. One can show that if the polynomial eigenfunctions are orthogonal, then w0 q(x) = w p(x) (One checks that this is the condition for the operator to be symmetric with respect to the inner product given by w(x).) Use partial fractions to find w(x) for different types of q(x) and p(x). Characteristic polynomial of a matrix: always true, use βi , γi as above. Zeros: always true, even though cannot use the derivative.