<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>3.3.6.2B Solve cubic given a root</text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p class="HELM_exercise">Exercise</p>
<p>In this exercise we will solve the cubic {@eqn=0@} given that \(x={@root@}\) is a root.<br></p>
<p>The cubic can therefore be expressed as<br></p><p></p><p>\( \qquad {@eqn = (x - root)*(a*x^2 + b*x + c)@} \)</p><p>where \(a\), \(b\), and \(c\) are constants. These can be found by expanding the right-hand side.</p>
<p>Expand the right-hand side:</p>
<p>\( \qquad {@eqn@} = (\) [[input:ans1]] [[validation:ans1]] \() x^3 + (\) [[input:ans2]] [[validation:ans2]] \()x^2 + (\) [[input:ans3]] [[validation:ans3]] \()x + \) [[input:ans4]] [[validation:ans4]].&nbsp;[[feedback:prt1]]</p><p>We identify the unknown coefficients by focusing on the greatest and least powers first.<br></p><p>Equate coefficients of \(x^3\) to find \(a\):&nbsp;[[input:ans5]] [[validation:ans5]].<br></p><p>Equate constant terms to find \(c\):&nbsp;[[input:ans6]] [[validation:ans6]].<br></p><p>With this we can now solve for \(b\).<br></p><p>Equate coefficients of \(x^2\) to find \(b\):&nbsp;[[input:ans7]] [[validation:ans7]].<br></p><p></p><p>This enables us to write the equation as \({@(x-root)*quad=0@}\) so \({@x-root=0@}\) or \({@quad@}=0\).<br></p><p></p><p>Now solve the quadratic and state all three roots: [[input:ans8]] [[validation:ans8]]&nbsp;</p><p><b>Give your answer as a set of precise expressions.</b></p><br><p></p><p></p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text><![CDATA[<p>We are given the cubic \[{@eqn@} = {@(x - root)*(a*x^2 + b*x + c)@}.\] If we expand the RHS we obtain \[{@eqn@} = {@expand((x - root)*(a*x^2 + b*x + c))@}.\] Collecting like-terms we get \[{@eqn@} = {@ta1*x^3 + ta2*x^2 + ta3*x + ta4@}.\]</p>

<p>If we equate the coefficients of the LHS and RHS of the above equation, we obtain \(a = 1\), \(b = {@-2*aa@}\) and \(c={@aa^2-bb@}\).</p>

<p>This enables us to write the equation as \({@(x-root)*quad=0@}\) so \({@x-root=0@}\) or \({@quad@}=0\).</p>

<p>The quadratic equation can be solved using the quadratic formula to obtain \(x={@x2@}\) and \(x={@x3@}\).</p><p>Thus the three roots of \({@eqn=0@}\) are \(x={@x1@}\), \(x={@x2@}\), and \(x={@x3@}.\)</p>]]></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0.1</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2021072200</text>
    </stackversion>
    <questionvariables>
      <text>root: -(rand(2)+3);
aa: -(rand(3)+4);
bb: rand(4)+21;
x1: root;
x2: aa+sqrt(bb);
x3: aa-sqrt(bb);

eqn: x^3 - (2*aa + root)*x^2 + (aa^2 - bb + 2*aa*root)*x - aa^2*root + bb*root;
quad: x^2 - 2*aa*x + aa^2 - bb;

ta1: a;
ta2: b-root*a;
ta3: c-root*b;
ta4: -root*c;
ta: setify([x1,x2,x3]);</text>
    </questionvariables>
    <specificfeedback format="html">
      <text/>
    </specificfeedback>
    <questionnote format="moodle_auto_format">
      <text>\({@eqn=0@}, \quad x={@ta@}\)</text>
    </questionnote>
    <questiondescription format="moodle_auto_format">
      <text/>
    </questiondescription>
    <questionsimplify>1</questionsimplify>
    <assumepositive>0</assumepositive>
    <assumereal>0</assumereal>
    <prtcorrect format="html">
      <text><![CDATA[<span style="font-size: 1.5em; color:green;"><i class="fa fa-check"></i></span> Correct answer, well done.]]></text>
    </prtcorrect>
    <prtpartiallycorrect format="html">
      <text><![CDATA[<span style="font-size: 1.5em; color:orange;"><i class="fa fa-adjust"></i></span> Your answer is partially correct.]]></text>
    </prtpartiallycorrect>
    <prtincorrect format="html">
      <text><![CDATA[<span style="font-size: 1.5em; color:red;"><i class="fa fa-times"></i></span> Incorrect answer.]]></text>
    </prtincorrect>
    <decimals>.</decimals>
    <scientificnotation>*10</scientificnotation>
    <multiplicationsign>none</multiplicationsign>
    <sqrtsign>1</sqrtsign>
    <complexno>i</complexno>
    <inversetrig>cos-1</inversetrig>
    <logicsymbol>lang</logicsymbol>
    <matrixparens>[</matrixparens>
    <isbroken>0</isbroken>
    <variantsselectionseed/>
    <input>
      <name>ans1</name>
      <type>algebraic</type>
      <tans>ta1</tans>
      <boxsize>3</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans2</name>
      <type>algebraic</type>
      <tans>ta2</tans>
      <boxsize>5</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans3</name>
      <type>algebraic</type>
      <tans>ta3</tans>
      <boxsize>5</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans4</name>
      <type>algebraic</type>
      <tans>ta4</tans>
      <boxsize>3</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans5</name>
      <type>numerical</type>
      <tans>1</tans>
      <boxsize>3</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans6</name>
      <type>numerical</type>
      <tans>aa^2 - bb</tans>
      <boxsize>3</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans7</name>
      <type>numerical</type>
      <tans>-2*aa</tans>
      <boxsize>3</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans8</name>
      <type>algebraic</type>
      <tans>ta</tans>
      <boxsize>15</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint>{x1,x2,x3}</syntaxhint>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>0</requirelowestterms>
      <checkanswertype>0</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <prt>
      <name>prt1</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>1</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans1</sans>
        <tans>a</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.1250000</truescore>
        <truepenalty/>
        <truenextnode>2</truenextnode>
        <trueanswernote>prt1-2-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>2</falsenextnode>
        <falseanswernote>prt1-2-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>2</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans2</sans>
        <tans>b-root*a</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.1250000</truescore>
        <truepenalty/>
        <truenextnode>3</truenextnode>
        <trueanswernote>prt1-3-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>3</falsenextnode>
        <falseanswernote>prt1-3-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>3</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans3</sans>
        <tans>c-root*b</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.1250000</truescore>
        <truepenalty/>
        <truenextnode>4</truenextnode>
        <trueanswernote>prt1-4-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>4</falsenextnode>
        <falseanswernote>prt1-4-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>4</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans4</sans>
        <tans>-root*c</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.1250000</truescore>
        <truepenalty/>
        <truenextnode>5</truenextnode>
        <trueanswernote>prt1-5-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>5</falsenextnode>
        <falseanswernote>prt1-5-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>5</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans5</sans>
        <tans>1</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.1250000</truescore>
        <truepenalty/>
        <truenextnode>6</truenextnode>
        <trueanswernote>prt1-6-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>6</falsenextnode>
        <falseanswernote>prt1-6-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>6</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans6</sans>
        <tans>aa^2 - bb</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.1250000</truescore>
        <truepenalty/>
        <truenextnode>7</truenextnode>
        <trueanswernote>prt1-7-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>7</falsenextnode>
        <falseanswernote>prt1-7-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>7</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans7</sans>
        <tans>-2*aa</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.1250000</truescore>
        <truepenalty/>
        <truenextnode>8</truenextnode>
        <trueanswernote>prt1-8-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>8</falsenextnode>
        <falseanswernote>prt1-8-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
      <node>
        <name>8</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans8</sans>
        <tans>ta</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.1250000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt1-9-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt1-9-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>1900202949</deployedseed>
    <deployedseed>890837031</deployedseed>
    <deployedseed>411054737</deployedseed>
    <deployedseed>868330198</deployedseed>
    <deployedseed>73246058</deployedseed>
    <deployedseed>1281595206</deployedseed>
    <deployedseed>1221616515</deployedseed>
    <deployedseed>373093062</deployedseed>
    <deployedseed>1479049162</deployedseed>
    <deployedseed>1008408641</deployedseed>
    <deployedseed>435527133</deployedseed>
    <deployedseed>1353930417</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ta1</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>ta2</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>ta3</value>
      </testinput>
      <testinput>
        <name>ans4</name>
        <value>ta4</value>
      </testinput>
      <testinput>
        <name>ans5</name>
        <value>1</value>
      </testinput>
      <testinput>
        <name>ans6</name>
        <value>aa^2 - bb</value>
      </testinput>
      <testinput>
        <name>ans7</name>
        <value>-2*aa</value>
      </testinput>
      <testinput>
        <name>ans8</name>
        <value>ta</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt1-9-T</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>2</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ev(ta1+1,simp)</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>ev(ta2+1,simp)</value>
      </testinput>
      <testinput>
        <name>ans3</name>
        <value>ev(ta3+1,simp)</value>
      </testinput>
      <testinput>
        <name>ans4</name>
        <value>ev(ta4+1,simp)</value>
      </testinput>
      <testinput>
        <name>ans5</name>
        <value>0</value>
      </testinput>
      <testinput>
        <name>ans6</name>
        <value>0</value>
      </testinput>
      <testinput>
        <name>ans7</name>
        <value>0</value>
      </testinput>
      <testinput>
        <name>ans8</name>
        <value>{0,0,0}</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>prt1-9-F</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
