// Numbas version: exam_results_page_options {"name": "Inequalities that involve a single absolute value", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "statement": "

You are given the inequality \\[|\\simplify{{a}x+{b}}| \\var{latex(sym)} \\var{c}.\\]

\n

", "tags": [], "ungrouped_variables": ["choice", "sym", "a", "c", "d", "b", "leadCoeff", "prod", "one", "rootList", "r1", "r2", "strict", "backChoice", "backsym", "extremeY", "backprod", "dr", "hole", "nonhole"], "variables": {"rootList": {"group": "Ungrouped variables", "description": "", "definition": "sort([(-b-c)/a,(-b+c)/a])", "name": "rootList", "templateType": "anything"}, "one": {"group": "Ungrouped variables", "description": "", "definition": "if(choice=3 or choice=4,true,false)", "name": "one", "templateType": "anything"}, "r2": {"group": "Ungrouped variables", "description": "

r2

", "definition": "rootList[1]", "name": "r2", "templateType": "anything"}, "c": {"group": "Ungrouped variables", "description": "", "definition": "random(1..12)", "name": "c", "templateType": "anything"}, "d": {"group": "Ungrouped variables", "description": "

d

", "definition": "random(-12..12 except -1..1)", "name": "d", "templateType": "anything"}, "prod": {"group": "Ungrouped variables", "description": "", "definition": "leadCoeff*choice", "name": "prod", "templateType": "anything"}, "choice": {"group": "Ungrouped variables", "description": "", "definition": "random(1..4)", "name": "choice", "templateType": "anything"}, "strict": {"group": "Ungrouped variables", "description": "", "definition": "if(choice=1 or choice=3,true,false)", "name": "strict", "templateType": "anything"}, "r1": {"group": "Ungrouped variables", "description": "

r1

", "definition": "rootList[0]", "name": "r1", "templateType": "anything"}, "a": {"group": "Ungrouped variables", "description": "", "definition": "random(-12..12 except 0)", "name": "a", "templateType": "anything"}, "extremeY": {"group": "Ungrouped variables", "description": "

approx of the furthest we need to plot in the y direction

", "definition": "(r2-r1)^2/4\n\n//abs((c*b-a)*b-(b*(d*d-1)+d*(c*b-a))^2/(4*d*(c*d-1)))", "name": "extremeY", "templateType": "anything"}, "nonhole": {"group": "Ungrouped variables", "description": "", "definition": "(a-b*c)/(c*d-1)", "name": "nonhole", "templateType": "anything"}, "sym": {"group": "Ungrouped variables", "description": "", "definition": "['>','\\\\ge','<','\\\\le'][choice-1]", "name": "sym", "templateType": "anything"}, "b": {"group": "Ungrouped variables", "description": "", "definition": "random(-12..12 except 0)", "name": "b", "templateType": "anything"}, "backChoice": {"group": "Ungrouped variables", "description": "", "definition": "mod(choice+1,4)+1", "name": "backChoice", "templateType": "anything"}, "dr": {"group": "Ungrouped variables", "description": "", "definition": "r2-r1", "name": "dr", "templateType": "anything"}, "hole": {"group": "Ungrouped variables", "description": "", "definition": "-b/d", "name": "hole", "templateType": "anything"}, "leadCoeff": {"group": "Ungrouped variables", "description": "", "definition": "sign(a)", "name": "leadCoeff", "templateType": "anything"}, "backsym": {"group": "Ungrouped variables", "description": "", "definition": "['>','\\\\ge','<','\\\\le'][backChoice-1]", "name": "backsym", "templateType": "anything"}, "backprod": {"group": "Ungrouped variables", "description": "", "definition": "leadCoeff*backchoice", "name": "backprod", "templateType": "anything"}}, "functions": {"graph": {"parameters": [], "definition": "a = Numbas.jme.unwrapValue(scope.variables.leadcoeff);\nr1 = Numbas.jme.unwrapValue(scope.variables.r1);\nr2 = Numbas.jme.unwrapValue(scope.variables.r2);\nprod = Numbas.jme.unwrapValue(scope.variables.backprod);\ndr=Numbas.jme.unwrapValue(scope.variables.dr);\nexy=Numbas.jme.unwrapValue(scope.variables.extremey);\nhole = Numbas.jme.unwrapValue(scope.variables.hole);\nnonhole = Numbas.jme.unwrapValue(scope.variables.nonhole);\n\nvar div = Numbas.extensions.jsxgraph.makeBoard('400px','400px',{boundingBox:[r1-dr,1.2*exy,r2+dr,-1.2*exy],grid:true,axis:false});\nvar board = div.board;\n\n// create the x-axis.\nvar xaxis = board.create('line',[[0,0],[1,0]], { strokeColor: 'black', fixed: true});\nvar xticks = board.create('ticks',[xaxis,2],{\n drawLabels: true,\n label: {offset: [-4, -10]},\n minorTicks: 0\n});\n\n// create the y-axis\nvar yaxis = board.create('line',[[0,0],[0,1]], { strokeColor: 'black', fixed: true });\nvar yticks = board.create('ticks',[yaxis,10],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0,\n});\n\n\n\nif(prod==2 || prod==4 || prod==-2 || prod==-4){ptColour = 'green';} else {ptColour = 'red';};\n\nboard.create('point',[hole,0],{fixed:true,withLabel:false,strokeColour:'red', fillColor:'red'});\nboard.create('point',[nonhole,0],{fixed:true,withLabel:false,strokeColor:ptColour,fillColor:ptColour});\n\nif(prod==2 || prod==-4 || prod== 1 || prod==-3){ outColour = 'green';} else {outColour = 'red';};\nif(prod==-2 || prod==4 || prod== -1 || prod==3){inColour = 'green';} else {inColour = 'red';};\n\nboard.create('functiongraph',[function(x){return a*(x**2-(r1+r2)*x+r1*r2);},r1,r2],{strokeColor:inColour,strokeWidth:2});\nboard.create('functiongraph',[function(x){return a*(x**2-(r1+r2)*x+r1*r2);},r1-dr,r1],{strokeColor:outColour,strokeWidth:2});\nboard.create('functiongraph',[function(x){return a*(x**2-(r1+r2)*x+r1*r2);},r2,r2+dr],{strokeColor:outColour,strokeWidth:2});\n\nreturn div;", "type": "html", "language": "javascript"}}, "preamble": {"css": "", "js": ""}, "metadata": {"licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", "description": "

Inequality involving a single absolute value, question solution uses the piecewise nature of the absolute value function.

"}, "parts": [{"variableReplacementStrategy": "originalfirst", "marks": 0, "type": "gapfill", "gaps": [{"variableReplacementStrategy": "originalfirst", "distractors": ["", ""], "marks": 0, "shuffleChoices": false, "choices": ["

one interval.

", "

two intervals.

"], "displayColumns": 0, "showCorrectAnswer": true, "maxMarks": 0, "displayType": "dropdownlist", "variableReplacements": [], "type": "1_n_2", "matrix": ["if(one=true,1,0)", "if(one=false,1,0)"], "showFeedbackIcon": true, "minMarks": 0, "scripts": {"mark": {"order": "instead", "script": "// apply the normal marking algorithm for this part\nthis.__proto__.mark.apply(this);\n// store whether the student said \"one interval\" in an attribute that's easier to access\nthis.one = this.ticks[0][0];"}}}, {"variableReplacementStrategy": "originalfirst", "scripts": {}, "marks": 1, "correctAnswerStyle": "plain", "showCorrectAnswer": true, "correctAnswerFraction": true, "mustBeReduced": false, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "maxValue": "r1", "showFeedbackIcon": true, "minValue": "r1", "variableReplacements": [], "allowFractions": true}, {"variableReplacementStrategy": "originalfirst", "distractors": ["", ""], "marks": 0, "shuffleChoices": false, "choices": ["

<

", "

"], "displayColumns": 0, "showCorrectAnswer": true, "maxMarks": 0, "displayType": "dropdownlist", "variableReplacements": [], "type": "1_n_2", "matrix": ["if(one=true and strict=true,1,0)", "if(one=true and strict=false,1,0)"], "showFeedbackIcon": true, "minMarks": 0, "scripts": {}}, {"variableReplacementStrategy": "originalfirst", "distractors": ["", ""], "marks": 0, "shuffleChoices": false, "choices": ["

<

", "

"], "displayColumns": 0, "showCorrectAnswer": true, "maxMarks": 0, "displayType": "dropdownlist", "variableReplacements": [], "type": "1_n_2", "matrix": ["if(one=true and strict=true,1,0)", "if(one=true and strict=false,1,0)"], "showFeedbackIcon": true, "minMarks": 0, "scripts": {}}, {"variableReplacementStrategy": "originalfirst", "scripts": {}, "marks": 1, "correctAnswerStyle": "plain", "showCorrectAnswer": true, "correctAnswerFraction": true, "mustBeReduced": false, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "maxValue": "r2", "showFeedbackIcon": true, "minValue": "r2", "variableReplacements": [], "allowFractions": true}, {"variableReplacementStrategy": "originalfirst", "distractors": ["", ""], "marks": 0, "shuffleChoices": false, "choices": ["

<

", "

"], "displayColumns": 0, "showCorrectAnswer": true, "maxMarks": 0, "displayType": "dropdownlist", "variableReplacements": [], "type": "1_n_2", "matrix": ["if(one=false and strict=true,1,0)", "if(one=false and strict=false,1,0)"], "showFeedbackIcon": true, "minMarks": 0, "scripts": {}}, {"variableReplacementStrategy": "originalfirst", "scripts": {}, "marks": 1, "correctAnswerStyle": "plain", "showCorrectAnswer": true, "correctAnswerFraction": true, "mustBeReduced": false, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "maxValue": "r1", "showFeedbackIcon": true, "minValue": "r1", "variableReplacements": [], "allowFractions": true}, {"variableReplacementStrategy": "originalfirst", "distractors": ["", ""], "marks": 0, "shuffleChoices": false, "choices": ["

>

", "

"], "displayColumns": 0, "showCorrectAnswer": true, "maxMarks": 0, "displayType": "dropdownlist", "variableReplacements": [], "type": "1_n_2", "matrix": ["if(one=false and strict=true,1,0)", "if(one=false and strict=false,1,0)"], "showFeedbackIcon": true, "minMarks": 0, "scripts": {}}, {"variableReplacementStrategy": "originalfirst", "scripts": {}, "marks": 1, "correctAnswerStyle": "plain", "showCorrectAnswer": true, "correctAnswerFraction": true, "mustBeReduced": false, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "type": "numberentry", "maxValue": "r2", "showFeedbackIcon": true, "minValue": "r2", "variableReplacements": [], "allowFractions": true}], "prompt": "

The solution to the above inequality

\n

is made up of  [[0]]

\n
\n

Given by the condition [[1]] [[2]] $x$ [[3]] [[4]].

\n
\n
\n

Given by the condition, $x$ [[5]] [[6]] or $x$ [[7]] [[8]].

\n
", "showFeedbackIcon": true, "showCorrectAnswer": true, "variableReplacements": [], "scripts": {"mark": {"order": "instead", "script": "var gaps = this.gaps;\n// if the student said \"one\" to gap 0, then mark gaps 0 to 4\nif(gaps[0].one) {\n this.setCredit((gaps[0].credit*gaps[0].marks+gaps[1].credit*gaps[1].marks+gaps[2].credit*gaps[2].marks+gaps[3].credit*gaps[3].marks+gaps[4].credit*gaps[4].marks)/(gaps[0].marks+gaps[1].marks+gaps[2].marks+gaps[3].marks+gaps[4].marks));\n// otherwise, work out the credit based on the gaps 0, 5 to 8\n} else {\n this.setCredit((gaps[0].credit*gaps[0].marks+gaps[5].credit*gaps[5].marks+gaps[6].credit*gaps[6].marks+gaps[7].credit*gaps[7].marks+gaps[8].credit*gaps[8].marks)/(gaps[0].marks+gaps[5].marks+gaps[6].marks+gaps[7].marks+gaps[8].marks));\n}\n\n"}, "constructor": {"order": "after", "script": "// override the default 'submit' method for the part\n// we only want to submit gaps 1,2,3,4 if the answer to gap 0 is \"one\" and we only want to submit gaps 5,6,7,8 if the answer to gap 0 is \"two\"\nthis.submit = Numbas.util.extend(function() {\n this.gaps[0].submit();\n if(this.gaps[0].one) {\n this.gaps[1].submit();\n this.gaps[2].submit();\n this.gaps[3].submit();\n this.gaps[4].submit();\n this.gaps[5].answered = true;\n this.gaps[6].answered = true;\n this.gaps[7].answered = true;\n this.gaps[8].answered = true;\n } else {\n this.gaps[1].answered = true;\n this.gaps[2].answered = true;\n this.gaps[3].answered = true;\n this.gaps[4].answered = true;\n this.gaps[5].submit();\n this.gaps[6].submit();\n this.gaps[7].submit();\n this.gaps[8].submit(); \n }\n},Part.prototype.submit);\n"}}}], "type": "question", "advice": "

Short-cut Method

\n

\n

For questions of this type (where the absolute value is 'less than' or 'less than and equal to' something positive) we can set out our working in a shorter way:

\n

\\begin{alignat}{2} &&|\\simplify{{a}x+{b}}| &\\var{latex(sym)} \\var{c}\\\\ \\var{-c} &\\var{latex(sym)}&\\simplify{{a}x+{b}}&\\var{latex(sym)}\\var{c}\\\\ \\var{-c-b} &\\var{latex(sym)} &\\simplify{{a}x}\\quad&\\var{latex(sym)}\\var{c-b}\\\\ \\var[fractionNumbers]{r1}&\\var{latex(sym)}&x\\quad&\\var{latex(sym)}\\var[fractionNumbers]{r2}.\\end{alignat}

\n

\\begin{alignat}{2} &&|\\simplify{{a}x+{b}}| &\\var{latex(sym)} \\var{c}\\\\ \\var{-c} &\\var{latex(sym)}&\\simplify{{a}x+{b}}&\\var{latex(sym)}\\var{c}\\\\ \\var{-c-b} &\\var{latex(sym)} &\\simplify{{a}x}\\quad&\\var{latex(sym)}\\var{c-b}.\\end{alignat}

\n

\\begin{alignat}{2} &&|\\simplify{{a}x+{b}}| &\\var{latex(sym)} \\var{c}\\\\ \\var{-c} &\\var{latex(sym)}&\\simplify{{a}x+{b}}&\\var{latex(sym)}\\var{c}\\\\ \\var{-c-b} &\\var{latex(sym)} &\\simplify{{a}x}\\quad&\\var{latex(sym)}\\var{c-b}\\\\ \\var[fractionNumbers]{r2}&\\var{latex(backsym)}&x\\quad&\\var{latex(backsym)}\\var[fractionNumbers]{r1}\\\\\\var[fractionNumbers]{r1}&\\var{latex(sym)}&x\\quad&\\var{latex(sym)}\\var[fractionNumbers]{r2}.\\end{alignat}

\n

\n

Cases Method

\n

 

\n

Recall that the absolute value is defined as the piecewise function \\[|x|=\\begin{cases}x, &\\text{ for } x\\ge 0\\\\ -x, &\\text{ for } x<0. \\end{cases}\\]

\n

This means that $|\\simplify{{a}x+{b}}|$ is actually $\\simplify{{a}x+{b}}$ when $\\simplify{{a}x+{b}}\\ge 0$ but it is $-(\\simplify{{a}x+{b}})$ when $\\simplify{{a}x+{b}}<0$. We have two cases:

\n

\n

Case 1: $\\simplify{{a}x+{b}}\\ge 0$

\n

Rearranging $\\simplify{{a}x+{b}}\\ge 0$ for $x$ gives $x \\ge \\simplify[fractionNumbers]{{-b/a}}$ $x \\le \\simplify[fractionNumbers]{{-b/a}}$ and so case 1 is only relevant for $x \\ge \\simplify[fractionNumbers]{{-b/a}}$ $x \\le \\simplify[fractionNumbers]{{-b/a}}$.

\n

In case 1, our inequality is simply $\\simplify{{a}x+{b}} \\var{latex(sym)} \\var{c}$, and so rearranging it for $x$ gives $x \\var{latex(sym)} \\simplify[fractionNumbers,simplifyFractions,!unitDenominator]{{(c-b)/a}}$ $x \\var{latex(backsym)} \\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{(c-b)/a}}$

\n

So in conclusion for case 1, we require that $x \\ge \\simplify[fractionNumbers]{{-b/a}}$ $x \\le \\simplify[fractionNumbers]{{-b/a}}$   and  $x \\var{latex(sym)} \\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{(c-b)/a}}$ $x \\var{latex(backsym)} \\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{(c-b)/a}}$ which is the same as $\\simplify[fractionNumbers]{-{b/a}}\\le x\\var{latex(sym)} \\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{(c-b)/a}}$ $\\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{(c-b)/a}}\\var{latex(sym)} x\\le \\simplify[fractionNumbers]{{-b/a}}$ $x\\var{latex(sym)}\\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{(c-b)/a}}$ $x\\var{latex(backsym)}\\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{(c-b)/a}}$.

\n

\n

Case 2: $\\simplify{{a}x+{b}}< 0$

\n

Rearranging $\\simplify{{a}x+{b}}< 0$ for $x$ gives $x < \\simplify[fractionNumbers]{{-b/a}}$ $x > \\simplify[fractionNumbers]{{-b/a}}$ and so case 2 is only relevant for $x < \\simplify[fractionNumbers]{{-b/a}}$ $x > \\simplify[fractionNumbers]{{-b/a}}$.

\n

In case 2, our inequality is actually $-(\\simplify{{a}x+{b}}) \\var{latex(sym)} \\var{c}$, and so rearranging it for $x$ gives $x \\var{latex(backsym)} \\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{(-c-b)/a}}$ $x \\var{latex(sym)} \\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{(-c-b)/a}}$

\n

So in conclusion for case 2, we require that $x < \\simplify[fractionNumbers]{-{b/a}}$ $x > \\simplify[fractionNumbers]{-{b/a}}$  and  $x \\var{latex(backsym)} \\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{(-c-b)/a}}$ $x \\var{latex(sym)} \\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{(-c-b)/a}}$ which is the same as $\\simplify[fractionNumbers]{{-(b+c)/a}}\\var{latex(sym)} x< \\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{-b}/{a}}$ $\\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{-b/a}}< x \\var{latex(sym)} \\simplify[fractionNumbers,simplifyFractions,unitDenominator]{-{(b+c)/a}}$ $x\\var{latex(backsym)}\\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{(-c-b)/a}}$ $x\\var{latex(sym)}\\simplify[fractionNumbers,simplifyFractions,unitDenominator]{{(-c-b)/a}}$.

\n

\n

Therefore the solution to our original inequality $|\\simplify{{a}x+{b}}| \\var{latex(sym)} \\var{c}$ is 

\n

\\[\\var[fractionNumbers]{r1}<x<\\var[fractionNumbers]{r2}.\\]

\n

\\[\\var[fractionNumbers]{r1}\\le x \\le\\var[fractionNumbers]{r2}.\\]

\n

\\[x< \\var[fractionNumbers]{r1}, \\, x> \\var[fractionNumbers]{r2}.  \\]

\n

\\[x\\le \\var[fractionNumbers]{r1}, \\, x\\ge\\var[fractionNumbers]{r2}.  \\]

\n

\n

\n

", "rulesets": {}, "extensions": ["jsxgraph"], "name": "Inequalities that involve a single absolute value", "variablesTest": {"condition": "", "maxRuns": 100}, "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}