A computer program contains one error. In order to find the error, we split the program into 6 blocks and test two of them, selected at random. Let X be the number of errors in these blocks. Compute E(X).

Respuesta :

There are [tex]\dbinom62[/tex] ways of selecting two of the six blocks at random. The probability that one of them contains an error is

[tex]\dfrac{\dbinom11\dbinom51}{\dbinom62}=\dfrac5{15}=\dfrac13[/tex]

So [tex]X[/tex] has probability mass function

[tex]f_X(x)=\begin{cases}\dfrac13&\text{for }x=1\\\\\dfrac23&\text{for }x=0\end{cases}[/tex]

These are the only two cases since there is only one error known to exist in the code; any two blocks of code chosen at random must either contain the error or not.

The expected value of finding an error is then

[tex]\displaystyle\sum_{x=0}^1xf_X(x)=0\times\dfrac23+1\times\dfrac13=\dfrac13[/tex]