235k views
4 votes
Joe is debugging a coding project. From prior experience he expects to find a bug in every 25 lines of code and each bug occurs independently of other bugs. What is the probability that it takes more than 30 lines of code until Joe finds his first bug?

1 Answer

0 votes

Answer:

The probability that it takes more than 30 lines of code until Joe finds his first bug is 0.2821.

Explanation:

Let X = number of bugs in every 25 lines of code.

The probability of the random variable X is,
P(X)=p=(1)/(25).

The random variable X follows a Geometric distribution.

A Geometric distribution is the probability distribution of the number of Bernoulli trials needed before the first success.

The probability mass function of Geometric distribution is:


P(X=x)=(1-p)^(x-1)p; x=0,1,2,3...

Compute the probability that it takes more than 30 lines of code until Joe finds his first bug as follows:

P (X > 30) = 1 - P (X ≤ 30)


=1-\sum\limits^(30)_(x=0)[(1-(1)/(25))^(x-1)(1)/(25)]\\=1-0.7179\\=0.2821

Thus, the probability that it takes more than 30 lines of code until Joe finds his first bug is 0.2821.

User MrAlias
by
4.8k points