// Numbas version: exam_results_page_options {"name": "JD's copy of Completing the square", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"showfrontpage": false, "allowregen": true, "preventleave": 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\$

", "variable_groups": [{"name": "Odds and Evens", "variables": ["evens1", "evens2", "evens3", "odds", "odds2", "odds3"]}], "contributors": [{"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/", "name": "Christian Lawson-Perfect"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/164/", "name": "Adrian Jannetta"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1594/", "name": "Hannah Aldous"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3389/", "name": "JD Ichwan"}], "name": "JD's copy of Completing the square", "preamble": {"js": "", "css": ""}, "variables": {"odds3": {"definition": "random(11..30 #2 except odds odds2)", "group": "Odds and Evens", "name": "odds3", "templateType": "anything", "description": ""}, "sml": {"definition": "random(2..6#2)", "group": "Ungrouped variables", "name": "sml", "templateType": "anything", "description": ""}, "odds2": {"definition": "random(11..30 #2 except odds)", "group": "Odds and Evens", "name": "odds2", "templateType": "anything", "description": ""}, "evens1": {"definition": "random(10..30 #2)", "group": "Odds and Evens", "name": "evens1", "templateType": "anything", "description": ""}, "all2": {"definition": "random(2..6 except all)", "group": "Ungrouped variables", "name": "all2", "templateType": "anything", "description": ""}, "evens2": {"definition": "random(10..30 #2 except evens1)", "group": "Odds and Evens", "name": "evens2", "templateType": "anything", "description": ""}, "all": {"definition": "random(2..6)", "group": "Ungrouped variables", "name": "all", "templateType": "anything", "description": ""}, "big": {"definition": "random(30..50)", "group": "Ungrouped variables", "name": "big", "templateType": "anything", "description": ""}, "multiall": {"definition": "all*random(2..10#2)", "group": "Ungrouped variables", "name": "multiall", "templateType": "anything", "description": ""}, "evens3": {"definition": "random(2..30 #2 except evens1 evens2)", "group": "Odds and Evens", "name": "evens3", "templateType": "anything", "description": ""}, "multiall2": {"definition": "all2*random(2..10 #2)", "group": "Ungrouped variables", "name": "multiall2", "templateType": "anything", "description": ""}, "odds": {"definition": "random(11..30 #2)", "group": "Odds and Evens", "name": "odds", "templateType": "anything", "description": ""}}, "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", "variablesTest": {"condition": "", "maxRuns": 100}, "tags": [], "extensions": [], "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$.

"}, "functions": {}, "rulesets": {}, "type": "question", "parts": [{"gaps": [{"unitTests": [], "musthave": {"strings": ["(x", ")^2"], "showStrings": false, "partialCredit": 0, "message": "

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

"}, "showPreview": true, "checkVariableNames": false, "answer": "(x+{evens1/2})^2-{evens1/2}^2", "useCustomName": false, "marks": 1, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "jme", "customName": "", "failureRate": 1, "customMarkingAlgorithm": "", "checkingType": "absdiff", "checkingAccuracy": 0.001, "valuegenerators": [{"value": "", "name": "x"}], "vsetRange": [0, 1], "vsetRangePoints": 5, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true}], "unitTests": [], "sortAnswers": false, "customName": "", "prompt": "

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

\n

", "variableReplacementStrategy": "originalfirst", "scripts": {}, "showCorrectAnswer": true, "useCustomName": false, "marks": 0, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "gapfill"}, {"gaps": [{"unitTests": [], "musthave": {"strings": ["(x", ")^2"], "showStrings": false, "partialCredit": 0, "message": "

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

"}, "showPreview": true, "checkVariableNames": false, "answer": "(x+{odds}/2)^2-{(odds/2)^2}", "answerSimplification": "basic, fractionNumbers", "useCustomName": false, "marks": 1, "showFeedbackIcon": true, "scripts": {}, "failureRate": 1, "extendBaseMarkingAlgorithm": true, "type": "jme", "customName": "", "variableReplacements": [], "customMarkingAlgorithm": "", "checkingType": "absdiff", "checkingAccuracy": 0.001, "valuegenerators": [{"value": "", "name": "x"}], "vsetRange": [0, 1], "vsetRangePoints": 5, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true}], "unitTests": [], "sortAnswers": false, "customName": "", "prompt": "

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

", "variableReplacementStrategy": "originalfirst", "scripts": {}, "showCorrectAnswer": true, "useCustomName": false, "marks": 0, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "gapfill"}, {"gaps": [{"unitTests": [], "musthave": {"strings": ["(x", ")^2"], "showStrings": false, "partialCredit": 0, "message": "

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

"}, "showPreview": true, "checkVariableNames": false, "answer": "(x+{evens2/2})^2+{-(evens2/2)^2+evens2-evens1}", "answerSimplification": "basic, fractionNumbers", "useCustomName": false, "marks": 1, "showFeedbackIcon": true, "scripts": {}, "failureRate": 1, "extendBaseMarkingAlgorithm": true, "type": "jme", "customName": "", "variableReplacements": [], "customMarkingAlgorithm": "", "checkingType": "absdiff", "checkingAccuracy": 0.001, "valuegenerators": [{"value": "", "name": "x"}], "vsetRange": [0, 1], "vsetRangePoints": 5, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true}], "unitTests": [], "sortAnswers": false, "customName": "", "prompt": "

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

", "variableReplacementStrategy": "originalfirst", "scripts": {}, "showCorrectAnswer": true, "useCustomName": false, "marks": 0, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "gapfill"}, {"gaps": [{"unitTests": [], "musthave": {"strings": ["^2", ")", "(x"], "showStrings": false, "partialCredit": 0, "message": "

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

"}, "showPreview": true, "checkVariableNames": false, "answer": "{all}(x+{multiall/all/2})^2+{-all*(multiall/all/2)^2+odds3-evens2}", "answerSimplification": "basic, fractionNumbers", "useCustomName": false, "marks": "2", "showFeedbackIcon": true, "scripts": {}, "failureRate": 1, "extendBaseMarkingAlgorithm": true, "type": "jme", "customName": "", "variableReplacements": [], "customMarkingAlgorithm": "", "checkingType": "absdiff", "checkingAccuracy": 0.001, "valuegenerators": [{"value": "", "name": "x"}], "vsetRange": [0, 1], "vsetRangePoints": 5, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true}], "unitTests": [], "sortAnswers": false, "customName": "", "prompt": "

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

", "variableReplacementStrategy": "originalfirst", "scripts": {}, "showCorrectAnswer": true, "useCustomName": false, "marks": 0, "showFeedbackIcon": true, "customMarkingAlgorithm": "", "variableReplacements": [], "extendBaseMarkingAlgorithm": true, "type": "gapfill"}]}]}], "contributors": [{"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/", "name": "Christian Lawson-Perfect"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/164/", "name": "Adrian Jannetta"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1594/", "name": "Hannah Aldous"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3389/", "name": "JD Ichwan"}]}