// Numbas version: exam_results_page_options {"name": "Complete the square and find solutions", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"showfrontpage": false, "allowregen": true, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"ungrouped_variables": ["big", "sml", "bits"], "metadata": {"description": "

Solve a quadratic equation by completing the square. The roots are not pretty!

", "licence": "Creative Commons Attribution 4.0 International"}, "rulesets": {}, "name": "Complete the square and find solutions", "tags": [], "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.

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

Rewrite $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}

\n

#### b)

\n

We showed above that

\n

\$\\simplify[basic]{x^2+{sml}x+{big}} = 0 \$

\n

is equivalent to

\n

\$\\simplify[basic]{(x+{bits[0]})^2-{bits[1]^2}} = 0 \\text{.} \$

\n

We 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} ", "functions": {}, "parts": [{"variableReplacements": [], "variableReplacementStrategy": "originalfirst", "prompt": " Write the following expression in the form a(x+b)^2-c. \n \\simplify {x^2+{sml}x+{big}} =  [[0]] ", "gaps": [{"variableReplacements": [], "variableReplacementStrategy": "originalfirst", "notallowed": {"partialCredit": 0, "showStrings": false, "message": " It doesn't look like you've completed the square. ", "strings": ["x^2"]}, "failureRate": 1, "checkVariableNames": false, "expectedVariableNames": [], "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "(x+{bits[0]})^2-{bits[1]^2}", "marks": 1, "type": "jme", "scripts": {}, "checkingType": "absdiff", "customMarkingAlgorithm": "", "vsetRangePoints": 5, "musthave": {"partialCredit": 0, "showStrings": false, "message": " It doesn't look like you've completed the square. ", "strings": [")^2"]}, "vsetRange": [0, 1], "showPreview": true, "checkingAccuracy": 0.001, "showFeedbackIcon": true, "showCorrectAnswer": true}], "showCorrectAnswer": true, "sortAnswers": false, "extendBaseMarkingAlgorithm": true, "unitTests": [], "marks": 0, "type": "gapfill", "customMarkingAlgorithm": "", "scripts": {}, "showFeedbackIcon": true}, {"variableReplacements": [], "variableReplacementStrategy": "originalfirst", "prompt": " Now solve the quadratic equation \n \\[ \\simplify {x^2+{sml}x+{big}} = 0\\text{.} \

\n

$x_1=$ [[0]]

\n

or

\n

$x_2=$ [[1]]

", "gaps": [{"variableReplacements": [], "mustBeReduced": false, "variableReplacementStrategy": "originalfirst", "minValue": "{-bits[0]-bits[1]}", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "allowFractions": false, "unitTests": [], "notationStyles": ["plain", "en", "si-en"], "marks": 1, "type": "numberentry", "correctAnswerStyle": "plain", "customMarkingAlgorithm": "", "correctAnswerFraction": false, "scripts": {}, "mustBeReducedPC": 0, "maxValue": "{-bits[0]-bits[1]}", "showFeedbackIcon": true}, {"variableReplacements": [], "mustBeReduced": false, "variableReplacementStrategy": "originalfirst", "minValue": "{-bits[0]+bits[1]}", "showCorrectAnswer": true, "extendBaseMarkingAlgorithm": true, "allowFractions": false, "unitTests": [], "notationStyles": ["plain", "en", "si-en"], "marks": 1, "type": "numberentry", "correctAnswerStyle": "plain", "customMarkingAlgorithm": "", "correctAnswerFraction": false, "scripts": {}, "mustBeReducedPC": 0, "maxValue": "{-bits[0]+bits[1]}", "showFeedbackIcon": true}], "showCorrectAnswer": true, "sortAnswers": true, "extendBaseMarkingAlgorithm": true, "unitTests": [], "marks": 0, "type": "gapfill", "customMarkingAlgorithm": "", "scripts": {}, "showFeedbackIcon": true}], "variablesTest": {"maxRuns": 100, "condition": ""}, "type": "question", "variable_groups": [], "preamble": {"css": "", "js": ""}, "extensions": [], "variables": {"big": {"templateType": "anything", "description": "

The constant term in the expanded quadratic.

", "group": "Ungrouped variables", "name": "big", "definition": "bits[0]^2-bits[1]^2"}, "sml": {"templateType": "anything", "description": "

The coefficient of $x$ in the expanded quadratic.

", "group": "Ungrouped variables", "name": "sml", "definition": "2*bits[0]"}, "bits": {"templateType": "anything", "description": "

After completing the square, the expression will have the form $(x + \\mathrm{bits}[0])^2 - \\mathrm{bits}[1]^2$.

", "group": "Ungrouped variables", "name": "bits", "definition": "sort(shuffle(1..9)[0..2])"}}, "contributors": [{"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/", "name": "Christian Lawson-Perfect"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/", "name": "Chris Graham"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2810/", "name": "Johnny Yi"}]}]}], "contributors": [{"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/", "name": "Christian Lawson-Perfect"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/", "name": "Chris Graham"}, {"profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2810/", "name": "Johnny Yi"}]}