Calculate probability that both $1$ and $2$ will be in the same cycle

combinatoricspermutationsprobabilityproof-verification

I solved this task and but I am not sure about my solution, can somebody check that?

Let consider random space of random n-permutation for $2\le n$;
Elementary events are $n-$permutations and each of them has the same
probability $\frac{1}{n!}$. Calculate probability that both $1$ and
$2$ will be in the same cycle.

$$P(\mathbb A) = \frac{\sum_{k}^{n-2} \binom{n-2}{k}\cdot (k+1)! \cdot (n-2-k)!}{n!}$$
We choose $k$ elements to complete our cycle, permutate them (with accuracy to shift) , and other elements just permutate.
It gives me result
$$ \frac{n}{2(n-2)} $$

Best Answer

Your first formula looks good (assuming the sum starts from $k=0$), but the simplification is not correct, and for $n=3$ gives a "probability" of $1.5$.

Your formula actually simplifies to $$\frac{\sum_{k=0}^{n-2}(n-2)!(k+1)}{n!}=\frac{\sum_{k=0}^{n-2}(k+1)}{n(n-1)},$$ which then gives $1/2$.

There is an easier way to see this. Choose $f(1)$ at random, then $f(f(1))$ (randomly from numbers not chosen so far), and so on, until you either hit $1$ or $2$. If you hit $2$ before $1$ then they will be in the same cycle, otherwise they are in different cycles. But $1$ and $2$ are equally likely to be chosen at every step.