Distribution of the Median

by greenturtle3141, Apr 8, 2022, 8:21 PM

Reading Difficulty: 4/5

$2n+1$ reals are chosen uniformly at random from the interval $[0,1]$. Let random variable $M_n$ be the median of these numbers. What is the distribution of $M_n$?

CLAIM: $M_n$ is a continuous random variable with density:
$$f_n(x)=(2n+1)\binom{2n}{n}x^n(1-x)^n \cdot 1_{[0,1]}(x)$$
Proof. Let's try to compute the CDF, $F_n$. For $t \in (0,1)$ we have that $M_n \leq t$ iff at least $n+1$ of the random reals chosen lie in $[0,t]$. Such an event may be partitioned into the following $n+1$ events:
  • Exactly $n+1$ of the numbers lie in $[0,t]$.
  • Exactly $n+2$ of the numbers lie in $[0,t]$.
  • ...
  • Exactly $2n+1$ of the numbers lie in $[0,t]$.

Computing the probability that exactly $k$ of the numbers lie in $[0,t]$ may be reasoned as follows: There are $\binom{2n+1}{k}$ ways to choose which $k$ of the numbers will lie in $[0,t]$. Then the probability that these $k$ numbers lie in $[0,t]$ is $t^k$, and the probability that the other $2n+1-k$ numbers lie in $(t,1]$ is $(1-t)^{2n+1-k}$. Altogether, this is a probability of $\binom{2n+1}{k}t^k(1-t)^{2n+1-k}$.

It follows that:
$$F_n(t) = \sum_{k=n+1}^{2n+1}\binom{2n+1}{k}t^k(1-t)^{2n+1-k}$$Since this is (absolutely) continuous, we deduce that indeed $M_n$ is a continuous random variable and that a density exists.

You might think that we're now going to brutally expand this, differentiate, and then pray that the result is the claimed density... but some beautiful magic happens if we differentiate now:
$$F_n'(t) = \sum_{k=n+1}^{2n+1}k\binom{2n+1}{k}t^{k-1}(1-t)^{2n+1-k} - (2n+1-k)\binom{2n+1}{k}t^k(1-t)^{2n-k}$$Let's examine this first term:
$$(n+1)\binom{2n+1}{n+1}t^{n}(1-t)^{n} = (n+1)\frac{(2n+1)!}{(n+1)!n!}t^{n}(1-t)^{n} = \frac{(2n+1)!}{n!n!}t^{n}(1-t)^{n} = (2n+1)\binom{2n}{n}t^n(1-t)^n$$Wait, isn't that the claimed density? Now we just need to show that everything else just zeroes out I guess... indeed, this series telescopes! To see why, just manipulate this expression, for $n+1 \leq k \leq 2n$:
$$(2n+1-k)\binom{2n+1}{k}t^k(1-t)^{2n-k} = (2n+1-k)\frac{(2n+1)!}{k!(2n+1-k)!}t^k(1-t)^{2n-k} = \frac{(2n+1)!}{k!(2n-k)!}t^k(1-t)^{2n-k}$$$$=(k+1)\frac{(2n+1)!}{(k+1)!(2n-k)!}t^k(1-t)^{2n-k} = (k+1)\binom{2n+1}{k+1}t^{(k+1)-1}(1-t)^{2n+1-(k+1)}$$Wow! So everything cancels except the very first term (the claimed density) and the very last term (which is just $=0$). $\square$


For fun we can now compute the expectation and variance of $M_n$.

CLAIM: $\mathbb{E}M_n = \frac12$

Proof. I mean, duh. $\square$

CLAIM: $\operatorname{Var} M_n = \frac{1}{8n+12}$
Proof. A simple inductive argument shows that for all $a,b \in \mathbb{N}_0$, we have:
$$\int_0^1 x^a(1-x)^b\,dx = \frac{a!b!}{(a+b+1)!}$$Applying this, we have:
$$\operatorname{Var} M_n = \mathbb{E}M_n^2 - (\mathbb{E}M_n)^2 =\int_0^1 x^2 \cdot(2n+1)\binom{2n}{n}x^n(1-x)^n \,dx-\frac14$$$$=\frac{(2n+1)(2n)!(n+2)!n!}{n!n!(2n+3)!} -\frac14 = \frac{(n+1)(n+2)}{(2n+2)(2n+3)} -\frac14$$And if you trust me, this ends up simplifying nicely to the claimed variance. $\square$

Comment

1 Comment

The post below has been deleted. Click to close.
This post has been deleted. Click here to see post.
Ah yes, I wonder who came up with this solution ;)

All teasing aside, great post!

by Archeon, Apr 28, 2022, 5:22 PM

Turtle math!

avatar

greenturtle3141
Archives
+ October 2024
Shouts
Submit
  • Can you give some thought to dropping a guide to STS? Just like how you presented your research (in your paper), what your essays were about, etc. Also cool blog!

    by Shreyasharma, Mar 13, 2025, 7:03 PM

  • this is so good

    by purpledonutdragon, Mar 4, 2025, 2:05 PM

  • orz usamts grader

    by Lhaj3, Jan 23, 2025, 7:43 PM

  • Entertaining blog

    by eduD_looC, Dec 31, 2024, 8:57 PM

  • wow really cool stuff

    by kingu, Dec 4, 2024, 1:02 AM

  • Although I had a decent college essay, this isn't really my specialty so I don't really have anything useful to say that isn't already available online.

    by greenturtle3141, Nov 3, 2024, 7:25 PM

  • Could you also make a blog post about college essay writing :skull:

    by Shreyasharma, Nov 2, 2024, 9:04 PM

  • what gold

    by peace09, Oct 15, 2024, 3:39 PM

  • oh lmao, i was confused because of the title initially. thanks! great read

    by OlympusHero, Jul 20, 2024, 5:00 AM

  • It should be under August 2023

    by greenturtle3141, Jul 11, 2024, 11:44 PM

  • does this blog still have the post about your math journey? for some reason i can't find it

    by OlympusHero, Jul 10, 2024, 5:41 PM

  • imagine not tortoise math

    no but seriously really interesting blog

    by fruitmonster97, Apr 2, 2024, 12:39 AM

  • W blog man

    by s12d34, Jan 24, 2024, 11:37 PM

  • very nice blog greenturtle it is very descriptive and fascinating to pay attention to :-D

    by StarLex1, Jan 3, 2024, 3:12 PM

  • orz blog

    by ryanbear, Dec 6, 2023, 9:23 PM

67 shouts
Tags
About Owner
  • Posts: 3553
  • Joined: Oct 14, 2014
Blog Stats
  • Blog created: Oct 23, 2021
  • Total entries: 54
  • Total visits: 40745
  • Total comments: 126
Search Blog
a