Probability of printing characters A printing machine capable of printing $n$ characters $A_1,A_2,\dotsc,A_n$ is operated by feeding electronic impulse. There is a distinct impulse designed to produce each character. One impulse is chosen at random and fed into the machine twice and found that 

                1.A_1 is printed twice
                2.First A_1 is printed than A_2


Suppose $p$ is the probability of printing the right character.Then find the probability that the impulse designed to produce $A_1$ was fed into the machine.
Here's an answer to (1), (2) is very similar. First note that each impulse is capable of producing any character, I assume with a probability of $\frac{1-p}{n-1}$. So the probability of impulse k producing character k is $p^2$. k then not k needs breaking down into component parts, so for example (k,1) is $p\frac{1-p}{n-1}$, and similarly (1,1) is $\frac{1-p}{n-1}\times\frac{1-p}{n-1}$. We can re-sum these to prove the answer is $1$. Now we only need to add the probability the impulse is $k=1$ and it fires correctly twice  ($p^2$), plus the impulse is not $k=1$ and it misfires twice: $n-1 \times\frac{1-p}{n-1}\times\frac{1-p}{n-1} = (1-p)\times\frac{1-p}{n-1} = \frac{1-2p+np^2}{n-1}.$
Here's an answer to (1), (2) is very similar. First note that each impulse is capable of producing any character, I assume with a probability of $\frac{1-p}{n-1}$. So the probability of impulse k producing character k is $p^2$. k then not k needs breaking down into component parts, so for example (k,1) is $p\frac{1-p}{n-1}$, and similarly (1,1) is $\frac{1-p}{n-1}\times\frac{1-p}{n-1}$. We can re-sum these to prove the answer is $1$. Now we only need to add the probability the impulse is $k=1$ and it fires correctly twice  ($p^2$), plus the impulse is not $k=1$ and it misfires twice: $n-1 \times\frac{1-p}{n-1}\times\frac{1-p}{n-1} = (1-p)\times\frac{1-p}{n-1} = \frac{1-2p+np^2}{n-1}.$