// Numbas version: finer_feedback_settings {"name": "Solving a quadratic equation", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "ungrouped_variables": ["a", "c", "b", "d", "f", "s3", "s2", "s1", "n4", "n2", "disc", "rdis", "n1", "c1", "n3", "rep", "n5", "d1"], "name": "Solving a quadratic equation", "tags": ["algebra", "factorisation", "Factorisation", "find roots of a quadratic equation", "quadratic formula", "quadratics", "roots of a quadratic equation", "solving a quadratic equation", "solving equations", "Solving equations"], "preamble": {"css": "", "js": ""}, "advice": "

There are different ways to solve a quadratic equation.

\n

If you can see how to factorise the quadratic expression then this should be the quickest method.

\n

For this example we have

\n

\\[\\simplify{{a*b} * x ^ 2 + ( {-b*c-a * d}) * x + {c * d} = ({a} * x + { -c}) * ({b} * x + { -d})}\\]

\n

So either \\[\\simplify{ ({a} * x + { -c}) =0} \\  \\text{or} \\ \\ \\simplify{ ({b} * x + { -d})}=0\\]

\n

So the roots are:
\\[x= \\simplify{{n1-n4}/{2*a*b}} \\ \\ \\text{and} \\ \\  x= \\simplify{{n1+n4}/{2*a*b}}  \\]

\n

If you cannot see a factorisation then you can use the quadratic formula:

\n

\\[ x = \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a}\\]

\n

Remember that there are three possible types of solution, depending upon the value of the discriminant $\\Delta=b^2-4ac$.

\n

1. $\\Delta \\gt 0$. The roots are real and distinct

\n

2. $\\Delta=0$. The roots are real and equal. Their common value is $\\displaystyle -\\frac{b}{2a}$

\n

3. $\\Delta \\lt 0$. There are no real roots. (The roots are complex)

\n

For this question the discriminant is $\\Delta = \\simplify[std]{{-n1}^2-4*{a*b*c*d}}=\\var{disc}$. {rdis}

\n

So the {rep} roots are:

\n

\\[ x = \\frac{\\var{n1} - \\sqrt{\\var{disc}}}{\\var{n3}} = \\frac{\\var{n1} - \\var{n4} }{\\var{n3}} = \\simplify{{n1 - n4}/ {n3}} \\ \\ \\text{and} \\ \\  x = \\frac{\\var{n1} + \\sqrt{\\var{disc}}}{\\var{n3}} = \\frac{\\var{n1} + \\var{n4} }{\\var{n3}} = \\simplify{{n1 + n4}/ {n3}} \\]

\n

You could also use the method of completing the square.

\n

First we write:
\\[\\begin{eqnarray} \\simplify{{a*b}x^2+{-n1}x+{c*d}}&=&\\var{n5}\\left(\\simplify{x^2+({-n1}/{a*b})x+ {c*d}/{a*b}}\\right)\\\\ &=&\\var{n5}\\left(\\left(\\simplify{x+({-n1}/{2*a*b})}\\right)^2+ \\simplify{{c*d}/{a*b}-({-n1}/({2*a*b}))^2}\\right)\\\\ &=&\\var{n5}\\left(\\left(\\simplify{x+({-n1}/{2*a*b})}\\right)^2 -\\simplify{ {n2^2}/{4*(a*b)^2}}\\right) \\end{eqnarray} \\]
So we need to solve:
\\[\\begin{eqnarray} \\left(\\simplify{x+({-n1}/{2*a*b})}\\right)^2&\\phantom{{}}& -\\simplify{ {n2^2}/{4*(a*b)^2}}=0\\Rightarrow\\\\ \\left(\\simplify{x+({-n1}/{2*a*b})}\\right)^2&\\phantom{{}}&=\\simplify{ {n2^2}/{4*(a*b)^2}=({abs(n2)}/{2*a*b})^2} \\end{eqnarray}\\]
and get the two {rep} solutions:
\\[\\begin{eqnarray} \\simplify{x+({-n1}/{2*a*b})}&=&\\simplify{-{abs(n2)}/{2*a*b}} \\Rightarrow &x& = \\simplify{({-abs(n2)+n1}/{2*a*b})}\\\\ \\simplify{x+({-n1}/{2*a*b})}&=&\\simplify{({abs(n2)}/{2*a*b})} \\Rightarrow &x& = \\simplify{({n1+abs(n2)}/{2*a*b})} \\end{eqnarray}\\]

\n

\n

See also these Mathcentre leaflets on solving quadratic equations.

\n

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

 \\[\\simplify[std]{{a*b} * x ^ 2 + ( {-b*c-a * d}) * x + {c * d}}=0\\]

\n

Enter the values of the roots as fractions or integers, not as decimals.

\n

Enter the root with the lower value first. If the equation has two equal roots then enter this value in both input boxes.

\n

The root with the lower value is $x=\\;$ [[0]]. The root with the higher value is $x=\\;$ [[1]]

\n

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"notallowed": {"message": "

Input numbers as fractions or integers not as a decimals.

", "showStrings": false, "strings": ["."], "partialCredit": 0}, "vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.0001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "answersimplification": "std", "scripts": {}, "answer": "{n1-n4}/{2*a*b}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}, {"notallowed": {"message": "

Input numbers as fractions or integers not as a decimals.

", "showStrings": false, "strings": ["."], "partialCredit": 0}, "vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.0001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "answersimplification": "std", "scripts": {}, "answer": "{n1+n4}/{2*a*b}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "extensions": [], "statement": "

Find the roots of the following quadratic equation.

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(2..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "c": {"definition": "c1*s3", "templateType": "anything", "group": "Ungrouped variables", "name": "c", "description": ""}, "b": {"definition": "random(1..4)", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": ""}, "d": {"definition": "if((a*d1)^2=(b*c)^2, max(d1+1,random(1..5))*s3,d1*s3)", "templateType": "anything", "group": "Ungrouped variables", "name": "d", "description": ""}, "f": {"definition": "a*b", "templateType": "anything", "group": "Ungrouped variables", "name": "f", "description": ""}, "s3": {"definition": "random(1,-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "s3", "description": ""}, "s2": {"definition": "random(1,-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "s2", "description": ""}, "s1": {"definition": "random(1,-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "s1", "description": ""}, "n4": {"definition": "abs(n2)", "templateType": "anything", "group": "Ungrouped variables", "name": "n4", "description": ""}, "n2": {"definition": "b*c-a*d", "templateType": "anything", "group": "Ungrouped variables", "name": "n2", "description": ""}, "disc": {"definition": "(b*c+a*d)^2-4*a*b*c*d", "templateType": "anything", "group": "Ungrouped variables", "name": "disc", "description": ""}, "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 are real and distinct. ')", "templateType": "anything", "group": "Ungrouped variables", "name": "rdis", "description": ""}, "n1": {"definition": "b*c+a*d", "templateType": "anything", "group": "Ungrouped variables", "name": "n1", "description": ""}, "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))", "templateType": "anything", "group": "Ungrouped variables", "name": "c1", "description": ""}, "n3": {"definition": "2*a*b", "templateType": "anything", "group": "Ungrouped variables", "name": "n3", "description": ""}, "rep": {"definition": "switch(disc=0,'repeated', ' ')", "templateType": "anything", "group": "Ungrouped variables", "name": "rep", "description": ""}, "n5": {"definition": "a*b", "templateType": "anything", "group": "Ungrouped variables", "name": "n5", "description": ""}, "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))", "templateType": "anything", "group": "Ungrouped variables", "name": "d1", "description": ""}}, "metadata": {"description": "

Solve for $x$: $\\displaystyle ax ^ 2 + bx + c=0$.

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "Lois Rollings", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/326/"}]}]}], "contributors": [{"name": "Lois Rollings", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/326/"}]}