1 The probability that a line of computer code contains an e
1. The probability that a line of computer code contains an error is 0.02. Suppose there are 100 lines of code and those errors are independent from line to line.
a) Find the probability that at least one line contain an error?
b) Explain why we use binomial distribution for this problem?
c) What is the expected value using a binomial distribution (mu)?
d) Use a Poisson approximation to find the probability that there are no mistakes over the 100 lines of code.
Solution
a)
Note that the probability of x successes out of n trials is
P(n, x) = nCx p^x (1 - p)^(n - x)
where
n = number of trials = 100
p = the probability of a success = 0.02
x = the number of successes = 0
Thus, the probability is
P ( 0 ) = 0.132619556
Thus,
P(at least 1) = 1 - P(0) = 1 - 0.132619556
P(at least 1) = 0.867380444 [ANSWER]
********************
b)
It is because there are only 2 possible results, the probability of success is constant, and the number of trials is constant and they are independent.
***********************
c)
E(x) = n p =100*0.02 = 2 [ANSWER]
************************
d)
Note that the probability of x successes out of n trials is
P(x) = u^x e^(-u) / x!
where
u = the mean number of successes = 2
x = the number of successes = 0
Thus, the probability is
P ( 0 ) = 0.135335283 [ANSWER]

