// Numbas version: finer_feedback_settings {"name": "Introduction to Probability", "feedback": {"allowrevealanswer": true, "showtotalmark": true, "advicethreshold": 0, "intro": "", "feedbackmessages": [], "showanswerstate": true, "showactualmark": true, "enterreviewmodeimmediately": true, "showexpectedanswerswhen": "inreview", "showpartfeedbackmessageswhen": "always", "showactualmarkwhen": "always", "showtotalmarkwhen": "always", "showanswerstatewhen": "always", "showadvicewhen": "never"}, "timing": {"allowPause": true, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "allQuestions": true, "shuffleQuestions": false, "percentPass": 0, "duration": 0, "pickQuestions": 0, "navigation": {"onleave": {"action": "none", "message": ""}, "reverse": true, "allowregen": true, "showresultspage": "oncompletion", "preventleave": true, "browse": true, "showfrontpage": true}, "metadata": {"description": "

Introduction to basic probability

\n

rebel

\n

rebelmaths

", "licence": "None specified"}, "type": "exam", "questions": [], "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": [{"name": "Probability Dice", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}], "functions": {}, "ungrouped_variables": ["y", "x", "thing"], "tags": ["probability", "Probability", "Rebel", "REBEL", "rebel", "rebelmaths"], "preamble": {"css": "", "js": ""}, "advice": "

(a) This can happen in 1 way out of 6 possible outcomes. 

\n

(b) This can happen in 2 ways out of 6 possible outcomes. 

\n

(c) This can happen in 3 ways out of 6 possible outcomes.

", "rulesets": {}, "parts": [{"prompt": "

throwing a {x} = [[0]]

\n

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": false, "scripts": {}, "answer": "1/6", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "

throwing a {x} or a {y} = [[0]]

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "1/3", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "

throwing an {thing} number = [[0]]

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "1/2", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "statement": "

When throwing a dice once what is the probability of (give answers in fraction form)

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"y": {"definition": "random(4..6#1)", "templateType": "anything", "group": "Ungrouped variables", "name": "y", "description": ""}, "x": {"definition": "random(1..3#1)", "templateType": "randrange", "group": "Ungrouped variables", "name": "x", "description": ""}, "thing": {"definition": "random('odd', 'even')", "templateType": "anything", "group": "Ungrouped variables", "name": "thing", "description": ""}}, "metadata": {"description": "

When throwing a dice once what is the probability of ....

\n

rebelmaths

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Single card drawn from a deck", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}, {"name": "Patricia Cogan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3359/"}], "tags": [], "metadata": {"description": "

\n

A single card is drawn from a standard deck of 52 cards.

", "licence": "None specified"}, "statement": "

For the following question, please give your answers to 3 decimal places.

\n

A single card is drawn from a standard pack of 52 playing  cards. 

", "advice": "

Part a)

\n

Let $A$ represent the event that a $\\var{card1}$s is selected. There are 4 $\\var{card1}$s. There are 52 cards in total. Therefore the probability of drawing a $\\var{card1}$, $P(A)$ is $\\frac{4}{52}=\\frac{1}{13}$

\n

Part b)

\n

Let $B$ be the event that a $\\var{card1}$s is selected. There are 13 $\\var{suit}$s. There are 52 cards in total. Therefore the probability of drawing a $\\var{suit}$ $P(B)$ is $\\frac{13}{52}=\\frac{1}{4}$

\n

Part c)

\n

There is 1 card that is a $\\var{card1}$ and a $\\var{suit}$. There are 52 cards in total. Therefore the probability of drawing a $\\var{card1}$ and a $\\var{suit}$ $P(A\\cap B)$ is $\\frac{1}{52}$

\n

Part d)

\n

$P(A) = \\frac{1}{13}$ and $P(C) = \\frac{1}{13}$ The events A and C are mutually exclusive (they cannot happen at the same time) so therefore $P(A \\cup B)=P(A)+P(B)= \\frac{1}{13}+\\frac{1}{13}=\\frac{2}{13}$

\n

Part e)

\n

$P(A) = \\frac{1}{13}$ and $P(B) = \\frac{1}{4}$ The events A and B are not mutually exclusive (they can happen at the same time) so therefore $P(A \\cup B)=P(A)+P(B)-P(A\\cap B)= \\frac{1}{13}+\\frac{1}{4}-\\frac{1}{52}=\\frac{4}{13}$

", "rulesets": {}, "variables": {"card1": {"name": "card1", "group": "Ungrouped variables", "definition": "random('jack', 'queen', 'king')", "description": "", "templateType": "anything"}, "suit": {"name": "suit", "group": "Ungrouped variables", "definition": "random('heart', 'diamond', 'spade', 'club')", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["card1", "suit"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"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": "

Let A be the event that a $\\var{card1}$ is selected. What is $P(A)$?

", "minValue": "4/52", "maxValue": "4/52", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "

Let B be the event that a $\\var{suit}$ is selected. What is $P(B)$?

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

What is the probability of drawing a $\\var{card1}$ and a $\\var{suit}$, $P(A\\cap B)$? Remember that you are only selecting one card.

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

Let C be the event that an ace is selected. What is the probablity of drawing a $\\var{card1}$ or an ace, $P(A\\cup C)$?

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

What is the probability of drawing a $\\var{card1}$ or a $\\var{suit}$ $P(A\\cup B)$?

", "minValue": "4/13", "maxValue": "4/13", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Julie's copy of BS2.1", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}, {"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}, {"name": "Patricia Cogan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3359/"}], "tags": ["probability", "Probability", "rebelmaths", "statistics", "udf"], "metadata": {"description": "

Simple probability question. Counting number of occurrences of an event in a sample space with given size and finding the probability of the event.

\n

rebelmaths

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

{sc[k]}

\n

{table(data,['  From','  To', '  Loans Made'])}

\n

 

", "advice": "

a) The number of loans less than €$\\var{u1}$ is $\\var{accumdisp(n,t)}$$=\\var{sum(n[0..t+1])}$

\n

Since there are $\\var{thismany}$ loans the probability of choosing one of these loans is  $\\displaystyle \\frac{\\var{sum(n[0..t+1])}}{\\var{thismany}}=\\var{ans1}$ to 2 decimal places.

\n

b) The number of loans greater than €$\\var{o1}$ is $\\var{accumdisp(n[v+1..abs(n)],abs(n)-v-2)}=\\var{sum(n[v+1..abs(n)])}$.

\n

Since there are $\\var{thismany}$ loans the probability of choosing one of these loans is  $\\displaystyle \\frac{\\var{sum(n[v+1..abs(n)])}}{\\var{thismany}}=\\var{ans2}$ to 2 decimal places.

\n

c) There are $\\var{accumdisp(n[p+1..q+1],q-p-1)}=\\var{sum(n[p+1..q+1])}$ loans between  €$\\var{a[p]}$ and €$\\var{a[q]-1}$.

\n

Hence the probability of selecting one of these loans in this range for review is $\\displaystyle \\frac{\\var{sum(n[p+1..q+1])}}{\\var{thismany}}=\\var{ans3}$ to 2 decimal places.

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"a": {"name": "a", "group": "Ungrouped variables", "definition": "[a0,a0+b0,a0+2*b0]", "description": "", "templateType": "anything", "can_override": false}, "a0": {"name": "a0", "group": "Ungrouped variables", "definition": "random(1000..4000#1000)", "description": "", "templateType": "anything", "can_override": false}, "n0": {"name": "n0", "group": "Ungrouped variables", "definition": "round(thismany/random(15,25))", "description": "", "templateType": "anything", "can_override": false}, "p": {"name": "p", "group": "Ungrouped variables", "definition": "0", "description": "", "templateType": "anything", "can_override": false}, "ans1": {"name": "ans1", "group": "Ungrouped variables", "definition": "precround(sum(n[0..t+1])/thismany,2)", "description": "", "templateType": "anything", "can_override": false}, "k": {"name": "k", "group": "Ungrouped variables", "definition": "random(0..abs(sc)-1)", "description": "", "templateType": "anything", "can_override": false}, "ans3": {"name": "ans3", "group": "Ungrouped variables", "definition": "precround((n[1]+n[2])/thismany,2)", "description": "", "templateType": "anything", "can_override": false}, "u1": {"name": "u1", "group": "Ungrouped variables", "definition": "a[t]", "description": "", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "[n0,n1,thismany-n0-n1-n3,n3]", "description": "", "templateType": "anything", "can_override": false}, "q": {"name": "q", "group": "Ungrouped variables", "definition": "2", "description": "", "templateType": "anything", "can_override": false}, "thismany": {"name": "thismany", "group": "Ungrouped variables", "definition": "random(300..1000#100)", "description": "", "templateType": "anything", "can_override": false}, "b0": {"name": "b0", "group": "Ungrouped variables", "definition": "random(1000..3000#1000)", "description": "", "templateType": "anything", "can_override": false}, "t": {"name": "t", "group": "Ungrouped variables", "definition": "random(0..abs(a)-1)", "description": "", "templateType": "anything", "can_override": false}, "v": {"name": "v", "group": "Ungrouped variables", "definition": "random(0..abs(a)-1 except t)", "description": "", "templateType": "anything", "can_override": false}, "sc": {"name": "sc", "group": "Ungrouped variables", "definition": "['A bank made '+{thismany}+' car loans last year. The amounts were as follows (\u20ac):']", "description": "", "templateType": "anything", "can_override": false}, "n1": {"name": "n1", "group": "Ungrouped variables", "definition": "round(thismany/random(3,6))", "description": "", "templateType": "anything", "can_override": false}, "n3": {"name": "n3", "group": "Ungrouped variables", "definition": "round(thismany/random(11,14))", "description": "", "templateType": "anything", "can_override": false}, "data": {"name": "data", "group": "Ungrouped variables", "definition": "\n [[0,a[0]-1,n[0]],\n [a[0],a[1]-1,n[1]],\n [a[1],a[2]-1,n[2]],\n [a[2],'plus',n[3]]]\n \n \n ", "description": "", "templateType": "anything", "can_override": false}, "ans2": {"name": "ans2", "group": "Ungrouped variables", "definition": "precround((thismany-sum(n[0..v+1]))/thismany,2)", "description": "", "templateType": "anything", "can_override": false}, "o1": {"name": "o1", "group": "Ungrouped variables", "definition": "a[v]", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a", "sc", "thismany", "ans1", "k", "ans3", "u1", "p", "n", "q", "a0", "b0", "t", "v", "n0", "n1", "n3", "data", "ans2", "o1"], "variable_groups": [], "functions": {"accumdisp": {"parameters": [["a", "list"], ["k", "number"]], "type": "string", "language": "jme", "definition": "if(k=0,'$\\\\var{a[0]}$','$\\\\var{a[0]}$ + '+accumdisp(a[1..abs(a)],k-1))"}}, "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": "

One of these loans is sampled randomly for review by the bank. What is the probability that it is :

\n

a) Under €$\\var{u1}$?   Probability = ? [[0]]  (answer to 2 decimal places).

\n

b) Over €$\\var{o1-1}$?     Probability = ? [[1]]  (answer to 2 decimal places).

\n

c) Between €$\\var{a[p]}$ and €$\\var{a[q]-1}$?    Probability = ? [[2]] (answer to 2 decimal places).

\n

 

\n

 

", "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": "ans1", "maxValue": "ans1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "ans2", "maxValue": "ans2", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "ans3", "maxValue": "ans3", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Single ball from box", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}], "functions": {}, "ungrouped_variables": ["m", "n"], "tags": [], "preamble": {"css": "", "js": ""}, "advice": "

For any event $A$ 

\n

Probability of $A$ = $\\frac{\\text{Number of outcomes for which A happens}} {\\text{Total number of outcomes (sample space)}}$

\n

\n

Let $A$ represent the outcome that the ball selected is white, then $P(A) =\\frac{\\var{m}}{\\var{m}+\\var{n}}$

\n

\n

", "rulesets": {}, "parts": [{"precisionType": "dp", "prompt": "

What is the probability that the ball is white?

", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "marks": 1, "maxValue": "m/(n+m)", "strictPrecision": false, "minValue": "m/(n+m)", "precisionPartialCredit": 0, "correctAnswerFraction": false, "showCorrectAnswer": true, "precision": "3", "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "statement": "

Please give your answer to 3 decimal places.

\n

A box contains $\\var{m} $ white balls and $\\var{n} $ black balls. A ball is drawn out of the box at random. 

", "variable_groups": [], "progress": "in-progress", "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"m": {"definition": "random(3..7)", "templateType": "anything", "group": "Ungrouped variables", "name": "m", "description": "

The number of white balls in the box

"}, "n": {"definition": "random(3..13)", "templateType": "anything", "group": "Ungrouped variables", "name": "n", "description": "

The number of blacl balls in the box.

"}}, "metadata": {"notes": "", "description": "

A box contains $m$ white balls and $n$ black balls. A ball is drawn out of the box at random. What is the probability that the ball is white?

"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Two balls of the same colour with replacement.", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}, {"name": "Patricia Cogan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3359/"}], "tags": [], "metadata": {"description": "

\n

A box contains m white balls and n black balls. A ball is drawn out of the box at random and then replaced. A second ball is then drawn out of the box at random. What is the probability that both balls chosen were white?

", "licence": "None specified"}, "statement": "

Please give your answer to 3 decimal places.

\n

A box contains $\\var{m} $ white balls and $\\var{n} $ black balls. A ball is drawn out of the box at random and then replaced. A second ball is then drawn out of the box at random. 

", "advice": "

Since the first ball is replaced, the outcome of the second draw is independent of (not effected by) the outcome of the first draw.

\n

If two events, $A$ and $B$, are independent then $P(A\\cap B)=P(A)\\times P(B)$.

\n
\n

Let $A$ represent the event that a white ball is selected on the first draw and let $B$ represent the event that a white ball is selected on the second draw.

\n

There are $\\var{m}$ white balls. Therefore $P(A) =P(B)= \\frac{\\var{m}}{\\var{m+n}}$. 

\n

The probability of drawing a white ball on the first and second draw is $ P(A) \\times P(B)=\\frac{\\var{m}}{\\var{m+n}} \\times \\frac{\\var{m}}{\\var{m+n}}=\\var{prob}$. 

", "rulesets": {}, "variables": {"n": {"name": "n", "group": "Ungrouped variables", "definition": "random(3..10)", "description": "

The number of black balls in the box.

", "templateType": "anything"}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "random(3..8)", "description": "

The number of white balls in the box.

", "templateType": "anything"}, "prob": {"name": "prob", "group": "Ungrouped variables", "definition": "(m/(m+n))*(m/(m+n))", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["m", "n", "prob"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"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": "

What is the probability that both balls chosen were white?

", "minValue": "(m/(m+n))^2", "maxValue": "(m/(m+n))^2", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Two balls of the same colour without replacement", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}, {"name": "Patricia Cogan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3359/"}], "tags": [], "metadata": {"description": "

A box contains m white balls and black balls. A ball is drawn from the box at random and is not replaced. A second ball is then drawn from the box at random. What is the probability that both balls chosen were white?

", "licence": "None specified"}, "statement": "

Please give your answer to 3 decimal places.

\n

A box contains $\\var{m} $ $\\var{colour1}$ balls and $\\var{n}$  $\\var{colour2}$ balls. A ball is drawn from the box at random and is NOT replaced. A second ball is then drawn from the box at random. 

", "advice": "

Since the first ball is not replaced, the outcome of the second draw is not independent of the outcome of the first draw. The probability that a white ball is selected on the second draw is affected by whether or not a white ball was removed from the box when the first ball was drawn.

\n

Let $A$ represent the event that a white ball is selected on the first draw and let $B$ represent the event that a white ball is selected on the second draw. 

\n

We use the notation $P(B|A)$ to denote the probability that $B$ happens, given that we know that $A$ happened. This is called a conditional probability.

\n

$P(A \\cap B)=P(B|A) \\times P(A)$

\n

Now $P(A)=\\frac{\\var{m}}{\\var{m+n}}$ and $P(B|A)= \\frac{\\var{m-1}}{\\var{m+n-1}}$. Therefore the probability of drawing two white balls is $P(B|A) \\times P(A) = \\frac{\\var{m}}{\\var{m+n}} \\times \\frac{\\var{m-1}}{\\var{m+n-1}}$.

", "rulesets": {}, "variables": {"m": {"name": "m", "group": "Ungrouped variables", "definition": "random(3..9)", "description": "

The number of white balls.

", "templateType": "anything"}, "colour2": {"name": "colour2", "group": "Ungrouped variables", "definition": "random('black','white','blue')", "description": "", "templateType": "anything"}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "random(3..10)", "description": "

The number of black balls.

", "templateType": "anything"}, "colour1": {"name": "colour1", "group": "Ungrouped variables", "definition": "random('red','yellow','green')", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["m", "n", "colour1", "colour2"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"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": "

What is the probability that two $\\var{colour1}$ balls were drawn?

", "minValue": "(m/(m+n))*((m-1)/(m+n-1))", "maxValue": "(m/(m+n))*((m-1)/(m+n-1))", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "3 coin tosses", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}], "ungrouped_variables": [], "variables": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

Let $H$ represent a head and $T$ represent a tail. Consider the sample space associated with tossing a coin three times:

\n

\n

$\\Omega = \\{HHH, HHT, HTH, HTT, THH, THT, TTH, TTT\\}$

\n

\n

a) There are 8 different outcomes, obtaining three heads is 1 possible outcome so the probability of obtaining three heads is $\\frac{1}{8}$.

\n

b) There are 8 different outcomes, obtaining two heads and one tail occurs in 3 possible outcomes so the probability of obtaining three heads is $\\frac{3}{8}$.

", "parts": [{"minValue": "1/8", "scripts": {}, "type": "numberentry", "maxValue": "1/8", "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "allowFractions": true, "prompt": "

What is the probability of getting three heads?

", "correctAnswerFraction": true, "variableReplacements": [], "marks": 1}, {"minValue": "3/8", "scripts": {}, "type": "numberentry", "maxValue": "3/8", "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "allowFractions": true, "prompt": "

What is the probability of getting (in no particular order) two heads and a tail?

", "correctAnswerFraction": true, "variableReplacements": [], "marks": "2"}], "functions": {}, "statement": "

Please give your answer as a fraction.

\n

A coin is tossed three times.

", "tags": [], "rulesets": {}, "metadata": {"description": "

A coin is tossed three times. What is the probability of getting...

", "licence": "None specified"}, "preamble": {"css": "", "js": ""}, "variable_groups": [], "type": "question"}, {"name": "Two cards drawn from a deck", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}, {"name": "Patricia Cogan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3359/"}], "tags": [], "metadata": {"description": "

Two cards are drawn from a standard deck of 52 cards with and without replacement.

", "licence": "None specified"}, "statement": "

Please give your answer to 3 decimal places.

\n

Drawing a tree diagram will help you to answer parts (b), (c) and (d).

\n

Two cards are drawn from a standard deck of 52 playing cards. 

", "advice": "

Part a)

\n

Since the first card is replaced, the outcome of the second draw is independent of (not effected by) the outcome of the first draw.

\n

If two events, $A$ and $B$, are independent then $P(A\\cap B)=P(A)\\times P(B)$.

\n
\n

Let $A$ represent the event that a $\\var{card1}$ is selected on the first draw and $B$ represent the event that a $\\var{card1}$ is selected on the second draw.

\n

There are 4 $\\var{card1}$s. There are 52 cards in total. Therefore $P(A)$ is $\\frac{4}{52}=\\frac{1}{13}$ and $P(B)$ is  $\\frac{4}{52}=\\frac{1}{13}$.

\n

Therefore the probability of drawing a $\\var{card1}$ on the first and second draw is $ P(A) \\times P(B)=\\frac{1}{13} \\times \\frac{1}{13}= \\frac{1}{169}$. 

\n

Part b)

\n

Since the first card is not replaced, the outcome of the second draw is not independent of the outcome of the first draw. The probability that a $\\var{card1}$ is selected as the second card is affected by whether or not a $\\var{card1}$ was removed from the pack when the first card was drawn.

\n

Let $A$ represent the event that a $\\var{card1}$ is selected on the first draw and $B$ represent the event that a $\\var{card1}$ is selected on the second draw. 

\n

We use the notation $P(B|A)$ to denote the probability that $B$ happens, given that we know that $A$ happened. This is called a conditional probability.

\n

$P(A \\cap B)=P(B|A) \\times P(A)$

\n

Now $P(A)=\\frac{4}{52}=\\frac{1}{13}$ and $P(B|A)= \\frac{3}{51}$. Therefore the probability of drawing two $\\var{card1}$s is $P(B|A) \\times P(A) = \\frac{3}{51} \\times \\frac{4}{52}= \\frac{1}{221}$.

\n

Part c)

\n

Again, since the first card is not replaced, the outcome of the second draw is not independent of the outcome of the first draw.

\n

Let $A$ represent the event that a $\\var{card1}$ is selected on the first draw and let $C$ represent the event that an ace is selected on the second draw.

\n

\n

We can use the conditional probability formula $P(A \\cap C)=P(C|A) \\times P(A)$.

\n

$ P(A) = \\frac{4}{52}=\\frac{1}{13}$ and  $P(C|A) = \\frac{4}{51}$. Therefore the probability of drawing a $\\var{card1}$ first and then an ace is $P(C|A) \\times P(A) = \\frac{4}{52} \\times \\frac{4}{51}= \\frac{4}{663}$.

\n

Part d)

\n

Since we are interested in calculating the probability of drawing a $\\var{card1}$ and an ace where order doesn't matter. We are interested in the probability of drawing a $\\var{card1}$ and then an ace or an ace and then a $\\var{card1}$. We add the probabilities of each outcome so that the probability of drawing a $\\var{card1}$ and an ace in no particular order is $\\frac{4}{52} \\times \\frac{4}{51}+ \\frac{4}{52} \\times \\frac{4}{51}= \\frac{8}{663}$.

\n

", "rulesets": {}, "variables": {"card1": {"name": "card1", "group": "Ungrouped variables", "definition": "random('jack','queen','king')", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["card1"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"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": "

A card is drawn from a standard deck of 52 cards, examined, replaced and then a second card is selected. What is the probability that the first and second cards selected were $\\var{card1}$?

", "minValue": "1/169", "maxValue": "1/169", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "

Suppose the two cards are chosen without replacement. What is the probability that two $\\var{card1}$s were drawn? 

", "minValue": "1/221", "maxValue": "1/221", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "

Suppose the two cards are chosen without replacement. What is the probability of drawing a $\\var{card1}$ first and then an ace? 

", "minValue": "(1/13)*(4/51)", "maxValue": "(1/13)*(4/51)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "

Suppose two cards are chosen without replacement. What is the probability of drawing (in no particular order) a $\\var{card1}$ and an ace? 

", "minValue": "8/663", "maxValue": "8/663", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "IP1.1", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}], "functions": {}, "tags": ["Probability", "dice", "die", "elementary probability", "events", "independence", "independent events", "probability", "probability dice", "statistics", "tested1"], "advice": "\n \n \n

Let $A$ be the event that first dice shows a $\\var{number}$ $\\Rightarrow P(A)=\\frac{1}{6}$.

\n \n \n \n

Let $B$ be the event that second dice shows a $\\var{number}$ $\\Rightarrow P(B)=\\frac{1}{6}$.

\n \n \n \n

$A$ and $B$ are independent events so $P(A\\cap B) = P(A)\\times P(B)$.

\n \n \n \n

We want the probability $P(A \\cup B)$ of either $A$ or $B$ showing $\\var{number}$ and

\n \n \n \n

\\[\\begin{eqnarray*}\n \n P(A \\cup B) &=& P(A)+P(B)-P(A \\cap B)\\\\\n \n &=& P(A)+P(B)-P(A)P(B)\\\\\n \n &=&\\frac{1}{6}+ \\frac{1}{6}-\\frac{1}{36}\\\\\n \n &=& \\frac{11}{36}\n \n \\end{eqnarray*}\n \n \\]

\n \n \n \n ", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"prompt": "\n \n \n

What is the probability of at least one dice showing a $\\var{number}$?

\n \n \n \n

probability = [[0]]?

\n \n \n \n

Enter your answer as a fraction and not a decimal.

\n \n \n \n ", "gaps": [{"notallowed": {"message": "

Your answer has to be a fraction and not a decimal.

", "showstrings": false, "strings": ["."], "partialcredit": 0.0}, "checkingaccuracy": 0.001, "vsetrange": [0.0, 1.0], "vsetrangepoints": 5.0, "checkingtype": "absdiff", "answersimplification": "std, fractionNumbers", "marks": 1.0, "answer": "11/36", "type": "jme", "musthave": {"message": "

Input as a fraction.

", "showstrings": false, "strings": ["/", 11.0, 36.0], "partialcredit": 0.0}}], "type": "gapfill", "marks": 0.0}], "statement": "

Two fair six-sided dice are rolled.

", "variable_groups": [], "progress": "testing", "type": "question", "variables": {"number": {"definition": "random(1..6)", "name": "number"}}, "metadata": {"notes": "\n \t\t

7/07/2012:

\n \t\t

Added tags.

\n \t\t

Too simple a question? Perhaps add two further parts?

\n \t\t

     For example : probability that at most one dice shows a number $\\gt m$

\n \t\t

                              probability that no dice shows a number $\\lt p$

\n \t\t

Checked calculation.

\n \t\t

22/07/2012:

\n \t\t

Added description.

\n \t\t

31/07/2012:

\n \t\t

Added tags.

\n \t\t

Question appears to be working correctly.

\n \t\t

20/12/2012:

\n \t\t

Added tested1 tag.

\n \t\t

 

\n \t\t", "description": "

Rolling a pair of dice. Find probability that at least one die shows a given number.

", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Decide whether pairs of events are independent, ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"mm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[[m1,-m1],[m2,-m2],[m3,-m3]]", "description": "", "name": "mm"}, "v": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..abs(a)-1 except [t,u])", "description": "", "name": "v"}, "thismany": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "", "name": "thismany"}, "u": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..abs(a)-1 except t)", "description": "", "name": "u"}, "m3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(v < k,1,-1)", "description": "", "name": "m3"}, "abbe": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"above\",\"below\")", "description": "", "name": "abbe"}, "sc3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a[v]", "description": "", "name": "sc3"}, "pc": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(3..20)", "description": "", "name": "pc"}, "pe": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.2..0.7#0.1)", "description": "", "name": "pe"}, "pm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(pe*pf,2)", "description": "", "name": "pm"}, "indep": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\n [\"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E \\\\;\\\\textrm{and}\\\\; F) = P(E) \\\\times P(F)$.\",\n \"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E)= \\\\var{pe}$, $P(F)= \\\\var{pf}$ and $P(E\\\\; \\\\textrm{and}\\\\; F)=\\\\var{pm}$\",\n \"H: A new laundry detergent will capture $\\\\var{pc} of the market next year, K: Rover will produce a new model next year.\",\n \"H: Spinning a six and K: spinning a five on the same spinner.\",\n \"A: I look out of the window and it is sunny, B: I win the National Lottery jackpot this weekend!\",\n \"A: I look out of the window and it is cloudy, B: Newcastle \"+{something}+\" this weekend.\",\n \"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E)= P(F)$ and $P(E\\\\; \\\\textrm{and}\\\\; F)= P(E) \\\\times P(F)$\",\n \"A student is selected at random from this class. The events A and B are such that A: the student has \"+ abbe+ \" average shoe size and B: the student was born in \"+ {mo},\n \"E: An individual eats out more than \"+thismany+\" times a week. F: An individual has \"+col+\" hair.\",\n \"$H$ and $K$, where $P(K) = P(K|H)$.\"]\n ", "description": "", "name": "indep"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "indep+notindep", "description": "", "name": "a"}, "pef": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.3..0.8)", "description": "", "name": "pef"}, "tm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(9,10,11)", "description": "", "name": "tm"}, "something": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"win easily\",\"scrape a draw\", \"get beat due to a disputed penalty\")", "description": "", "name": "something"}, "npef": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(pef^2+random(0.1..0.2#0.01),2)", "description": "", "name": "npef"}, "m2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(u < k,1,-1)", "description": "", "name": "m2"}, "k": {"templateType": "anything", "group": "Ungrouped variables", "definition": "length(indep)", "description": "", "name": "k"}, "sc1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a[t]", "description": "", "name": "sc1"}, "m1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(t < k,1,-1)", "description": "", "name": "m1"}, "col": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"black\",\"brown\",\"blonde\")", "description": "", "name": "col"}, "notindep": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\n [\"A: The sky is cloudy today. B: It will rain today.\",\n \"A: A level marks in Mathematics, B: A level marks in Physics from students in the same school.\",\n \"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E)= P(F)=\\\\var{pef}$ and $P(E\\\\; \\\\textrm{and}\\\\; F)= \\\\var{npef}$\",\n \"H: Tom lies in on \"+ td + \", K: Tom is late for his \"+ tm+\" o'clock lecture on \"+ td,\n \"A student is selected at random from this class. The events H and K are such that H: the student is \"+ abbe+ \" average in height and K: the student is \"+abbe +\" average in weight.\",\n \"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E\\\\; \\\\textrm{and}\\\\; F)\\\\neq P(E)\\\\times P(F)$\",\n \"H: There is a severe thunderstorm in my home town this afternoon. K: My computer crashes this afternoon.\",\n \"A: A patient takes an abnormally long time to recover from an operation. B: The patient is elderly.\"]\n ", "description": "", "name": "notindep"}, "td": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"Monday\",\"Tuesday\", \"Wednesday\",\"Thursday\",\"Friday\")", "description": "", "name": "td"}, "sc2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a[u]", "description": "", "name": "sc2"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..abs(a)-1)", "description": "", "name": "t"}, "pf": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.2..0.7#0.1)", "description": "", "name": "pf"}, "mo": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"January\",\"February\", \"March\", \"April\",\"June\", \"October\",\"November\",\"December\")", "description": "", "name": "mo"}}, "ungrouped_variables": ["something", "indep", "pc", "tm", "pf", "m3", "m2", "m1", "td", "pm", "abbe", "npef", "pe", "thismany", "sc1", "pef", "sc3", "sc2", "a", "mm", "mo", "notindep", "col", "u", "t", "v", "k"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"layout": {"expression": ""}, "choices": ["First Pair: {sc1}", "Second Pair: {sc2}", "Third Pair: {sc3}"], "matrix": "mm", "type": "m_n_x", "maxAnswers": 0, "shuffleChoices": false, "answers": ["Independent", "Not independent"], "scripts": {}, "minMarks": 0, "minAnswers": 0, "maxMarks": 0, "shuffleAnswers": false, "showCorrectAnswer": true, "marks": 0}], "type": "gapfill", "prompt": "

[[0]]

", "showCorrectAnswer": true, "marks": 0}], "statement": "\n

Choose whether or not the following three pairs of events are independent or not.

\n

For every wrong choice you will lose a mark.  The minimum mark you can get is 0.

\n ", "tags": ["checked2015", "MAS1403", "MAS1604"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "\n \t\t

29/12/2012:

\n \t\t

Added sc tag as can add more pairs of events. Note that if you add more then the number of independent events in the new list has to be updated in variables m1,m2,m3.**

\n \t\t

The presentation of the pairs in the MCQ is not optimal! Not sure about the rather random labelling (A and B, H and K etc).

\n \t\t

No solution given. Perhaps a general statement on independence in Advice or in Show steps.  

\n \t\t

** Split up into two arrays, independent and not independent pairs.  If you add events to these arrays then everything is automatically updated.

\n \t\t

Question tested, OK.

\n \t\t", "licence": "Creative Commons Attribution 4.0 International", "description": "

Independent events in probability. Choose whether given three given pairs of events are independent or not.

"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

No solution provided.

"}, {"name": "Probability independent", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}], "functions": {}, "ungrouped_variables": ["y", "thing", "x", "a1d", "a2", "a3", "a4", "a1", "a2d", "a3d", "a4d"], "tags": ["rebelmaths"], "preamble": {"css": "", "js": ""}, "advice": "

(a) P({thing[0]})xP({thing[1]})={x}x{y}={a1}

\n

Next round to 2 decimal places to get {a1d}

\n

(b) P(not - {thing[0]})xP(not - {thing[1]})$=(1-\\var{x})\\times (1-\\var{y})=\\var{a2}$

\n

Next round to 2 decimal places to get {a2d}

\n

(c) 1- (answer to part (b))=1-{a2d}={a3d}

\n

(d) ( (1-{x})x {y})+( (1-{y})x {x})={a4}

\n

Next round to 2 decimal places to get {a4d}

\n

", "rulesets": {}, "parts": [{"precisionType": "dp", "prompt": "

What is the probabilty that both of these events occur?

", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "precision": "2", "showPrecisionHint": false, "variableReplacementStrategy": "originalfirst", "strictPrecision": false, "correctAnswerFraction": false, "showCorrectAnswer": true, "precisionPartialCredit": 0, "scripts": {}, "marks": "2", "maxValue": "{x}*{y}", "minValue": "{x}*{y}", "type": "numberentry"}, {"precisionType": "dp", "prompt": "

What is the probabilty that neither of these events occur?

", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "precision": "2", "showPrecisionHint": false, "variableReplacementStrategy": "originalfirst", "strictPrecision": false, "correctAnswerFraction": false, "showCorrectAnswer": true, "precisionPartialCredit": 0, "scripts": {}, "marks": "2", "maxValue": "(1-{x})*(1-{y})", "minValue": "(1-{x})*(1-{y})", "type": "numberentry"}, {"precisionType": "dp", "prompt": "

What is the probabilty that at least one of these two events will occur?

", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "precision": "2", "showPrecisionHint": false, "variableReplacementStrategy": "originalfirst", "strictPrecision": false, "correctAnswerFraction": false, "showCorrectAnswer": true, "precisionPartialCredit": "0", "scripts": {}, "marks": "2", "maxValue": "1-(1-{x})*(1-{y})", "minValue": "1-(1-{x})*(1-{y})", "type": "numberentry"}, {"precisionType": "dp", "prompt": "

What is the probabilty that only one of the two events occur?

", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "variableReplacements": [], "precision": "2", "showPrecisionHint": false, "variableReplacementStrategy": "originalfirst", "strictPrecision": false, "correctAnswerFraction": false, "showCorrectAnswer": true, "precisionPartialCredit": 0, "scripts": {}, "marks": "2", "maxValue": "(1-{x})*{y}+(1-{y})*{x}", "minValue": "(1-{x})*{y}+(1-{y})*{x}", "type": "numberentry"}], "statement": "

The probability that {thing[0]} is {x}, while the probability that {thing[1]} is {y}. Assume that these two events are independent. Give all answers correct to two decimal places.

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a4d": {"definition": "precround((1-x)*y+(1-y)*x,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "a4d", "description": ""}, "a1d": {"definition": "precround(x*y,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "a1d", "description": ""}, "a1": {"definition": "x*y", "templateType": "anything", "group": "Ungrouped variables", "name": "a1", "description": ""}, "thing": {"definition": "random(['there will be a change in government in Ireland next year ', 'Ireland will win the rugby world cup next year'],['it will rain in Qumar on any given day','it will rain in Timbucktoo on any given day'],['shares in the Bank of Lapland will rise on any given day','shares in the Bank of Never Never Land will rise on any given day'])", "templateType": "anything", "group": "Ungrouped variables", "name": "thing", "description": ""}, "a3": {"definition": "1-a2", "templateType": "anything", "group": "Ungrouped variables", "name": "a3", "description": ""}, "a2": {"definition": "(1-x)*(1-y)", "templateType": "anything", "group": "Ungrouped variables", "name": "a2", "description": ""}, "a2d": {"definition": "precround((1-x)*(1-y),2)", "templateType": "anything", "group": "Ungrouped variables", "name": "a2d", "description": ""}, "a4": {"definition": "(1-x)*y+(1-y)*x", "templateType": "anything", "group": "Ungrouped variables", "name": "a4", "description": ""}, "a3d": {"definition": "precround(1-a2,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "a3d", "description": ""}, "y": {"definition": "random(0.01..0.99#0.01)", "templateType": "randrange", "group": "Ungrouped variables", "name": "y", "description": ""}, "x": {"definition": "random(0.01..0.9#0.01)", "templateType": "randrange", "group": "Ungrouped variables", "name": "x", "description": ""}}, "metadata": {"description": "

rebelmaths

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Select a card and roll a dice", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}, {"name": "Patricia Cogan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3359/"}], "tags": ["probability", "Probability", "rebel", "REBEL", "Rebel", "rebelmaths"], "metadata": {"description": "

A student selects a card from a deck of 52 and rolls a dice once.

\n

rebelmaths

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

Please give your answers to 3 decimal places.

\n

A student selects one card at random from a pack of 52 playing cards and then rolls a dice once.

\n

Let event $A$ be that the card she picks is a $\\var{suit}$.

\n

Let event $B$ be that the number she rolls is greater than $\\var{n}$.

", "advice": "

The outcome of selecting the card is independent of (not effected by) the outcome of rolling the dice.

\n

If two events, $A$ and $B$, are independent then $P(A\\cap B)=P(A)\\times P(B)$.

\n

Part a)

\n
\n

Let $A$ represent the event that a $\\var{suit}$ is selected and let $B$ represent the event that a number greater than $\\var{n}$ is rolled.

\n

 $P(A)$ is $\\frac{13}{52}=\\frac{1}{4}$ and $P(B)$ is  $\\frac{\\var{6-n}}{6}$.

\n

Therefore the probability of drawing a $\\var{suit}$ and rolling a number greater than $\\var{n}$ is $ P(A) \\times P(B)=\\frac{1}{4} \\times \\frac{\\var{6-n}}{6}$. 

\n

Part b)

\n

\n

The probability that neither of these events occur is the probability of not drawing a $\\var{suit}$ which is $P(A^c)=\\frac{3}{4}$ mulitiplied by the probability of not rolling a number greater than $\\var{n}$ which is $P(B^c)=\\frac{\\var{n}}{6}$ .

\n

Part c)

\n

The probability that only one of these events occur is $P(A ^c\\cap B)+P(A \\cap B^c)=(\\frac{3}{4} \\times \\frac{\\var{6-n}}{6})+(\\frac{1}{4} \\times \\frac{\\var{n}}{6})$.

\n

Part d)

\n

The probability  that at least one of these two events will occur is $1- P$(neither of the events occur)$=1-(P(A^c)\\times P(B^c))= 1-(\\frac{3}{4}\\times \\frac{\\var{n}}{6})$

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "

number on dice is greater than n.

", "templateType": "anything", "can_override": false}, "suit": {"name": "suit", "group": "Ungrouped variables", "definition": "random ('diamond','spade','heart','club')", "description": "

suit

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["n", "suit"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"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 probability that the card she picks is a $\\var{suit}$ and the number she rolls is greater than $\\var{n}$.

", "minValue": "(1/4)*((6-n)/6)-0.001", "maxValue": "(1/4)*((6-n)/6)+0.001", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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 probability that neither of these two events will occur.

", "minValue": "(3/4)*(n/6)-0.001", "maxValue": "(3/4)*(n/6)+0.001", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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 probability that only one of these two events will occur.

", "minValue": "((1/4)*(n/6)+(3/4)*((6-n)/6))-0.001", "maxValue": "((1/4)*(n/6)+(3/4)*((6-n)/6))+0.001", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "

What is the probability that at least one of these two events will occur?

", "minValue": "((1/4)*(n/6)+(3/4)*((6-n)/6)+(1/4)*((6-n)/6))-0.001", "maxValue": "((1/4)*(n/6)+(3/4)*((6-n)/6)+(1/4)*((6-n)/6))+0.001", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "precisionType": "dp", "precision": "3", "precisionPartialCredit": "0", "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Catherine's copy of BS2.3", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}, {"name": "Patricia Cogan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3359/"}], "tags": ["percentages", "probabilities", "probability", "Probability", "probability law", "probability of union", "sc"], "metadata": {"description": "\n \t\t

Example showing how to calculate the probability of A or B using the law $p(A \\;\\textrm{or}\\; B)=p(A)+p(B)-p(A\\;\\textrm{and}\\;B)$. 

\n \t\t

Also converting percentages to probabilities.

\n \t\t

Easily adapted to other applications.

\n \t\t", "licence": "None specified"}, "statement": "

$\\var{p1}$% of {things} {desc1} {dothis}, $\\var{p2}$% {dothat} and $\\var{p3}$% {dothisandthat}. 

\n

{therest} {desc2}.

\n

A Venn Diagram is useful to help organise the information.

", "advice": "

Let $A$ represent the event that a $\\var{thing}$ $\\var{dothis1}$ and let $B$ represent the event that a $\\var{thing}$ $\\var{dothat1}$. It is clear that the events $A$ and $B$ are not mutually exclusive. Therefore

\n

$P(A \\cup B) = P(A)+P(B)-P(A\\cap B)$

\n

a) The number of stewardesses working on both routes is $P(A\\cap B) =  P(A)+P(B)-P(A \\cup B)$

\n

There are $\\var{p1}+\\var{p2}-\\var{p3}=\\var{p-p3}$ % of stewardesses working on both routes. The probability that a random stewardess is working both routes is therefore $\\displaystyle \\frac{\\var{p-p3}}{100}=\\var{prob1}$.

\n

b) The rest are in training and the probability that a randomly selected stewardess is in training is $1-\\var{prob1}=\\var{1-prob1}$.

", "rulesets": {}, "variables": {"dothisandthat": {"name": "dothisandthat", "group": "Ungrouped variables", "definition": "\"work on both domestic and European routes\"", "description": "", "templateType": "anything"}, "desc4": {"name": "desc4", "group": "Ungrouped variables", "definition": "\"is in training\"", "description": "", "templateType": "anything"}, "p1": {"name": "p1", "group": "Ungrouped variables", "definition": "random(40..70)", "description": "", "templateType": "anything"}, "desc1": {"name": "desc1", "group": "Ungrouped variables", "definition": "\"with a small UK-based airline\"", "description": "", "templateType": "anything"}, "dothat": {"name": "dothat", "group": "Ungrouped variables", "definition": "\"work on European routes\"", "description": "", "templateType": "anything"}, "desc3": {"name": "desc3", "group": "Ungrouped variables", "definition": "\"working with this airline\"", "description": "", "templateType": "anything"}, "things": {"name": "things", "group": "Ungrouped variables", "definition": "'stewardesses'", "description": "", "templateType": "anything"}, "ans2": {"name": "ans2", "group": "Ungrouped variables", "definition": "precround(1-prob1,2)", "description": "", "templateType": "anything"}, "p3": {"name": "p3", "group": "Ungrouped variables", "definition": "p-random(85..95)", "description": "", "templateType": "anything"}, "p": {"name": "p", "group": "Ungrouped variables", "definition": "random(105..125)", "description": "", "templateType": "anything"}, "p2": {"name": "p2", "group": "Ungrouped variables", "definition": "p-p1", "description": "", "templateType": "anything"}, "dothat1": {"name": "dothat1", "group": "Ungrouped variables", "definition": "\"works on European routes\"", "description": "", "templateType": "anything"}, "dothis": {"name": "dothis", "group": "Ungrouped variables", "definition": "\"work on domestic routes\"", "description": "", "templateType": "anything"}, "therest": {"name": "therest", "group": "Ungrouped variables", "definition": "\"The remainder\"", "description": "", "templateType": "anything"}, "desc2": {"name": "desc2", "group": "Ungrouped variables", "definition": "\"are in training\"", "description": "", "templateType": "anything"}, "thing": {"name": "thing", "group": "Ungrouped variables", "definition": "\"stewardess\"", "description": "", "templateType": "anything"}, "dothis1": {"name": "dothis1", "group": "Ungrouped variables", "definition": "\"works on domestic routes\"", "description": "", "templateType": "anything"}, "prob1": {"name": "prob1", "group": "Ungrouped variables", "definition": "precround((p-p3)/100,2)", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["dothisandthat", "desc4", "p1", "desc1", "dothat", "desc3", "things", "ans2", "p3", "p", "p2", "dothat1", "dothis", "therest", "desc2", "thing", "dothis1", "prob1"], "variable_groups": [], "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

Find the probabilities that a randomly chosen {thing} {desc3}: 

\n

a) {dothis1} or {dothat1}.

\n

Probability = [[0]]

\n

b) {desc4}.

\n

Probability = [[1]]

\n

Enter both probabilities to 2 decimal places.

\n ", "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": "prob1", "maxValue": "prob1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "ans2", "maxValue": "ans2", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Template 1 for Workshop", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Julie Crowley", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/113/"}], "functions": {"norm": {"definition": "\n var b=a;\n var s=-b[x];\n for(i=0;i1) The total number of {somecat} {things}s is $\\var{sumr[t]}$ hence the probability that a random {things} from this survey is {somecat} is $\\displaystyle \\frac{ \\var{sumr[t]}}{\\var{n}}=\\var{ans[0]}$ to 3 decimal places.

\n

 

\n

2) The total number of  {things}s who are {drk} is $\\var{tc[u]}$ hence the probability that a random {things} from this survey is {drk} is $\\displaystyle \\frac{ \\var{tc[u]}}{\\var{n}}=\\var{ans[1]}$  to 3 decimal places.

\n

 

\n

3) Looking at the table there are $\\var{ve}$ {things}s that are {oneof}. Hence the probability is $\\displaystyle \\frac{ \\var{ve}}{\\var{n}}=\\var{ans[2]}$  to 3 decimal places.

\n

 

\n

4) These are the {things}s that are not {drk}, and hence there are $\\var{n}-\\var{tc[u]}=\\var{n-tc[u]}$ of them (see answer to part b)), and the probability of randomly selecting one is  $\\displaystyle \\frac{ \\var{n-tc[u]}}{\\var{n}}=\\var{ans[3]}$ to 3 decimal places.

\n

 

\n

5)Looking at the table we see that the number corresponding to {catattrib1} is $\\var{ce1}$. Hence the probability of randomly selecting one is $\\displaystyle \\frac{ \\var{ce1}}{\\var{n}}=\\var{ans[4]}$ to 3 decimal places.

\n

6) As in the last question, looking at the table we see that the number corresponding to {catattrib2} is $\\var{ce2}$. Hence the probability of randomly selecting one is $\\displaystyle \\frac{ \\var{ce2}}{\\var{n}}=\\var{ans[5]}$ to 3 decimal places.

\n

 

\n

7) We know from question a) that the probability of selecting a {somecat} {things} is,  $\\displaystyle \\frac{ \\var{sumr[t]}}{\\var{n}}$, after this we now have $\\var{sumr[t]-1} $ {somecat} {things}s amongst the $\\var{n-1}$  left,  and the probability of yet again selecting one  of these is $\\displaystyle \\frac{ \\var{sumr[t]-1}}{\\var{n-1}}$. So the probability of selecting two is  $\\displaystyle \\frac{ \\var{sumr[t]}\\times  \\var{sumr[t]-1}}{\\var{n}\\times\\var{n-1}}=\\var{ans[6]}$ to 3 decimal places.

\n

8) The probability of selecting a {things} who is {drk1} is $\\displaystyle \\frac{ \\var{tc[u1]}}{\\var{n}}$, after this we now have  $\\var{tc[u1]-1}$ {drk1} {things}s amongst the $\\var{n-1}$ left, and the probability of yet again selecting one  of these is $\\displaystyle \\frac{ \\var{tc[u1]-1}}{\\var{n-1}}$. So the probability of selecting two is  $\\displaystyle \\frac{ \\var{tc[u1]}\\times  \\var{tc[u1]-1}}{\\var{n}\\times\\var{n-1}}=\\var{ans[7]}$ to 3 decimal places.

\n

9) Since there are $\\var{r[t][u]}$ {somecat} {things}s from the  $\\var{tc[u]}$ {things}s that are {drk} the probability of selecting one  is $\\displaystyle \\frac{\\var{r[t][u]}}{\\var{tc[u]}}= \\var{ans[8]}$ to 3 decimal places.

\n

", "rulesets": {}, "parts": [{"prompt": "

Find the following probabilities that a randomly chosen {things} involved in this survey:

\n
    \n
  1. is {somecat}: Probability = [[0]]
  2. \n
  3. is {drk}:  Probability = [[1]]
  4. \n
  5. is either {oneof}: Probability = [[2]]
  6. \n
  7. {drkpair}: Probability = [[3]]
  8. \n
  9. {catattrib1}: Probability = [[4]]
  10. \n
  11. {catattrib2}: Probability = [[5]]
  12. \n
\n

(Enter all probabilities to 3 decimal places)

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"allowFractions": false, "variableReplacements": [], "maxValue": "ans[0]", "minValue": "ans[0]", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "ans[1]", "minValue": "ans[1]", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "ans[2]", "minValue": "ans[2]", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "ans[3]", "minValue": "ans[3]", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "ans[4]", "minValue": "ans[4]", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "ans[5]", "minValue": "ans[5]", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "\n

Find the probability (to 3 decimal places) that two randomly selected {things}s in this survey are

\n

7) both {somecat}:  Probability = ? [[0]]

\n

8) both {drk1}: Probability =? [[1]]

\n \n ", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"allowFractions": false, "variableReplacements": [], "maxValue": "ans[6]", "minValue": "ans[6]", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "variableReplacements": [], "maxValue": "ans[7]", "minValue": "ans[7]", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "

Given that a randomly selected {things} in this survey is {drk}, what is the probability that he:

\n

9) is {somecat}: Probability = ? [[0]]

\n

 

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"allowFractions": false, "variableReplacements": [], "maxValue": "ans[8]", "minValue": "ans[8]", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "statement": "

A survey was conducted to obtain information on {this}. A random sample of {things}s gave :

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
{Cats}{At[0]}{At[1]}{At[2]}Total
{cat[0]}{r[0][0]}{r[0][1]}{r[0][2]}{sumr[0]}
{cat[1]}{r[1][0]}{r[1][1]}{r[1][2]}{sumr[1]}
{cat[2]}{r[2][0]}{r[2][1]}{r[2][2]}{sumr[2]}
{cat[3]}{r[3][0]}{r[3][1]}{r[3][2]}{sumr[3]}
Totals{tc[0]}{tc[1]}{tc[2]}\n

{tot}

\n
\n

Give all answers correct to 3 decimal places (not in fraction form).

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "variables": {"somecat": {"definition": "\n //name of category chosen using t\n cat[t]\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "somecat", "description": ""}, "ve": {"definition": "\n //sums across selected rows\n switch(v=1,sumr[0]+ sumr[1] ,v=2,sumr[0]+sumr[2],v=3,sumr[0]+sumr[3],v=4,sumr[1]+sumr[2],v=5,sumr[1]+sumr[3],sumr[2]+sumr[3])\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "ve", "description": ""}, "othercats": {"definition": "switch(t=0,cat[1]+\" or \"+ cat[2] ,t=1,cat[0]+\" or \"+cat[3],t=2,cat[0]+\" or \"+cat[1],t=3,cat[0]+\" or \"+cat[1],cat[0]+\" or \"+cat[2])", "templateType": "anything", "group": "Ungrouped variables", "name": "othercats", "description": ""}, "at": {"definition": "\n //column titles, the attributes\n [\"teetotal\",\"drinking 1-20 units/week\",\"drinking 21+ units/week\"]\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "at", "description": ""}, "ce1": {"definition": "\n //corresponding table entries given by w\n switch(w=1, r[0][0],w=2, r[0][1],w=3, r[0][2],w=4,r[1][0],w=5, r[1][1],r[1][2])\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "ce1", "description": ""}, "ans": {"definition": "\n //the answers bundled together. Index of answer corresponds to the order of the questions\n map(precround(x,3),x,[sumr[t]/n,tc[u]/n,ve/n,1-tc[u]/n,ce1/n,ce2/n,sumr[t]*(sumr[t]-1)/(n*(n-1)),tc[u1]*(tc[u1]-1)/(n*(n-1)),r[t][u]/tc[u],we2/tc[u]])\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "ans", "description": ""}, "n": {"definition": "\n //total number of observations\n random(1200..2300#2)\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "n", "description": ""}, "drk1": {"definition": "\n //the attribute chosen\n At[u1]\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "drk1", "description": ""}, "things": {"definition": "\n //kind of subjects\n \"male\"\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "things", "description": ""}, "u1": {"definition": "\n //another choice of attribute\n random(0..2)\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "u1", "description": ""}, "tot": {"definition": "\n //should be n, redundant\n sum(tc)\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "tot", "description": ""}, "catattrib2": {"definition": "\n //names of pairs of categories chosen using w1\n switch(w1=1,cat[2]+\" and \"+At[0],w1=2,cat[2]+\" and \"+At[1],w1=3,cat[2]+\" and \"+At[2],w1=4,cat[3]+\" and \"+At[0],w1=5,cat[3]+\" and \"+At[1],cat[3]+\" and \"+At[2])\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "catattrib2", "description": ""}, "cats": {"definition": "\n //Title of row\n \"Marital Status\"\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "cats", "description": ""}, "tc": {"definition": "\n //the column sums, attribute numbers. preordained, probably not a good idea\n [tc1,tc2,tc3]\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "tc", "description": ""}, "w1": {"definition": "\n //another category,attribute pair\n random(1..6)\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "w1", "description": ""}, "oneof": {"definition": "\n //names of pairs of categories chosen using v\n switch(v=1,cat[0]+\" or \"+ cat[1] ,v=2,cat[0]+\" or \"+cat[2],v=3,cat[0]+\" or \"+cat[3],v=4,cat[1]+\" or \"+cat[2],v=5,cat[1]+\" or \"+cat[3],cat[2]+\" or \"+cat[3])\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "oneof", "description": ""}, "tc2": {"definition": "\n //second attribute sum\n n-tc1-tc3\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "tc2", "description": ""}, "tc3": {"definition": "\n //third attribute sum\n round(n/random(6.5..7.5#0.1))\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "tc3", "description": ""}, "tc1": {"definition": "\n //first attribute sum\n round(n/random(2.5..3.5#0.1))\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "tc1", "description": ""}, "catattrib1": {"definition": "\n //names of pairs of categories chosen using w\n switch(w=1,cat[0]+\" and \"+At[0],w=2,cat[0]+\" and \"+At[1],w=3,cat[0]+\" and \"+At[2],w=4,cat[1]+\" and \"+At[0],w=5,cat[1]+\" and \"+At[1],cat[1]+\" and \"+At[2])\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "catattrib1", "description": ""}, "a": {"definition": "\n //assigning numbers (need to transpose to convert rows to columns)\n //0 in second entry adjusted by matrix r below using the norm function, so column sums the same\n [[round(tc1/random(7.5..8.5#0.1)),0,round(tc1/random(6.5..7.5#0.1)),round(tc1/random(19.5..20.5#0.1))],[round(tc2/random(3.5..4.5#0.1)),0,round(tc2/random(19.5..20.5#0.1)),round(tc2/random(19.5..20.5#0.1))],[round(tc3/random(2.5..3.5#0.1)),0,random(5..15),round(tc3/random(14.5..15.5#0.1))]]\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "drkpair": {"definition": "\n //names of attributes chosen using u\n switch(u=0,\"drinks alcohol\",u=1,At[0]+' or ' + At[2],At[0]+\" or \" +At[1])\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "drkpair", "description": ""}, "this": {"definition": "\n //what about\n \"alcohol consumption\"\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "this", "description": ""}, "cat": {"definition": "\n //Row categories\n ['single','married','divorced','widowed']\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "cat", "description": ""}, "we2": {"definition": "if(u=0, if(t=0,r[1][0]+r[2][0], if(t=1,r[0][0]+r[3][0], if(t=2,r[0][0]+r[1][0],r[0][0]+r[2][0]))),if(u=1, if(t=0,r[1][1]+r[2][1], if(t=1,r[0][1]+r[3][1], if(t=2,r[0][1]+r[1][1],r[0][1]+r[2][1]))),if(t=0,r[1][2]+r[2][2], if(t=1,r[0][2]+r[3][2], if(t=2,r[0][2]+r[1][2], r[0][2]+r[2][2])))))", "templateType": "anything", "group": "Ungrouped variables", "name": "we2", "description": ""}, "drk": {"definition": "\n //name of attribute chosen using u\n At[u]\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "drk", "description": ""}, "r": {"definition": "\n //uses the user defined function norm to complete the matrix columns so that the sums are tc\n transpose(matrix(map(norm(a[y],1,tc[y]),y,0..2)))\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "r", "description": ""}, "u": {"definition": "\n //used to choose a column attribute\n random(0..2)\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "u", "description": ""}, "t": {"definition": "\n //used to choose a row category\n random(0..3)\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}, "w": {"definition": "\n // category,attribute pair\n random(1..6)\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "w", "description": ""}, "v": {"definition": "\n //used to choose a pair of row categories randomly\n random(1..6)\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "v", "description": ""}, "sumr": {"definition": "\n //sum of rows\n map(sum(list(r[y])),y,0..3)\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "sumr", "description": ""}, "ce2": {"definition": "\n //corresponding table entries given by w1\n switch(w1=1, r[2][0],w1=2, r[2][1],w1=3, r[2][2],w1=4,r[3][0],w1=5, r[3][1],r[3][2])\n ", "templateType": "anything", "group": "Ungrouped variables", "name": "ce2", "description": ""}}, "metadata": {"description": "

Basic data structures and maths/stats functionality given.

\n

You can configure the rest.

\n

rebelmaths

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Simple expected outcome", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Lois Rollings", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/326/"}], "functions": {}, "ungrouped_variables": ["answer", "denom", "parts", "onepart", "fraction"], "tags": ["expected value", "fraction"], "preamble": {"css": "", "js": ""}, "advice": "

$ \\dfrac {\\var{parts}}{\\var{denom}} \\times 40 = \\var{parts} \\times \\var{onepart} = \\var{answer}$

", "rulesets": {}, "parts": [{"prompt": "

In how many matches would he expect to score in a season of 40 games?

\n

[[0]] matches.

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"allowFractions": false, "variableReplacements": [], "maxValue": "{answer}", "minValue": "{answer}", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "statement": "

A premiership footballer expects to score a goal in {parts} {fraction} of the matches he plays.

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"answer": {"definition": "parts*40/denom", "templateType": "anything", "group": "Ungrouped variables", "name": "answer", "description": ""}, "denom": {"definition": "switch(fraction = 'quarters', 4, fraction = 'fifths',5, fraction = 'eighths',8, fraction = 'tenths', 10)", "templateType": "anything", "group": "Ungrouped variables", "name": "denom", "description": ""}, "parts": {"definition": "switch( fraction ='fifths', random(2,3), fraction = 'quarters', 3, fraction='eighths', random(3,5), fraction = 'tenths', random(3,7))", "templateType": "anything", "group": "Ungrouped variables", "name": "parts", "description": ""}, "onepart": {"definition": "40/denom", "templateType": "anything", "group": "Ungrouped variables", "name": "onepart", "description": ""}, "fraction": {"definition": "random( 'fifths', 'quarters', 'eighths', 'tenths')", "templateType": "anything", "group": "Ungrouped variables", "name": "fraction", "description": ""}}, "metadata": {"description": "

Footballer expects to score in a/b matches.

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Expected value coin toss", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}], "advice": "

The expected value of a random variable $X$ (denoted by $E[X]$ or $μ$) is given by $E[X]=∑_{i}x_{i}P(X=x_{i})$

\n

Let $X$ represent the winnings for the game.

\n

Then $E[X]=\\frac{1}{2}\\times(-1)+\\frac{1}{2}\\times(1)=0$

", "variable_groups": [], "functions": {}, "variablesTest": {"maxRuns": 100, "condition": ""}, "parts": [{"variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "gaps": [{"variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "maxValue": "0", "type": "numberentry", "correctAnswerFraction": false, "correctAnswerStyle": "plain", "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "scripts": {}, "showFeedbackIcon": true, "minValue": "0", "mustBeReduced": false, "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}], "prompt": "

What are the expected winnings?

\n

€[[0]]

", "variableReplacements": [], "type": "gapfill", "marks": 0, "scripts": {}, "showCorrectAnswer": true}], "rulesets": {}, "variables": {}, "preamble": {"js": "", "css": ""}, "metadata": {"description": "

Suppose that we toss a coin. We win €1 for a head and lose €1 for a tail. Let X represent our winnings. What is our expected winnings?

", "licence": "None specified"}, "statement": "

Suppose that we toss a coin. We win €1 for a head and lose €1 for a tail. Let $X$ represent the winnings. 

", "ungrouped_variables": [], "tags": [], "type": "question"}, {"name": "Expected winnings 2", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}], "functions": {}, "ungrouped_variables": ["even", "odd", "even4", "odd3"], "tags": [], "preamble": {"css": "", "js": ""}, "advice": "

The expected value of a random variable $X$ (denoted by $E[X]$ or $μ$) is given by $E[X]=∑_{i}x_{i}P(X=x_{i})$

\n

Let $X$ represent the winnings for the game.

\n

Then $E[X]=\\frac{1}{6}\\times(-1)+\\frac{1}{6}\\times(2)+\\frac{1}{6}\\times(-3)+\\frac{1}{6}\\times(4)+\\frac{1}{6}\\times(-5)+\\frac{1}{6}\\times(6)=0.5$

\n

The minimum price that PJ should charge for a ticket is €0.50 otherwise, over the course of many games he will make a loss.

\n

\n

", "rulesets": {}, "parts": [{"precisionType": "dp", "prompt": "

Calculate the expected value of the player’s winnings (in €).

", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "marks": "4", "maxValue": "((-1/6)+(-3/6)+(-5/6)+(2/6)+(4/6)+1)", "strictPrecision": false, "minValue": "((-1/6)+(-3/6)+(-5/6)+(2/6)+(4/6)+1)", "precisionPartialCredit": 0, "correctAnswerFraction": false, "showCorrectAnswer": true, "precision": "2", "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"precisionType": "dp", "prompt": "

What is the minimum price (in €) that PJ should charge for the tickets?

", "precisionMessage": "You have not given your answer to the correct precision.", "allowFractions": false, "marks": "1", "maxValue": "((-1/6)+(-3/6)+(-5/6)+(2/6)+(4/6)+1)", "strictPrecision": false, "minValue": "((-1/6)+(-3/6)+(-5/6)+(2/6)+(4/6)+1)", "precisionPartialCredit": 0, "correctAnswerFraction": false, "showCorrectAnswer": true, "precision": "2", "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "statement": "

Please give your answer to 2 decimal places.

\n

PJ Murphy is in charge of one of the stalls at the annual parish fete. At this stall, each player buys a ticket that entitles him to roll a dice once. If the player rolls an even number, PJ pays him the amount shown on the dice in euro, but if the player rolls an odd number, he must pay PJ the amount shown on the dice in euro. 

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"even": {"definition": "random(8..16)", "templateType": "anything", "group": "Ungrouped variables", "name": "even", "description": "

euros per point for an even throw

"}, "odd3": {"definition": "odd*(3)", "templateType": "anything", "group": "Ungrouped variables", "name": "odd3", "description": ""}, "odd": {"definition": "random(6..10)", "templateType": "anything", "group": "Ungrouped variables", "name": "odd", "description": "

euros per point for an odd throw

"}, "even4": {"definition": "even*4", "templateType": "anything", "group": "Ungrouped variables", "name": "even4", "description": ""}}, "metadata": {"notes": "", "description": "

 PJ Murphy is in charge of one of the stalls at the annual parish fete. At this stall, each player buys a ticket that entitles him to roll a dice once. If the player rolls an even number, PJ pays him the amount shown on the dice in euro, but if the player rolls an odd number, he must pay PJ the amount shown on the dice in euro. 

", "licence": "None specified"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Expected winnings 1", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Catherine Palmer", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/423/"}, {"name": "Patricia Cogan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3359/"}], "tags": [], "metadata": {"description": "

In a casino game, a player rolls a dice once. If he rolls an even number, he wins €x for each point scored (if he rolls a 4, for example, he wins €4x). If he rolls an odd number, he loses €z for each point scored (if he rolls a 3, for example, he loses €3z).

", "licence": "None specified"}, "statement": "

Please give your answer to 2 decimal places.

\n

In a casino game, a player rolls a dice once. If he rolls an even number, he wins €$\\var{even}$ for each point scored (if he rolls a 4, for example, he wins €$\\var{even4}$). If he rolls an odd number, he loses €$\\var{odd}$ for each point scored (if he rolls a 3, for example, he loses €$\\var{odd3}$).

", "advice": "", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"even": {"name": "even", "group": "Ungrouped variables", "definition": "random(8..16)", "description": "

euros per point for an even throw

", "templateType": "anything", "can_override": false}, "odd3": {"name": "odd3", "group": "Ungrouped variables", "definition": "odd*(3)", "description": "", "templateType": "anything", "can_override": false}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "random(2..6 #4)", "description": "", "templateType": "anything", "can_override": false}, "neven": {"name": "neven", "group": "Ungrouped variables", "definition": "n*even", "description": "", "templateType": "anything", "can_override": false}, "odd": {"name": "odd", "group": "Ungrouped variables", "definition": "random(6..10)", "description": "

euros per point for an odd throw

", "templateType": "anything", "can_override": false}, "even4": {"name": "even4", "group": "Ungrouped variables", "definition": "even*4", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["even", "odd", "even4", "odd3", "n", "neven"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"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": "

What is the probability that a player rolls a $\\var{n}$?

", "minValue": "(1/6)-0.01", "maxValue": "(1/6)+0.01", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "

If a player rolls a $\\var{n}$, how much does he win?

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

Calculate the expected value of his winnings.

", "minValue": "((-1/6)*odd+(-3/6)*odd+(-5/6)*odd+(2/6)*even+(4/6)*even+even)-0.01", "maxValue": "((-1/6)*odd+(-3/6)*odd+(-5/6)*odd+(2/6)*even+(4/6)*even+even)+0.01", "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": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "

If the casino wishes to break even from this game, what is the minimum amount it should charge a player to play this game?

", "minValue": "((-1/6)*odd+(-3/6)*odd+(-5/6)*odd+(2/6)*even+(4/6)*even+even)-0.01", "maxValue": "((-1/6)*odd+(-3/6)*odd+(-5/6)*odd+(2/6)*even+(4/6)*even+even)+0.01", "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": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question"}, {"name": "Make decision based on expected monetary value", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"cat": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\"Market the product nationwide\",\"Sell by mail order\",\"Sell the patent\"]", "description": "", "name": "cat"}, "b": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map([cat[x]]+a[x],x,0..2)", "description": "", "name": "b"}, "a22": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a12+random(5..15#5)", "description": "", "name": "a22"}, "p3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-p1-p2,2)", "description": "", "name": "p3"}, "outcomes": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"outcomes\"", "description": "", "name": "outcomes"}, "emv": {"templateType": "anything", "group": "Ungrouped variables", "definition": "matrix(a)*vector(p)", "description": "", "name": "emv"}, "correct": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(mm[0]=1,Cat[0],mm[1]=1,Cat[1],Cat[2])", "description": "", "name": "correct"}, "product": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"product\"", "description": "", "name": "product"}, "a10": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(random(0.75..0.9#0.5)*a00)", "description": "", "name": "a10"}, "a20": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(a10*random(0.7..0.85))", "description": "", "name": "a20"}, "p1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(random(0.2..0.35#0.05),2)", "description": "", "name": "p1"}, "expectedreturn": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"the Marketing Director`s thoughts on the likely profit (in thousands of pounds) to be earned\"", "description": "", "name": "expectedreturn"}, "something": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"A car accessory company, Marla PLC, \"", "description": "", "name": "something"}, "mm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "map(award(1,maxemv=emv[x]),x,0..abs(cat)-1)", "description": "", "name": "mm"}, "info": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"Initial market research\"", "description": "", "name": "info"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[p1,p2,p3]", "description": "", "name": "p"}, "maxemv": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(list(emv))", "description": "", "name": "maxemv"}, "units": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'thousands of pounds'", "description": "", "name": "units"}, "hasdonethis": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"has developed a new car immobiliser \"", "description": "", "name": "hasdonethis"}, "p2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(p1+random(0.05..0.1#0.05),2)", "description": "", "name": "p2"}, "a02": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-40..-10#10)", "description": "", "name": "a02"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[[a00,a01,a02],[a10,a11,a12],[a20,a21,a22]]", "description": "", "name": "a"}, "decision": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"and has to decide whether to:\"", "description": "", "name": "decision"}, "a00": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(80..120#10)", "description": "", "name": "a00"}, "a01": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(40..70#10)", "description": "", "name": "a01"}, "att": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[\" \",\"highly successful\",\"moderately successful\",\"limited success/failure\"]", "description": "", "name": "att"}, "a12": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(5..15#5)", "description": "", "name": "a12"}, "a11": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(random(0.75..0.95#0.5)*a01)", "description": "", "name": "a11"}, "a21": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(a01*random(0.7..0.85))", "description": "", "name": "a21"}}, "ungrouped_variables": ["a20", "a21", "a22", "a02", "a00", "a01", "outcomes", "something", "maxemv", "decision", "units", "correct", "a", "product", "a11", "a10", "a12", "b", "p2", "p3", "p1", "mm", "info", "cat", "p", "att", "emv", "expectedreturn", "hasdonethis"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "variable_groups": [], "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "emv[0]", "minValue": "emv[0]", "showCorrectAnswer": true, "marks": 1}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "emv[1]", "minValue": "emv[1]", "showCorrectAnswer": true, "marks": 1}, {"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "emv[2]", "minValue": "emv[2]", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "prompt": "\n

Calculate the Expected Monetary Value (EMV) for each option:

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
 EMV
{Cat[0]}[[0]]
{Cat[1]}[[1]]
{Cat[2]}[[2]]
\n ", "showCorrectAnswer": true, "marks": 0}, {"displayType": "radiogroup", "choices": ["{Cat[0]}", "{Cat[1]}", "{Cat[2]}"], "matrix": "mm", "prompt": "\n

Hence determine the optimal course of action:

\n

 

\n ", "distractors": ["", "", ""], "shuffleChoices": false, "scripts": {}, "maxMarks": 0, "type": "1_n_2", "minMarks": 0, "showCorrectAnswer": true, "displayColumns": 0, "marks": 0}], "statement": "\n

{Something} {hasdonethis} {decision}

\n

A. {Cat[0]}

\n

B. {Cat[1]}

\n

C. {Cat[2]}

\n

{info} has the following probabilities associated to the following {outcomes} for the {product}:

\n

{Att[1]}, {Att[2]} or {Att[3]}.

\n

{table([['<strong>Probability</strong>']+p],Att)}

\n

The next table shows {expectedreturn} for each option against these {outcomes}:

\n

{table(b,Att)}

\n ", "tags": ["checked2015", "MAS1403"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "\n \t\t

29/12/2012:

\n \t\t

Added tag sc (as configurable to other applications).

\n \t\t

Also added tag table.

\n \t\t

The tables need sorting out. OK, but need better table functions.

\n \t\t

Checked calculations, OK.

\n \t\t

 

\n \t\t", "licence": "Creative Commons Attribution 4.0 International", "description": "

Given data on probabilities of three levels of success of three options and projections of the profits that the options will accrue depending on the level of success, find the expected monetary value (EMV) for each option and choose the one with the greatest EMV.

"}, "advice": "\n

The Expected Monetary Value for the first option:  {Cat[0]} is given in four steps (all numbers below are in {units}):

\n

1.  Multiplying the probability $\\var{p1}$  of a {Att[1]} outcome by the expected profit $\\var{a[0][0]}$,  gives:

\n

expected profit = $\\var{p1}\\times \\var{a[0][0]}=  \\var{p1*a[0][0]}$ 

\n

 

\n

2.  Multiplying the probability $\\var{p2}$  of a {Att[2]} outcome  by the expected profit,  $\\var{a[0][1]}$ gives:

\n

 expected profit =  $\\var{p2}\\times \\var{a[0][1]}=  \\var{p2*a[0][1]}$  

\n

 

\n

3.   Multiplying the probability $\\var{p3}$  of a {Att[3]} outcome  by the expected profit,  $\\var{a[0][2]}$ gives:

\n

 expected profit =  $\\var{p3}\\times \\var{a[0][2]}=  \\var{p3*a[0][2]}$ 

\n

4. Finally add these three together to get the Expected Monetary Value  for the option {Cat[0]} :

\n

$\\var{p1*a[0][0]}+\\var{p2*a[0][1]}-\\var{abs(p3*a[0][2])}=\\var{emv[0]}$

\n

 

\n

You calculate in the same way for the other options - the next table gives the Expected Monetary Value for all three::

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
 EMV
{Cat[0]}{emv[0]}
{Cat[1]}{emv[1]}
{Cat[2]}{emv[2]}
\n

The optimal course of action is take to be that which has the highest Expected Monetary Value (EMV) and this is seen to be :

\n

{Correct} with EMV  $\\var{maxemv}$.

\n

 

\n

 

\n

 

\n

 

\n

 

\n "}]}], "contributors": [{"name": "Deirdre Casey", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/681/"}], "extensions": ["stats"], "custom_part_types": [], "resources": []}