My question is similar to (and an extension of) this one.

I select two values ($i$ and $j$) at random from a standard normal distribution. What is the expected value of $|x_i^n-x_j^n|$ for all integer powers of $n$? The vertical bars represent absolute value symbols, so I know the answer will be a positive number for all values of $n$.

From this website, I know that, for $n = 1$, the expected value will be $2 / \sqrt\pi$, but I'm not sure about all other values of $n$. I'm hoping to find an equation that relates $n$ with the expected value; I suspect that it will involve an exponential term and a factorial (or gamma-function-like) term like the formula at the bottom of this website has, but I'm not quite able to figure it out myself.

Thanks in advance.

  • $\begingroup$ Expressing the integral in polar coordinates shows it's separable. The radial integral is a Gamma function of $n.$ The angular integral can be broken into eight equal sectors where, on each sector, you need to integrate $\cos^n(\theta)\pm \sin^n(\theta),$ which is elementary. $\endgroup$
    – whuber
    Commented Jun 9, 2023 at 14:14
  • 1
    $\begingroup$ You can typeset math here using MathJax: math.meta.stackexchange.com/q/5020/321264. $\endgroup$ Commented Jun 9, 2023 at 15:40

1 Answer 1


Here is a solution aided interactively with a computer algebra system which does not get all of it by itself, but certainly assists the path to finding the solution.

Let $X$ and $Y$ be independent $\text{N(0,1)}$ drawings, with joint pdf $f(x,y)$:

enter image description here

The problem is to find: $\quad E\big[\space \big|{X^n - Y^n} \big| \space \big] \quad \quad \text{for positive integer} \space n$.

Trying the obvious integrations with a computer algebra system (here Mathematica and mathStatica) just yields an unevaluated integral. So, instead, consider say the first positive 20 integers:

enter image description here

... and solve $E\big[\space \big|{X^n - Y^n} \big| \space \big]$ for $n$ = 1 to 20:

enter image description here

This can be seen to contain two sequences:

  • one sequence for ODD-valued $n$ of form:

$$\frac{{2^\frac{3-n}{2}}}{\sqrt \pi}\big\{1, \space 5, \space 43, \space 531, \space 8601, \space 172965 ...\big\}$$

where the latter sequence is in the Encyclopedia of Integer Sequences, and can be generated by:

$$ \frac{1}{\sqrt{2}} 2^{\frac{n-1}{2}} n\text{!!} B_{\frac{1}{2}}\left(\frac{1}{2},\frac{n+1}{2}\right) \quad \text{denoting the incomplete Beta function}$$

  • one sequence for EVEN-valued $n$ of form:

$$\frac{4}{\pi} \big \{1, \space 4, \space 22, \space 160, \space 1464, \space 16224 ...\big \}$$

where the latter sequence is also in the Encyclopedia of Integer Sequences, and can be generated by:

$$n \, _2F_1\left(1,\frac{1-n}{2};\frac{3}{2};-1\right) \Gamma \left(\frac{n}{2}\right)-\sqrt{\pi } 2^{\frac{n}{2}-1} \Gamma \left(\frac{n+1}{2}\right) \quad $$

where 2F1 denotes the Hypergeometric2F1 function.

In Summary

  • For $n$ odd, the solution is: $$n\text{!!} \sqrt{\frac{2}{\pi }} B_{\frac{1}{2}}\left(\frac{1}{2},\frac{n+1}{2}\right)$$

  • For $n$ even, the solution is:

$$ \frac{1}{\pi \frac{n}{2}!} 2^{1-\frac{n}{2}} \left(2^{n+2} \left(\frac{n}{2}!\right)^2 \, _2F_1\left(\frac{1}{2},\frac{n}{2}+1;\frac{3}{2};-1\right)-\pi n!\right)$$

Mathematica code

  • For odd $n$:

    oddsol = n!! Sqrt[2/Pi] Beta[1/2, 1/2, (n + 1)/2]

enter image description here

  • For even $n$:

    evensol = (2^(1 - n/2)*((-Pi)*n! + 2^(2 + n)*(n/2)!^2* Hypergeometric2F1[1/2, 1 + n/2, 3/2, -1]))/(Pi*(n/2)!)

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.