# Hitting a Target

If the probability of hitting a target is $1/5$, and 10 shots are fired independently, what is the probability of the target being hit at least twice?

Let $X$ be the number of times the target is hit. We want to find $P(X \geq 2)$. So $$P(X \geq 2) = 1-P(X < 2)$$

$$= 1- \binom{10}{0} (0.2)^{0} (0.8)^{10}-\binom{10}{1} (0.2)^{1}(0.8)^{9}$$

Would that be correct?

Thanks

-
Yes, that is correct, and I am pleased that you figured out that it is easier to calculate the complementary probability instead of adding up $P\{X = 2\} + P\{X = 3\} + \cdots + P\{X = 10\}$ – Dilip Sarwate Dec 29 '11 at 1:20

One way to check theory is to simulate the problem. The code snippet below (using Octave) gives the empirical value of $0.62980$ which is comparable to the answer you have: $0.62419$ (See computation at Wolfram Alpha).

Of course, simulations like the one below are no guarantee that your theoretical answer is correct. However, at the very least they can help rule out incorrect answers and serve as a secondary check to your theoretical analysis.

function ev = ProbEst()

# Probability of hit is 1/5
probHit = 1/5;

totalIter = 10000;
noShots = 10;

# Counter to track if the event of interest
# has occurred
eventOccurred = 0;

# Set seed of random number generator
rand("state",[11;22;3209;42038021;11]);

for iter =1:totalIter
targetHit = 0;
for shot = 1:noShots
if (rand(1,1) < probHit)
targetHit += 1;
endif
endfor
if (targetHit >= 2)
eventOccurred += 1;
endif
endfor

# Output empirical probability to console
eventOccurred/totalIter

endfunction

-
So this does nothing except say "I can't say your result is wrong". – msh210 Dec 29 '11 at 22:44
It is a reality check, or would be if tards had bothered to estimate the size of the sampling error in his/her estimate (looks as though it ought to be $\sim \pm 1$ in the second digit). When you have to do this sort of thing for real it is always a good idea to conduct some sort of reality check. It also shows a horrible example of Octave/Matlab un-vectorised code, but I suppose that could be to make it comprehensible to the uninitiated. – Conrad Turner Jan 6 '15 at 21:45

Yes.

-