// Numbas version: exam_results_page_options {"name": "Composite Functions", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Composite Functions", "tags": [], "metadata": {"description": "Evaluating and finding composite functions.", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

You are given the following functions:

\n

$f(x) = \\var{a}x+\\var{b}$

\n

$g(x) = \\var{c}x-\\var{d}$ 

\n

", "advice": "

(a)

\n

(i)

\n

To find $f(\\var{m}x)$ we just replace $x$ with $\\var{m}x$ in our function definition $f(x) = \\var{a}x+\\var{b}$

\n

Hence $f(\\var{m}x) = \\var{a}(\\var{m}x)+\\var{b}=\\var{a*m}x+\\var{b}$

\n

\n

(ii)

\n

To find $g(x+\\var{m+1})$ we just replace $x$ with $(x+\\var{m+1})$ in our function definition $g(x) = \\var{c}x-\\var{d}$

\n

Hence $g(x+\\var{m+1}) = \\var{c}(x+\\var{m+1})-\\var{d}=\\var{c}x+\\var{c*(m+1)}-\\var{d}=\\var{c}x+\\var{c*(m+1)-d}$

\n

\n

\n

(iii)

\n

$fg(x)=f(g(x))=f(\\var{c}x-\\var{d})=\\var{a}(\\var{c}x-\\var{d})+\\var{b}=\\var{a*c}x-\\var{a*d}+\\var{b}=\\simplify[]{{a*c}x+{b-a*d}}$ 

\n

\n

(iv)

\n

$gf(x)=g(f(x))=g(\\var{a}x+\\var{b})=\\var{c}(\\var{a}x+\\var{b})-\\var{d}=\\var{a*c}x+\\var{b*c}-\\var{d}=\\simplify[]{{a*c}x+{b*c-d}}$ 

\n

\n

(b)

\n

Since we found in (ii) that $fg(x)=\\simplify[]{{a*c}x+{b-a*d}}$ we only need to solve the straighfroward equation $\\simplify[]{{a*c}x+{b-a*d}}=\\var{q}$. Hence we obtain $x=\\frac{\\simplify{{q}-{b-a*d}}}{\\var{a*c}}=\\var{sol}$

\n

\n

Alternatively, if we hadn't already found the explicit expression for $fg(x)$, we could solve this equation in two steps. Namely, if we can find $y$ such that $f(y)=\\var{q}$, and then find $x$ such that $g(x)=y$, then we must have $f(g(x))=f(y)=\\var{q}$ as required.

\n

Solving $f(y)= \\var{q}$ gives $\\var{a}y+\\var{b}= \\var{q}.$ Hence $y= \\var{(q-b)/a}$

\n

Now solving $g(x)=  \\var{(q-b)/a}$ gives $\\var{c}x-\\var{d}= \\var{(q-b)/a}$. Hence $x=\\var{sol}$ as before.

", "rulesets": {}, "extensions": [], "variables": {"a": {"name": "a", "group": "Ungrouped variables", "definition": "random(2 .. 8#1)", "description": "", "templateType": "randrange"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(1 .. 8#1)", "description": "", "templateType": "randrange"}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "random(2 .. 8#1)", "description": "", "templateType": "randrange"}, "d": {"name": "d", "group": "Ungrouped variables", "definition": "random(2 .. 8#1)", "description": "", "templateType": "randrange"}, "x": {"name": "x", "group": "Ungrouped variables", "definition": "random(2 .. 4#1)", "description": "", "templateType": "randrange"}, "m": {"name": "m", "group": "Ungrouped variables", "definition": "random(2 .. 5#1)", "description": "", "templateType": "randrange"}, "sol": {"name": "sol", "group": "Ungrouped variables", "definition": "random(3 .. 8#0.5)", "description": "", "templateType": "randrange"}, "q": {"name": "q", "group": "Ungrouped variables", "definition": "a*c*sol-a*d+b", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "a<>c", "maxRuns": 100}, "ungrouped_variables": ["a", "b", "c", "d", "x", "m", "sol", "q"], "variable_groups": [], "functions": {"f": {"parameters": [["x", "number"]], "type": "number", "language": "jme", "definition": "{a}*x+{b}"}, "g": {"parameters": [["x", "number"]], "type": "number", "language": "jme", "definition": "{c}*x-{d}"}, "h": {"parameters": [["x", "number"]], "type": "number", "language": "jme", "definition": "{d}*x^2-{b}*x+{c}-1"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Give an expression for:

\n

(i) $f(\\var{m}x)=$[[0]]

\n

(ii) $g(x+\\var{m+1})=$[[1]]

\n

(iii) $fg(x)=$[[2]]

\n

(iv) $gf(x)=$[[3]]

\n

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "{m*a}x+{b}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "{c}(x)+{m+1}*{c}-{d}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "{a*c}(x)-{a*d}+{b}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "{a*c}(x)+{b*c}-{d}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "valuegenerators": [{"name": "x", "value": ""}]}], "sortAnswers": false}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Solve $fg(x) = \\var{q}$

", "minValue": "sol", "maxValue": "sol", "correctAnswerFraction": false, "allowFractions": true, "mustBeReduced": true, "mustBeReducedPC": 0, "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "contributors": [{"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}]}], "contributors": [{"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}