// Numbas version: exam_results_page_options {"name": "Simon's copy of Functions: definition of a function", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"statement": "

For two sets $A,B$ the Cartesian product is

\n

$A \\times B = \\left\\{(a,b) | a \\in A, b \\in B\\right\\}.$

\n

A function $f$ from $A$ to $B$, written $f : A \\mapsto B$, is a subset of $A\\times B$ subject to the condition that for all $a\\in A$ there is exactly one $b\\in B$ such that $(a,b) \\in f$.

\n

In other words, for every $a$ the function must determine a unique output $b$. Since $a$ determines $b$ we usually indicate this with the function notation $f(a) = b$.

\n

For example, consider the sets $A = \\left\\{\\var{a0},\\var{a1},\\var{b1},\\var{a2}\\right\\}$ and $B=\\left\\{\\var{b0},\\var{b1},\\var{b2}\\right\\}$ and $f : A \\mapsto B$ defined by

\n

$ f = \\left\\{ (\\var{a0},\\var{b0}),(\\var{a1},\\var{b1}),(\\var{a2},\\var{b0}),(\\var{a0},\\var{b1})\\right\\}$.

\n

", "name": "Simon's copy of Functions: definition of a function", "preamble": {"js": "", "css": ""}, "functions": {}, "variable_groups": [], "tags": [], "ungrouped_variables": ["a0", "a1", "a2", "b0", "b1", "b2"], "variables": {"a1": {"description": "", "name": "a1", "templateType": "anything", "definition": "random(0..9 except a0)", "group": "Ungrouped variables"}, "b2": {"description": "", "name": "b2", "templateType": "anything", "definition": "random(0..9 except [a0,a1,a2,b0,b1])", "group": "Ungrouped variables"}, "b1": {"description": "", "name": "b1", "templateType": "anything", "definition": "random(0..9 except [a0,a1,a2,b0])", "group": "Ungrouped variables"}, "b0": {"description": "", "name": "b0", "templateType": "anything", "definition": "random(0..9 except [a0,a1,a2])", "group": "Ungrouped variables"}, "a0": {"description": "", "name": "a0", "templateType": "anything", "definition": "random(0..9)", "group": "Ungrouped variables"}, "a2": {"description": "", "name": "a2", "templateType": "anything", "definition": "random(0..9 except [a0,a1])", "group": "Ungrouped variables"}}, "advice": "

This question exhibits the different ways to show that $f$ is not a function.

\n
\n

Part (a) introduces the notion of a function as a subset of the Cartesian product, and is designed to get you used to the syntax.

\n

For part (b), there are two values of $\\var{b0},\\var{b1} \\in B$ which are equal to $f(\\var{a0})$. This means that $f(\\var{a0})$ is not uniquely determined, and so $f$ can not be a function.

\n

For part (c), we see that $\\var{b1} \\in A$ but there is no function value for $f(\\var{b1})$. This means that $f(a)$ is not uniquely determined for every $a \\in A$ and so $f$ can not be a function.

", "parts": [{"maxMarks": 0, "displayColumns": 0, "distractors": ["", "According to the relation $(\\var{a0}, \\var{b0}) \\in f$, but you answered $(\\var{b0}, \\var{a0})$ which is not in $f$.", "", "According to the relation $f(\\var{a2})=\\var{b0}$, but you answered $f(\\var{b0}) = \\var{a2}$.", "", "You chose $f(\\var{a2}) = \\var{b1}$ but $(\\var{a2}, \\var{b1}) \\notin f$."], "prompt": "

Which of the following are true?

", "scripts": {}, "warningType": "none", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "matrix": ["1", "-1", "1", "-1", "1", "-1"], "marks": 0, "displayType": "checkbox", "maxAnswers": 0, "variableReplacements": [], "showCellAnswerState": true, "customMarkingAlgorithm": "", "unitTests": [], "extendBaseMarkingAlgorithm": true, "minMarks": 0, "showFeedbackIcon": true, "shuffleChoices": true, "type": "m_n_2", "minAnswers": 0, "choices": ["

$(\\var{a0}, \\var{b0}) \\in f$

", "

$(\\var{b0}, \\var{a0}) \\in f$

", "

$f(\\var{a2}) = \\var{b0}$

", "

$f(\\var{b0}) = \\var{a2}$

", "

$(\\var{a1}, \\var{b1}) \\in f$

", "

$f(\\var{a2}) = \\var{b1}$

"]}, {"maxMarks": 0, "displayColumns": 0, "distractors": ["", "", "", "", ""], "prompt": "

For $f$ to be a function of the set $A$ then for every element $a \\in A$ there must be exactly one $b$ value such that $f(a) = b$. 

\n

In this example $f$ is not a function because there is more than one value of $b$ such that $f(\\var{a0}) = b$. These are

", "scripts": {}, "warningType": "none", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "matrix": ["0.5", "0.5", "-0.5", "-0.5", "-0.5"], "marks": 0, "displayType": "checkbox", "maxAnswers": 0, "variableReplacements": [], "showCellAnswerState": true, "customMarkingAlgorithm": "", "unitTests": [], "extendBaseMarkingAlgorithm": true, "minMarks": 0, "showFeedbackIcon": true, "shuffleChoices": true, "type": "m_n_2", "minAnswers": 0, "choices": ["

$\\var{b0}$

", "

$\\var{b1}$

", "

$\\var{a0}$

", "

$\\var{a1}$

", "

$\\var{a2}$

"]}, {"variableReplacements": [], "failureRate": 1, "checkingAccuracy": 0.001, "showPreview": true, "customMarkingAlgorithm": "", "unitTests": [], "scripts": {"mark": {"order": "instead", "script": "// extract question variables\nvar variables = this.question.scope.variables;\nvar unwrap = Numbas.jme.unwrapValue;\nvar a0 = unwrap(variables.a0);\nvar a1 = unwrap(variables.a1);\nvar a2 = unwrap(variables.a2);\n\nvar b0 = unwrap(variables.b0);\nvar b1 = unwrap(variables.b1);\nvar b2 = unwrap(variables.b2);\n\nvar tree;\ntry {\n tree = Numbas.jme.compile(this.studentAnswer);\n var ans = unwrap(Numbas.jme.evaluate(tree,this.question.scope));\n \n switch (ans) {\n case a0:\n this.setCredit(0,\"$f(\" + a0 + \")$ is defined to be $\" + b0 + \"$ and $\" + b1 + \"$.\");\n break;\n case a1:\n this.setCredit(0,\"$f(\" + a1 + \")$ is defined to be $\" + b1 + \"$.\");\n break;\n case a2:\n this.setCredit(0,\"$f(\" + a2 + \")$ is defined to be $\" + b0 + \"$.\");\n break;\n case b1: \n this.setCredit(1,\"You correctly identified that $f(\" + b1 + \")$ is undefined.\");\n break;\n default:\n this.setCredit(0,\"Your answer $\" + ans + \"$ is not an element of the domain $A$.\");\n break;\n }\n}\ncatch(e) {\n this.markingComment(e);\n}"}}, "vsetRange": [0, 1], "checkVariableNames": false, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "prompt": "

Here is a different reason why $f$ is not a function -  becase there is one value of $a\\in A$ such that $f(a)$ is not defined. This is

", "variableReplacementStrategy": "originalfirst", "vsetRangePoints": 5, "marks": "1", "showFeedbackIcon": true, "type": "jme", "checkingType": "absdiff", "answer": "{b1}", "expectedVariableNames": []}], "metadata": {"description": "

Intorduces students to the definition of a function $f:A\\mapsto B$ as a subset of the Cartesian product $A\\times B$.

", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "rulesets": {}, "variablesTest": {"maxRuns": 100, "condition": ""}, "extensions": [], "type": "question", "contributors": [{"name": "Daniel Mansfield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/743/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}]}], "contributors": [{"name": "Daniel Mansfield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/743/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}