// Numbas version: exam_results_page_options {"name": "JD'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\".
\nThis can be useful when it isn't obvious how to fully factorise a quadratic equation.
\nRewrite the following expressions in the form \\[(x+b)^2-c\\] or \\[a(x+b)^2-c\\]
", "ungrouped_variables": ["all", "all2", "multiall", "big", "sml", "multiall2"], "parts": [{"unitTests": [], "marks": 0, "customMarkingAlgorithm": "", "sortAnswers": false, "useCustomName": false, "variableReplacementStrategy": "originalfirst", "gaps": [{"unitTests": [], "variableReplacementStrategy": "originalfirst", "checkingAccuracy": 0.001, "valuegenerators": [{"value": "", "name": "x"}], "musthave": {"strings": ["(x", ")^2"], "message": "It doesn't look like you've completed the square.
", "showStrings": false, "partialCredit": 0}, "extendBaseMarkingAlgorithm": true, "type": "jme", "vsetRange": [0, 1], "showPreview": true, "vsetRangePoints": 5, "customMarkingAlgorithm": "", "marks": 1, "useCustomName": false, "answer": "(x+{evens1/2})^2-{evens1/2}^2", "showFeedbackIcon": true, "scripts": {}, "checkingType": "absdiff", "showCorrectAnswer": true, "failureRate": 1, "checkVariableNames": false, "variableReplacements": [], "customName": ""}], "showFeedbackIcon": true, "prompt": "$x^2+ \\var{evens1}x =$ [[0]]
\n", "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "gapfill", "customName": "", "showCorrectAnswer": true, "variableReplacements": []}, {"unitTests": [], "marks": 0, "customMarkingAlgorithm": "", "sortAnswers": false, "useCustomName": false, "variableReplacementStrategy": "originalfirst", "gaps": [{"unitTests": [], "variableReplacementStrategy": "originalfirst", "checkingAccuracy": 0.001, "valuegenerators": [{"value": "", "name": "x"}], "musthave": {"strings": ["(x", ")^2"], "message": "
It doesn't look like you've completed the square.
", "showStrings": false, "partialCredit": 0}, "extendBaseMarkingAlgorithm": true, "type": "jme", "vsetRange": [0, 1], "answerSimplification": "basic, fractionNumbers", "showPreview": true, "vsetRangePoints": 5, "customMarkingAlgorithm": "", "marks": 1, "useCustomName": false, "answer": "(x+{odds}/2)^2-{(odds/2)^2}", "showFeedbackIcon": true, "scripts": {}, "checkingType": "absdiff", "showCorrectAnswer": true, "failureRate": 1, "checkVariableNames": false, "variableReplacements": [], "customName": ""}], "showFeedbackIcon": true, "prompt": "$x^2+\\var{odds}x =$ [[0]]
", "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "gapfill", "customName": "", "showCorrectAnswer": true, "variableReplacements": []}, {"unitTests": [], "marks": 0, "customMarkingAlgorithm": "", "sortAnswers": false, "useCustomName": false, "variableReplacementStrategy": "originalfirst", "gaps": [{"unitTests": [], "variableReplacementStrategy": "originalfirst", "checkingAccuracy": 0.001, "valuegenerators": [{"value": "", "name": "x"}], "musthave": {"strings": ["(x", ")^2"], "message": "It doesn't look like you've completed the square.
", "showStrings": false, "partialCredit": 0}, "extendBaseMarkingAlgorithm": true, "type": "jme", "vsetRange": [0, 1], "answerSimplification": "basic, fractionNumbers", "showPreview": true, "vsetRangePoints": 5, "customMarkingAlgorithm": "", "marks": 1, "useCustomName": false, "answer": "(x+{evens2/2})^2+{-(evens2/2)^2+evens2-evens1}", "showFeedbackIcon": true, "scripts": {}, "checkingType": "absdiff", "showCorrectAnswer": true, "failureRate": 1, "checkVariableNames": false, "variableReplacements": [], "customName": ""}], "showFeedbackIcon": true, "prompt": "$\\simplify {x^2+ {evens2}x +{evens2-evens1}} =$ [[0]]
It doesn't look like you've completed the square.
", "showStrings": false, "partialCredit": 0}, "extendBaseMarkingAlgorithm": true, "type": "jme", "vsetRange": [0, 1], "answerSimplification": "basic, fractionNumbers", "showPreview": true, "vsetRangePoints": 5, "customMarkingAlgorithm": "", "marks": "2", "useCustomName": false, "answer": "{all}(x+{multiall/all/2})^2+{-all*(multiall/all/2)^2+odds3-evens2}", "showFeedbackIcon": true, "scripts": {}, "checkingType": "absdiff", "showCorrectAnswer": true, "failureRate": 1, "checkVariableNames": false, "variableReplacements": [], "customName": ""}], "showFeedbackIcon": true, "prompt": "$\\simplify {{all} x^2+{multiall}x+{odds3-evens2}} =$ [[0]]
", "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "gapfill", "customName": "", "showCorrectAnswer": true, "variableReplacements": []}], "name": "JD's copy of Completing the square", "tags": [], "preamble": {"css": "", "js": ""}, "functions": {}, "metadata": {"description": "Rearrange expressions in the form $ax^2+bx+c$ to $a(x+b)^2+c$.
", "licence": "Creative Commons Attribution 4.0 International"}, "advice": "Completing the square works by noticing that
\n\\[ (x+a)^2 = x^2 + 2ax + a^2 \\]
\nSo when we see an expression of the form $x^2 + 2ax$, we can rewrite it as $(x+a)^2-a^2$.
\nWe 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}$.
\nCheck 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}
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}
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}
First, notice that $\\simplify[basic]{ {all}x^2 + {multiall}x } = \\simplify[basic]{ {all}*( x^2 + {multiall/all} x)}$.
\nThen, 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}