I'm having a trouble understanding the logic behind the derivation of probability for a certain event. I'll state my question and explain the part which's bothering me:
"In a permutation of an ordered numbers set $(1,2,3,....,n) \:, n>=2$, each event in which two numbers $i$ and $j$, $i\neq j$, swap places ($i\longleftrightarrow j$) is called a replacement. For example, in the permutation $(7,5,6,3,2,4,1)$ of the ordered numbers set $(1,2,3,4,5,6,7)$, there are two replacements: $1\longleftrightarrow 7$ and $2\longleftrightarrow 5$.
What is the expectation of the number of replacements in a uniform and randomly given permutation of the ordered numbers set $(1,2,3,4,5,6,7)$?
Ps.: By uniform, it means that all the permutations have the same probabilities."
My solution: There are $\frac {42}{2}=21$ couples of numbers which can participate in a replacement, so I defined the following indicator:
$$\forall i\neq j, \:\:\:\:\:\mathcal{X}_{i,j}=\begin{cases} 1,& i,j \:are \:swapped\:\\ 0,& otherwise\end{cases}$$
Hence, the number of replacements in a given permutation is:
$$X=\sum\limits_{1\le i<j\le 7} \mathcal{X}_{i,j}$$
But I'm having a trouble calculating the probability that two numbers $i,\: j$ are a replacement. My first instinct tells me it's $\frac {2}{42}=\frac {1}{21}$, for out of 42 couples it can be picked twice. However, that means that $E[\mathcal{X}]=1$ which is wrong... the answer in the book is $E[\mathcal{X}]=\frac{1}{2}$ but I cannot understand why. Thanks in advance for any help!
The probability that $X_{i,j}=1$ is by symmetry exactly the same as the one that $X_{i,j}=0$. To see why, pick a permutation $\pi$ where $(i,j)$ is a replacement. Then $\pi\circ[i,j]$ is another permutation, where $(i,j)$ is not; you therefore have exactly the same number of permutations where $(i,j)$ is a replacement than of permutations where it is not, since $$ \phi\colon \pi \mapsto \pi\circ[i,j] $$ is a bijection. This implies $\mathbb{E} X_{i,j} = \mathbb{P}\{X_{i,j}=1\} = \mathbb{P}\{X_{i,j}=0\}.$
Now, the number of permutations $\pi$ where $\{i,j\} = \{\pi(i),\pi(j)\}$ is $2\cdot 5!$: indeed, this is leaving only $5$ elements out of $7$ (the remaining ones to permute) to choose, times the two choices (swapping $i$ and $j$ or not), leading to $2\cdot 5!$ permutations. In particular, such a permutation $\pi$ is picked with probability $\frac{2\cdot 5!}{7!} = \frac{1}{21}$.
Thus, $\mathbb{E} X_{i,j} = \frac{1}{2}\frac{1}{21}.$ But you have $\binom{7}{2}=2$ pairs $(i,j)$, so overall the sum is $$\mathbb{E} X = 21\cdot \frac{1}{2}\cdot\frac{1}{21} = \frac{1}{2}.$$