<?xml version="1.0" encoding="UTF-8"?>
<quiz>
  <question type="stack">
    <name>
      <text>35.4.4.8 Defective items from a production line</text>
    </name>
    <questiontext format="html">
      <text><![CDATA[<h4 class="HELM_exercise"> Exercise </h4>
<p> Machines \(M_A\) and \(M_B\) produce \({@pca@}\%\) and \({@pcb@}\%\) respectively of the production of a component intended for the motor industry. From experience, it is known that the probability that machine \(M_A\) produces a defective component is \(\displaystyle{{@dfa@}}\) while the probability that machine \(M_B\) produces a defective component is \(\displaystyle{{@dfb@}}\). If a component is selected at random from a day’s production and is found to be defective, find </p>
<ol class="HELM_parts">
<li> \(p_A\), the probability that the item is from machine \(A\); </li>
<li> \(p_B\), the probability that the item is from machine \(B\). </li>
</ol>
<p> Give your probabilities as fractions, not decimals: </p>
<ol class="HELM_parts">
<li> \(p_A=\quad\)[[input:ans1]][[validation:ans1]][[feedback:prt1]] </li>
<li> \(p_B=\quad\)[[input:ans2]][[validation:ans2]][[feedback:prt2]] </li>
</ol>]]></text>
    </questiontext>
    <generalfeedback format="html">
      <text><![CDATA[<h4 class="HELM_solution"> Solution </h4>
<p> Machines \(M_A\) and \(M_B\) produce \({@pca@}\%\) and \({@pcb@}\%\) respectively of the production of a component.</p><p>We know known that the probability that machine \(M_A\) produces a defective component is \(\displaystyle{{@dfa@}}\) while the probability that machine \(M_B\) produces a defective component is \(\displaystyle{{@dfb@}}\).</p><p>Let \(A = \{\text{item from machine }M_A\}\), \(B = \{\text{item from machine }M_B\}\), and \(D = \{\text{item is defective}\}\).&nbsp;</p><p>Then, the probabilities we have are \(\mathbb{P}(A) = \displaystyle {@pa@}\), \(\mathbb{P}(B) =\displaystyle {@pb@}\), \(\mathbb{P}(D|A) =\displaystyle {@dfa@}\) and \(\mathbb{P}(D|B) =\displaystyle {@dfb@}.\)</p><p>The probabilities we are looking for are \(p_A = \mathbb{P}(A|D)\) and \(p_B = \mathbb{P}(B|D)\) which can be found using Bayes' theorem: </p>
<ol class="HELM_parts">
<li>\[\mathbb{P}(A|D) = \frac{\mathbb{P}(D|A)\mathbb{P}(A)}{\mathbb{P}(D|A)\mathbb{P}(A) + \mathbb{P}(D|B)\mathbb{P}(B)} = {@ta1@}. \] </li>
<li>\[\mathbb{P}(B|D) = \frac{\mathbb{P}(D|B)\mathbb{P}(B)}{\mathbb{P}(D|A)\mathbb{P}(A) + \mathbb{P}(D|B)\mathbb{P}(B)} = {@ta2@}. \] </li></ol>]]></text>
    </generalfeedback>
    <defaultgrade>1</defaultgrade>
    <penalty>0</penalty>
    <hidden>0</hidden>
    <idnumber/>
    <stackversion>
      <text>2021072200</text>
    </stackversion>
    <questionvariables>
      <text>num: rand([1,2,3,4,6,7,8,9]);
pca: 10 * num;
pcb: 100 - pca;
pa: num / 10;
pb: 1 - pa;
dfa: rand([3/100,4/100,5/100]);
dfb: rand([3/100,4/100,5/100]);
/* Bayes' theorem: */
ta1: ( dfa*pa ) / ( dfa*pa + dfb*pb);
ta2: ( dfb*pb ) / ( dfa*pa + dfb*pb);</text>
    </questionvariables>
    <specificfeedback format="html">
      <text/>
    </specificfeedback>
    <questionnote format="moodle_auto_format">
      <text>\( (A\%,B\%)=({@pca@}\%,{@pcb@}\%) \) with respective defectives \( ({@dfa@},{@dfb@}) \).\[p_A = {@ta1@};\qquad p_B = {@ta2@} \]</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; --darkreader-inline-color:#72ff72;" data-darkreader-inline-color=""><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; --darkreader-inline-color:#ffae1a;" data-darkreader-inline-color=""><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; --darkreader-inline-color:#ff1a1a;" data-darkreader-inline-color=""><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>ta1</tans>
      <boxsize>4</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>4</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>
    <prt>
      <name>prt1</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>ta1</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt1-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt1-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <prt>
      <name>prt2</name>
      <value>1.0000000</value>
      <autosimplify>1</autosimplify>
      <feedbackstyle>1</feedbackstyle>
      <feedbackvariables>
        <text/>
      </feedbackvariables>
      <node>
        <name>0</name>
        <description/>
        <answertest>AlgEquiv</answertest>
        <sans>ans2</sans>
        <tans>ta2</tans>
        <testoptions/>
        <quiet>0</quiet>
        <truescoremode>=</truescoremode>
        <truescore>1.0000000</truescore>
        <truepenalty/>
        <truenextnode>-1</truenextnode>
        <trueanswernote>prt2-1-T</trueanswernote>
        <truefeedback format="html">
          <text/>
        </truefeedback>
        <falsescoremode>=</falsescoremode>
        <falsescore>0.0000000</falsescore>
        <falsepenalty/>
        <falsenextnode>-1</falsenextnode>
        <falseanswernote>prt2-1-F</falseanswernote>
        <falsefeedback format="html">
          <text/>
        </falsefeedback>
      </node>
    </prt>
    <deployedseed>354376383</deployedseed>
    <deployedseed>1383853104</deployedseed>
    <deployedseed>146299381</deployedseed>
    <deployedseed>483826706</deployedseed>
    <deployedseed>600768576</deployedseed>
    <deployedseed>1699724364</deployedseed>
    <deployedseed>1734342365</deployedseed>
    <deployedseed>1012330981</deployedseed>
    <deployedseed>1563190410</deployedseed>
    <deployedseed>385811295</deployedseed>
    <deployedseed>2014360892</deployedseed>
    <deployedseed>1897308346</deployedseed>
    <deployedseed>1656627230</deployedseed>
    <deployedseed>1771210564</deployedseed>
    <deployedseed>133575361</deployedseed>
    <deployedseed>1680033819</deployedseed>
    <deployedseed>1518061404</deployedseed>
    <deployedseed>104902164</deployedseed>
    <deployedseed>92108972</deployedseed>
    <deployedseed>1119278468</deployedseed>
    <deployedseed>1417533872</deployedseed>
    <deployedseed>1757606608</deployedseed>
    <deployedseed>301487356</deployedseed>
    <deployedseed>1080335686</deployedseed>
    <deployedseed>2015318496</deployedseed>
    <deployedseed>817030790</deployedseed>
    <deployedseed>1147911855</deployedseed>
    <deployedseed>64347105</deployedseed>
    <deployedseed>1495431272</deployedseed>
    <deployedseed>1602299845</deployedseed>
    <deployedseed>1500229948</deployedseed>
    <deployedseed>1749825479</deployedseed>
    <deployedseed>635626252</deployedseed>
    <deployedseed>1617362221</deployedseed>
    <deployedseed>65263530</deployedseed>
    <deployedseed>1051392337</deployedseed>
    <deployedseed>1815623190</deployedseed>
    <deployedseed>416240949</deployedseed>
    <deployedseed>771360018</deployedseed>
    <deployedseed>443908579</deployedseed>
    <deployedseed>1363546872</deployedseed>
    <deployedseed>642881078</deployedseed>
    <qtest>
      <testcase>1</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>ta1</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>ta2</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt1-1-T</expectedanswernote>
      </expected>
      <expected>
        <name>prt2</name>
        <expectedscore>1.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt2-1-T</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>2</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>0</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>0</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt1-1-F</expectedanswernote>
      </expected>
      <expected>
        <name>prt2</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt2-1-F</expectedanswernote>
      </expected>
    </qtest>
    <qtest>
      <testcase>3</testcase>
      <description/>
      <testinput>
        <name>ans1</name>
        <value>1</value>
      </testinput>
      <testinput>
        <name>ans2</name>
        <value>1</value>
      </testinput>
      <expected>
        <name>prt1</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt1-1-F</expectedanswernote>
      </expected>
      <expected>
        <name>prt2</name>
        <expectedscore>0.0000000</expectedscore>
        <expectedpenalty>0.0000000</expectedpenalty>
        <expectedanswernote>prt2-1-F</expectedanswernote>
      </expected>
    </qtest>
  </question>
</quiz>
