// Numbas version: exam_results_page_options {"name": "Maths Support: Completing the square", "navigation": {"onleave": {"action": "none", "message": ""}, "reverse": true, "allowregen": true, "preventleave": false, "browse": true, "showfrontpage": false, "showresultspage": "never"}, "duration": 0.0, "metadata": {"notes": "", "description": "

Two questions on completing the square. The first asks you to express $x^2+ax+b$ in the form $(x+c)^2+d$ for suitable numbers $c$ and $d$. The second asks you to complete the square on the quadratic of the form $ax^2+bx+c$ and then find its roots.

", "licence": "Creative Commons Attribution 4.0 International"}, "timing": {"timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "none", "message": ""}}, "shufflequestions": false, "questions": [], "percentpass": 0.0, "allQuestions": true, "pickQuestions": 0, "type": "exam", "feedback": {"showtotalmark": true, "advicethreshold": 0.0, "showanswerstate": true, "showactualmark": true, "allowrevealanswer": true}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": [{"name": "Complete the square", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}], "functions": {}, "tags": ["Steps", "algebra", "algebraic manipulation", "complete the square", "completing the square", "quadratics", "steps"], "advice": "\n

Given the quadratic $q(x)=\\simplify{x^2+{2*a}x+ {a^2+b}}$ we complete the square by:

\n

1. Halving the coefficient of $x$ gives $\\var{a}$

\n

2. Work out $\\simplify[all]{p(x)=(x+{a})^2=x^2+{2*a}x+{a^2}}$.
This gives the first two terms of $q(x)$.

\n

3. But the constant term $\\simplify[all]{{a^2}}$ in $p(x)$ is not the same as in $q(x)$, so we need to adjust by adding on $\\simplify[std,!fractionNumbers]{{a^2+b}-{a^2}={b}}$ to $p(x)$.
Hence we get \\[q(x) = \\simplify[all]{p(x)+{b} = (x+{a})^2+{b}}=\\simplify[all]{ (x+{a})^2+{b}}\\]

\n ", "rulesets": {"std": ["all", "!collectNumbers", "fractionNumbers", "!noLeadingMinus"]}, "parts": [{"stepspenalty": 1.0, "prompt": "

$\\simplify{x^2+{2*a}x+ {a^2+b}} = \\phantom{{}}$ [[0]].

", "gaps": [{"notallowed": {"message": "

Input your answer in the form $(x+a)^2+b$.

", "showstrings": false, "strings": ["x^2", "x*x", "x x", "x(", "x*("], "partialcredit": 0.0}, "checkingaccuracy": 0.0001, "vsetrange": [0.0, 1.0], "vsetrangepoints": 5.0, "checkingtype": "absdiff", "answersimplification": "std", "marks": 2.0, "answer": "(x+{a})^2+{b}", "type": "jme", "musthave": {"message": "

please input in the form $(x+a)^2+b$

", "showstrings": false, "strings": ["(", ")", "^"], "partialcredit": 0.0}}], "steps": [{"prompt": "\n

Given the quadratic $q(x)=\\simplify{x^2+{2*a}x+ {a^2+b}}$ we complete the square by:

\n

1. Halving the coefficient of $x$ gives $\\var{a}$

\n

2. Work out $\\simplify[all]{p(x)=(x+{a})^2=x^2+{2*a}x+{a^2}}$.
This gives the first two terms of $q(x)$.

\n

3. But the constant term $\\simplify[all]{{a^2}}$ in $p(x)$ is not the same as in $q(x)$ – so we need to adjust by adding on a suitable constant to $p(x)$.

\n ", "type": "information", "marks": 0.0}], "marks": 0.0, "type": "gapfill"}], "statement": "\n

Put the following quadratic expression in the form $(x+a)^2+b$ for suitable numbers $a$ and $b$.

\n

Note that you have to input your answer in the form $(x+a)^2+b$  and  the numbers $a,\\;b$ must be input exactly.

\n ", "variable_groups": [], "progress": "ready", "type": "question", "variables": {"a": {"definition": "s1*random(1.0..9.5#0.5)", "name": "a"}, "s1": {"definition": "random(1,-1)", "name": "s1"}, "b": {"definition": "random(1..20)-a^2", "name": "b"}}, "metadata": {"notes": "\n \t\t

5/08/2012:

\n \t\t

Added tags.

\n \t\t

Added description.

\n \t\t

Checked calculation.OK.

\n \t\t", "description": "

Find $c$ and $d$ such that $x^2+ax+b = (x+c)^2+d$.

", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Complete the square. (Video)", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}], "functions": {}, "tags": ["Steps", "algebra", "algebraic manipulation", "complete the square", "completing the square", "quadratics", "roots of a polynomial", "roots of a quadratic", "solving equations", "solving quadratic equation", "steps", "video"], "advice": "\n \n \n

Completing the square for the quadratic expression $\\simplify{{a*b}x^2+{-n1}x+{c*d}}$
\\[\\begin{eqnarray}\n \n \\simplify{{a*b}x^2+{-n1}x+{c*d}}&=&\\var{n5}\\left(\\simplify{x^2+({-n1}/{a*b})x+ {c*d}/{a*b}}\\right)\\\\\n \n &=&\\var{n5}\\left(\\left(\\simplify{x+({-n1}/{2*a*b})}\\right)^2+ \\simplify{{c*d}/{a*b}-({-n1}/({2*a*b}))^2}\\right)\\\\\n \n &=&\\var{n5}\\left(\\left(\\simplify{x+({-n1}/{2*a*b})}\\right)^2 -\\simplify{ {n2^2}/{4*(a*b)^2}}\\right)\\\\\n \n &=&\\var{n5}\\left(\\simplify{x+({-n1}/{2*n5})}\\right)^2 -\\simplify{ {n2^2}/{4*(n5)}}\n \n \\end{eqnarray}\n \n \\]
So to solve $\\simplify{{a*b}x^2+{-n1}x+{c*d}}=0$ we have to solve:
\\[\\begin{eqnarray}\n \n \\left(\\simplify{x+({-n1}/{2*a*b})}\\right)^2&\\phantom{{}}& -\\simplify{ {n2^2}/{4*(a*b)^2}}=0\\Rightarrow\\\\\n \n \\left(\\simplify{x+({-n1}/{2*a*b})}\\right)^2&\\phantom{{}}&=\\simplify{ {n2^2}/{4*(a*b)^2}=({abs(n2)}/{2*a*b})^2}\n \n \\end{eqnarray}\\]
So we get the two {rep} solutions:
\\[\\begin{eqnarray}\n \n \\simplify{x+({-n1}/{2*a*b})}&=&\\simplify{{abs(n2)}/{2*a*b}} \\Rightarrow &x& = \\simplify{({abs(n2)+n1}/{2*a*b})}\\\\\n \n \\simplify{x+({-n1}/{2*a*b})}&=&\\simplify{-({abs(n2)}/{2*a*b})} \\Rightarrow &x& = \\simplify{({n1-abs(n2)}/{2*a*b})}\n \n \\end{eqnarray}\\]

\n \n \n ", "rulesets": {"std": ["all", "!collectNumbers", "fractionNumbers", "!noLeadingMinus"]}, "parts": [{"stepspenalty": 1.0, "prompt": "

\\[q(x)=\\simplify[std]{{a*b} * x ^ 2 + ( {-b*c-a * d}) * x + {c * d}}\\]
Write $q(x) = a(x+b)^2+c\\;\\;$ for fractions or integers $a$, $b$, $c$.

\n

$q(x)=\\;$ [[0]]

\n

You can get more information on completing the square by clicking on Show steps. You will lose 1 mark if you do so.

\n

You will also find a video covering the use of completing the square in solving a quadratic equation.

\n

Input all numbers as fractions or integers and not as decimals.

", "gaps": [{"notallowed": {"message": "

Write in the form $a(x+b)^2+c$ without using decimals.

", "showstrings": false, "strings": [".", "x*x", "x x", "x(", "x (", ")x", ") x"], "partialcredit": 0.0}, "checkingaccuracy": 0.0001, "vsetrange": [0.0, 1.0], "vsetrangepoints": 5.0, "checkingtype": "absdiff", "answersimplification": "std", "marks": 2.0, "answer": "{n5}(x+({-n1}/{2*n5}))^2-{n2^2}/{4*n5}", "type": "jme", "musthave": {"message": "

write in the form $a(x+b)^2+c$

", "showstrings": false, "strings": ["(", ")", "^"], "partialcredit": 0.0}}], "steps": [{"prompt": "

Given the quadratic $\\simplify{{a*b} * x ^ 2 + ( {-b*c-a * d}) * x + {c * d}}$ we complete the square by:

\n

1. Writing the quadratic as \\[\\var{n5}\\left(\\simplify{x^2+({-n1}/{n5})x+ {c*d}/{n5}}\\right)\\]

\n

2. Then complete the square for the quadratic \\[\\simplify{x^2+({-n1}/{n5})x+ {c*d}/{n5}}\\]

\n

3. Remember to multiply by $\\var{n5}$ the expression found from the second stage.

\n

The following video steps through a similar problem.

\n

\n

 

", "type": "information", "marks": 0.0}], "marks": 0.0, "type": "gapfill"}, {"prompt": "\n

Now find the roots of the quadratic equation $\\simplify{{a*b}x^2+{-n1}x+{c*d}}=0$.

\n

The least root is $x=\\;$ [[0]]. The greatest root is $x=\\;$ [[1]].

\n

Input the roots as fractions or integers not as decimals.

\n ", "gaps": [{"notallowed": {"message": "

Input numbers as fractions or integers not as decimals.

", "showstrings": false, "strings": ["."], "partialcredit": 0.0}, "checkingaccuracy": 0.0001, "vsetrange": [0.0, 1.0], "vsetrangepoints": 5.0, "checkingtype": "absdiff", "answersimplification": "std", "marks": 1.0, "answer": "{n1-n4}/{2*a*b}", "type": "jme"}, {"notallowed": {"message": "

Input numbers as fractions or integers not as  decimals.

", "showstrings": false, "strings": ["."], "partialcredit": 0.0}, "checkingaccuracy": 0.0001, "vsetrange": [0.0, 1.0], "vsetrangepoints": 5.0, "checkingtype": "absdiff", "answersimplification": "std", "marks": 1.0, "answer": "{n1+n4}/{2*a*b}", "type": "jme"}], "type": "gapfill", "marks": 0.0}], "statement": "

Complete the square for the quadratic expression $q(x)$ given below by writing it in the form \\[a(x+b)^2+c\\] for numbers $a,\\;b$ and $c$.

\n

Hence, or otherwise, find both roots of the equation $q(x)=0$.

\n

 

", "variable_groups": [], "progress": "ready", "type": "question", "variables": {"a": {"definition": "random(2..5)", "name": "a"}, "c": {"definition": "c1*s3", "name": "c"}, "b": {"definition": "random(1..4)", "name": "b"}, "d": {"definition": "if(d1=b*c/a, max(d1+1,random(1..5))*s3,d1*s3)", "name": "d"}, "f": {"definition": "a*b", "name": "f"}, "s3": {"definition": "random(1,-1)", "name": "s3"}, "s2": {"definition": "random(1,-1)", "name": "s2"}, "s1": {"definition": "random(1,-1)", "name": "s1"}, "n5": {"definition": "a*b", "name": "n5"}, "disc": {"definition": "(b*c+a*d)^2-4*a*b*c*d", "name": "disc"}, "c1": {"definition": "switch(f=1, random(1..6),f=2,random(1,3,5,7,9),f=3,random(1,2,5,7,8),f=4,random(1,3,5,7,9),f=6, random(1,5,7,8),f=9,random(1,2,4,7,8),f=8,random(1,3,5,7,9),f=12,random(1,5,7),random(1,3,5,7))", "name": "c1"}, "rep": {"definition": "switch(disc=0,'repeated', ' ')", "name": "rep"}, "n1": {"definition": "b*c+a*d", "name": "n1"}, "n2": {"definition": "b*c-a*d", "name": "n2"}, "n3": {"definition": "2*a*b", "name": "n3"}, "n4": {"definition": "abs(n2)", "name": "n4"}, "rdis": {"definition": "switch(disc=0,'The discriminant is '+ 0+' and so we get two repeated roots in this case.',disc<0, 'There are no real roots.','The roots exist and are distinct. ')", "name": "rdis"}, "d1": {"definition": "switch(f=1, random(1..6),f=2,random(1,3,5,7,9),f=3,random(1,2,5,7,8),f=4,random(1,3,5,7,9),f=6, random(1,5,7,8),f=9,random(1,2,4,7,8),f=8,random(1,3,5,7,9),f=12,random(1,5,7),random(1,3,5,7))", "name": "d1"}}, "metadata": {"notes": "\n \t\t

5/08/2012:

\n \t\t

Added tags.

\n \t\t

Added description.

\n \t\t

Corrected variable value n2 to ensure that there are no repeated roots.

\n \t\t

Checked calculation.OK.

\n \t\t

Improved display in content areas.

\n \t\t", "description": "

Find $p$ and $q$ such that $ax^2+bx+c = a(x+p)^2+q$. 

\n

Hence, or otherwise, find roots of  $ax^2+bx+c=0$.

\n

Includes a video which shows how to solve a quadratic by completing the square.

", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "extensions": [], "custom_part_types": [], "resources": []}