# Expected Value of the Difference Between the Powers of Two Randomly Selected Numbers From a Standard Normal Distribution

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.

• 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.
– whuber
Commented Jun 9, 2023 at 14:14
• You can typeset math here using MathJax: math.meta.stackexchange.com/q/5020/321264. Commented Jun 9, 2023 at 15:40

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)$$:

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:

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

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]

• 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)!)