// 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": "\n

Probability that both numbers are {parity}= [[0]]

\n

Enter your answer as a fraction and not a decimal.

\n ", "marks": 0}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "\n

Two numbers are drawn at random (and without replacement) from the numbers $\\var{mi}$ to $\\var{ma}$.

\n

Find 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:

\n

Added tags.

\n

Reminded user to input answer as a fraction.

\n

Checked calculation.

\n

 22/07/2012:

\n

Added description.

\n

Checked stats extension box.

\n

31/07/2012:

\n

Question appears to be working correctly.

\n

20/12/2012:

\n

Checked calculation, OK. Added tested1 tag.

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

Two numbers are drawn at random without replacement from the numbers m to n.

\n \t\t

Find the probability that both are odd given their sum is even.

\n \t\t"}, "advice": "\n \n \n

As we are sampling without replacement the best sampling space is the space of all unordered pairs.

\n \n \n \n

This means that when we count up the number of pairs we use the number of ways of selecting pairs.

\n \n \n \n

Let $A$ be the event that both numbers are {parity} and $B$ the event that their sum is even.

\n \n \n \n

Note that $A$ is a subset of $B$ hence $P(A \\cap B)=P(A)$.

\n \n \n \n

The probability we want to find is $P(A | B)$.

\n \n \n \n

Using 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 \n

Now there are $\\var{numpar}$ {parity} numbers between $\\var{mi}$ and $\\var{ma}$.

\n \n \n \n

and 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 \n

such pairs, both {parity}.

\n \n \n \n

This gives the number of elements in $A$.

\n \n \n \n

Also 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 \n

There are $\\var{botheven}+\\var{bothodd}=\\var{together}$ pairs with sum even.

\n \n \n \n

This gives the number of events in $B$.

\n \n \n \n

Hence \\[\\frac{P(A)}{P(B)}=\\frac{\\var{comb(numpar,2)}}{\\var{together}}\\]

\n \n \n \n

So 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/"}]}