// Numbas version: exam_results_page_options {"name": "Maths Support: Probability density functions", "navigation": {"onleave": {"action": "none", "message": ""}, "reverse": true, "allowregen": true, "preventleave": false, "browse": true, "showfrontpage": false, "showresultspage": "never"}, "duration": 0.0, "metadata": {"notes": "", "description": "", "licence": "Creative Commons Attribution 4.0 International"}, "timing": {"timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "shufflequestions": false, "questions": [], "percentpass": 75.0, "allQuestions": true, "pickQuestions": 0, "type": "exam", "feedback": {"showtotalmark": true, "advicethreshold": 0.0, "showanswerstate": true, "showactualmark": true, "allowrevealanswer": true}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": [{"name": "IS2.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": {}, "ungrouped_variables": ["a", "valk", "xl", "p", "pval", "xu"], "tags": ["CDF", "PDF", "Probability", "cdf", "continuous random variables", "cumulative distribution functions", "density function", "distribution function", "distribution functions", "integration", "pdf", "probability", "probability density function", "random variables", "statistics"], "preamble": {"css": "", "js": ""}, "advice": "

a)

\n

Note that in order for $f_X(x)$ to be a pdf it must satisfy two important conditions:

\n

1. $f_X(x) \\ge 0$ in the range $\\var{xl} \\le x \\le \\var{xu}$

\n

2. The area under the curve given by $f_X(x)$ is $1$ and this implies that:
\\[\\int_{\\var{xl}}^{\\var{xu}}f_X(x)\\;dx = 1\\] as the value of the function is $0$ outside this range.

\n

We first check condition 2. and then check that condition 1. is satisfied.

\n

Note that \\[\\int kx\\;dx = k\\frac{x^2}{2}\\] on forgetting the constant of integration.

\n

Hence \\[\\begin{eqnarray*} \\int_{\\var{xl}}^{\\var{xu}}kx\\;dx &=&\\frac{k}{2}(\\var{xu}^2-\\var{xl}^2)\\\\ &=&\\frac{k}{2}\\times \\var{xu^2-xl^2} \\end{eqnarray*} \\]

\n

But we must have this last value equal to $1$ hence:
\\[ \\frac{k}{2}\\times \\var{xu^2-xl^2}=1 \\Rightarrow k = \\simplify[std]{2/{xu^2-xl^2}}\\]

\n

Hence the pdf is:
\\[f_X(x) = \\simplify[std]{2/{xu^2-xl^2}x}\\;\\;\\;\\;\\;\\var{xl} \\le x \\le \\var{xu}\\]

\n

We have to check condition 1. that the function $f_X(x)$ is positive for $\\var{xl} \\le x \\le \\var{xu} $ – but this is clear from
the definition of $f_X(x)$ and the value of $k$.

\n

b)

\n

If $F_X(x)$ is the distribution function of the distribution given by $f_X(x)$ then:

\n

$F_X(x) = 0\\;\\;\\;x \\lt \\var{xl},\\;\\;\\;\\;F_X(x)=1\\;\\;\\;x \\ge \\var{xu}$

\n

and for $\\var{xl} \\le x \\le \\var{xu}$:

\n

\\[\\begin{eqnarray*} F_X(x)&=&\\int_{-\\infty}^x f_X(x)\\;dx=\\simplify[std]{2/{xu^2-xl^2}}\\int_{\\var{xl}}^x x\\;dx\\\\ &=&\\simplify[std]{2/{xu^2-xl^2}}\\times\\frac{\\left(x^2-\\var{xl}^2\\right)}{2}\\\\ &=&\\frac{x^2-\\var{xl^2}}{\\var{xu^2-xl^2}} \\end{eqnarray*} \\]

\n

c)

\n

We have
\\[\\begin{eqnarray*} P\\left(X \\lt \\simplify[std]{{xl+xu}/2}\\right)&=&F_X\\left(\\simplify[std]{{(xl+xu)}/2}\\right)\\\\ &=& \\frac{1}{\\var{xu^2-xl^2}}\\left(\\simplify[std]{({(xl+xu)}/{2})^2-{xl}^2}\\right)\\\\ &=&\\simplify{{3*xl+xu-4*a}/{4*(xu+xl-2*a)}} \\end{eqnarray*} \\]

", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"prompt": "\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
$f_X(x) = \\left \\{ \\begin{array}{l} \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\end{array} \\right .$$kx$ $\\var{xl} \\leq x \\leq \\var{xu},$
$0,$$\\textrm{otherwise.}$
\n \n \n \n

What value of $k$ makes $f_X(x)$ into the pdf of a distribution?

\n \n \n \n

Input your answer here as a fraction and not as a decimal.

\n \n \n \n

$k=\\;\\;$[[0]]

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

input as a fraction and not a decimal.

", "showStrings": false, "strings": ["."], "partialCredit": 0}, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "vsetrangepoints": 5, "showCorrectAnswer": true, "answersimplification": "std", "scripts": {}, "answer": "{2}/{p*(xu+xl)}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "\n

Given the value of $k$ found in the first part, determine and input the distribution function $F_X(x)$

\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
$F_X(x) = \\left \\{ \\begin{array}{l} \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\end{array} \\right .$[[0]]$x \\lt \\var{xl},$
  
[[1]]$\\var{xl} \\leq x \\leq \\var{xu},$
  
[[2]]$x \\gt \\var{xu}.$
\n ", "marks": 0, "gaps": [{"expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "vsetrangepoints": 5, "showCorrectAnswer": true, "scripts": {}, "answer": "0", "marks": 0.5, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"notallowed": {"message": "

input numbers as fractions or integers and not as decimals

", "showStrings": false, "strings": ["."], "partialCredit": 0}, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "vsetrangepoints": 5, "showCorrectAnswer": true, "answersimplification": "std", "scripts": {}, "answer": "(((x + ( - {xl})) * (x + {(xl + ( - (2 * a)))})) / {((xu + ( - xl)) * (xu + xl + ( - (2 * a))))})", "marks": 2, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "vsetrangepoints": 5, "showCorrectAnswer": true, "scripts": {}, "answer": "1", "marks": 0.5, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "\n \n \n

Find and input as a fraction not a decimal:

\n \n \n \n

$P\\left(X \\lt \\simplify[std]{{xl+xu}/2}\\right) = \\phantom{{}}$[[0]]

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

input as a fraction or integer and not as a decimal

", "showStrings": false, "strings": ["."], "partialCredit": 0}, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "vsetrangepoints": 5, "showCorrectAnswer": true, "answersimplification": "std", "scripts": {}, "answer": "{3*xl+xu-4*a}/{4*(xu+xl-2*a)}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "

A random variable $X$ has a probability density function (PDF) given by:

", "type": "question", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "0", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "valk": {"definition": "precround(2/(p*(xu+xl-2*a)),4)", "templateType": "anything", "group": "Ungrouped variables", "name": "valk", "description": ""}, "xl": {"definition": "random(1..4)", "templateType": "anything", "group": "Ungrouped variables", "name": "xl", "description": ""}, "p": {"definition": "(xu-xl)", "templateType": "anything", "group": "Ungrouped variables", "name": "p", "description": ""}, "pval": {"definition": "precround((3*xl+xu-4*a)/(4*(xu+xl)-2*a),2)", "templateType": "anything", "group": "Ungrouped variables", "name": "pval", "description": ""}, "xu": {"definition": "xl+random(1..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "xu", "description": ""}}, "metadata": {"notes": "\n \t\t

8/07/2012:

\n \t\t

Added tags.

\n \t\t

Checked calculations, OK.

\n \t\t

23/07/2012:

\n \t\t

Added description.

\n \t\t

1/08/2012:

\n \t\t

Added tags.

\n \t\t

Question appears to be working correctly.

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

The random variable $X$ has a PDF which involves a parameter $k$. Find the value of $k$. Find the distribution function $F_X(x)$ and $P(X \\lt a)$.

", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "IS2.2", "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": {}, "ungrouped_variables": ["a", "ux", "xl", "i1", "lo", "j1", "up", "exans", "p", "u", "t", "tol", "ans", "cval", "lx", "xu"], "tags": ["CFD", "continuous random variables", "cr1", "cumulative distribution functions", "density functions", "distribution function", "distribution functions", "integration", "PDF", "pdf", "probabilities", "probability density function", "random variables", "statistics", "tested1"], "advice": "

a)

\n

Note that in order for $f_X(x)$ to be a pdf it must satisfy two important conditions:

\n

1. $f_X(x) \\ge 0$ in the range $\\var{xl} \\le x \\le \\var{xu}$

\n

2. The area under the curve given by $f_X(x)$ is $1$ and this implies that:
\\[\\int_{\\var{xl}}^{\\var{xu}}f_X(x)\\;dx = 1\\] as the value of the function is $0$ outside this range.

\n

We first check condition 2. and then check that condition 1. is satisfied.

\n

Hence \\[\\begin{eqnarray*} \\int_{-\\infty}^{\\infty}f_X(x)\\;dx=\\int_{\\var{xl}}^{\\var{xu}}f_X(x)\\;dx&=&\\int_{\\var{xl}}^{\\simplify[std]{{xu+xl}/2}}cx\\;dx+\\int_{\\simplify[std]{{xu+xl}/2}}^{\\var{xu}}c(\\var{xu}-x)\\;dx\\\\ &=&\\simplify[std]{{(xu-xl)^2}/8}c+\\simplify[std]{{(xu-xl)^2}/8}c=\\simplify[std]{{(xu-xl)^2}/{4}}c \\end{eqnarray*} \\]
But this has to equal $1$ and so \\[c=\\simplify[std]{4/{p^2}}\\]

\n

Hence with this value of $c$ we see that condition 2. is satisfied i.e.

\n

\\[\\int_{-\\infty}^{\\infty}f_X(x)\\;dx=1\\]

\n

Condition 1. is clearly satisfied as $c \\gt 0$.

\n

b)

\n

We must have $F_X(x)=0,\\;\\;\\;x \\le \\var{xl},\\;\\;\\;\\textrm{and}\\;\\;\\;F_X(x)=1,\\;\\;\\;x \\ge \\var{xu}$

\n

Apart from that we find an expression for $F_X(x)$ in each of the ranges $[\\var{xl},\\simplify[std]{{xl+xu}/2}],\\;\\;\\;[\\simplify[std]{{xl+xu}/2},\\var{xu}]$

\n

1. $x \\in [\\var{xl},\\simplify[std]{{xl+xu}/2}]$

\n

We have:\\[\\begin{eqnarray*} f_X(x) &=& \\simplify[std]{{4}/{p^2}} x \\\\ \\Rightarrow F_X(x)&=& \\int_{-\\infty}^xf_X(x)\\;dx \\\\ &=& \\simplify[std]{{4}/{p^2}}\\int_{\\var{xl}}^x x\\;dx\\\\ &=&\\simplify[std]{{2}/{p^2}}x^2 \\end{eqnarray*} \\]

\n

2. $x \\in [\\simplify[std]{{xl+xu}/2},\\var{xu}]$

\n

We have:\\[\\begin{eqnarray*} f_X(x) &=& \\simplify[std]{{4}/{p^2}}(\\var{xu}-x) \\\\ \\Rightarrow  F_X(x)&=& \\int_{-\\infty}^xf_X(x)\\;dx = \\int_{\\var{xl}}^{\\simplify[std]{{xl+xu}/2}}f_X(x)\\;dx+\\int_{\\simplify[std]{{xl+xu}/2}}^x f_X(x)\\;dx\\\\ &=& \\simplify[std]{{4}/{p^2}}\\int_{\\var{xl}}^{\\simplify[std]{{xl+xu}/2}} x\\;dx + \\simplify[std]{{4}/{p^2}}\\int_{\\simplify[std]{{xl+xu}/2}}^x(\\var{xu}-x)\\;dx\\\\ &=&1-\\simplify[std]{{2}/{p^2}}(\\var{xu}-x)^2 \\end{eqnarray*} \\]

\n

c)

\n

Using the distribution function we have just found we have that:

\n

$P(\\var{lx} \\lt X \\lt \\var{ux}) = F_X(\\var{ux})-F_X(\\var{lx})$

\n

But $\\var{ux}$ is in the range between $\\var{(xl+xu)/2}$ and $\\var{xu}$ and the distribution function is given by:

\n

\\[F_X(x)=1-\\simplify[std]{{2}/{p^2}}(\\var{xu}-x)^2\\]

\n

Hence $F_X(\\var{ux})=1-\\simplify[std]{{2}/{p^2}}(\\var{xu}-\\var{ux})^2 = \\var{up}$ to 5 decimal places.

\n

Similarly, $\\var{lx}$ is in the range between $\\var{xl}$ and $\\var{(xl+xu)/2}$ and the distribution function is given by:

\n

\\[F_X(x)=\\simplify[std]{{2}/{p^2}}x^2\\]

\n

Hence $F_X(\\var{lx})=\\simplify[std]{{2}/{p^2}}(\\var{lx})^2 = \\var{lo}$ to 5 decimal places.

\n

Hence $P(\\var{lx} \\lt X \\lt \\var{ux}) = F_X(\\var{ux})-F_X(\\var{lx})=\\var{up}-\\var{lo}=\\var{up-lo}=\\var{ans}$ to 2 decimal places.

", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "parts": [{"prompt": "\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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
$f_X(x) = \\left \\{ \\begin{array}{l} \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\\\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}}\\end{array} \\right .$$0$ $ x \\leq \\var{xl},$
$cx$ $\\var{xl} \\lt x \\leq \\simplify[std]{{xu+xl}/2},$
$c(\\var{xu}-x)$ $\\simplify[std]{{xu+xl}/2} \\lt x \\leq \\var{xu},$
$0$$x \\gt \\var{xu}.$
\n \n \n \n

What value of $c$ makes $f_X(x)$ into the pdf of a distribution?

\n \n \n \n

Input your answer here as a fraction and not as a decimal.

\n \n \n \n

$c=\\;\\;$[[0]]

\n \n \n \n ", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"notallowed": {"message": "

input as a fraction and not a decimal

", "showStrings": false, "strings": ["."], "partialCredit": 0}, "variableReplacements": [], "expectedvariablenames": [], "checkingaccuracy": 0.001, "type": "jme", "showpreview": true, "vsetrangepoints": 5, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "answersimplification": "std", "scripts": {}, "answer": "{4}/{p^2}", "marks": 2, "checkvariablenames": false, "checkingtype": "absdiff", "vsetrange": [0, 1]}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "\n \n \n

Given the value of $c$ found in the first part, determine and input the distribution function $F_X(x)$

\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 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
$F_X(x) = \\left \\{ \\begin{array}{l} \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}} \\\\ \\phantom{{.}}\\\\ \\phantom{{.}}\\\\ \\phantom{{.}} \\end{array} \\right .$ [[0]] $x \\leq \\var{xl},$
[[1]] $\\var{xl} \\lt x \\leq \\simplify[std]{{xu+xl}/2},$
[[2]] $\\simplify[std]{{xu+xl}/2} \\lt x \\leq \\var{xu},$
[[3]] $ x \\gt \\var{xu}.$
\n \n \n \n

Input all numbers as fractions or integers in the above formulae.

\n \n \n \n ", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "type": "jme", "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "0", "marks": 0.5, "checkvariablenames": false, "checkingtype": "absdiff", "vsetrange": [0, 1]}, {"notallowed": {"message": "

input numbers as fractions or integers and not as decimals

", "showStrings": false, "strings": ["."], "partialCredit": 0}, "variableReplacements": [], "expectedvariablenames": [], "checkingaccuracy": 0.001, "type": "jme", "showpreview": true, "vsetrangepoints": 5, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "answersimplification": "std", "scripts": {}, "answer": "(({2} / {(p ^ 2)}) * ((x + ( - {xl})) ^ 2))", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "vsetrange": [0, 1]}, {"notallowed": {"message": "

input numbers as fractions or integers and not as decimals

", "showStrings": false, "strings": ["."], "partialCredit": 0}, "variableReplacements": [], "expectedvariablenames": [], "checkingaccuracy": 0.001, "type": "jme", "showpreview": true, "vsetrangepoints": 5, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "answersimplification": "std", "scripts": {}, "answer": "(1 + ( - (({2} / {(p ^ 2)}) * ((x + ( - {xu})) ^ 2))))", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "vsetrange": [0, 1]}, {"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "type": "jme", "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "scripts": {}, "answer": "1", "marks": 0.5, "checkvariablenames": false, "checkingtype": "absdiff", "vsetrange": [0, 1]}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "\n \n \n

Also, using the distribution function above find:

\n \n \n \n

$P(\\var{lx} \\lt X \\lt \\var{ux})=\\;\\;$[[0]]

\n \n \n \n

(input your answer to $2$ decimal places).

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

A random variable $X$ has a probability density function (PDF) given by:

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "variables": {"a": {"definition": "0", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "ux": {"definition": "j1/2", "templateType": "anything", "group": "Ungrouped variables", "name": "ux", "description": ""}, "xl": {"definition": "0", "templateType": "anything", "group": "Ungrouped variables", "name": "xl", "description": ""}, "i1": {"definition": "round((t+(100-t)*(xu-1))/100)", "templateType": "anything", "group": "Ungrouped variables", "name": "i1", "description": ""}, "lo": {"definition": "precround((2/p^2)*(lx-xl)^2,5)", "templateType": "anything", "group": "Ungrouped variables", "name": "lo", "description": ""}, "j1": {"definition": "round((u*(xu+1)+(100-u)*(2*xu-1))/100)", "templateType": "anything", "group": "Ungrouped variables", "name": "j1", "description": ""}, "up": {"definition": "precround(1-(2/p^2)*(ux-xu)^2,5)", "templateType": "anything", "group": "Ungrouped variables", "name": "up", "description": ""}, "exans": {"definition": "up-lo", "templateType": "anything", "group": "Ungrouped variables", "name": "exans", "description": ""}, "p": {"definition": "(xu-xl)", "templateType": "anything", "group": "Ungrouped variables", "name": "p", "description": ""}, "u": {"definition": "random(0..100)", "templateType": "anything", "group": "Ungrouped variables", "name": "u", "description": ""}, "t": {"definition": "random(0..100)", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}, "tol": {"definition": "0.01", "templateType": "anything", "group": "Ungrouped variables", "name": "tol", "description": ""}, "ans": {"definition": "precround(exans,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "ans", "description": ""}, "cval": {"definition": "precround(4/p^2,4)", "templateType": "anything", "group": "Ungrouped variables", "name": "cval", "description": ""}, "lx": {"definition": "i1/2", "templateType": "anything", "group": "Ungrouped variables", "name": "lx", "description": ""}, "xu": {"definition": "xl+random(4,6,8,12,14)", "templateType": "anything", "group": "Ungrouped variables", "name": "xu", "description": ""}}, "metadata": {"notes": "\n \t\t

8/07/2012:

\n \t\t

Added tags.

\n \t\t

Checked calculations, OK.

\n \t\t

Set tolerance via new variable tol=0.01 for last question.

\n \t\t

23/07/2012:

\n \t\t

Added description.

\n \t\t

1/08/2012:

\n \t\t

Added tags.

\n \t\t

In the Advice section, moved \\Rightarrow to the beginning of the line instead of the end of the previous line.

\n \t\t

Question appears to be working correctly.

\n \t\t

21/12/2012:

\n \t\t

Checked calculations, OK. Added tag tested1.

\n \t\t

Checked rounding, OK. Added tag cr1.

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

The random variable $X$ has a PDF which involves a parameter $c$. Find the value of $c$. Find the distribution function $F_X(x)$ and $P(a \\lt X \\lt b)$.

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "IS2.3", "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/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "functions": {}, "ungrouped_variables": ["a", "f1", "c", "b", "d", "f", "tol1", "m", "pd1", "n", "pc", "s", "r", "u", "t", "pd", "tol", "n1", "s1", "gc"], "tags": ["PDF", "Probability", "conditional probability", "cr1", "density function", "diagram", "integration", "pdf", "probabilities", "probability", "probability density function", "query", "statistics", "tested1"], "preamble": {"css": "", "js": ""}, "advice": "

a)

\n

We have:

\n

\\[\\begin{eqnarray*} P(X \\gt \\var{c})&=&\\int_{\\var{c}}^{\\var{b}}f(x)\\;dx\\\\ &=&\\frac{1}{\\var{n1}}\\int_{\\var{c}}^{\\var{b}}\\simplify[std]{({f1}-{s1}x)}\\;dx\\\\ &=&\\frac{1}{\\var{n1}}\\left(\\simplify[std,!otherNumbers]{{f1}({b}-{c})-{s1}({b}^2-{c}^2)/2}\\right)\\\\ &=&\\simplify[std]{{2*f1 * (b -c) + s1 * (c ^ 2 -(b ^ 2))} / {2*n1} }\\\\ &=& \\var{pc} \\end{eqnarray*} \\] to 4 decimal places.

\n

b)

\n

\\[\\begin{eqnarray*} P(X \\gt \\var{d} | X \\gt \\var{c})&=&\\frac{P(X \\gt \\var{d}\\;\\;\\textrm{and}\\;\\; X \\gt \\var{c})}{P(X \\gt \\var{c})}\\\\ &=&\\frac{P(X \\gt \\var{d})}{P(X \\gt \\var{c})} \\end{eqnarray*} \\] as $\\var{d} \\gt \\var{c}$.

\n

But,
\\[\\begin{eqnarray*} P(X \\gt \\var{d})&=&\\int_{\\var{d}}^{\\var{b}}f(x)\\;dx\\\\ &=&\\frac{1}{\\var{n1}}\\int_{\\var{d}}^{\\var{b}}\\simplify[std]{({f1}-{s1}x)}\\;dx\\\\ &=&\\frac{1}{\\var{n1}}\\left(\\simplify[std,!otherNumbers]{{f1}({b}-{d})-{s1}({b}^2-{d}^2)/2}\\right)\\\\ &=&\\simplify[std]{{2*f1 * (b -d) + s1 * (d ^ 2 -(b ^ 2))} / {2*n1} }\\\\ &=& \\var{pd1} \\end{eqnarray*} \\] to 4 decimal places.

\n

Hence \\[\\begin{eqnarray*} P(X \\gt \\var{d} | X \\gt \\var{c})&=&\\frac{P(X \\gt \\var{d})}{P(X \\gt \\var{c})}\\\\ &=&\\frac{\\var{pd1}}{\\var{pc}}\\\\ &=&\\var{pd} \\end{eqnarray*} \\] to 2 decimal places.

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

$P(X \\gt \\var{c})=\\;\\;$[[0]]

\n \n \n \n

Input to 4 decimal places.

\n \n \n ", "marks": 0, "gaps": [{"allowFractions": false, "marks": 1, "maxValue": "{pc+tol}", "minValue": "{pc-tol}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "\n

$P(X \\gt \\var{d} | X \\gt \\var{c})=\\;\\;$[[0]]

\n

Input to 2 decimal places.

\n ", "marks": 0, "gaps": [{"allowFractions": false, "marks": 1, "maxValue": "{pd+tol1}", "minValue": "{pd-tol1}", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "\n

Given the pdf

\n

\\[\\begin{eqnarray*} f(x)&=&\\simplify[std]{({f1}-{s1}x)/{n1}}\\;\\;\\var{a} \\leq x \\leq \\var{b}\\\\ f(x)&=&0\\;\\;\\;\\textrm{otherwise} \\end{eqnarray*} \\]
find the following probabilities:

\n ", "type": "question", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(0..2)", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "f1": {"definition": "f/gc", "templateType": "anything", "group": "Ungrouped variables", "name": "f1", "description": ""}, "c": {"definition": "a+round((t*1+(100-t)*((r-1)))/100)/2", "templateType": "anything", "group": "Ungrouped variables", "name": "c", "description": ""}, "b": {"definition": "a+r", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": ""}, "d": {"definition": "a+round((u*2*(r-1)+(100-u)*((r+1)))/100)/2", "templateType": "anything", "group": "Ungrouped variables", "name": "d", "description": ""}, "f": {"definition": "b * (2 * n -m) -(a * m)", "templateType": "anything", "group": "Ungrouped variables", "name": "f", "description": ""}, "tol1": {"definition": "0", "templateType": "anything", "group": "Ungrouped variables", "name": "tol1", "description": ""}, "m": {"definition": "random(1,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "m", "description": ""}, "pd1": {"definition": "precround((n*r^2+s*(d^2-a^2)-f*(d-a))/(n*r^2),4)", "templateType": "anything", "group": "Ungrouped variables", "name": "pd1", "description": ""}, "n": {"definition": "m+s", "templateType": "anything", "group": "Ungrouped variables", "name": "n", "description": ""}, "pc": {"definition": "precround((n*r^2+s*(c^2-a^2)-f*(c-a))/(n*r^2),4)", "templateType": "anything", "group": "Ungrouped variables", "name": "pc", "description": ""}, "s": {"definition": "random(1,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "s", "description": ""}, "r": {"definition": "random(4,5)", "templateType": "anything", "group": "Ungrouped variables", "name": "r", "description": ""}, "u": {"definition": "random(0..100)", "templateType": "anything", "group": "Ungrouped variables", "name": "u", "description": ""}, "t": {"definition": "random(0..100)", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}, "pd": {"definition": "precround((n*r^2+s*(d^2-a^2)-f*(d-a))/(n*r^2)/pc,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "pd", "description": ""}, "tol": {"definition": "0", "templateType": "anything", "group": "Ungrouped variables", "name": "tol", "description": ""}, "n1": {"definition": "n*r^2/gc", "templateType": "anything", "group": "Ungrouped variables", "name": "n1", "description": ""}, "s1": {"definition": "2*s/gc", "templateType": "anything", "group": "Ungrouped variables", "name": "s1", "description": ""}, "gc": {"definition": "gcd(n*r^2,gcd(f,2*s))", "templateType": "anything", "group": "Ungrouped variables", "name": "gc", "description": ""}}, "metadata": {"notes": "\n \t\t

8/07/2012:

\n \t\t

Added tags.

\n \t\t

Set new tolerance variables, tol=0 for first question and tol1=0 for second question. Aslo included statement that second question is to be entered to 2 dps.

\n \t\t

There is an image to be included in the Advice. This needs to be done.

\n \t\t

Checked calculations, OK.

\n \t\t

23/07/2012:

\n \t\t

Added description.

\n \t\t

1/08/2012:

\n \t\t

Question appears to be working correctly.

\n \t\t

21/12/2012:

\n \t\t

Checked calculation. Added tag tested1.

\n \t\t

Added query and diagram tags re possible inclusion of a diagram - which could be dynamic?

\n \t\t

Checked rounding, OK. Added tag cr1.

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

Given the pdf  $f(x)=\\frac{a-bx}{c},\\;r \\leq x \\leq s,\\;f(x)=0$ else, find $P(X \\gt p)$, $P(X \\gt q | X \\gt t)$.

", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "extensions": ["stats"], "custom_part_types": [], "resources": []}