<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>8.1.4.1 (not in quiz): Solving two equations in two unknowns</text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Use Cramer's rule to find the solution of the system: <br>  \[ {@eqns[1]@}\ =\ {@bmat[1,1]@} , \] \[ {@eqns[2]@}\ =\ {@bmat[2,1]@} , \] <br> \(x=\) [[input:ans1]]&nbsp;[[validation:ans1]]<br> \(y=\) [[input:ans2]]&nbsp;[[validation:ans2]]<br>&nbsp;[[feedback:Result]]</p>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text><![CDATA[<p>Cramer's rule states that \(x = \frac{\Delta_{x}}{\Delta}\) where \(\Delta\) is the determinant of the matrix and \(\Delta_{x}\) is the determinant of the matrix with the x column replaced by the numbers on the right hand side of
the equations and similarly \(y = \frac{\Delta_{y}}{\Delta}\). <br>
</p><p></p>
<p>Therefore for the system, <br> \[{@eqns[1]@}\ =\ {@bmat[1,1]@} , \] \[ {@eqns[2]@}\ =\ {@bmat[2,1]@} , \]&nbsp;&nbsp;<br> \[\Delta = \det{@Amat@}={@D@},\]<br> \[\Delta_{x} = \det{@Amatx@}={@Dx@},\] and<br> \[\Delta_{y} = \det{@Amaty@}={@Dy@},\]</p>
<p>where the notation \(\det A = |A|\) is the determinant of a matrix \(A\).&nbsp;<br></p>
<p> Hence, \[x=\frac{@Dx@}{@D@} = {@Dx/D@},\] and<br> </p>
<p>\[y=\frac{@Dy@}{@D@} = {@Dy/D@}.\]&nbsp;&nbsp;</p>]]></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0.1</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2020120600</text>
    </stackversion>
    <questionvariables>
      <text>ordergreat(x,y);
pos:rand(2)+1;
 vdet:rand(6)+2;
 Au:matrix([0,0],[0,0]);
 Au:matrix([rand_with_step(-1,1,2),ev(rand(9)-4)],[0,rand_with_step(-1,1,2)]);
 Au[pos,pos]:vdet;
 Bu:matrix([rand_with_step(-1,1,2),ev(rand(9)-4)],[0,rand_with_step(-1,1,2)]);
 Amat:ev(transpose(Au).Bu);
 bmat:matrix([rand(5)+1],[rand(5)+1]);
 xy:matrix([x],[y]);
 eqns[1]:ev(Amat.xy)[1,1];
 eqns[2]:ev(Amat.xy)[2,1];
 truesolm:ev(invert(Amat) . bmat);
 correctanswer:[truesolm[1,1],truesolm[2,1]];
 D:determinant(Amat);
 Amatx:copymatrix(Amat);
 Amatx[1,1]:ev(bmat[1,1]);
 Amatx[2,1]:ev(bmat[2,1]);
 Dx:determinant(Amatx);
 Amaty:copymatrix(Amat);
 Amaty[1,2]:ev(bmat[1,1]);
 Amaty[2,2]:ev(bmat[2,1]);
 Dy:determinant(Amaty);</text>
    </questionvariables>
    <specificfeedback format="html">
      <text/>
    </specificfeedback>
    <questionnote format="moodle_auto_format">
      <text>\[ {@eqns[1]@}\ =\ {@bmat[1,1]@}\]   \[{@eqns[2]@}\ =\ {@bmat[2,1]@} \] gives x,y = {@correctanswer@}</text>
    </questionnote>
    <questiondescription format="moodle_auto_format">
      <text/>
    </questiondescription>
    <questionsimplify>1</questionsimplify>
    <assumepositive>0</assumepositive>
    <assumereal>0</assumereal>
    <prtcorrect format="html">
      <text><![CDATA[<p><span class="correct">Correct answer, well done.</span></p>]]></text>
    </prtcorrect>
    <prtpartiallycorrect format="html">
      <text><![CDATA[<p><span class="partially">Your answer is partially correct.</span></p>]]></text>
    </prtpartiallycorrect>
    <prtincorrect format="html">
      <text><![CDATA[<p><span class="incorrect">Incorrect answer.</span></p>]]></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>correctanswer[1]</tans>
      <boxsize>5</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>1</requirelowestterms>
      <checkanswertype>1</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <input>
      <name>ans2</name>
      <type>algebraic</type>
      <tans>correctanswer[2]</tans>
      <boxsize>5</boxsize>
      <strictsyntax>1</strictsyntax>
      <insertstars>0</insertstars>
      <syntaxhint/>
      <syntaxattribute>0</syntaxattribute>
      <forbidwords/>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>1</requirelowestterms>
      <checkanswertype>1</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <prt>
      <name>Result</name>
      <value>2.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans1</sans>
        <tans>correctanswer[1]</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>0.5000000</truescore>
        <truepenalty/>
        <truenextnode>1</truenextnode>
        <trueanswernote>Result-0-T </trueanswernote>
        <truefeedback format="html">
          <text><![CDATA[<p>Your x-value is correct.</p>]]></text>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>1</falsenextnode>
        <falseanswernote>Result-0-F </falseanswernote>
        <falsefeedback format="html">
          <text><![CDATA[<p>Your x-value is incorrect.</p>]]></text>
        </falsefeedback>
      </node>
      <node>
        <name>1</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans2</sans>
        <tans>correctanswer[2]</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>+</truescoremode>
        <truescore>0.5000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>Result-1-T </trueanswernote>
        <truefeedback format="html">
          <text><![CDATA[<p>Your y-value is correct.</p>]]></text>
        </truefeedback>
        <falsescoremode>+</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>Result-1-F </falseanswernote>
        <falsefeedback format="html">
          <text><![CDATA[<p>Your y-value is incorrect.</p>]]></text>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>1416438987</deployedseed>
    <deployedseed>1424515908</deployedseed>
    <deployedseed>4741691</deployedseed>
    <deployedseed>879644659</deployedseed>
    <deployedseed>1841239305</deployedseed>
    <deployedseed>359355855</deployedseed>
    <deployedseed>138843354</deployedseed>
    <deployedseed>824785688</deployedseed>
    <deployedseed>172333940</deployedseed>
    <deployedseed>1505066948</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>correctanswer[1]</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>correctanswer[2]</value>
      </testinput>
      <expected>
        <name>Result</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>Result-1-T</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>2</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>correctanswer[1]-10</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>correctanswer[2]-10</value>
      </testinput>
      <expected>
        <name>Result</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.1000000</expectedpenalty>
        <expectedanswernote>Result-1-F</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
