Test three randomly selected blocks of a program











up vote
1
down vote

favorite












There is one error in one of five blocks of a program. To find the error, we test three randomly selected
blocks. Let $𝑋$ be the number of errors in these three blocks. Compute $E(X)$ and $Var(X)$.



That's what i've tried:
$p = 0.6$
$n = 1$
$E(X) = ncdot p = 1cdot (0.6) = 0.6$
$Var(X) = n cdot pcdot q = 1cdot (0.6)cdot (0.4) = 0.24$



If we were using $n = 2$ with success probability of $0.6$ we would have:
$P(X = 0) = 0.16$
$P(X = 1) = 0.48$
$P(X = 2) = 0.36$



$p = 0.6$
$n = 2$
$E(X) = 2cdot (0.6) = 1.2$
$Var(X) = 2cdot (0.6)cdot (0.4) = 0.48$










share|cite|improve this question
























  • Can we assume that the second error can occur in the same block as the first error, and that the probability of this happening is $frac15$? If so, the calculations all look fine to me.
    – David K
    Nov 21 at 6:56

















up vote
1
down vote

favorite












There is one error in one of five blocks of a program. To find the error, we test three randomly selected
blocks. Let $𝑋$ be the number of errors in these three blocks. Compute $E(X)$ and $Var(X)$.



That's what i've tried:
$p = 0.6$
$n = 1$
$E(X) = ncdot p = 1cdot (0.6) = 0.6$
$Var(X) = n cdot pcdot q = 1cdot (0.6)cdot (0.4) = 0.24$



If we were using $n = 2$ with success probability of $0.6$ we would have:
$P(X = 0) = 0.16$
$P(X = 1) = 0.48$
$P(X = 2) = 0.36$



$p = 0.6$
$n = 2$
$E(X) = 2cdot (0.6) = 1.2$
$Var(X) = 2cdot (0.6)cdot (0.4) = 0.48$










share|cite|improve this question
























  • Can we assume that the second error can occur in the same block as the first error, and that the probability of this happening is $frac15$? If so, the calculations all look fine to me.
    – David K
    Nov 21 at 6:56















up vote
1
down vote

favorite









up vote
1
down vote

favorite











There is one error in one of five blocks of a program. To find the error, we test three randomly selected
blocks. Let $𝑋$ be the number of errors in these three blocks. Compute $E(X)$ and $Var(X)$.



That's what i've tried:
$p = 0.6$
$n = 1$
$E(X) = ncdot p = 1cdot (0.6) = 0.6$
$Var(X) = n cdot pcdot q = 1cdot (0.6)cdot (0.4) = 0.24$



If we were using $n = 2$ with success probability of $0.6$ we would have:
$P(X = 0) = 0.16$
$P(X = 1) = 0.48$
$P(X = 2) = 0.36$



$p = 0.6$
$n = 2$
$E(X) = 2cdot (0.6) = 1.2$
$Var(X) = 2cdot (0.6)cdot (0.4) = 0.48$










share|cite|improve this question















There is one error in one of five blocks of a program. To find the error, we test three randomly selected
blocks. Let $𝑋$ be the number of errors in these three blocks. Compute $E(X)$ and $Var(X)$.



That's what i've tried:
$p = 0.6$
$n = 1$
$E(X) = ncdot p = 1cdot (0.6) = 0.6$
$Var(X) = n cdot pcdot q = 1cdot (0.6)cdot (0.4) = 0.24$



If we were using $n = 2$ with success probability of $0.6$ we would have:
$P(X = 0) = 0.16$
$P(X = 1) = 0.48$
$P(X = 2) = 0.36$



$p = 0.6$
$n = 2$
$E(X) = 2cdot (0.6) = 1.2$
$Var(X) = 2cdot (0.6)cdot (0.4) = 0.48$







probability probability-distributions variance






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Nov 21 at 12:44









David K

51.7k340114




51.7k340114










asked Nov 20 at 18:06









sarah

61




61












  • Can we assume that the second error can occur in the same block as the first error, and that the probability of this happening is $frac15$? If so, the calculations all look fine to me.
    – David K
    Nov 21 at 6:56




















  • Can we assume that the second error can occur in the same block as the first error, and that the probability of this happening is $frac15$? If so, the calculations all look fine to me.
    – David K
    Nov 21 at 6:56


















Can we assume that the second error can occur in the same block as the first error, and that the probability of this happening is $frac15$? If so, the calculations all look fine to me.
– David K
Nov 21 at 6:56






Can we assume that the second error can occur in the same block as the first error, and that the probability of this happening is $frac15$? If so, the calculations all look fine to me.
– David K
Nov 21 at 6:56












1 Answer
1






active

oldest

votes

















up vote
0
down vote













Since there is one error in the 5 blocks of code, $X in {0,1}$, where $X=0$ if all 3 blocks of code being tested are correct.



Assuming the error is equally likely to be in any of the 5 blocks of code, the probability of drawing three correct blocks of code is $frac{4}{5} times frac{3}{4} times frac{2}{3} = frac{2}{5}$, i.e. $P(X=0) = frac{2}{5}$ and $P(X=1)=frac{3}{5}$.



$mathbb{E}[X] = 0 times frac{2}{5} + 1 times frac{3}{5} = frac{3}{5}$.



$mathbb{E}[X^2] = 0^2 times frac{2}{5} + 1^2 times frac{3}{5} = frac{3}{5}$.



$Var(X) = mathbb{E}[X^2] - mathbb{E}[X]^2 = frac{3}{5}-left( frac{3}{5} right)^2 = frac{6}{25}$.






share|cite|improve this answer





















  • This confirms that the methods and results in the question were correct for the one-error case.
    – David K
    Nov 21 at 6:53













Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3006679%2ftest-three-randomly-selected-blocks-of-a-program%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Since there is one error in the 5 blocks of code, $X in {0,1}$, where $X=0$ if all 3 blocks of code being tested are correct.



Assuming the error is equally likely to be in any of the 5 blocks of code, the probability of drawing three correct blocks of code is $frac{4}{5} times frac{3}{4} times frac{2}{3} = frac{2}{5}$, i.e. $P(X=0) = frac{2}{5}$ and $P(X=1)=frac{3}{5}$.



$mathbb{E}[X] = 0 times frac{2}{5} + 1 times frac{3}{5} = frac{3}{5}$.



$mathbb{E}[X^2] = 0^2 times frac{2}{5} + 1^2 times frac{3}{5} = frac{3}{5}$.



$Var(X) = mathbb{E}[X^2] - mathbb{E}[X]^2 = frac{3}{5}-left( frac{3}{5} right)^2 = frac{6}{25}$.






share|cite|improve this answer





















  • This confirms that the methods and results in the question were correct for the one-error case.
    – David K
    Nov 21 at 6:53

















up vote
0
down vote













Since there is one error in the 5 blocks of code, $X in {0,1}$, where $X=0$ if all 3 blocks of code being tested are correct.



Assuming the error is equally likely to be in any of the 5 blocks of code, the probability of drawing three correct blocks of code is $frac{4}{5} times frac{3}{4} times frac{2}{3} = frac{2}{5}$, i.e. $P(X=0) = frac{2}{5}$ and $P(X=1)=frac{3}{5}$.



$mathbb{E}[X] = 0 times frac{2}{5} + 1 times frac{3}{5} = frac{3}{5}$.



$mathbb{E}[X^2] = 0^2 times frac{2}{5} + 1^2 times frac{3}{5} = frac{3}{5}$.



$Var(X) = mathbb{E}[X^2] - mathbb{E}[X]^2 = frac{3}{5}-left( frac{3}{5} right)^2 = frac{6}{25}$.






share|cite|improve this answer





















  • This confirms that the methods and results in the question were correct for the one-error case.
    – David K
    Nov 21 at 6:53















up vote
0
down vote










up vote
0
down vote









Since there is one error in the 5 blocks of code, $X in {0,1}$, where $X=0$ if all 3 blocks of code being tested are correct.



Assuming the error is equally likely to be in any of the 5 blocks of code, the probability of drawing three correct blocks of code is $frac{4}{5} times frac{3}{4} times frac{2}{3} = frac{2}{5}$, i.e. $P(X=0) = frac{2}{5}$ and $P(X=1)=frac{3}{5}$.



$mathbb{E}[X] = 0 times frac{2}{5} + 1 times frac{3}{5} = frac{3}{5}$.



$mathbb{E}[X^2] = 0^2 times frac{2}{5} + 1^2 times frac{3}{5} = frac{3}{5}$.



$Var(X) = mathbb{E}[X^2] - mathbb{E}[X]^2 = frac{3}{5}-left( frac{3}{5} right)^2 = frac{6}{25}$.






share|cite|improve this answer












Since there is one error in the 5 blocks of code, $X in {0,1}$, where $X=0$ if all 3 blocks of code being tested are correct.



Assuming the error is equally likely to be in any of the 5 blocks of code, the probability of drawing three correct blocks of code is $frac{4}{5} times frac{3}{4} times frac{2}{3} = frac{2}{5}$, i.e. $P(X=0) = frac{2}{5}$ and $P(X=1)=frac{3}{5}$.



$mathbb{E}[X] = 0 times frac{2}{5} + 1 times frac{3}{5} = frac{3}{5}$.



$mathbb{E}[X^2] = 0^2 times frac{2}{5} + 1^2 times frac{3}{5} = frac{3}{5}$.



$Var(X) = mathbb{E}[X^2] - mathbb{E}[X]^2 = frac{3}{5}-left( frac{3}{5} right)^2 = frac{6}{25}$.







share|cite|improve this answer












share|cite|improve this answer



share|cite|improve this answer










answered Nov 21 at 5:54









Aditya Dua

6208




6208












  • This confirms that the methods and results in the question were correct for the one-error case.
    – David K
    Nov 21 at 6:53




















  • This confirms that the methods and results in the question were correct for the one-error case.
    – David K
    Nov 21 at 6:53


















This confirms that the methods and results in the question were correct for the one-error case.
– David K
Nov 21 at 6:53






This confirms that the methods and results in the question were correct for the one-error case.
– David K
Nov 21 at 6:53




















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3006679%2ftest-three-randomly-selected-blocks-of-a-program%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bundesstraße 106

Verónica Boquete

Ida-Boy-Ed-Garten