// Numbas version: exam_results_page_options {"name": "Functions: Evaluating Composite Functions 1 - Modulus Functions", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Functions: Evaluating Composite Functions 1 - Modulus Functions", "tags": [], "metadata": {"description": "

Evaluating composite functions involving a linear function and a modulus function of the form $f(x)=|x|+c$, for a given value of $x$.

", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "

If $f(x)=\\simplify{abs(x)+{c}}$ and $g(x)=\\simplify{{n}x+{d}}$, calculate $f\\circ g(x)$ and $g \\circ f(x)$ when $x=\\var{a}$.

\n

\n

Recall: $f \\circ g(x) \\equiv f(g(x))$ and $g \\circ f(x) \\equiv g(f(x))$.

", "advice": "

\n

To find the composition $f \\circ g(x)$ we are substituting the expression for $g(x)$ into the function $f(x)$, replacing the $x$-terms with the function $g(x)$. Similarly, to find the composition $g \\circ f(x)$ we are substituting the expression for $f(x)$ into the function $g(x)$, replacing the $x$-terms with the function $f(x)$.

\n

So, for $f(x)=\\simplify{abs(x)+{c}}$ and $g(x)=\\simplify{{n}x+{d}}$,

\n

\\[ f \\circ g(x) \\equiv f(g(x)) =  \\simplify{abs({n}x+{d})+{c}},\\]

\n

and 

\n

\\[ \\begin{split} g \\circ f(x) \\equiv g(f(x)) &\\,=  \\simplify{{n}(abs(x)+{c})+{d}} \\\\ &\\,=\\simplify[!collectNumbers,unitFactor]{{n}abs(x)+{n*c}+{d}} \\\\ &\\,=\\simplify{{n}abs(x)+{n*c+d}}. \\end{split} \\]

\n

When $x=\\var{a}$, 

\n

\\[ \\begin{split} f \\circ g(\\var{a}) \\equiv f(g(\\var{a})) &\\,=  \\simplify[alwaysTimes]{abs({n}{a}+{d})+{c}} \\\\ &\\,=\\simplify{abs({n*a}+{d})+{c}} \\\\ &\\,=\\simplify[!collectNumbers]{{abs(n*a+d)}+{c}}\\\\ &\\,=\\simplify{{abs(n*a+d)}+{c}},\\end{split}\\]

\n

and 

\n

\\[ \\begin{split} g \\circ f(\\var{a}) \\equiv g(f(\\var{a})) &\\,=\\simplify{{n}abs({a})+{n*c+d}} \\\\ &\\,=\\simplify[!collectNumbers]{{n}{abs(a)}+{n*c+d}} \\\\ &\\,=\\simplify[!collectNumbers]{{n*abs(a)+(n*c+d)}} . \\end{split} \\]

\n

\n

Alternative Method:

\n

Rather than finding the composite functions first and then evaluating them, we can calculate $g(\\var{a})$ and $f(\\var{a})$, and then substitute those values into the other functions:

\n

\\[ \\begin{split} g(\\var{a}) &\\,=\\simplify[alwaysTimes]{{n}{a}+{d}} \\\\ &\\,=\\simplify{{n*a}+{d}}, \\end{split} \\]

\n

hence

\n

\\[  \\begin{split} f \\circ g(\\var{a}) = f(\\simplify{{n*a+d}}) &\\,= \\simplify{abs({n*a+d})+{c}} \\\\ &\\,= \\simplify{{abs(n*a+d)+c}}. \\end{split} \\]

\n

Similarly,

\n

\\[ \\begin{split} f(\\var{a}) &\\,= \\simplify{abs({a})+{c}}\\\\ &\\,=\\simplify[!collectNumbers]{{abs(a)}+{c}} \\\\ &\\,=\\simplify{{abs(a)+c}} \\end{split} \\]

\n

hence, 

\n

\\[\\begin{split} g \\circ f(\\var{a}) = g(\\simplify{{abs(a)+c}}) &\\,= \\simplify[alwaysTimes]{{n}{abs(a)+c}+{d}} \\\\ &\\,=\\simplify{{n}{abs(a)+c}+{d}}.\\end{split} \\]

", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"n": {"name": "n", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "", "templateType": "anything", "can_override": false}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "random(-7..7 except 0)", "description": "", "templateType": "anything", "can_override": false}, "d": {"name": "d", "group": "Ungrouped variables", "definition": "random(-7..7 except [0,c])", "description": "", "templateType": "anything", "can_override": false}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random(-2..-8)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["n", "c", "d", "a"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

$f \\circ g(\\var{a})=$[[0]]

\n

$g \\circ f(\\var{a})=$[[1]]

", "gaps": [{"type": "jme", "useCustomName": true, "customName": "Gap 0", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{abs(n*a+d)}+{c}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "{n*abs(a)+(n*c+d)}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}]}]}], "contributors": [{"name": "Ben McGovern", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4872/"}]}