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?

Respuesta :

Answer:

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

Step-by-step explanation:

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

The probability of the random variable X is, [tex]P(X)=p=\frac{1}{25}[/tex].

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:

[tex]P(X=x)=(1-p)^{x-1}p; x=0,1,2,3...[/tex]

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)

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

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