// Numbas version: exam_results_page_options {"name": "Completing the square", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"rulesets": {}, "variable_groups": [{"variables": ["evens1", "evens2", "evens3", "odds", "odds2", "odds3"], "name": "Odds and Evens"}], "functions": {}, "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\$

", "ungrouped_variables": ["all", "all2", "multiall", "big", "sml", "multiall2"], "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

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

"}, "parts": [{"marks": 0, "unitTests": [], "showCorrectAnswer": true, "type": "gapfill", "gaps": [{"marks": 1, "unitTests": [], "showCorrectAnswer": true, "type": "jme", "checkingType": "absdiff", "answer": "(x+{evens1/2})^2-{evens1/2}^2", "scripts": {}, "expectedVariableNames": [], "showFeedbackIcon": true, "failureRate": 1, "extendBaseMarkingAlgorithm": true, "checkingAccuracy": 0.001, "musthave": {"partialCredit": 0, "message": "

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

", "strings": ["(x", ")^2"], "showStrings": false}, "vsetRange": [0, 1], "showPreview": true, "checkVariableNames": false, "vsetRangePoints": 5, "variableReplacements": [], "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst"}], "scripts": {}, "sortAnswers": false, "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "prompt": "

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

\n

", "variableReplacements": [], "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst"}, {"marks": 0, "unitTests": [], "showCorrectAnswer": true, "type": "gapfill", "gaps": [{"marks": 1, "unitTests": [], "showCorrectAnswer": true, "answerSimplification": "basic, fractionNumbers", "type": "jme", "checkingType": "absdiff", "answer": "(x+{odds}/2)^2-{(odds/2)^2}", "scripts": {}, "expectedVariableNames": [], "showFeedbackIcon": true, "failureRate": 1, "extendBaseMarkingAlgorithm": true, "checkingAccuracy": 0.001, "musthave": {"partialCredit": 0, "message": "

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

", "strings": ["(x", ")^2"], "showStrings": false}, "vsetRange": [0, 1], "showPreview": true, "checkVariableNames": false, "vsetRangePoints": 5, "variableReplacements": [], "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst"}], "scripts": {}, "sortAnswers": false, "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "prompt": "

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

", "variableReplacements": [], "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst"}, {"marks": 0, "unitTests": [], "showCorrectAnswer": true, "type": "gapfill", "gaps": [{"marks": 1, "unitTests": [], "showCorrectAnswer": true, "answerSimplification": "basic, fractionNumbers", "type": "jme", "checkingType": "absdiff", "answer": "(x+{evens2/2})^2+{-(evens2/2)^2+evens2-evens1}", "scripts": {}, "expectedVariableNames": [], "showFeedbackIcon": true, "failureRate": 1, "extendBaseMarkingAlgorithm": true, "checkingAccuracy": 0.001, "musthave": {"partialCredit": 0, "message": "

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

", "strings": ["(x", ")^2"], "showStrings": false}, "vsetRange": [0, 1], "showPreview": true, "checkVariableNames": false, "vsetRangePoints": 5, "variableReplacements": [], "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst"}], "scripts": {}, "sortAnswers": false, "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "prompt": "

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

", "variableReplacements": [], "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst"}, {"marks": 0, "unitTests": [], "showCorrectAnswer": true, "type": "gapfill", "gaps": [{"marks": "2", "unitTests": [], "showCorrectAnswer": true, "answerSimplification": "basic, fractionNumbers", "type": "jme", "checkingType": "absdiff", "answer": "{all}(x+{multiall/all/2})^2+{-all*(multiall/all/2)^2+odds3-evens2}", "scripts": {}, "expectedVariableNames": [], "showFeedbackIcon": true, "failureRate": 1, "extendBaseMarkingAlgorithm": true, "checkingAccuracy": 0.001, "musthave": {"partialCredit": 0, "message": "

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

", "strings": ["^2", ")", "(x"], "showStrings": false}, "vsetRange": [0, 1], "showPreview": true, "checkVariableNames": false, "vsetRangePoints": 5, "variableReplacements": [], "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst"}], "scripts": {}, "sortAnswers": false, "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "prompt": "

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

", "variableReplacements": [], "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst"}], "variables": {"all": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "random(2..6)", "name": "all"}, "evens2": {"templateType": "anything", "description": "", "group": "Odds and Evens", "definition": "random(10..30 #2 except evens1)", "name": "evens2"}, "odds3": {"templateType": "anything", "description": "", "group": "Odds and Evens", "definition": "random(11..30 #2 except odds odds2)", "name": "odds3"}, "odds2": {"templateType": "anything", "description": "", "group": "Odds and Evens", "definition": "random(11..30 #2 except odds)", "name": "odds2"}, "evens1": {"templateType": "anything", "description": "", "group": "Odds and Evens", "definition": "random(10..30 #2)", "name": "evens1"}, "sml": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "random(2..6#2)", "name": "sml"}, "evens3": {"templateType": "anything", "description": "", "group": "Odds and Evens", "definition": "random(2..30 #2 except evens1 evens2)", "name": "evens3"}, "multiall2": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "all2*random(2..10 #2)", "name": "multiall2"}, "all2": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "random(2..6 except all)", "name": "all2"}, "odds": {"templateType": "anything", "description": "", "group": "Odds and Evens", "definition": "random(11..30 #2)", "name": "odds"}, "multiall": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "all*random(2..10#2)", "name": "multiall"}, "big": {"templateType": "anything", "description": "", "group": "Ungrouped variables", "definition": "random(30..50)", "name": "big"}}, "tags": [], "variablesTest": {"condition": "", "maxRuns": 100}, "preamble": {"css": "", "js": ""}, "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

#### 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

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

#### 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

#### c)

\n

Replace $x^2+\\var{evens2}x$ with $(x+\\var{evens2/2})^2 - \\var{evens2/2}^2$. Remember to keep the $\\var{evens2-evens1}$ term on the end!

\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

#### 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", "extensions": [], "name": "Completing the square", "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Adrian Jannetta", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/164/"}, {"name": "Hannah Aldous", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1594/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Adrian Jannetta", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/164/"}, {"name": "Hannah Aldous", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1594/"}]}