5
$\begingroup$

The following question was asked by another user and then deleted. I liked my answer to the post, so I have made another post with the question and the answer. I am paraphrasing the question here, followed by my answer below, in the hope that it will be useful to someone else.

Question:

Assume that we choose a random permutation of $1,\dots, n$ and consider all numbers $i$ that are greater than the numbers that appear to its left. What is the probability that the sum of such numbers is even?

Conjecture: This probability is exactly $\frac 12$ if $n$ is even and $\frac12 - \frac1{2n}$ if $n$ is odd.

$\endgroup$

2 Answers 2

5
$\begingroup$

Define indicator random variables $X_1,\ldots, X_n$ where $X_i = 1$ if $i$ appears to the left of $i+1,\ldots, n$ in the random permutation. Consider the random variables $$ Y_n = (-1)^{X_1+ X_3 + \cdots} $$ and $$ Z_n = (-1)^{X_2 + X_4 + \cdots}. $$ Note that $\mathbb{E}Y_n$ will give us the answer to the question since it yields the difference between the probability of the sum being even and the sum being odd.

We will try to compute $\mathbb{E}Y_n$ and $\mathbb{E}Z_n$ inductively on $n$. Conditioned on the choice of any ordering $\pi$ of $2,\ldots, n$, the probability that $X_1 = 1$ is exactly $1/n,$ which implies that $$ \mathbb{E}\left[ (-1)^{X_1}\ \right|\left. \pi\right] = \left(1-\frac{2}{n}\right). $$ To compute $\mathbb{E}Y_n$, we note that $$ \mathbb{E} Y_n = \left(1-\frac{2}{n}\right)\cdot \mathbb{E}_\pi (-1)^{X_3 + X_5 + \cdots} = \left(1-\frac{2}{n}\right) \cdot\mathbb{E} Z_{n-1} $$ where we switched to $Z_{n-1}$ since we are now summing the $X_i$ variables corresponding to $i$ of even rank among $\{2,\ldots, n\}$. Similarly, we can also show $$ \mathbb{E}Z_n = \mathbb{E}Y_{n-1}. $$

This implies that $\mathbb{E}Y_n = (1-\frac{2}{n}) \mathbb{E} Y_{n-2}$ for $n > 2$ and hence $$ \mathbb{E}Y_n = \frac{n-2}{n}\cdot \frac{n-4}{n-2}\cdots $$

For the base cases $n = 1,2$, we can explicitly compute $$ \mathbb{E}Y_1 = -1, \ \ \ \mathbb{E}Y_2 = 0. $$

This shows that if $n$ is even, $\mathbb{E} Y_n = 0$, implying that the probability of the sum being odd and even are both $1/2$.

When $n$ is odd, $\mathbb{E}Y_n = -\frac{1}{n}$, implying that the probability of the sum being even is $\frac{1}{2} - \frac{1}{2n}$.

$\endgroup$
2
$\begingroup$

Here's a quick proof that the probability is $1/2$ when $n$ is even, but I couldn't figure out a similarly quick proof (i.e. one that avoids induction) when $n$ is odd.

Notice that the following procedures are equivalent:

  1. Pick a uniformly random permutation.
  2. Pick a uniformly random permutation, then with probability $1/2$, flip the positions of $n - 1$ and $n$.

But if $n$ is even, then flipping the positions of $n - 1$ and $n$ flips the parity of the desired sum, because it toggles whether $n - 1$, which is odd, is included in the sum. So if $n$ is even, procedure 2 makes the desired sum even with probability $1/2$, and thus so does procedure 1.

$\endgroup$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.