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

In total you have made $\\var{total}$ observations of events $A$ and $B$. You know that the size of the set $A \\setminus B$ is $\\simplify{{A} - {AandB}}$ and the size of the set $B \\setminus A$ is $\\simplify{{B} - {AandB}}$. The number of observations in the set $A \\cap B$ is $\\var{AandB}$, and the number in $A^c \\cap B^c$ is $\\var{notAnotB}$.

\n

You will be asked to find various probabilities, including conditional probabilities. Drawing a Venn diagram and including the sizes of the relevant areas is useful for this question.

", "advice": "

Answers are given as fractions and reduced to their lowest terms where possible. Otherwise, they appear twice.

\n

Probability of A

\n

The probability of $A$ is given by $\\frac{\\var{A}}{\\var{total}}=\\simplify{{A}/{total}}$.

\n

Probability of B

\n

The probability of $B$ is given by $\\frac{\\var{B}}{\\var{total}}=\\simplify{{B}/{total}}$.

\n

Probability of A given B

\n

The probability $P(A|B)$ is given by $\\frac{\\var{AandB}}{\\var{B}}=\\simplify{{AandB}/{B}}$.

\n

Probability of B given A

\n

The probability $P(B|A)$ is given by $\\frac{\\var{AandB}}{\\var{A}}=\\simplify{{AandB}/{A}}$.

", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"total": {"name": "total", "group": "Ungrouped variables", "definition": "random(800..1000)", "description": "", "templateType": "anything", "can_override": false}, "A": {"name": "A", "group": "Ungrouped variables", "definition": "random(100..400)", "description": "", "templateType": "anything", "can_override": false}, "B": {"name": "B", "group": "Ungrouped variables", "definition": "random(100..400)", "description": "", "templateType": "anything", "can_override": false}, "AandB": {"name": "AandB", "group": "Ungrouped variables", "definition": "random(0..min(A,B))", "description": "", "templateType": "anything", "can_override": false}, "notAnotB": {"name": "notAnotB", "group": "Ungrouped variables", "definition": "total-AorB", "description": "", "templateType": "anything", "can_override": false}, "AorB": {"name": "AorB", "group": "Ungrouped variables", "definition": "A + B - AandB", "description": "", "templateType": "anything", "can_override": false}, "probA": {"name": "probA", "group": "Ungrouped variables", "definition": "A/total", "description": "", "templateType": "anything", "can_override": false}, "probB": {"name": "probB", "group": "Ungrouped variables", "definition": "B/total", "description": "", "templateType": "anything", "can_override": false}, "probBgivA": {"name": "probBgivA", "group": "Ungrouped variables", "definition": "AandB/A", "description": "", "templateType": "anything", "can_override": false}, "probAgivB": {"name": "probAgivB", "group": "Ungrouped variables", "definition": "AandB/B", "description": "", "templateType": "anything", "can_override": false}, "test": {"name": "test", "group": "Ungrouped variables", "definition": "notAnotB < 0", "description": "", "templateType": "anything", "can_override": false}, "test2": {"name": "test2", "group": "Ungrouped variables", "definition": "A - AandB <0", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["total", "A", "B", "AandB", "notAnotB", "AorB", "probA", "probB", "probBgivA", "probAgivB", "test", "test2"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "numberentry", "useCustomName": true, "customName": "Probability of A", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate $P(A)$.

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

Calculate $P(B)$.

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

Calculate $P(A|B)$.

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

Calculate $P(B|A)$.

", "minValue": "probBgivA", "maxValue": "probBgivA", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Alexander Corner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5328/"}], "resources": []}]}], "contributors": [{"name": "Alexander Corner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5328/"}]}