// Numbas version: finer_feedback_settings {"name": "Probability - sum of two numbers drawn without replacement", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "variables": {"noeven": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(isint(mi/2),di/2+1,di/2)", "description": "", "name": "noeven"}, "botheven": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(noeven,2)", "description": "", "name": "botheven"}, "together": {"templateType": "anything", "group": "Ungrouped variables", "definition": "botheven+bothodd", "description": "", "name": "together"}, "numpar": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(parity='even',noeven,noodd)", "description": "", "name": "numpar"}, "mess": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(gcd(comb(numpar,2),together)=1,'','(after reducing to lowest form as a fraction).')", "description": "", "name": "mess"}, "mi": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..10)", "description": "", "name": "mi"}, "otherparity": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(parity='even','odd','even')", "description": "", "name": "otherparity"}, "bothodd": {"templateType": "anything", "group": "Ungrouped variables", "definition": "comb(noodd,2)", "description": "", "name": "bothodd"}, "ma": {"templateType": "anything", "group": "Ungrouped variables", "definition": "mi+random(8..12#2)", "description": "", "name": "ma"}, "di": {"templateType": "anything", "group": "Ungrouped variables", "definition": "ma-mi", "description": "", "name": "di"}, "parity": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random('odd','even')", "description": "", "name": "parity"}, "noodd": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(isint(mi/2),di/2,di/2+1)", "description": "", "name": "noodd"}, "numotherpar": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(parity='even',noodd,noeven)", "description": "", "name": "numotherpar"}, "bothsame": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(parity='odd',bothodd,botheven)", "description": "", "name": "bothsame"}}, "ungrouped_variables": ["parity", "otherparity", "ma", "di", "mess", "mi", "numotherpar", "noodd", "together", "bothodd", "botheven", "numpar", "bothsame", "noeven"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "name": "Probability - sum of two numbers drawn without replacement", "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"answer": "{bothsame}/{botheven+bothodd}", "musthave": {"showStrings": false, "message": "
Input your answer as a fraction
", "strings": ["/"], "partialCredit": 0}, "vsetrange": [0, 1], "checkingaccuracy": 0.001, "answersimplification": "std", "expectedvariablenames": [], "notallowed": {"showStrings": false, "message": "Input your answer as a fraction not a decimal.
", "strings": ["."], "partialCredit": 0}, "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "checkvariablenames": false, "type": "jme", "showCorrectAnswer": true, "marks": 2, "vsetrangepoints": 5}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "\nProbability that both numbers are {parity}= [[0]]
\nEnter your answer as a fraction and not a decimal.
\n ", "marks": 0}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "\nTwo numbers are drawn at random (and without replacement) from the numbers $\\var{mi}$ to $\\var{ma}$.
\nFind the probability that both numbers are {parity} given that their sum is even.
\n ", "tags": ["MAS1604", "Probability", "checked2015", "conditional probability", "counting", "drawn without replacement", "events", "sampling space", "select without replacement", "sets", "statistics", "subset", "tested1", "urn model", "without replacement"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "7/07/2012:
\nAdded tags.
\nReminded user to input answer as a fraction.
\nChecked calculation.
\n22/07/2012:
\nAdded description.
\nChecked stats extension box.
\n31/07/2012:
\nQuestion appears to be working correctly.
\n20/12/2012:
\nChecked calculation, OK. Added tested1 tag.
", "licence": "Creative Commons Attribution 4.0 International", "description": "\n \t\tTwo numbers are drawn at random without replacement from the numbers m to n.
\n \t\tFind the probability that both are odd given their sum is even.
\n \t\t"}, "advice": "\n \n \nAs we are sampling without replacement the best sampling space is the space of all unordered pairs.
\n \n \n \nThis means that when we count up the number of pairs we use the number of ways of selecting pairs.
\n \n \n \nLet $A$ be the event that both numbers are {parity} and $B$ the event that their sum is even.
\n \n \n \nNote that $A$ is a subset of $B$ hence $P(A \\cap B)=P(A)$.
\n \n \n \nThe probability we want to find is $P(A | B)$.
\n \n \n \nUsing the definition of conditional probability:
\n \n \n \n\\[P(A | B) = \\frac{P(A \\cap B)}{P(B)} = \\frac{P(A)}{P(B)} \\]
\n \n \n \nNow there are $\\var{numpar}$ {parity} numbers between $\\var{mi}$ and $\\var{ma}$.
\n \n \n \nand as we are sampling without replacement there are
\n \n \n \n\\[{\\var{numpar} \\choose 2} = \\frac{\\var{numpar}\\times \\var{numpar-1}}{2} = \\var{comb(numpar,2)}\\]
\n \n \n \nsuch pairs, both {parity}.
\n \n \n \nThis gives the number of elements in $A$.
\n \n \n \nAlso since there are $\\var{ma-mi+1-numpar}$ {otherparity} numbers in the range, there are:
\n \n \n \n\\[{\\var{numotherpar} \\choose 2}=\\var{comb(numotherpar,2)}\\] such pairs, both {otherparity}.
\n \n \n \nThere are $\\var{botheven}+\\var{bothodd}=\\var{together}$ pairs with sum even.
\n \n \n \nThis gives the number of events in $B$.
\n \n \n \nHence \\[\\frac{P(A)}{P(B)}=\\frac{\\var{comb(numpar,2)}}{\\var{together}}\\]
\n \n \n \nSo the probability that both are {parity} given their sum is even is
\n \n \n \n\\[\\simplify[std]{{comb(numpar,2)}/{together}}\\]
\n \n \n \n{mess}
\n \n \n ", "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}