// Numbas version: finer_feedback_settings {"name": "IP3.3", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {"scale": {"definition": "map(b*x+c,x,a)", "type": "list", "language": "jme", "parameters": [["a", "list"], ["b", "number"], ["c", "number"]]}}, "ungrouped_variables": ["a", "b", "d", "p", "pmf", "q", "twice", "x8", "expx", "t", "m2", "x2", "x3", "x0", "x1", "x6", "x7", "x4", "x5"], "name": "IP3.3", "tags": ["PMF", "Probability", "choose without replacement", "expectation", "expected value", "mass function", "pmf", "probabilities", "probability", "probability mass function", "random choice", "statistics", "tested1", "udf", "without replacement"], "preamble": {"css": "", "js": ""}, "advice": "

a)

\n

First we find the sums that can occur by simply adding two different numbers together from the given.

\n

Note that these are pairs of different numbers as we choose without replacement.

\n

We get:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$X=x$$\\var{pmf[0]}$$\\var{pmf[1]}$$\\var{pmf[2]}$$\\var{pmf[3]}$$\\var{pmf[4]}$$\\var{pmf[5]}$$\\var{pmf[6]}$$\\var{pmf[7]}$$\\var{pmf[8]}$
\n

We have to find the probabilities that each of these sums occur.

\n

There are $10$ ways of selecting $2$ numbers from the $5$ given, but it may be the case that two different pairs produce the same sum.

\n

In this case we find that there are two ways of producing the sum $\\var{twice}$. All other sums have only one way.

\n

So since each selection of a pair of numbers has probability $0.1$.

\n

The probability of producing the sum $\\var{twice}$ is $0.2$ , and the other sums have probability $0.1$ .

\n

b)

\n

The expectation is given by:

\n

\\[ \\begin{eqnarray*} E[X]&=& \\sum xP(X=x)\\\\ &=&\\simplify[]{ {pmf[0]}*{x0}+{pmf[1]}*{x1}+{pmf[2]}*{x2}+{pmf[3]}*{x3}+{pmf[4]}*{x4}+{pmf[5]}*{x5}+{pmf[6]}*{x6}+{pmf[7]}*{x7}+{pmf[8]}*{x8}}\\\\ &=&\\var{expx} \\end{eqnarray*} \\]

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

Input the possible values of $X$ in the following table.

\n \n \n \n

You have to input these in increasing order.

\n \n \n \n

Also find the probability mass function $P(X=x)$ values and input them into the table.

\n \n \n \n

Input all values as exact values.

\n \n \n \n \n \n \n \n \n \n
$X=x$[[0]][[1]][[2]][[3]][[4]][[5]][[6]][[7]][[8]]
$P(X=x)$[[9]][[10]][[11]][[12]][[13]][[14]][[15]][[16]][[17]]
\n \n \n ", "marks": 0, "gaps": [{"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[0]}", "minValue": "{pmf[0]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[1]}", "minValue": "{pmf[1]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[2]}", "minValue": "{pmf[2]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[3]}", "minValue": "{pmf[3]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[4]}", "minValue": "{pmf[4]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[5]}", "minValue": "{pmf[5]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[6]}", "minValue": "{pmf[6]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[7]}", "minValue": "{pmf[7]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{pmf[8]}", "minValue": "{pmf[8]}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x0}", "minValue": "{x0}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x1}", "minValue": "{x1}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x2}", "minValue": "{x2}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x3}", "minValue": "{x3}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x4}", "minValue": "{x4}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x5}", "minValue": "{x5}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x6}", "minValue": "{x6}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x7}", "minValue": "{x7}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.1, "maxValue": "{x8}", "minValue": "{x8}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "\n

Find the expectation, $E[X]$ of $X$.

\n

Input as an exact decimal.

\n

$E[X]=\\;\\;$[[0]]

\n ", "marks": 0, "gaps": [{"allowFractions": false, "marks": 1.2, "maxValue": "{expx}", "minValue": "{expx}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "\n

Two of the integers $\\var{d[0]},\\;\\var{d[1]}, \\;\\var{d[2]}, \\;\\var{d[3]}, \\;\\var{d[4]} $ are chosen at random, without replacement.

\n

Let $X$ denote the sum of the chosen two values.

\n

Answer the following two parts:

\n ", "type": "question", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "[[0,1,2,3,7],[0,1,2,4,6],[0,1,3,5,7]]", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "b": {"definition": "[[1,2,3,4,5,7,8,9,10],[1,2,3,4,5,6,7,8,10],[1,3,4,5,6,7,8,10,12]]", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": ""}, "d": {"definition": "scale(a[t],p,q)", "templateType": "anything", "group": "Ungrouped variables", "name": "d", "description": ""}, "twice": {"definition": "switch(t=0,pmf[2],t=1,pmf[5],pmf[6])", "templateType": "anything", "group": "Ungrouped variables", "name": "twice", "description": ""}, "x8": {"definition": "0.1", "templateType": "anything", "group": "Ungrouped variables", "name": "x8", "description": ""}, "q": {"definition": "random(-9..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "q", "description": ""}, "p": {"definition": "random(1,2,3,4)", "templateType": "anything", "group": "Ungrouped variables", "name": "p", "description": ""}, "pmf": {"definition": "scale(b[t],p,2*q)", "templateType": "anything", "group": "Ungrouped variables", "name": "pmf", "description": ""}, "expx": {"definition": "x0*pmf[0]+x1*pmf[1]+x2*pmf[2]+x3*pmf[3]+x4*pmf[4]+x5*pmf[5]+x6*pmf[6]+x7*pmf[7]+x8*pmf[8]", "templateType": "anything", "group": "Ungrouped variables", "name": "expx", "description": ""}, "t": {"definition": "random(0..2)", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}, "m2": {"definition": "if(t=0,0.2,0.1)", "templateType": "anything", "group": "Ungrouped variables", "name": "m2", "description": ""}, "x2": {"definition": "if(t=0,0.2,0.1)", "templateType": "anything", "group": "Ungrouped variables", "name": "x2", "description": ""}, "x3": {"definition": "0.1", "templateType": "anything", "group": "Ungrouped variables", "name": "x3", "description": ""}, "x0": {"definition": "0.1", "templateType": "anything", "group": "Ungrouped variables", "name": "x0", "description": ""}, "x1": {"definition": "0.1", "templateType": "anything", "group": "Ungrouped variables", "name": "x1", "description": ""}, "x6": {"definition": "if(t=2,0.2,0.1)", "templateType": "anything", "group": "Ungrouped variables", "name": "x6", "description": ""}, "x7": {"definition": "0.1", "templateType": "anything", "group": "Ungrouped variables", "name": "x7", "description": ""}, "x4": {"definition": "0.1", "templateType": "anything", "group": "Ungrouped variables", "name": "x4", "description": ""}, "x5": {"definition": "if(t=1,0.2,0.1)", "templateType": "anything", "group": "Ungrouped variables", "name": "x5", "description": ""}}, "metadata": {"notes": "\n \t\t

7/07/2012:

\n \t\t

Added tags.

\n \t\t

Checked calculations.

\n \t\t

22/07/2012:

\n \t\t

Added description.

\n \t\t

Improved display, in particular replaced $E(X)$ by $E[X]$.

\n \t\t

Corrected typo in Advice (\"if\" instead of \"of\").

\n \t\t

Ticked stats extension box.

\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

Improved display of integers in statement.

\n \t\t

Added tag udf for user-defined functions.

\n \t\t

One such:

\n \t\t

scale(a,b,c)=map(b*x+c,x,a), scaling the list a.

\n \t\t

Calculation OK. Added tested1 tag.

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

Two numbers from a set of $5$ numbers are chosen at random, without replacement. Find the distribution $X$ of their sum and $E[X]$.

", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}]}]}], "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}]}