A printing machine has n letters say a1, a2,.. an. It is operated by impulses ,each letter produced by a different impulse. Assume that there exists a constant probablity ,p, of printing the correct letter and assume independence. One of the n impulses, chosen at random , was fed into the machine twice and both times a1 was printed. Whats the probability that the impulse chosen was meant to print a1.
Pr[printed a1 2x | a1]Pr[a1] = Pr[a1 | printed a1 2x]Pr[printed a1 2x]
Pr[a1] = $\dfrac 1 n$
Pr[printed a1 2x|a1] = $p^2$ as I showed
Pr[a1 | printed a1 2x] is the value you want to find
that leaves
Pr[printed a1 2x] = Pr[printed a1 2x|a1]Pr[a1] + Pr[printed a1 2x| !a1]Pr[!a1]
Pr[printed a1 2x] = $p^2 \cdot \dfrac 1 n$ + $(1-p)^2 \cdot \dfrac {n-1} n$
I leave it to you to digest all this and come up with your final answer.