// Numbas version: exam_results_page_options {"name": "Probability: Discrete Random Variable 2", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Probability: Discrete Random Variable 2", "tags": [], "metadata": {"description": "", "licence": "None specified"}, "statement": "

Given a discrete random variable (in a table) calculate:
E(X), Var, std dev, cumulative distribution and probabilties.

", "advice": "

part a)

\n

A probability distribution is a function that defines the probability of each possible outcome.  Since the sum of probabilities of all outcomes must be 1, we can use this fact to calculate the missing probability.

Therefore
\\[ 
P(\\var{X[0]} = \\var{x1}) + P(\\var{X[0]}  = \\var{x2}) + P(\\var{X[0]}=\\var{x3}) + P(\\var{X[0]}=\\var{x4}) +P(\\var{X[0]}=\\var{x5}) = 1 \\\\
\\implies  \\var{p1} +  P(\\var{X[0]} = \\var{x2}) + \\var{p3} + \\var{p4} + \\var{p5} = 1  \\]

Which we can solve to show that 

\n

\\[ P(\\var{X[0]} = \\var{x2}) = \\var{p2}\\]

\n


part b)

\n

The expected value is calculated by multiplying each value by it's probability, and adding these up.  

You can use the formula:

\\[ E(\\var{X[0]}) = \\sum_{\\var{X[1]}=1}^{5}  \\var{X[1]} \\times  P(\\var{X[0]} = \\var{X[1]}) \\]

Which gives:

\\[ \\begin{split}
E(\\var{X[0]}) &= \\var{x1} \\times \\var{p1} + \\var{x2} \\times \\var{p2} + \\var{x3} \\times \\var{p3} + \\var{x4} \\times \\var{p4} + \\var{x5} \\times \\var{p5} \\\\ &= \\var{ex}
\\end{split} \\]

The expectation can be understood to be the average value you will get if you select a number from the distribution many, many times.  Therefore it makes sense for the expectation to be roughly in the middle of the $\\var{x[1]}$ values.

\n

part c)  

\n

The variance is calculated using the formula:

\\[ Var(\\var{X[0]}) = E \\left(\\var{X[0]}^2\\right) - [E(\\var{X[0]})]^2\\]

Which you can remember by saying 'the expectation of the square subtract the square of the expectation'.

We worked out $E(\\var{X[0]})$ in part b), but we need to find $E \\left(\\var{X[0]}^2 \\right)$, so we need to square the values before performing the expectation calculation:

\\[E \\left(\\var{X[0]}^2 \\right) = \\sum_{\\var{X[1]}=1}^{5}  \\var{X[1]}^2 \\times  P(\\var{X[0]} = \\var{X[1]}) \\]

\n


Which gives:

\\[ \\begin{split}
E \\left(\\var{X[0]}^2 \\right) &= \\var{x1^2} \\times \\var{p1} + \\var{x2^2} \\times \\var{p2} + \\var{x3^2} \\times \\var{p3} + \\var{x4^2} \\times \\var{p4} + \\var{x5^2} \\times \\var{p5} \\\\ &= \\var{exsquared}
\\end{split} \\]

Therefore

\n

{partc}

\n

part d)

\n

The standard deviation is the square root of the variance, so not too much work to do for this one, phewph!  

\n

To avoid losing accuracy in your answer for the standard deviation, you should use the unrounded answer for the variance you calculated in part c).

\n

{partd}

\n

part e)

\n

The cumulative distribution function can be thought of as a 'less than this value' probability distribution.  

\n

\\[F(\\var{x[1]}) = P(\\var{X[0]} \\le \\var{x[1]})\\].

So if we take $P(\\var{X[0]} \\le \\var{x2})$ as an example, we can see that 

\\[P(\\var{X[0]} \\le \\var{x2}) = P(\\var{X[0]} = \\var{x1}) + P(\\var{X[0]} = \\var{x2})\\]

\n

part f)

\n

To find $P(\\var{xset[l-1]} < \\var{X[0]} \\le \\var{xset[u-1]})$ we can use the cumulative frequency table to help us.  Remember that this is a discrete random variable, that means that the in-between values don't exist, so

\n

\\[P(\\var{xset[l-1]} < \\var{X[0]} \\le \\var{xset[u-1]}) = F(\\var{xset[u-1]}) - F(\\var{xset[l-1]})
\\\\= \\var{cum[u-1]} - \\var{cum[l-1]} = \\var{lastpart}\\]

\n

", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"X": {"name": "X", "group": "Ungrouped variables", "definition": "random(['$X$','$x$'],['$Y$','$y$'],['$A$','$a$'],['$Z$','$z$'],['$K$','$k$'])", "description": "", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "random(3..5)", "description": "", "templateType": "anything", "can_override": false}, "p1": {"name": "p1", "group": "Ungrouped variables", "definition": "random(0..0.8 # 0.01)", "description": "", "templateType": "anything", "can_override": false}, "p2": {"name": "p2", "group": "Ungrouped variables", "definition": "random(0..(1-p1) # 0.01)", "description": "", "templateType": "anything", "can_override": false}, "p3": {"name": "p3", "group": "Ungrouped variables", "definition": "if(n=3,1-p1-p2,random(0..(1-p1-p2) # 0.01))", "description": "", "templateType": "anything", "can_override": false}, "p4": {"name": "p4", "group": "Ungrouped variables", "definition": "if(n=3,0,if(n=4,1-p1-p2-p3,random(0..(1-p1-p2-p3) # 0.01)))", "description": "", "templateType": "anything", "can_override": false}, "p5": {"name": "p5", "group": "Ungrouped variables", "definition": "if(n=4,0,1-p1-p2-p3-p4)", "description": "", "templateType": "anything", "can_override": false}, "CHECKSUM": {"name": "CHECKSUM", "group": "Ungrouped variables", "definition": "P1+P2+P3+P4+p5", "description": "", "templateType": "anything", "can_override": false}, "ex": {"name": "ex", "group": "Ungrouped variables", "definition": "p1*x1+p2*x2+p3*x3+p4*x4+p5*x5", "description": "", "templateType": "anything", "can_override": false}, "exsquared": {"name": "exsquared", "group": "Ungrouped variables", "definition": "p1*x1^2+p2*x2^2+p3*x3^2+p4*x4^2+p5*x5^2\n", "description": "", "templateType": "anything", "can_override": false}, "x3": {"name": "x3", "group": "Ungrouped variables", "definition": "xset[2]", "description": "", "templateType": "anything", "can_override": false}, "x4": {"name": "x4", "group": "Ungrouped variables", "definition": "xset[3]", "description": "", "templateType": "anything", "can_override": false}, "x5": {"name": "x5", "group": "Ungrouped variables", "definition": "xset[4]", "description": "", "templateType": "anything", "can_override": false}, "x1": {"name": "x1", "group": "Ungrouped variables", "definition": "xset[0]", "description": "", "templateType": "anything", "can_override": false}, "xset": {"name": "xset", "group": "Ungrouped variables", "definition": "xsets[xsetchoice-1]", "description": "", "templateType": "anything", "can_override": false}, "xsets": {"name": "xsets", "group": "Ungrouped variables", "definition": "matrix(\n[1,2,3,4,5],\n[10,20,30,40,50],\n[5,10,15,20,25],\n[6,8,10,12,14],\n[100,200,300,400,500],\n[6,7,8,9,10],\n[0,1,2,3,4],\n[2,4,6,8,10],\n[3,6,9,12,15],\n[1,3,5,7,9],\n[150,200,250,300,350],\n[20,30,40,50,60],\n[20,40,60,80,100],\n[4,6,9,10,11],\n[200,300,400,500,600]\n)", "description": "", "templateType": "anything", "can_override": false}, "x2": {"name": "x2", "group": "Ungrouped variables", "definition": "xset[1]", "description": "", "templateType": "anything", "can_override": false}, "varx": {"name": "varx", "group": "Unnamed group", "definition": "p1*x1^2+p2*x2^2+p3*x3^2+p4*x4^2+p5*x5^2 - ex^2", "description": "", "templateType": "anything", "can_override": false}, "std2": {"name": "std2", "group": "Ungrouped variables", "definition": "precround(sqrt(p1*x1^2+p2*x2^2+p3*x3^2+p4*x4^2+p5*x5^2 - ex^2),2)", "description": "", "templateType": "anything", "can_override": false}, "cum": {"name": "cum", "group": "Ungrouped variables", "definition": "[p1,p1+p2,p1+p2+p3,p1+p2+p3+p4,p1+p2+p3+p4+p5]", "description": "", "templateType": "anything", "can_override": false}, "l": {"name": "l", "group": "Ungrouped variables", "definition": "if(u=5,random(2..3),2)", "description": "", "templateType": "anything", "can_override": false}, "u": {"name": "u", "group": "Ungrouped variables", "definition": "random(4..5)", "description": "", "templateType": "anything", "can_override": false}, "xsetchoice": {"name": "xsetchoice", "group": "Ungrouped variables", "definition": "random(1..15)", "description": "", "templateType": "anything", "can_override": false}, "lastpart": {"name": "lastpart", "group": "Ungrouped variables", "definition": "cum[u-1]-cum[l-1]", "description": "", "templateType": "anything", "can_override": false}, "partd": {"name": "partd", "group": "Ungrouped variables", "definition": "if(std2=std,'{sold1}','{sold2}')", "description": "", "templateType": "anything", "can_override": false}, "sold1": {"name": "sold1", "group": "Ungrouped variables", "definition": "\"

\\\\[ \\\\begin{split}

\\\\text{Standard deviation} &\\\\,= \\\\sqrt{Var(\\\\var{X[0]})} \\\\\\\\ &\\\\,= \\\\sqrt{\\\\var{varx}} \\\\\\\\ &\\\\,= \\\\var{std}

\\\\end{split} \\\\]

\"", "description": "", "templateType": "long string", "can_override": false}, "sold2": {"name": "sold2", "group": "Ungrouped variables", "definition": "\"

\\\\[ \\\\begin{split}

\\\\text{Standard deviation} &\\\\,= \\\\sqrt{Var(\\\\var{X[0]})} \\\\\\\\ &\\\\,= \\\\sqrt{\\\\var{varx}} \\\\\\\\ &\\\\,= \\\\var{std} \\\\\\\\ &\\\\,= \\\\var{std2} \\\\text{ (2 d.p.)}

\\\\end{split} \\\\]

\"", "description": "", "templateType": "long string", "can_override": false}, "std": {"name": "std", "group": "Ungrouped variables", "definition": "sqrt(varx)", "description": "", "templateType": "anything", "can_override": false}, "partc": {"name": "partc", "group": "Ungrouped variables", "definition": "if(abs(varx-varx2)<0.001,'{solc1}','{solc2}')", "description": "", "templateType": "anything", "can_override": false}, "solc2": {"name": "solc2", "group": "Ungrouped variables", "definition": "\"

\\\\[ \\\\begin{split}
Var(\\\\var{X[0]}) &= \\\\var{exsquared} - \\\\var{ex^2} \\\\\\\\ &= \\\\var{varx} \\\\\\\\ &=\\\\var{varx2} \\\\text{ (2 d.p.)}
\\\\end{split} \\\\]

\"", "description": "", "templateType": "long string", "can_override": false}, "solc1": {"name": "solc1", "group": "Ungrouped variables", "definition": "\"

\\\\[ \\\\begin{split}
Var(\\\\var{X[0]}) &= \\\\var{exsquared} - \\\\var{ex^2} \\\\\\\\ &= \\\\var{varx}\\\\end{split} \\\\]

\"", "description": "", "templateType": "long string", "can_override": false}, "varx2": {"name": "varx2", "group": "Unnamed group", "definition": "precround(varx,2)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["X", "n", "p1", "p2", "p3", "p4", "p5", "CHECKSUM", "ex", "exsquared", "x3", "x4", "x5", "x1", "xset", "xsets", "x2", "xsetchoice", "std", "std2", "cum", "l", "u", "lastpart", "partd", "sold1", "sold2", "partc", "solc1", "solc2"], "variable_groups": [{"name": "Unnamed group", "variables": ["varx", "varx2"]}], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

\n

The probability distribution of a discrete random variable $\\var{X[0]}$ is given by:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$\\var{x[1]}$
   $\\var{X1}$   

   $\\var{X2}$     $\\var{X3}$     $\\var{X4}$     $\\var{X5}$  
$f(\\var{x[1]})$
= $P(\\var{X[0]} = \\var{x[1]})$

   $\\var{p1}$
 
   [[0]]   $\\var{p3}$     $\\var{p4}$  $\\var{p5}$  
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "p2", "maxValue": "p2", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate the expected value, E($\\var{X[0]}$)

", "minValue": "ex", "maxValue": "ex", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "2", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate the variance, $Var(\\var{X[0]})$

\n

[[0]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{precround(varx,2)}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate the standard deviation of $\\var{x[0]}$.

", "minValue": "floor(std2)", "maxValue": "ceil(std2)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "2", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Find the cumulative distribution function, $F(\\var{x[1]})$,

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$\\var{x[1]}$
   $\\var{X1}$   

   $\\var{X2}$     $\\var{X3}$     $\\var{X4}$     $\\var{X5}$  
$F(\\var{x[1]})$
= $P(\\var{X[0]} \\le \\var{x[1]})$

    [[0]]
 
[[1]]     [[2]]      [[3]]  [[4]]
", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "cum[0]", "maxValue": "cum[0]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "cum[1]", "maxValue": "cum[1]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "cum[2]", "maxValue": "cum[2]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "cum[3]", "maxValue": "cum[3]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "cum[4]", "maxValue": "cum[4]", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Find the value of $P(\\var{xset[l-1]} < \\var{X[0]} \\le \\var{xset[u-1]})$

", "minValue": "lastpart", "maxValue": "lastpart", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Ruth Hand", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3228/"}, {"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}]}]}], "contributors": [{"name": "Ruth Hand", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3228/"}, {"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}]}