// Numbas version: exam_results_page_options {"name": "Complete the square and find solutions", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "variables": {"bits": {"templateType": "anything", "description": "
After completing the square, the expression will have the form $(x + \\mathrm{bits}[0])^2 - \\mathrm{bits}[1]^2$.
", "definition": "sort(shuffle(1..9)[0..2])", "name": "bits", "group": "Ungrouped variables"}, "big": {"templateType": "anything", "description": "The constant term in the expanded quadratic.
", "definition": "bits[0]^2-bits[1]^2", "name": "big", "group": "Ungrouped variables"}, "sml": {"templateType": "anything", "description": "The coefficient of $x$ in the expanded quadratic.
", "definition": "2*bits[0]", "name": "sml", "group": "Ungrouped variables"}}, "name": "Complete the square and find solutions", "parts": [{"type": "gapfill", "showCorrectAnswer": true, "unitTests": [], "prompt": "Write the following expression in the form $a(x+b)^2-c$.
\n$\\simplify {x^2+{sml}x+{big}} = $ [[0]]
", "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "sortAnswers": false, "scripts": {}, "customMarkingAlgorithm": "", "gaps": [{"showCorrectAnswer": true, "checkVariableNames": false, "useCustomName": false, "unitTests": [], "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "musthave": {"partialCredit": 0, "showStrings": false, "strings": [")^2"], "message": "It doesn't look like you've completed the square.
"}, "variableReplacementStrategy": "originalfirst", "failureRate": 1, "notallowed": {"partialCredit": 0, "showStrings": false, "strings": ["x^2"], "message": "It doesn't look like you've completed the square.
"}, "vsetRange": [0, 1], "variableReplacements": [], "customMarkingAlgorithm": "", "vsetRangePoints": 5, "adaptiveMarkingPenalty": 0, "customName": "", "type": "jme", "checkingAccuracy": 0.001, "answer": "(x+{bits[0]})^2-{bits[1]^2}", "valuegenerators": [{"value": "", "name": "x"}], "checkingType": "absdiff", "scripts": {}, "showPreview": true, "marks": 1}], "marks": 0, "variableReplacements": [], "useCustomName": false, "adaptiveMarkingPenalty": 0, "customName": ""}, {"type": "gapfill", "showCorrectAnswer": true, "unitTests": [], "prompt": "Now solve the quadratic equation
\n\\[ \\simplify {x^2+{sml}x+{big}} = 0\\text{.} \\]
\n$x_1=$ [[0]]
\nor
\n$x_2=$ [[1]]
", "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "sortAnswers": true, "scripts": {}, "customMarkingAlgorithm": "", "gaps": [{"correctAnswerFraction": false, "mustBeReduced": false, "showCorrectAnswer": true, "unitTests": [], "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "minValue": "{-bits[0]-bits[1]}", "maxValue": "{-bits[0]-bits[1]}", "showFractionHint": true, "variableReplacements": [], "customMarkingAlgorithm": "", "adaptiveMarkingPenalty": 0, "customName": "", "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "useCustomName": false, "correctAnswerStyle": "plain", "scripts": {}, "marks": 1}, {"correctAnswerFraction": false, "mustBeReduced": false, "showCorrectAnswer": true, "unitTests": [], "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "allowFractions": false, "minValue": "{-bits[0]+bits[1]}", "maxValue": "{-bits[0]+bits[1]}", "showFractionHint": true, "variableReplacements": [], "customMarkingAlgorithm": "", "adaptiveMarkingPenalty": 0, "customName": "", "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "mustBeReducedPC": 0, "useCustomName": false, "correctAnswerStyle": "plain", "scripts": {}, "marks": 1}], "marks": 0, "variableReplacements": [], "useCustomName": false, "adaptiveMarkingPenalty": 0, "customName": ""}], "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$.
\nRewrite $x^2+\\var{sml}x$ as $\\simplify[basic]{ (x+{sml/2})^2 - {sml/2}^2}$.
\n\\begin{align}
\\simplify[basic]{x^2+{sml}x+{big}} &= \\simplify[basic]{(x+{sml/2})^2-{(sml/2)}^2+{big}} \\\\
&= \\simplify[basic]{(x+{sml/2})^2+{-(sml/2)^2+big}} \\text{.}
\\end{align}
We showed above that
\n\\[ \\simplify[basic]{x^2+{sml}x+{big}} = 0 \\]
\nis equivalent to
\n\\[ \\simplify[basic]{(x+{bits[0]})^2-{bits[1]^2}} = 0 \\text{.} \\]
\nWe can then rearrange this equation to solve for $x$.
\n\\begin{align}
\\simplify{(x+{bits[0]})^2-{(bits[1])^2} } &= 0 \\\\
(x+\\var{bits[0]})^2 &= \\var{bits[1]^2} \\\\
x+\\var{bits[0]} &= \\pm \\var{bits[1]} \\\\
x &= -\\var{bits[0]} \\pm \\var{bits[1]} \\\\[2em]
x_1 &= \\var{-bits[0]-bits[1]} \\text{,}\\\\
x_2 &= \\var{-bits[0]+bits[1]} \\text{.}
\\end{align}
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.
", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "Solve a quadratic equation by completing the square. The roots are not pretty!
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}]}