<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>Linear dependence</text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<p>Let \({\bf v_{1}}\), \({\bf v_2}\), \({\bf v_3}\) be the following vectors: 
\[ {\bf v_{1}} = {@v1@},\quad {\bf v_{2}} = {@v2@},\quad {\bf v_{3}} = {@v3@}. \] 
Find the values for \(\lambda_1\) and \(\lambda_2\) such that
\[{\bf v_3} = \lambda_1 {\bf v_1} + \lambda_2 {\bf v_2} .\]
If such values do not exist, enter <code>null</code> for all entries. </p>
\(\lambda_1\) = [[input:ans1]] [[validation:ans1]] <br/>
\(\lambda_2\) = [[input:ans2]] [[validation:ans2]]]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text><![CDATA[<p>If \[{\bf v_3} = \lambda_1 {\bf v_1} + \lambda_2 {\bf v_2},\] we have 3 equations in 2 unknowns. <br />For there to be a solution for \(\lambda_1\) and \(\lambda_2\) the vectors \({\bf v_1},{\bf v_2}\) and \({\bf v_3}\) must be linearly dependent. <br /> This requires the determinant of the matrix of vectors to be zero. <br /> The matrix is \[{@matrixv312@}\] with a determinant of \( {@detmatrix@}\) <br /> Therefore the vectors are not linearly dependent and there is no solution for \(\lambda_1\) and \(\lambda_2\)</p>]]></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2023010400</text>
    </stackversion>
    <questionvariables>
      <text>Au:matrix([rand_with_step(-1,1,2),ev(rand(4)+1),ev(rand(4)+1)],[0,rand_with_step(-1,1,2),ev(rand(4)+1)],[0,0,rand_with_step(-1,1,2)]);
Bu:matrix([rand_with_step(-1,1,2),ev(rand(4)+1),ev(rand(4)+1)],[0,rand_with_step(-1,1,2),ev(rand(4)+1)],[0,0,rand_with_step(-1,1,2)]);
Amat:ev(transpose(Au). Bu);
v1:col(Amat,1);
v2:col(Amat,2);
ind1:rand(2)+1;
ind2:ind1 + 1;
v1[ind1,1]:0;
v2[ind2,1]:0;
n1:rand(9)+1;
n2:rand(9)+1;
v3:ev(n1*v1+n2*v2);
v3[2,1]:v3[2,1]+1;
correctanswer:[null,null];
matrixv312:matrix([v1[1,1],v2[1,1],v3[1,1]],[v1[2,1],v2[2,1],v3[2,1]],[v1[3,1],v2[3,1],v3[3,1]]);
detmatrix:determinant(matrixv312);</text>
    </questionvariables>
    <specificfeedback format="html">
      <text><![CDATA[<p>[[feedback:Result]]</p>]]></text>
    </specificfeedback>
    <questionnote format="moodle_auto_format">
      <text>\({@v1@}, {@v2@}, {@v3@}\)</text>
    </questionnote>
    <questiondescription format="moodle_auto_format">
      <text>This question is distributed as part of the STACK source code as an example. This is licenced as Creative Commons Attribution-ShareAlike 4.0 International License.</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>dot</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>determinant</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>determinant</forbidwords>
      <allowwords/>
      <forbidfloat>1</forbidfloat>
      <requirelowestterms>1</requirelowestterms>
      <checkanswertype>1</checkanswertype>
      <mustverify>1</mustverify>
      <showvalidation>3</showvalidation>
      <options/>
    </input>
    <prt>
      <name>Result</name>
      <value>1.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.5</truescore>
        <truepenalty/>
        <truenextnode>1</truenextnode>
        <trueanswernote>Result-0-T </trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>1</falsenextnode>
        <falseanswernote>Result-0-F </falseanswernote>
        <falsefeedback format="html">
          <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.5</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>Result-1-T </trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>-</falsescoremode>
        <falsescore>0</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>Result-1-F </falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>945039179</deployedseed>
    <deployedseed>891580513</deployedseed>
    <deployedseed>20362872</deployedseed>
    <deployedseed>514956338</deployedseed>
    <deployedseed>419406738</deployedseed>
    <deployedseed>2032958399</deployedseed>
    <deployedseed>2143754516</deployedseed>
    <deployedseed>275899066</deployedseed>
    <deployedseed>723074380</deployedseed>
    <deployedseed>1211726881</deployedseed>
    <deployedseed>1441441108</deployedseed>
    <deployedseed>1979350786</deployedseed>
    <deployedseed>793729752</deployedseed>
    <deployedseed>2063043157</deployedseed>
    <deployedseed>1868492319</deployedseed>
    <deployedseed>1703167180</deployedseed>
    <deployedseed>680335644</deployedseed>
    <deployedseed>1988758674</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]-1</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>correctanswer[2]-1</value>
      </testinput>
      <expected>
        <name>Result</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>Result-1-F</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
