// 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}, "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\$

", "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]]

", "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": ["^2", ")", "(x"], "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": "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$.

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": [], "variables": {"evens2": {"templateType": "anything", "description": "", "definition": "random(10..30 #2 except evens1)", "name": "evens2", "group": "Odds and Evens"}, "evens1": {"templateType": "anything", "description": "", "definition": "random(10..30 #2)", "name": "evens1", "group": "Odds and Evens"}, "evens3": {"templateType": "anything", "description": "", "definition": "random(2..30 #2 except evens1 evens2)", "name": "evens3", "group": "Odds and Evens"}, "odds2": {"templateType": "anything", "description": "", "definition": "random(11..30 #2 except odds)", "name": "odds2", "group": "Odds and Evens"}, "big": {"templateType": "anything", "description": "", "definition": "random(30..50)", "name": "big", "group": "Ungrouped variables"}, "all": {"templateType": "anything", "description": "", "definition": "random(2..6)", "name": "all", "group": "Ungrouped variables"}, "multiall2": {"templateType": "anything", "description": "", "definition": "all2*random(2..10 #2)", "name": "multiall2", "group": "Ungrouped variables"}, "sml": {"templateType": "anything", "description": "", "definition": "random(2..6#2)", "name": "sml", "group": "Ungrouped variables"}, "multiall": {"templateType": "anything", "description": "", "definition": "all*random(2..10#2)", "name": "multiall", "group": "Ungrouped variables"}, "odds3": {"templateType": "anything", "description": "", "definition": "random(11..30 #2 except odds odds2)", "name": "odds3", "group": "Odds and Evens"}, "odds": {"templateType": "anything", "description": "", "definition": "random(11..30 #2)", "name": "odds", "group": "Odds and Evens"}, "all2": {"templateType": "anything", "description": "", "definition": "random(2..6 except all)", "name": "all2", "group": "Ungrouped variables"}}, "rulesets": {}, "variable_groups": [{"variables": ["evens1", "evens2", "evens3", "odds", "odds2", "odds3"], "name": "Odds and Evens"}], "variablesTest": {"maxRuns": 100, "condition": ""}, "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/"}, {"name": "JD Ichwan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3389/"}]}]}], "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/"}, {"name": "JD Ichwan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3389/"}]}