Let $Y_1<Y_2 $ denote the order statistics of a random sample of size 2 from a distribution that is $N\left( \mu,\sigma^2 \right) $, where $\sigma^2$ is known. Compute the expected value of the random length $Y_2-Y_1$.

I can see that the answer is $\frac{2\sigma}{\sqrt{\pi}}$ but I do not know how to get there since I cannot evaluate the double integral:

$$ \int_{-\infty}^{\infty} \int_{-\infty}^{y_2} \left( y_2-y_1 \right) \frac{1}{2\pi \sigma^2} exp \left\{ -\frac{1}{2\sigma^2}\left[ \left( y_1-\mu \right)^2 +\left( y_2-\mu \right)^2 \right]\right\} \mathrm {dy_1 dy_2}$$

Any ideas on how to compute this are greatly appreciated, thank you!

  • 3
    $\begingroup$ How can you "see the answer" if you can't compute the integral? Hint: Just use $Y_2 - Y_1 = |X_2 - X_1|$ where the $X_i$ form the underlying sample. (Why?) Now use properties of joint normality and compute the resulting one-dimensional integral. $\endgroup$
    – cardinal
    Oct 30, 2013 at 17:06
  • $\begingroup$ @cardinal This is simply the answer at the end of the book but I cannot see how it is reached. Do you mean that I have to use the bivariate normal distribution? I am still a begginer so I might not know enough. $\endgroup$
    – JohnK
    Oct 30, 2013 at 17:09
  • $\begingroup$ What do you know about linear combinations of jointly normal random variables? What does that tell you about $\Delta = X_2 - X_1$? Can you go from there? $\endgroup$
    – cardinal
    Oct 30, 2013 at 17:12
  • 1
    $\begingroup$ Good! (Minor typo: you forgot the $\sigma^2$.) I'm saying: Think of the difference of order statistics as a function on the underlying (unordered) sample. I've shown you what that function is in this case; now you need only justify why it's true and then calculate $\mathbb E|\Delta|$. $\endgroup$
    – cardinal
    Oct 30, 2013 at 17:19
  • 2
    $\begingroup$ Please write up and post your solution as an answer once you get everything resolved to your satisfaction. I'll be happy to provide any feedback necessary to polish it (and an upvote, of course). Cheers. $\endgroup$
    – cardinal
    Oct 30, 2013 at 17:39

2 Answers 2


Here is a quick check using a computer algebra system. I am using the mathStatica package for Mathematica (I am one of the developers of the former) to automate the nitty gritties for me ...

Given: The parent pdf is $N(\mu, \sigma^2)$ with pdf $f(y)$:

enter image description here

Then, the joint pdf of the 1st and 2nd order statistics $(Y_1, Y_2)$, in a sample of size 2, denoted say $g(y_1,y_2)$ can be easily obtained using the OrderStat function:

enter image description here

Note that the constant multiplier here is $\frac{1}{\pi \sigma^2}$, not $\frac{1}{2\pi \sigma^2}$ in your equation.

Because the constraint $Y_1 < Y_2$ is already entered into the pdf definition, we can enter the domain of support on the real line as:

enter image description here

Finally, the expectation you seek is:

enter image description here

which agrees with your stated solution.

@Ioannis wrote:

Is there a way to see how the integral is computed though?

One can activate VerboseMode, which shows all the integrands being sent off for calculation. With VerboseMode[On], one can see the intermediary integrands ...

enter image description here

You might need to open the pic manually in a separate window to see the detail ...

  • $\begingroup$ Hey thanks. Is there a way to see how the integral is computed though? $\endgroup$
    – JohnK
    Nov 1, 2013 at 13:35
  • $\begingroup$ Yes - partially - please see addendum above. $\endgroup$
    – wolfies
    Nov 1, 2013 at 15:40

As was mentioned in the comment section, the sample range $Y_2-Y_1$ can be expressed as $Y_2-Y_1=X_{(2)}-X_{(1)}=|X_1-X_2|$ where $(X_1,X_2)$ is the random sample under consideration.

Since $(X_1,X_2)$ is i.i.d $\mathcal{N}(\mu,\sigma^2)$, by the reproductive property of normal distribution, we have $X_1-X_2\sim\mathcal{N}(0,2\sigma^2)$. So, $E(|X_1-X_2|)$ is simply the mean absolute deviation of $X_1-X_2$ about its mean.

It is well-known (and can be easily shown) that, for some $X\sim\mathcal{N}(\mu,\sigma^2)$, one has mean absolute deviation about mean $E(|X-\mu|)=\sqrt{\frac{2}{\pi}}\sigma$.

So, for $X\sim\mathcal{N}(0,\sigma^2)$, we readily get $E(|X|)=\sqrt{\frac{2}{\pi}}\sigma$

Hence, $E(Y_2-Y_1)=E(|X_1-X_2|)=\sqrt{\frac{2}{\pi}}\cdot\sqrt{2}\sigma=\frac{2\sigma}{\sqrt{\pi}}$

This, in my opinion, is easier to show than to find the expectation from the distribution of $Y_2-Y_1$ or to find $E(Y_2)-E(Y_1)$ from the distributions of $Y_1$ and $Y_2$.

Interestingly, by the same logic, it can be shown that expected value of the sample range $R$ from the same population when the sample size is three is $E(R)=\frac{3\sigma}{\sqrt{\pi}}$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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