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

We can rewrite quadratic equations given in the form $ax^2+bx+c$ as a square plus another term - this is called \"completing the square\".

\n

This can be useful when it isn't obvious how to fully factorise a quadratic equation.

\n

Rewrite the following expressions in the form \\[(x+b)^2-c\\] or \\[a(x+b)^2-c\\]

", "name": "Simon's copy of Completing the square", "preamble": {"js": "", "css": ""}, "functions": {}, "variable_groups": [{"variables": ["evens1", "evens2", "evens3", "odds", "odds2", "odds3"], "name": "Odds and Evens"}], "tags": [], "ungrouped_variables": ["all", "all2", "multiall", "big", "sml", "multiall2"], "variables": {"odds": {"description": "", "name": "odds", "templateType": "anything", "definition": "random(11..30 #2)", "group": "Odds and Evens"}, "evens2": {"description": "", "name": "evens2", "templateType": "anything", "definition": "random(10..30 #2 except evens1)", "group": "Odds and Evens"}, "evens3": {"description": "", "name": "evens3", "templateType": "anything", "definition": "random(2..30 #2 except evens1 evens2)", "group": "Odds and Evens"}, "big": {"description": "", "name": "big", "templateType": "anything", "definition": "random(30..50)", "group": "Ungrouped variables"}, "all": {"description": "", "name": "all", "templateType": "anything", "definition": "random(2..6)", "group": "Ungrouped variables"}, "all2": {"description": "", "name": "all2", "templateType": "anything", "definition": "random(2..6 except all)", "group": "Ungrouped variables"}, "evens1": {"description": "", "name": "evens1", "templateType": "anything", "definition": "random(10..30 #2)", "group": "Odds and Evens"}, "multiall": {"description": "", "name": "multiall", "templateType": "anything", "definition": "all*random(2..10#2)", "group": "Ungrouped variables"}, "odds3": {"description": "", "name": "odds3", "templateType": "anything", "definition": "random(11..30 #2 except odds odds2)", "group": "Odds and Evens"}, "sml": {"description": "", "name": "sml", "templateType": "anything", "definition": "random(2..6#2)", "group": "Ungrouped variables"}, "multiall2": {"description": "", "name": "multiall2", "templateType": "anything", "definition": "all2*random(2..10 #2)", "group": "Ungrouped variables"}, "odds2": {"description": "", "name": "odds2", "templateType": "anything", "definition": "random(11..30 #2 except odds)", "group": "Odds and Evens"}}, "advice": "

Completing the square works by noticing that

\n

\\[ (x+a)^2 = x^2 + 2ax + a^2 \\]

\n

So when we see an expression of the form $x^2 + 2ax$, we can rewrite it as $(x+a)^2-a^2$.

\n

\n

(a)  

\n

We have $x^2+ \\var{evens1}x$, so we can replace it with $(x+\\var{evens1/2})^2-\\var{evens1/2}^2 = (x+\\var{evens1/2})^2 - \\var{evens1^2/4}$.

\n

We can check that this is equivalent to the original expression by expanding the brackets:

\n

\\begin{align}
(x+\\var{evens1/2})^2 - \\var{evens1^2/4} &= \\simplify[basic]{ x^2 + 2*{evens1/2}*x + {evens1/2}^2 - {evens1^2/4} } \\\\
&= x^2 + \\var{evens1}x \\text{.}
\\end{align}

\n

\n

(b)

\n

Replace $x^2 + \\var{odds}x$ by $\\simplify[basic]{(x+{odds}/2)^2-({odds}/2)^2}$, to obtain

\n

\\begin{align}
x^2 + \\var{odds}x &= \\simplify[basic]{(x+{odds}/2)^2-({odds}/2)^2} \\\\[0.5em]
&= \\simplify[basic]{ (x+{odds}/2)^2 - {odds^2}/4} \\text{.}
\\end{align}

\n

\n

(c)

\n

Replace $x^2+\\var{evens2}x$ with $(x+\\var{evens2/2})^2 - \\var{evens2/2}^2$.

\n

\n

Now remember that our original expression was not $x^2+\\var{evens2}x$ but $\\simplify[basic]{ x^2 + {evens2}x + {evens2-evens1}}$

\n

\n

Hence:

\n

\\begin{align}
\\simplify[basic]{ x^2 + {evens2}x + {evens2-evens1}}  &= \\simplify[basic]{ (x+{evens2/2})^2 - {evens2/2}^2 + {evens2-evens1} } \\\\
&= \\simplify[basic]{ (x+{evens2/2})^2 + {evens2-evens1 - evens2^2/4} }
\\end{align}

\n

\n

(d)

\n

First, notice that $\\simplify[basic]{ {all}x^2 + {multiall}x } = \\simplify[basic]{ {all}*( x^2 + {multiall/all} x)}$.

\n

Then, we can replace $x^2 + \\var{multiall/all}x$ with $(x+\\var{multiall/all/2})^2 - \\var{multiall/all/2}^2$.

\n

\\begin{align}
\\simplify[basic]{ {all}x^2 + {multiall}x + {odds3-evens2}} &= \\simplify[basic]{ {all}*( x^2 + {multiall/all} x) + {odds3-evens2}}   & \\text{Extract the common factor of } \\var{all} \\\\
&= \\simplify[basic]{ {all}*( (x+{multiall/all/2})^2 - {multiall/all/2}^2) + {odds3-evens2} } & \\text{Complete the square}\\\\
&= \\simplify[basic]{ {all}*(x+{multiall/all/2})^2 - {all}*{(multiall/all/2)^2} + {odds3-evens2} } & \\text{Expand the constant term}\\\\
&= \\simplify[basic]{ {all}*(x+{multiall/all/2})^2 + {odds3-evens2 - (multiall/2)^2/all}} & \\text{Collect constants}
\\end{align}

\n

\n

", "parts": [{"variableReplacements": [], "gaps": [{"variableReplacements": [], "failureRate": 1, "checkingAccuracy": 0.001, "showPreview": true, "musthave": {"partialCredit": 0, "showStrings": false, "message": "

It doesn't look like you've completed the square.

", "strings": ["(x", ")^2"]}, "customMarkingAlgorithm": "", "unitTests": [], "scripts": {}, "vsetRange": [0, 1], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "checkVariableNames": false, "variableReplacementStrategy": "originalfirst", "vsetRangePoints": 5, "marks": 1, "showFeedbackIcon": true, "type": "jme", "checkingType": "absdiff", "answer": "(x+{evens1/2})^2-{evens1/2}^2", "expectedVariableNames": []}], "sortAnswers": false, "customMarkingAlgorithm": "", "unitTests": [], "scripts": {}, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "prompt": "

$x^2+ \\var{evens1}x =$ [[0]]

\n

", "variableReplacementStrategy": "originalfirst", "marks": 0, "showFeedbackIcon": true, "type": "gapfill"}, {"variableReplacements": [], "gaps": [{"variableReplacements": [], "failureRate": 1, "checkingAccuracy": 0.001, "showPreview": true, "musthave": {"partialCredit": 0, "showStrings": false, "message": "

It doesn't look like you've completed the square.

", "strings": ["(x", ")^2"]}, "customMarkingAlgorithm": "", "unitTests": [], "scripts": {}, "vsetRange": [0, 1], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "checkVariableNames": false, "answerSimplification": "basic, fractionNumbers", "variableReplacementStrategy": "originalfirst", "vsetRangePoints": 5, "marks": 1, "showFeedbackIcon": true, "type": "jme", "checkingType": "absdiff", "answer": "(x+{odds}/2)^2-{(odds/2)^2}", "expectedVariableNames": []}], "sortAnswers": false, "customMarkingAlgorithm": "", "unitTests": [], "scripts": {}, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "prompt": "

$x^2+\\var{odds}x =$ [[0]]

", "variableReplacementStrategy": "originalfirst", "marks": 0, "showFeedbackIcon": true, "type": "gapfill"}, {"variableReplacements": [], "gaps": [{"variableReplacements": [], "failureRate": 1, "checkingAccuracy": 0.001, "showPreview": true, "musthave": {"partialCredit": 0, "showStrings": false, "message": "

It doesn't look like you've completed the square.

", "strings": ["(x", ")^2"]}, "customMarkingAlgorithm": "", "unitTests": [], "scripts": {}, "vsetRange": [0, 1], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "checkVariableNames": false, "answerSimplification": "basic, fractionNumbers", "variableReplacementStrategy": "originalfirst", "vsetRangePoints": 5, "marks": 1, "showFeedbackIcon": true, "type": "jme", "checkingType": "absdiff", "answer": "(x+{evens2/2})^2+{-(evens2/2)^2+evens2-evens1}", "expectedVariableNames": []}], "sortAnswers": false, "customMarkingAlgorithm": "", "unitTests": [], "scripts": {}, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "prompt": "

$\\simplify {x^2+ {evens2}x +{evens2-evens1}} =$ [[0]]

", "variableReplacementStrategy": "originalfirst", "marks": 0, "showFeedbackIcon": true, "type": "gapfill"}, {"variableReplacements": [], "gaps": [{"variableReplacements": [], "failureRate": 1, "checkingAccuracy": 0.001, "showPreview": true, "musthave": {"partialCredit": 0, "showStrings": false, "message": "

It doesn't look like you've completed the square.

", "strings": ["^2", ")", "(x"]}, "customMarkingAlgorithm": "", "unitTests": [], "scripts": {}, "vsetRange": [0, 1], "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "checkVariableNames": false, "answerSimplification": "basic, fractionNumbers", "variableReplacementStrategy": "originalfirst", "vsetRangePoints": 5, "marks": 1, "showFeedbackIcon": true, "type": "jme", "checkingType": "absdiff", "answer": "{all}(x+{multiall/all/2})^2+{-all*(multiall/all/2)^2+odds3-evens2}", "expectedVariableNames": []}], "sortAnswers": false, "customMarkingAlgorithm": "", "unitTests": [], "scripts": {}, "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "prompt": "

$\\simplify {{all} x^2+{multiall}x+{odds3-evens2}} =$ [[0]]

", "variableReplacementStrategy": "originalfirst", "marks": 0, "showFeedbackIcon": true, "type": "gapfill"}], "metadata": {"description": "

Rearrange expressions in the form $ax^2+bx+c$ to $a(x+b)^2+c$.

", "licence": "Creative Commons Attribution 4.0 International"}, "rulesets": {}, "variablesTest": {"maxRuns": 100, "condition": ""}, "extensions": [], "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Hannah Aldous", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1594/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Hannah Aldous", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1594/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}