// Numbas version: exam_results_page_options {"question_groups": [{"name": "", "pickQuestions": 1, "pickingStrategy": "all-ordered", "questions": [{"name": "Linear combinations of 2 x 2 matrices", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "functions": {}, "ungrouped_variables": ["a", "q1", "c", "b", "r1", "q", "p", "p1", "apb", "lcab", "lcabc"], "tags": ["addition of matrices", "linear algebra", "linear combination of matrices", "matrices", "matrix"], "preamble": {"css": "", "js": ""}, "advice": "

#### a)

\n

\$\\begin{eqnarray*} \\simplify[std]{A+B} &=&\\simplify[std]{{a}+{b}}\\\\ &=& \\begin{pmatrix} \\simplify[std]{{a[0][0]}+{b[0][0]}}& \\simplify[std]{{a[0][1]}+{b[0][1]}}\\\\ \\simplify[std]{{a[1][0]}+{b[1][0]}}&\\simplify[std]{{a[1][1]}+{b[1][1]}} \\end{pmatrix}\\\\ &=&\\simplify{{apb}}\\\\ \\end{eqnarray*} \$

\n

#### b)

\n

\$\\begin{eqnarray*} \\simplify[std]{{p}A+{q}B} &=&\\simplify[std]{{p}{a}+{q}{b}}\\\\ &=& \\begin{pmatrix} \\simplify[std]{{p}*{a[0][0]}+{q}*{b[0][0]}}& \\simplify[std]{{p}*{a[0][1]}+{q}*{b[0][1]}}\\\\ \\simplify[std]{{p}*{a[1][0]}+{q}*{b[1][0]}}&\\simplify[std]{{p}*{a[1][1]}+{q}*{b[1][1]}} \\end{pmatrix}\\\\ &=&\\simplify{{lcab}}\\\\ \\end{eqnarray*} \$

\n

#### c)

\n

\$\\begin{eqnarray*} \\simplify[std]{{p1}A+{q1}B+{r1}C} &=&\\simplify[std]{{p1}{a}+{q1}{b}+{r1}{c}}\\\\ &=& \\begin{pmatrix} \\simplify[std]{{p1}*{a[0][0]}+{q1}*{b[0][0]}+{r1}*{c[0][0]}}& \\simplify[std]{{p1}*{a[0][1]}+{q1}*{b[0][1]}+{r1}*{c[0][1]}}\\\\ \\simplify[std]{{p1}*{a[1][0]}+{q1}*{b[1][0]}+{r1}*{c[1][0]}}&\\simplify[std]{{p1}*{a[1][1]}+{q1}*{b[1][1]}+{r1}*{c[1][1]}} \\end{pmatrix}\\\\ &=&\\simplify{{lcabc}}\\\\ \\end{eqnarray*} \$

\n

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

$\\mathrm{A}+\\mathrm{B} = \\simplify[std]{{a}+{b}} =$ [[0]]

", "marks": 0, "gaps": [{"numColumns": "2", "type": "matrix", "allowFractions": false, "correctAnswerFractions": false, "markPerCell": false, "numRows": "2", "showCorrectAnswer": true, "correctAnswer": "apb", "scripts": {}, "marks": 1, "tolerance": 0, "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "$\\simplify{{p}A+{q}B = {p}{a}+{q}{b}}=$ [[0]]", "marks": 0, "gaps": [{"numColumns": "2", "type": "matrix", "allowFractions": false, "correctAnswerFractions": false, "markPerCell": false, "numRows": "2", "showCorrectAnswer": true, "correctAnswer": "lcab", "scripts": {}, "marks": 1, "tolerance": 0, "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "

$\\simplify{{p1}A+{q1}B+{r1}C = {p1}{a}+{q1}{b}+{r1}{c}}=$ [[0]]

", "marks": 0, "gaps": [{"numColumns": "2", "type": "matrix", "allowFractions": false, "correctAnswerFractions": false, "markPerCell": false, "numRows": "2", "showCorrectAnswer": true, "correctAnswer": "lcabc", "scripts": {}, "marks": 1, "tolerance": 0, "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "

Let
\$A=\\simplify{{a}},\\;\\; B=\\simplify{{b}},\\;\\; C=\\simplify{{c}}\$
Calculate the following $2 \\times 2$ matrices:

\n

", "type": "question", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "matrix(repeat(repeat(random(-5..5 except 0),2),2))", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "q1": {"definition": "random(-6..6 except [0,1,-1,p1,q])", "templateType": "anything", "group": "Ungrouped variables", "name": "q1", "description": ""}, "c": {"definition": "matrix(repeat(repeat(random(-5..5 except [0,a[0][0],b[0][0]]),2),2))", "templateType": "anything", "group": "Ungrouped variables", "name": "c", "description": ""}, "b": {"definition": "matrix(repeat(repeat(random(-5..5 except [0,a[0][0]]),2),2))", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": ""}, "r1": {"definition": "random(-6..6 except [0,1,-1,p1,q1])", "templateType": "anything", "group": "Ungrouped variables", "name": "r1", "description": ""}, "q": {"definition": "random(-6..6 except [0,1,-1,p])", "templateType": "anything", "group": "Ungrouped variables", "name": "q", "description": ""}, "p": {"definition": "random(2..6)", "templateType": "anything", "group": "Ungrouped variables", "name": "p", "description": ""}, "p1": {"definition": "random(2..6 except p)", "templateType": "anything", "group": "Ungrouped variables", "name": "p1", "description": ""}, "apb": {"definition": "a+b", "templateType": "anything", "group": "Ungrouped variables", "name": "apb", "description": ""}, "lcab": {"definition": "p*a+q*b", "templateType": "anything", "group": "Ungrouped variables", "name": "lcab", "description": ""}, "lcabc": {"definition": "p1*a+q1*b+r1*c", "templateType": "anything", "group": "Ungrouped variables", "name": "lcabc", "description": ""}}, "metadata": {"notes": "\n \t\t

8/02/2013:

\n \t\t

Finished first draft.

\n \t\t", "description": "

Linear combinations of $2 \\times 2$ matrices. Three examples.

", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Matrix Multiplication 1", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "functions": {}, "ungrouped_variables": ["ba21", "a21", "a22", "ba22", "cb21", "b22", "b21", "cb22", "ac22", "ac21", "ab22", "ab21", "b12", "b11", "c12", "c11", "c22", "a11", "cb11", "cb12", "a12", "c21", "ba11", "ba12", "ab12", "ab11", "ac12", "ac11"], "tags": ["matrices", "matrix", "matrix multiplication", "matrix product", "multiplication of matrices", "multiplying matrices", "product of matrices"], "preamble": {"css": "", "js": ""}, "advice": "

#### a)

\n

\$\\begin{eqnarray*} AB &=& \\begin{pmatrix} \\var{a11}&\\var{a12}\\\\ \\var{a21}&\\var{a22}\\\\ \\end{pmatrix}\\begin{pmatrix} \\var{b11}&\\var{b12}\\\\ \\var{b21}&\\var{b22}\\\\ \\end{pmatrix}\\\\ &=& \\begin{pmatrix} \\simplify[]{{a11}{b11}+{a12}{b21}}&\\simplify[]{{a11}{b12}+{a12}{b22}}\\\\ \\simplify[]{{a21}{b11}+{a22}{b21}}&\\simplify[]{{a21}{b12}+{a22}{b22}}\\\\ \\end{pmatrix}\\\\ &=& \\begin{pmatrix} \\var{ab11}&\\var{ab12}\\\\ \\var{ab21}&\\var{ab22}\\\\ \\end{pmatrix} \\end{eqnarray*} \$

\n

#### b)

\n

\$\\begin{eqnarray*} BA &=& \\begin{pmatrix} \\var{b11}&\\var{b12}\\\\ \\var{b21}&\\var{b22}\\\\ \\end{pmatrix}\\begin{pmatrix} \\var{a11}&\\var{a12}\\\\ \\var{a21}&\\var{a22}\\\\ \\end{pmatrix}\\\\ &=& \\begin{pmatrix} \\simplify[]{{b11}{a11}+{b12}{a21}}&\\simplify[]{{b11}{a12}+{b12}{a22}}\\\\ \\simplify[]{{b21}{a11}+{b22}{a21}}&\\simplify[]{{b21}{a12}+{b22}{a22}}\\\\ \\end{pmatrix}\\\\ &=& \\begin{pmatrix} \\var{ba11}&\\var{ba12}\\\\ \\var{ba21}&\\var{ba22}\\\\ \\end{pmatrix} \\end{eqnarray*} \$

\n

#### c)

\n

\$\\begin{eqnarray*} CB &=& \\begin{pmatrix} \\var{c11}&\\var{c12}\\\\ \\var{c21}&\\var{c22}\\\\ \\end{pmatrix}\\begin{pmatrix} \\var{b11}&\\var{b12}\\\\ \\var{b21}&\\var{b22}\\\\ \\end{pmatrix}\\\\ &=& \\begin{pmatrix} \\simplify[]{{c11}{b11}+{c12}{b21}}&\\simplify[]{{c11}{b12}+{c12}{b22}}\\\\ \\simplify[]{{c21}{b11}+{c22}{b21}}&\\simplify[]{{c21}{b12}+{a22}{b22}}\\\\ \\end{pmatrix}\\\\ &=& \\begin{pmatrix} \\var{cb11}&\\var{cb12}\\\\ \\var{cb21}&\\var{cb22}\\\\ \\end{pmatrix} \\end{eqnarray*} \$

\n

#### d)

\n

\$\\begin{eqnarray*} AC &=& \\begin{pmatrix} \\var{a11}&\\var{a12}\\\\ \\var{a21}&\\var{a22}\\\\ \\end{pmatrix}\\begin{pmatrix} \\var{c11}&\\var{c12}\\\\ \\var{c21}&\\var{c22}\\\\ \\end{pmatrix}\\\\ &=& \\begin{pmatrix} \\simplify[]{{a11}{c11}+{a12}{c21}}&\\simplify[]{{a11}{c12}+{a12}{c22}}\\\\ \\simplify[]{{a21}{c11}+{a22}{c21}}&\\simplify[]{{a21}{c12}+{a22}{c22}}\\\\ \\end{pmatrix}\\\\ &=& \\begin{pmatrix} \\var{ac11}&\\var{ac12}\\\\ \\var{ac21}&\\var{ac22}\\\\ \\end{pmatrix} \\end{eqnarray*} \$

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

$AB = \\begin{pmatrix} \\var{a11}&\\var{a12}\\\\ \\var{a21}&\\var{a22}\\\\ \\end{pmatrix}\\begin{pmatrix} \\var{b11}&\\var{b12}\\\\ \\var{b21}&\\var{b22}\\\\ \\end{pmatrix} =$ [[0]]

", "marks": 0, "gaps": [{"numColumns": "2", "type": "matrix", "allowFractions": false, "correctAnswerFractions": false, "markPerCell": false, "numRows": "2", "showCorrectAnswer": true, "correctAnswer": "matrix([\n [ab11,ab12],\n [ab21,ab22]\n])", "scripts": {}, "marks": 1, "tolerance": 0, "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "

$BA = \\begin{pmatrix} \\var{b11}&\\var{b12}\\\\ \\var{b21}&\\var{b22}\\\\ \\end{pmatrix}\\begin{pmatrix} \\var{a11}&\\var{a12}\\\\ \\var{a21}&\\var{a22}\\\\ \\end{pmatrix}=$ [[0]]

", "marks": 0, "gaps": [{"numColumns": "2", "type": "matrix", "allowFractions": false, "correctAnswerFractions": false, "markPerCell": false, "numRows": "2", "showCorrectAnswer": true, "correctAnswer": "matrix([\n [ba11,ba12],\n [ba21,ba22]\n])", "scripts": {}, "marks": 1, "tolerance": 0, "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "

$CB = \\begin{pmatrix} \\var{c11}&\\var{c12}\\\\ \\var{c21}&\\var{c22}\\\\ \\end{pmatrix} \\begin{pmatrix} \\var{b11}&\\var{b12}\\\\ \\var{b21}&\\var{b22}\\\\ \\end{pmatrix}=$ [[0]]

", "marks": 0, "gaps": [{"numColumns": "2", "type": "matrix", "allowFractions": false, "correctAnswerFractions": false, "markPerCell": false, "numRows": "2", "showCorrectAnswer": true, "correctAnswer": "matrix([\n [cb11,cb12],\n [cb21,cb22]\n])", "scripts": {}, "marks": 1, "tolerance": 0, "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "

$AC = \\begin{pmatrix} \\var{a11}&\\var{a12}\\\\ \\var{a21}&\\var{a22}\\\\ \\end{pmatrix}\\begin{pmatrix} \\var{c11}&\\var{c12}\\\\ \\var{c21}&\\var{c22}\\\\ \\end{pmatrix}=$ [[0]]

", "marks": 0, "gaps": [{"numColumns": "2", "type": "matrix", "allowFractions": false, "correctAnswerFractions": false, "markPerCell": false, "numRows": "2", "showCorrectAnswer": true, "correctAnswer": "matrix([\n [ac11,ac12],\n [ac21,ac22]\n])", "scripts": {}, "marks": 1, "tolerance": 0, "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "\n \n \n

Do the following matrix problems
Let
\$A=\\begin{pmatrix} \\var{a11}&\\var{a12}\\\\ \\var{a21}&\\var{a22}\\\\ \\end{pmatrix},\\;\\;\n \n B=\\begin{pmatrix} \\var{b11}&\\var{b12}\\\\ \\var{b21}&\\var{b22}\\\\ \\end{pmatrix},\\;\\;\n \n C=\\begin{pmatrix} \\var{c11}&\\var{c12}\\\\ \\var{c21}&\\var{c22}\\\\ \\end{pmatrix}\$
Calculate the following products of these matrices:

\n \n \n \n ", "type": "question", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"ba21": {"definition": "b21*a11+b22*a21", "templateType": "anything", "group": "Ungrouped variables", "name": "ba21", "description": ""}, "a21": {"definition": "random(-2..2)", "templateType": "anything", "group": "Ungrouped variables", "name": "a21", "description": ""}, "a22": {"definition": "random(1..3)", "templateType": "anything", "group": "Ungrouped variables", "name": "a22", "description": ""}, "ba22": {"definition": "b21*a12+b22*a22", "templateType": "anything", "group": "Ungrouped variables", "name": "ba22", "description": ""}, "cb21": {"definition": "c21*b11+c22*b21", "templateType": "anything", "group": "Ungrouped variables", "name": "cb21", "description": ""}, "b22": {"definition": "random(-3..-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "b22", "description": ""}, "b21": {"definition": "random(2,3)", "templateType": "anything", "group": "Ungrouped variables", "name": "b21", "description": ""}, "cb22": {"definition": "c21*b12+c22*b22", "templateType": "anything", "group": "Ungrouped variables", "name": "cb22", "description": ""}, "ac22": {"definition": "a21*c12+a22*c22", "templateType": "anything", "group": "Ungrouped variables", "name": "ac22", "description": ""}, "ac21": {"definition": "a21*c11+a22*c21", "templateType": "anything", "group": "Ungrouped variables", "name": "ac21", "description": ""}, "ab22": {"definition": "a21*b12+a22*b22", "templateType": "anything", "group": "Ungrouped variables", "name": "ab22", "description": ""}, "ab21": {"definition": "a21*b11+a22*b21", "templateType": "anything", "group": "Ungrouped variables", "name": "ab21", "description": ""}, "b12": {"definition": "random(-3..1)", "templateType": "anything", "group": "Ungrouped variables", "name": "b12", "description": ""}, "b11": {"definition": "random(-3,-1,0,3)", "templateType": "anything", "group": "Ungrouped variables", "name": "b11", "description": ""}, "c12": {"definition": "a12+b12", "templateType": "anything", "group": "Ungrouped variables", "name": "c12", "description": ""}, "c11": {"definition": "random(1,0,4)", "templateType": "anything", "group": "Ungrouped variables", "name": "c11", "description": ""}, "ab12": {"definition": "a11*b12+a12*b22", "templateType": "anything", "group": "Ungrouped variables", "name": "ab12", "description": ""}, "a11": {"definition": "random(-2,1,2)", "templateType": "anything", "group": "Ungrouped variables", "name": "a11", "description": ""}, "cb11": {"definition": "c11*b11+c12*b21", "templateType": "anything", "group": "Ungrouped variables", "name": "cb11", "description": ""}, "cb12": {"definition": "c11*b12+c12*b22", "templateType": "anything", "group": "Ungrouped variables", "name": "cb12", "description": ""}, "a12": {"definition": "random(1..4)", "templateType": "anything", "group": "Ungrouped variables", "name": "a12", "description": ""}, "ab11": {"definition": "a11*b11+a12*b21", "templateType": "anything", "group": "Ungrouped variables", "name": "ab11", "description": ""}, "ba11": {"definition": "b11*a11+b12*a21", "templateType": "anything", "group": "Ungrouped variables", "name": "ba11", "description": ""}, "ba12": {"definition": "b11*a12+b12*a22", "templateType": "anything", "group": "Ungrouped variables", "name": "ba12", "description": ""}, "c22": {"definition": "random(0,1)", "templateType": "anything", "group": "Ungrouped variables", "name": "c22", "description": ""}, "c21": {"definition": "random(2..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "c21", "description": ""}, "ac12": {"definition": "a11*c12+a12*c22", "templateType": "anything", "group": "Ungrouped variables", "name": "ac12", "description": ""}, "ac11": {"definition": "a11*c11+a12*c21", "templateType": "anything", "group": "Ungrouped variables", "name": "ac11", "description": ""}}, "metadata": {"notes": "\n \t\t \t\t

10/07/2012:

\n \t\t \t\t

\n \t\t \t\t

Display of matrices looks untidy when individual components include negative numbers.

\n \t\t \t\t

Is it worthwhile restricting all components of matrices to be non zero?

\n \t\t \t\t

Question appears to be working correctly.

\n \t\t \n \t\t", "description": "

Multiplication of $2 \\times 2$ matrices.

", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Determinants ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Hayley Bishop", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/93/"}], "functions": {}, "ungrouped_variables": ["a21", "a22", "b22", "b21", "b1", "s2", "s1", "b12", "b11", "tr1", "c12", "c11", "tr2", "tr4", "c22", "a11", "a12", "db", "dc", "da", "a1", "c21", "c1", "tr3", "a", "b", "s", "u", "t"], "tags": ["determinant of a matrix", "inverse", "inverse matrix", "matrix", "matrix inverse", "matrix multiplication", "multiply matrix"], "advice": "

#### a)

\n
##### Determinants.
\n

Here is the formula for the determinant of a $2 \\times 2$ matrix:
\$M = \\begin{pmatrix} a & b \\\\ c&d \\end{pmatrix} \\Rightarrow \\mathrm{det}\\left(M\\right) = ad-bc \$

\n

$\\mathrm{det}\\left(A\\right) = \\simplify[]{{a11}*{a22}-{a12}*{a21} = {dA}}$
$\\mathrm{det}\\left(B\\right) = \\simplify[]{{b11}*{b22}-{b12}*{b21} = {dB}}$
$\\mathrm{det}\\left(C\\right) = \\simplify[]{{c11}*{c22}-{c12}*{c21} = {dC}}$

\n
##### Determinant of a product of matrices.
\n

If we have two $n \\times n$ matrices $M$ and $N$ then:
\$\\mathrm{det}\\left(MN\\right) = \\mathrm{det}\\left(M\\right)\\mathrm{det}\\left(N\\right)\$
And it follows that if we have a third matrix $P$ that:
\$\\mathrm{det}\\left(MNP\\right) = \\mathrm{det}\\left(M\\right)\\mathrm{det}\\left(N\\right)\\mathrm{det}\\left(P\\right)\$

\n

Thus for our example we have:

\n

\$\\begin{eqnarray*}\\mathrm{det}\\left(ABC\\right) &=& \\mathrm{det}\\left(A\\right)\\times\\mathrm{det}\\left(B\\right)\\times\\mathrm{det}\\left(C\\right)\\\\ &=& \\var{dA}\\times \\var{dB} \\times \\var{dC}\\\\ &=& \\var{dA*dB*dC} \\end{eqnarray*} \$

\n
##### Inverse of a $2 \\times 2$ matrix
\n

Suppose $M$ is a $2 \\times 2$ matrix and $\\mathrm{det}\\left(M\\right) = \\Delta \\neq 0$.

\n

Then $M$ is invertible and:
\$M = \\begin{pmatrix} a & b \\\\ c&d \\end{pmatrix} \\Rightarrow M^{-1} = \\frac{1}{\\Delta} \\begin{pmatrix} d & -b\\\\ -c& a \\end{pmatrix}=\\begin{pmatrix} \\frac{d}{\\Delta} & -\\frac{b}{\\Delta}\\\\ -\\frac{c}{\\Delta}& \\frac{a}{\\Delta} \\end{pmatrix}\$

\n

Applying this to these examples we obtain:

\n

#### b)

\n

\$A^{-1} = \\begin{pmatrix} \\simplify[std]{{a22}/{dA}} &\\simplify[std]{{-a12}/{dA}}\\\\\\simplify[std]{{-a21}/{dA}}&\\simplify[std]{{a11}/{dA}}\\end{pmatrix}\$

\n

#### c)

\n

\$B^{-1} = \\begin{pmatrix} \\simplify[std]{{b22}/{dB}} &\\simplify[std]{{-b12}/{dB}}\\\\\\simplify[std]{{-b21}/{dB}}&\\simplify[std]{{b11}/{dB}}\\end{pmatrix}\$

\n

#### d)

\n

\$C^{-1} = \\begin{pmatrix} \\simplify[std]{{c22}/{dC}} &\\simplify[std]{{-c12}/{dC}}\\\\\\simplify[std]{{-c21}/{dC}}&\\simplify[std]{{c11}/{dC}}\\end{pmatrix}\$

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

Calculate the determinants of these matrices:

\n

$\\mathrm{det}\\left(A\\right) = \\;\\;$[[0]]$,\\;\\;\\;\\mathrm{det}\\left(B\\right) = \\;\\;$[[1]]$,\\;\\;\\;\\mathrm{det}\\left(C\\right) = \\;\\;$[[2]]$,\\;\\;\\;\\mathrm{det}\\left(ABC\\right) = \\;\\;$[[3]]

", "marks": 0, "gaps": [{"allowFractions": false, "scripts": {}, "maxValue": "dA", "minValue": "dA", "correctAnswerFraction": false, "showCorrectAnswer": true, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "scripts": {}, "maxValue": "dB", "minValue": "dB", "correctAnswerFraction": false, "showCorrectAnswer": true, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "scripts": {}, "maxValue": "dC", "minValue": "dC", "correctAnswerFraction": false, "showCorrectAnswer": true, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "scripts": {}, "maxValue": "dA*dB*dC", "minValue": "dA*dB*dC", "correctAnswerFraction": false, "showCorrectAnswer": true, "marks": 0.5, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "

Let
\$A=\\begin{pmatrix} \\var{a11}&\\var{a12}\\\\ \\var{a21}&\\var{a22}\\\\ \\end{pmatrix},\\;\\; B=\\begin{pmatrix} \\var{b11}&\\var{b12}\\\\ \\var{b21}&\\var{b22}\\\\ \\end{pmatrix},\\;\\; C=\\begin{pmatrix} \\var{c11}&\\var{c12}\\\\ \\var{c21}&\\var{c22}\\\\ \\end{pmatrix}\$

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "variables": {"a21": {"definition": "s2*random(1..6)", "templateType": "anything", "group": "Ungrouped variables", "name": "a21", "description": ""}, "a22": {"definition": "if(tr1*a11=a21*a12,tr1+1,tr1)", "templateType": "anything", "group": "Ungrouped variables", "name": "a22", "description": ""}, "b22": {"definition": "if(tr3*b11=b21*b12,tr3+1,tr3)", "templateType": "anything", "group": "Ungrouped variables", "name": "b22", "description": ""}, "b21": {"definition": "s*random(1..6)", "templateType": "anything", "group": "Ungrouped variables", "name": "b21", "description": ""}, "b1": {"definition": "t*random(1..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "b1", "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": ""}, "b12": {"definition": "random(-5..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "b12", "description": ""}, "b11": {"definition": "if(a11=tr2,tr2+1,tr2)", "templateType": "anything", "group": "Ungrouped variables", "name": "b11", "description": ""}, "tr1": {"definition": "random(1..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "tr1", "description": ""}, "c12": {"definition": "a12+b12", "templateType": "anything", "group": "Ungrouped variables", "name": "c12", "description": ""}, "c11": {"definition": "random(1,2,4)", "templateType": "anything", "group": "Ungrouped variables", "name": "c11", "description": ""}, "tr2": {"definition": "random(1..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "tr2", "description": ""}, "tr4": {"definition": "random(1..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "tr4", "description": ""}, "c22": {"definition": "if(tr4*c11=c21*c12,tr4+1,tr4)", "templateType": "anything", "group": "Ungrouped variables", "name": "c22", "description": ""}, "a11": {"definition": "s1*random(1..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "a11", "description": ""}, "a12": {"definition": "random(-5..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "a12", "description": ""}, "db": {"definition": "b11*b22-b21*b12", "templateType": "anything", "group": "Ungrouped variables", "name": "db", "description": ""}, "dc": {"definition": "c11*c22-c21*c12", "templateType": "anything", "group": "Ungrouped variables", "name": "dc", "description": ""}, "da": {"definition": "a11*a22-a21*a12", "templateType": "anything", "group": "Ungrouped variables", "name": "da", "description": ""}, "a1": {"definition": "random(2..4)", "templateType": "anything", "group": "Ungrouped variables", "name": "a1", "description": ""}, "c21": {"definition": "random(2..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "c21", "description": ""}, "c1": {"definition": "u*random(1..6)", "templateType": "anything", "group": "Ungrouped variables", "name": "c1", "description": ""}, "tr3": {"definition": "s1*random(1..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "tr3", "description": ""}, "a": {"definition": "random(1..3)", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "b": {"definition": "s*random(2..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": ""}, "s": {"definition": "random(1,-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "s", "description": ""}, "u": {"definition": "random(1,-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "u", "description": ""}, "t": {"definition": "random(1,-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}}, "metadata": {"notes": "\n \t\t \t\t \t\t

10/07/2012:

\n \t\t \t\t \t\t

\n \t\t \t\t \t\t

Question appears to be working correctly.

\n \t\t \t\t \t\t

Corrected a typo in the Advice section.

\n \t\t \t\t \n \t\t \n \t\t", "description": "

Find the determinant of three $2 \\times 2$ invertible matrices.

", "licence": "None specified"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "2x2 Inverses", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Hayley Bishop", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/93/"}], "functions": {}, "ungrouped_variables": ["a21", "a22", "b22", "b21", "b1", "s2", "s1", "b12", "b11", "tr1", "c12", "c11", "tr2", "tr4", "c22", "a11", "a12", "db", "dc", "da", "a1", "c21", "c1", "tr3", "a", "b", "s", "u", "t"], "tags": ["determinant of a matrix", "inverse", "inverse matrix", "matrix", "matrix inverse", "matrix multiplication", "multiply matrix"], "advice": "

#### a)

\n
##### Determinants.
\n

Here is the formula for determinants:
\$M = \\begin{pmatrix} a & b \\\\ c&d \\end{pmatrix} \\Rightarrow \\mathrm{det}\\left(M\\right) = ad-bc \$

\n

$\\mathrm{det}\\left(A\\right) = \\simplify[]{{a11}*{a22}-{a12}*{a21} = {dA}}$
$\\mathrm{det}\\left(B\\right) = \\simplify[]{{b11}*{b22}-{b12}*{b21} = {dB}}$
$\\mathrm{det}\\left(C\\right) = \\simplify[]{{c11}*{c22}-{c12}*{c21} = {dC}}$

\n
##### Determinant of a product of matrices.
\n

If we have two $n \\times n$ matrices $M$ and $N$ then:
\$\\mathrm{det}\\left(MN\\right) = \\mathrm{det}\\left(M\\right)\\mathrm{det}\\left(N\\right)\$
And it follows that if we have a third matrix $P$ that:
\$\\mathrm{det}\\left(MNP\\right) = \\mathrm{det}\\left(M\\right)\\mathrm{det}\\left(N\\right)\\mathrm{det}\\left(P\\right)\$

\n

Thus for our example we have:

\n

\$\\begin{eqnarray*}\\mathrm{det}\\left(ABC\\right) &=& \\mathrm{det}\\left(A\\right)\\times\\mathrm{det}\\left(B\\right)\\times\\mathrm{det}\\left(C\\right)\\\\ &=& \\var{dA}\\times \\var{dB} \\times \\var{dC}\\\\ &=& \\var{dA*dB*dC} \\end{eqnarray*} \$

\n
##### Inverse of a $2 \\times 2$ matrix
\n

Suppose $M$ is a $2 \\times 2$ matrix and $\\mathrm{det}\\left(M\\right) = \\Delta \\neq 0$.

\n

Then $M$ is invertible and:
\$M = \\begin{pmatrix} a & b \\\\ c&d \\end{pmatrix} \\Rightarrow M^{-1} = \\frac{1}{\\Delta} \\begin{pmatrix} d & -b\\\\ -c& a \\end{pmatrix}=\\begin{pmatrix} \\frac{d}{\\Delta} & -\\frac{b}{\\Delta}\\\\ -\\frac{c}{\\Delta}& \\frac{a}{\\Delta} \\end{pmatrix}\$

\n

Applying this to these examples we obtain:

\n

#### b)

\n

\$A^{-1} = \\begin{pmatrix} \\simplify[std]{{a22}/{dA}} &\\simplify[std]{{-a12}/{dA}}\\\\\\simplify[std]{{-a21}/{dA}}&\\simplify[std]{{a11}/{dA}}\\end{pmatrix}\$

\n

#### c)

\n

\$B^{-1} = \\begin{pmatrix} \\simplify[std]{{b22}/{dB}} &\\simplify[std]{{-b12}/{dB}}\\\\\\simplify[std]{{-b21}/{dB}}&\\simplify[std]{{b11}/{dB}}\\end{pmatrix}\$

\n

#### d)

\n

\$C^{-1} = \\begin{pmatrix} \\simplify[std]{{c22}/{dC}} &\\simplify[std]{{-c12}/{dC}}\\\\\\simplify[std]{{-c21}/{dC}}&\\simplify[std]{{c11}/{dC}}\\end{pmatrix}\$

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

$A^{-1} =$ [[0]]

", "marks": 0, "gaps": [{"numColumns": "2", "type": "matrix", "tolerance": 0, "allowFractions": true, "scripts": {}, "markPerCell": false, "numRows": "2", "showCorrectAnswer": true, "correctAnswer": "matrix([\n [a22,-a12],\n [-a21,a11]\n])/dA", "correctAnswerFractions": true, "marks": 1, "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "

$B^{-1} =$ [[0]]

", "marks": 0, "gaps": [{"numColumns": "2", "type": "matrix", "tolerance": 0, "allowFractions": true, "scripts": {}, "markPerCell": false, "numRows": "2", "showCorrectAnswer": true, "correctAnswer": "matrix([\n [b22,-b12],\n [-b21,b11]\n])/dB", "correctAnswerFractions": true, "marks": 1, "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "

$C^{-1} =$ [[0]]

", "marks": 0, "gaps": [{"numColumns": "2", "type": "matrix", "tolerance": 0, "allowFractions": true, "scripts": {}, "markPerCell": false, "numRows": "2", "showCorrectAnswer": true, "correctAnswer": "matrix([\n [c22,-c12],\n [-c21,c11]\n])/dB", "correctAnswerFractions": true, "marks": 1, "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "

Let
\$A=\\begin{pmatrix} \\var{a11}&\\var{a12}\\\\ \\var{a21}&\\var{a22}\\\\ \\end{pmatrix},\\;\\; B=\\begin{pmatrix} \\var{b11}&\\var{b12}\\\\ \\var{b21}&\\var{b22}\\\\ \\end{pmatrix},\\;\\; C=\\begin{pmatrix} \\var{c11}&\\var{c12}\\\\ \\var{c21}&\\var{c22}\\\\ \\end{pmatrix}\$

\n

Find the following matrix inverses. Input all matrix entries as fractions or integers and not as decimals.

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "preamble": {"css": "", "js": ""}, "variables": {"a21": {"definition": "s2*random(1..6)", "templateType": "anything", "group": "Ungrouped variables", "name": "a21", "description": ""}, "a22": {"definition": "if(tr1*a11=a21*a12,tr1+1,tr1)", "templateType": "anything", "group": "Ungrouped variables", "name": "a22", "description": ""}, "b22": {"definition": "if(tr3*b11=b21*b12,tr3+1,tr3)", "templateType": "anything", "group": "Ungrouped variables", "name": "b22", "description": ""}, "b21": {"definition": "s*random(1..6)", "templateType": "anything", "group": "Ungrouped variables", "name": "b21", "description": ""}, "b1": {"definition": "t*random(1..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "b1", "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": ""}, "b12": {"definition": "random(-5..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "b12", "description": ""}, "b11": {"definition": "if(a11=tr2,tr2+1,tr2)", "templateType": "anything", "group": "Ungrouped variables", "name": "b11", "description": ""}, "tr1": {"definition": "random(1..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "tr1", "description": ""}, "c12": {"definition": "a12+b12", "templateType": "anything", "group": "Ungrouped variables", "name": "c12", "description": ""}, "c11": {"definition": "random(1,2,4)", "templateType": "anything", "group": "Ungrouped variables", "name": "c11", "description": ""}, "tr2": {"definition": "random(1..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "tr2", "description": ""}, "tr4": {"definition": "random(1..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "tr4", "description": ""}, "c22": {"definition": "if(tr4*c11=c21*c12,tr4+1,tr4)", "templateType": "anything", "group": "Ungrouped variables", "name": "c22", "description": ""}, "a11": {"definition": "s1*random(1..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "a11", "description": ""}, "a12": {"definition": "random(-5..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "a12", "description": ""}, "db": {"definition": "b11*b22-b21*b12", "templateType": "anything", "group": "Ungrouped variables", "name": "db", "description": ""}, "dc": {"definition": "c11*c22-c21*c12", "templateType": "anything", "group": "Ungrouped variables", "name": "dc", "description": ""}, "da": {"definition": "a11*a22-a21*a12", "templateType": "anything", "group": "Ungrouped variables", "name": "da", "description": ""}, "a1": {"definition": "random(2..4)", "templateType": "anything", "group": "Ungrouped variables", "name": "a1", "description": ""}, "c21": {"definition": "random(2..5)", "templateType": "anything", "group": "Ungrouped variables", "name": "c21", "description": ""}, "c1": {"definition": "u*random(1..6)", "templateType": "anything", "group": "Ungrouped variables", "name": "c1", "description": ""}, "tr3": {"definition": "s1*random(1..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "tr3", "description": ""}, "a": {"definition": "random(1..3)", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "b": {"definition": "s*random(2..9)", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": ""}, "s": {"definition": "random(1,-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "s", "description": ""}, "u": {"definition": "random(1,-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "u", "description": ""}, "t": {"definition": "random(1,-1)", "templateType": "anything", "group": "Ungrouped variables", "name": "t", "description": ""}}, "metadata": {"notes": "\n \t\t \t\t \t\t

10/07/2012:

\n \t\t \t\t \t\t

\n \t\t \t\t \t\t

Question appears to be working correctly.

\n \t\t \t\t \t\t

Corrected a typo in the Advice section.

\n \t\t \t\t \n \t\t \n \t\t", "description": "

Find the inverse of three $2 \\times 2$ invertible matrices.

", "licence": "None specified"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Determinant and inverse of 2x2 matrices", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "functions": {"inverse": {"definition": "matrix([\n [m[1][1],-m[0][1]],\n [-m[1][0],m[0][0]]\n])/det(m)", "type": "matrix", "language": "jme", "parameters": [["m", "matrix"]]}}, "ungrouped_variables": [], "tags": ["determinant of a matrix", "inverse", "inverse matrix", "matrices", "matrix", "matrix inverse", "matrix multiplication", "multiplication of matrices", "tested1"], "preamble": {"css": "", "js": ""}, "advice": "

#### Determinant of a $2 \\times 2$ matrix

\n

The determinant of a matrix $\\mathrm{M} = \\begin{pmatrix} a&b \\\\ c&d \\end{pmatrix}$ is given by

\n

\$\\det\\left(\\mathrm{M}\\right) = ad-bc \$

\n

If we have two $n \\times n$ matrices $M$ and $N$, then

\n

\$\\det\\left(\\mathrm{MN}\\right) = \\det\\left(\\mathrm{M}\\right)\\det\\left(\\mathrm{N}\\right) \$

\n

And it follows that if we have a third matrix $P$,

\n

\$\\det\\left(\\mathrm{MNP}\\right) = \\det\\left(\\mathrm{M}\\right)\\det\\left(\\mathrm{N}\\right)\\det\\left(\\mathrm{P}\\right) \$

\n

#### a)

\n

Thus for our example we have:

\n

\\begin{align}
\\det\\left(\\mathrm{A}\\right) &= \\simplify[]{{a11}*{a22}-{a12}*{a21} = {det(a)}} \\\\
\\det\\left(\\mathrm{B}\\right) &= \\simplify[]{{b11}*{b22}-{b12}*{b21} = {det(b)}} \\\\
\\det\\left(\\mathrm{C}\\right) &= \\simplify[]{{c11}*{c22}-{c12}*{c21} = {det(c)}}
\\end{align}

\n

\\begin{align}
\\det\\left( \\mathrm{ABC} \\right) &= \\det(\\mathrm{A}) \\det(\\mathrm{B}) \\det(\\mathrm{C}) \\\\
&= \\simplify[]{{det(a)}*{det(b)}*{det(c)}} \\\\
&= \\var{det(a*b*c)}
\\end{align}

\n

#### Inverse of a $2 \\times 2$ matrix

\n

Suppose $\\mathrm{M} = \\begin{pmatrix} a&b \\\\ c&d \\end{pmatrix}$ is a $2 \\times 2$ matrix and $\\det\\left(\\mathrm{M}\\right) = \\Delta \\neq 0$.

\n

Then $\\mathrm{M}$ is invertible and

\n

\$\\mathrm{M}^{-1} = \\frac{1}{\\Delta} \\begin{pmatrix} d & -b\\\\ -c& a \\end{pmatrix}=\\begin{pmatrix} \\frac{d}{\\Delta} & -\\frac{b}{\\Delta}\\\\ -\\frac{c}{\\Delta}& \\frac{a}{\\Delta} \\end{pmatrix}\$

\n

Applying this to these examples we obtain:

\n

#### b)

\n

\$\\simplify[fractionnumbers]{matrix:A^(-1)={inverse(a)}} \$

\n

#### c)

\n

\$\\simplify[fractionnumbers]{matrix:B^(-1)={inverse(b)}} \$

\n

#### d)

\n

\$\\simplify[fractionnumbers]{matrix:C^(-1)={inverse(c)}} \$

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

Let

\n

\$\\mathrm{A} = \\var{a},\\;\\; \\mathrm{B} = \\var{b},\\;\\; \\mathrm{C} = \\var{c}\$

\n

Calculate the determinants of these matrices:

\n

$\\det\\left(\\mathrm{A}\\right) =$ [[0]]

\n

$\\det\\left(\\mathrm{B}\\right) =$ [[1]]

\n

$\\det\\left(\\mathrm{C}\\right) =$ [[2]]

\n

$\\det\\left(\\mathrm{ABC}\\right) =$ [[3]]

", "marks": 0, "gaps": [{"allowFractions": false, "marks": 0.5, "maxValue": "det(a)", "minValue": "det(a)", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.5, "maxValue": "det(b)", "minValue": "det(b)", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.5, "maxValue": "det(c)", "minValue": "det(c)", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"allowFractions": false, "marks": 0.5, "maxValue": "det(a*b*c)", "minValue": "det(a*b*c)", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "

Find the inverses of the matrices given above. Input all matrix entries as fractions or integers and not as decimals.

\n

$\\mathrm{A}^{-1} =$ [[0]]

", "marks": 0, "gaps": [{"numColumns": "2", "type": "matrix", "allowFractions": true, "correctAnswerFractions": true, "markPerCell": false, "numRows": "2", "showCorrectAnswer": true, "correctAnswer": "inverse(a)", "scripts": {}, "marks": 1, "tolerance": "0.01", "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "

$\\mathrm{B}^{-1} =$ [[0]]

", "marks": 0, "gaps": [{"numColumns": "2", "type": "matrix", "allowFractions": true, "correctAnswerFractions": true, "markPerCell": false, "numRows": "2", "showCorrectAnswer": true, "correctAnswer": "inverse(b)", "scripts": {}, "marks": 1, "tolerance": "0.01", "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}, {"prompt": "

$\\mathrm{C}^{-1} =$ [[0]]

", "marks": 0, "gaps": [{"numColumns": "2", "type": "matrix", "allowFractions": true, "correctAnswerFractions": true, "markPerCell": false, "numRows": "2", "showCorrectAnswer": true, "correctAnswer": "inverse(c)", "scripts": {}, "marks": 1, "tolerance": "0.01", "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "type": "gapfill"}], "statement": "

Do the following matrix problems.

", "variable_groups": [{"variables": ["a11", "a12", "a21", "a22", "a"], "name": "Matrix A"}, {"variables": ["b11", "b12", "b21", "b22", "b"], "name": "Matrix B"}, {"variables": ["c11", "c12", "c21", "c22", "c"], "name": "Matrix C"}], "variablesTest": {"maxRuns": 100, "condition": ""}, "type": "question", "variables": {"c22": {"definition": "random(1..9 except c21*c12/c11)", "templateType": "anything", "group": "Matrix C", "name": "c22", "description": ""}, "a21": {"definition": "random(-6..6 except 0) ", "templateType": "anything", "group": "Matrix A", "name": "a21", "description": ""}, "a22": {"definition": "random(1..9 except a21*a12/a11)", "templateType": "anything", "group": "Matrix A", "name": "a22", "description": ""}, "c21": {"definition": "random(2..5)", "templateType": "anything", "group": "Matrix C", "name": "c21", "description": ""}, "a11": {"definition": "random(-9..9 except 0)", "templateType": "anything", "group": "Matrix A", "name": "a11", "description": ""}, "a12": {"definition": "random(-5..5)", "templateType": "anything", "group": "Matrix A", "name": "a12", "description": ""}, "c": {"definition": "matrix([\n [c11,c12],\n [c21,c22]\n])", "templateType": "anything", "group": "Matrix C", "name": "c", "description": ""}, "b21": {"definition": "random(-6..6 except 0)", "templateType": "anything", "group": "Matrix B", "name": "b21", "description": ""}, "b22": {"definition": "random(-9..9 except [0,b21*b12/b11])", "templateType": "anything", "group": "Matrix B", "name": "b22", "description": ""}, "b": {"definition": "matrix([\n [b11,b12],\n [b21,b22]\n])", "templateType": "anything", "group": "Matrix B", "name": "b", "description": ""}, "b12": {"definition": "random(-5..5)", "templateType": "anything", "group": "Matrix B", "name": "b12", "description": ""}, "a": {"definition": "matrix([\n [a11,a12],\n [a21,a22]\n])", "templateType": "anything", "group": "Matrix A", "name": "a", "description": ""}, "b11": {"definition": "random(1..9 except a11)\n//if(a11=tr2,tr2+1,tr2)", "templateType": "anything", "group": "Matrix B", "name": "b11", "description": ""}, "c12": {"definition": "a12+b12", "templateType": "anything", "group": "Matrix C", "name": "c12", "description": ""}, "c11": {"definition": "random(1,2,4)", "templateType": "anything", "group": "Matrix C", "name": "c11", "description": ""}}, "metadata": {"notes": "

10/07/2012:

\n

\n

Question appears to be working correctly.

\n

Corrected a typo in the Advice section.

\n

24/12/2012:

\n

Checked calculations, OK. Added tested1 tag.

", "description": "

Find the determinant and inverse of three $2 \\times 2$ invertible matrices.

", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "cormac's copy of Matrix question", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "cormac breen", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/306/"}], "functions": {}, "tags": ["inverse of a matrix", "linear equations", "linear equations in matrix form", "matrices", "matrix", "matrix equations", "matrix form", "matrix multiplication", "multiply matrices", "multiply matrix", "solving linear equations", "system of linear equations"], "advice": "\n

a)
The equations can be written in the matrix form:
\$\\begin{pmatrix} \\var{a} & \\var{b}\\\\ \\var{a1}&\\var{b1} \\end{pmatrix} \\begin{pmatrix} x \\\\ y \\end{pmatrix} = \\begin{pmatrix} \\var{c} \\\\ \\var{c1} \\end{pmatrix}\$

\n

b)

\n

Since $\\mathrm{det}(A) = \\simplify[]{{a}*{b1}-{b}*{a1}={dA}} \\neq 0$, $A$ is invertible and

\n

\$A^{-1} = \\begin{pmatrix} \\simplify[std]{{b1}/{dA}}&\\simplify[std]{{-b}/{dA}}\\\\\\simplify[std]{{-a1}/{dA}}&\\simplify[std]{{a}/{dA}} \\end{pmatrix}\$

\n

c)

\n

We have:
\$\\begin{eqnarray*} A^{-1}b &=& \\begin{pmatrix} \\simplify[std]{{b1}/{dA}}&\\simplify[std]{{-b}/{dA}}\\\\\\simplify[std]{{-a1}/{dA}}&\\simplify[std]{{a}/{dA}} \\end{pmatrix}\\begin{pmatrix} \\var{c}\\\\\\var{c1}\\end{pmatrix} \\\\ &=& \\begin{pmatrix} \\simplify[std]{{c*b1-c1*b}/{dA}}\\\\\\simplify[std]{{c1*a-c*a1}/{dA}}\\end{pmatrix} \\end{eqnarray*} \$

\n

d) Note that $Av = b \\Rightarrow v = A^{-1}b$ hence we can read the solution from the last part as this gives:

\n

\$\\begin{pmatrix} x\\\\y \\end{pmatrix} = \\begin{pmatrix} \\simplify[std]{{c*b1-c1*b}/{dA}}\\\\ \\simplify[std]{{c1*a-c*a1}/{dA}}\\end{pmatrix}\$
Hence \$\\begin{eqnarray*} x&=& \\simplify[std]{{c*b1-c1*b}/{dA}}\\\\ y&=& \\simplify[std]{{c1*a-c*a1}/{dA}} \\end{eqnarray*} \$

\n \n ", "rulesets": {"std": ["all", "!collectNumbers", "fractionNumbers", "!noLeadingMinus"]}, "parts": [{"prompt": "\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
 $A = \\Bigg($ [[0]] [[1]] $\\Bigg)$ [[2]] [[3]] $v = \\;\\;\\Bigg($ [[4]] $\\Bigg)$ [[5]] $b = \\;\\;\\Bigg($ [[6]] $\\Bigg)$ [[7]]

Find the inverse of $A$, input all numbers as fractions or integers and not as decimals:

\n \n \n \n \n \n \n \n \n \n \n \n \n \n
 $A^{-1} = \\Bigg($ [[0]] [[1]] $\\Bigg)$ [[2]] [[3]]
\n \n ", "gaps": [{"notallowed": {"message": "

Input as a fraction or an integer, not as a decimal

", "showstrings": false, "strings": ["."], "partialcredit": 0.0}, "checkingaccuracy": 0.001, "vsetrange": [0.0, 1.0], "vsetrangepoints": 5.0, "checkingtype": "absdiff", "answersimplification": "std", "marks": 0.5, "answer": "{b1}/{dA}", "type": "jme"}, {"notallowed": {"message": "

Input as a fraction or an integer, not as a decimal

", "showstrings": false, "strings": ["."], "partialcredit": 0.0}, "checkingaccuracy": 0.001, "vsetrange": [0.0, 1.0], "vsetrangepoints": 5.0, "checkingtype": "absdiff", "answersimplification": "std", "marks": 0.5, "answer": "{-b}/{dA}", "type": "jme"}, {"notallowed": {"message": "

Input as a fraction or an integer, not as a decimal

", "showstrings": false, "strings": ["."], "partialcredit": 0.0}, "checkingaccuracy": 0.001, "vsetrange": [0.0, 1.0], "vsetrangepoints": 5.0, "checkingtype": "absdiff", "answersimplification": "std", "marks": 0.5, "answer": "{-a1}/{dA}", "type": "jme"}, {"notallowed": {"message": "

Input as a fraction or an integer, not as a decimal

", "showstrings": false, "strings": ["."], "partialcredit": 0.0}, "checkingaccuracy": 0.001, "vsetrange": [0.0, 1.0], "vsetrangepoints": 5.0, "checkingtype": "absdiff", "answersimplification": "std", "marks": 0.5, "answer": "{a}/{dA}", "type": "jme"}], "type": "gapfill", "marks": 0.0}, {"prompt": "\n

Now find, inputting all numbers as fractions or integers and not as decimals.

\n \n \n \n \n \n \n \n \n \n \n \n
 $A^{-1}b = \\;\\;\\Bigg($ [[0]] $\\Bigg)$ [[1]]
\n \n ", "gaps": [{"notallowed": {"message": "

Input as a fraction or an integer, not as a decimal

", "showstrings": false, "strings": ["."], "partialcredit": 0.0}, "checkingaccuracy": 0.001, "vsetrange": [0.0, 1.0], "vsetrangepoints": 5.0, "checkingtype": "absdiff", "answersimplification": "std", "marks": 0.5, "answer": "{c*b1-c1*b}/{b1*a-a1*b}", "type": "jme"}, {"notallowed": {"message": "

Input as a fraction or an integer, not as a decimal

", "showstrings": false, "strings": ["."], "partialcredit": 0.0}, "checkingaccuracy": 0.001, "vsetrange": [0.0, 1.0], "vsetrangepoints": 5.0, "checkingtype": "absdiff", "answersimplification": "std", "marks": 0.5, "answer": "{-c*a1+c1*a}/{b1*a-a1*b}", "type": "jme"}], "type": "gapfill", "marks": 0.0}, {"prompt": "\n \n \n

Now solve the equations, inputting all numbers as fractions or integers and not as decimals.
$x = \\;\\;$[[0]]

\n \n \n \n

$y = \\;\\;$[[1]]

\n \n \n \n ", "gaps": [{"notallowed": {"message": "

Input as a fraction or an integer, not as a decimal

", "showstrings": false, "strings": ["."], "partialcredit": 0.0}, "checkingaccuracy": 0.001, "vsetrange": [0.0, 1.0], "vsetrangepoints": 5.0, "checkingtype": "absdiff", "answersimplification": "std", "marks": 0.5, "answer": "{c*b1-c1*b}/{b1*a-a1*b}", "type": "jme"}, {"notallowed": {"message": "

Input as a fraction or an integer, not as a decimal

", "showstrings": false, "strings": ["."], "partialcredit": 0.0}, "checkingaccuracy": 0.001, "vsetrange": [0.0, 1.0], "vsetrangepoints": 5.0, "checkingtype": "absdiff", "answersimplification": "std", "marks": 0.5, "answer": "{-c*a1+c1*a}/{b1*a-a1*b}", "type": "jme"}], "type": "gapfill", "marks": 0.0}], "statement": "

Write the following equations as a matrix equation
\$Av=b\$for a matrix $A$ and column vectors $v$ and $b$
\$\\begin{eqnarray*} \\simplify[std]{{a}x+{b}y}&=&\\var{c}\\\\ \\simplify[std]{{a1}x+{b1}y}&=&\\var{c1} \\end{eqnarray*} \$

", "variable_groups": [], "progress": "ready", "type": "question", "variables": {"a": {"definition": "sa*random(1..9)", "name": "a"}, "addortakeaway": {"definition": "if(b*b1<0,'add the equation','take away the equation')", "name": "addortakeaway"}, "c": {"definition": "sc*random(1..9)", "name": "c"}, "b": {"definition": "sb*random(1..9)", "name": "b"}, "da": {"definition": "a*b1-a1*b", "name": "da"}, "a1": {"definition": "if(test+inc=0,test+inc+1,test+inc)", "name": "a1"}, "test": {"definition": "round(a*b1/b)", "name": "test"}, "ab": {"definition": "abs(b)", "name": "ab"}, "sb1": {"definition": "random(1,-1)", "name": "sb1"}, "b1": {"definition": "if(ab=1,sb1*random(2..9),if(ab=2 or ab=4 or ab=8,sb1*random(1,3,5,7,9), if(ab=3 or ab=6 or ab=9,sb1*random(1,2,4,5,6,8),if(ab=5,sb1*random(1,2,3,4,6,7,8,9),sb1*random(1,2,3,4,5,6,8,9)))))", "name": "b1"}, "sc": {"definition": "random(1,-1)", "name": "sc"}, "sb": {"definition": "random(1,-1)", "name": "sb"}, "sa": {"definition": "random(1,-1)", "name": "sa"}, "sc1": {"definition": "random(1,-1)", "name": "sc1"}, "sa1": {"definition": "random(1,-1)", "name": "sa1"}, "c1": {"definition": "sc1*random(1..9)", "name": "c1"}, "inc": {"definition": "sa*random(1..9)", "name": "inc"}}, "metadata": {"notes": "\n \t\t \t\t

20/06/2012:

\n \t\t \t\t

\n \t\t \t\t

Edited advice so that it gave the correct solution for $y$ (as in the answer).

\n \t\t \t\t

\n \t\t \t\t

\n \t\t \t\t

4/07/2012:

\n \t\t \t\t

Column vectors v and b have the bracket in the incorrect place.

\n \t\t \t\t

\n \t\t \t\t

10/07/2012:

\n \t\t \t\t

\n \t\t \t\t

Question appears to be working correctly.

\n \t\t \t\t

Column vectors v and b still have brackets in incorrect places.

\n \t\t \n \t\t", "description": "

Putting a pair of linear equations into matrix notation and then solving by finding the inverse of the coefficient matrix.

"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}, {"name": "Singular Matrix", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}], "functions": {}, "tags": ["determinant", "formative", "hidden gaps", "linear combination", "matrices", "matrix", "preamble", "satisfy", "singular matrix", "zero gaps"], "type": "question", "advice": "

There are several possible matrices with the given entries and which are singular i.e. determinant $0$.

\n

One such is \$A=\\var{a}\$

\n

Another method for finding some appropriate values is to note that if one row of a matrix is a combination of the other rows then the matrix is singular.

\n

In this case let

\n

\$A=\\begin{pmatrix} \\var{a11}&\\var{a12}&a\\\\b&c&\\var{a23}\\\\\\var{a31}&\\var{a32}&\\var{a33}\\end{pmatrix}\$

\n

In this case we will find  $a,\\;b$ and $c$ such that the second row is the sum of the first and third rows.

\n

This gives three equations:

\n

\$\\begin{eqnarray}b&=&\\simplify[]{{a11}+{a31}}\\Rightarrow b=\\var{a11+a31}\\\\c&=&\\simplify[]{{a12}+{a32}}\\Rightarrow c=\\var{a12+a32}\\\\\\var{a23}&=&\\simplify[]{a+{a33}}\\Rightarrow a=\\var{a23-a33}\\end{eqnarray}\$

\n

Hence another singular matrix with the original given entries is:

\n

\$A=\\begin{pmatrix} \\var{a11}&\\var{a12}&\\var{a23-a33}\\\\\\var{a11+a31}&\\var{a12+a32}&\\var{a23}\\\\\\var{a31}&\\var{a32}&\\var{a33}\\end{pmatrix}\$

\n

You can check that the determinant of this matrix is $0$ and is therefore singular.

\n

", "rulesets": {}, "parts": [{"stepsPenalty": 0, "prompt": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
 \$A=\\left( \\begin{matrix} \\phantom{.}\\\\ \\phantom{.}\\\\ \\phantom{.}\\\\ \\phantom{.}\\\\ \\end{matrix} \\right.\$ $\\var{a11}$ $\\var{a12}$ [[0]] \$\\left) \\begin{matrix} \\phantom{.} \\\\ \\phantom{.}\\\\ \\phantom{.}\\\\ \\phantom{.}\\\\ \\end{matrix} \\right.\$ [[1]] [[2]] $\\var{a23}$ $\\var{a31}$ $\\var{a32}$ $\\var{a33}$
\n

Enter values in the matrix so that the matrix is singular.

\n

Click on Show steps if you want more information on singular matrices.

\n

", "marks": 0, "gaps": [{"marks": "0", "maxValue": "1", "minValue": "1", "showCorrectAnswer": false, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"marks": "0", "maxValue": "1", "minValue": "1", "showCorrectAnswer": false, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"marks": "0", "maxValue": "1", "minValue": "1", "showCorrectAnswer": false, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}, {"marks": "1", "maxValue": "d", "minValue": "d", "showCorrectAnswer": false, "scripts": {}, "type": "numberentry", "showPrecisionHint": false}], "showCorrectAnswer": true, "scripts": {}, "steps": [{"type": "information", "showCorrectAnswer": true, "scripts": {}, "prompt": "

Note that a matrix is singular if and only if  it has determinant $0$.

\n

Also if a row is a linear combination of other rows then it is singular, similarly if a column is a linear combination of other columns.

", "marks": 0}], "type": "gapfill"}], "statement": "

\n

", "variable_groups": [], "progress": "in-progress", "preamble": {"css": "", "js": "question.signals.on('HTMLAttached',function() {\n var scope = question.scope;\n var a11 = Numbas.jme.unwrapValue(scope.variables.a11);\n var a23 = Numbas.jme.unwrapValue(scope.variables.a23);\n var a32 = Numbas.jme.unwrapValue(scope.variables.a32);\n var a12 = Numbas.jme.unwrapValue(scope.variables.a12);\n var a33 = Numbas.jme.unwrapValue(scope.variables.a33);\n var a31 = Numbas.jme.unwrapValue(scope.variables.a31);\n ko.computed(function() {\n var a13 = parseInt(question.parts[0].gaps[0].display.studentAnswer());\n var a21 = parseInt(question.parts[0].gaps[1].display.studentAnswer());\n var a22 = parseInt(question.parts[0].gaps[2].display.studentAnswer());\n var fin= isNaN(a13)||isNaN(a21)||isNaN(a22);\n\n var dt =a11*(a22*a33-a32*a23)-a12*(a21*a33-a31*a23)+a13*(a21*a32-a31*a22);\n var message1='';\n if(!fin) {\n if(dt !=0){\n message1='The determinant of your matrix is '+ dt+ ' and is therefore not a singular matrix.';\n }\n else message1='The determinant of your matrix is '+ dt+ ' and is therefore a singular matrix.'\n \n }\n var html = $(question.display.html);\n //This is displayed in the question as an aid to the user.\n html.find('#mess1').text(message1);\n\n\n\nquestion.parts[0].gaps[3].display.studentAnswer(dt);\n });\n})"}, "variables": {"a": {"definition": "rmatrix[0]", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "a32": {"definition": "a[2][1]", "templateType": "anything", "group": "Ungrouped variables", "name": "a32", "description": ""}, "a31": {"definition": "a[2][0]", "templateType": "anything", "group": "Ungrouped variables", "name": "a31", "description": ""}, "a23": {"definition": "a[1][2]", "templateType": "anything", "group": "Ungrouped variables", "name": "a23", "description": ""}, "a11": {"definition": "a[0][0]", "templateType": "anything", "group": "Ungrouped variables", "name": "a11", "description": ""}, "d": {"definition": "det(a)", "templateType": "anything", "group": "Ungrouped variables", "name": "d", "description": ""}, "rmatrix": {"definition": "satisfy(\n [a],\n [\n matrix(repeat(repeat(random(-3..3),3),3))\n ],\n [\n a[1][2]<>0,\n a[0][0]*a[2][1]-a[0][1]*a[2][0]<>0,\n det(a)=0\n ]\n )", "templateType": "anything", "group": "Ungrouped variables", "name": "rmatrix", "description": " Using the satisfy function, the 3 x 3 matrix produced here has$a_{23}\\neq 0$along with its cofactor$A_{23} \\neq 0$. This prevents the user putting$a_{21}=a_{22}=0\$ as then we make sure that the matrix has non zero determinant.

"}, "a12": {"definition": "a[0][1]", "templateType": "anything", "group": "Ungrouped variables", "name": "a12", "description": ""}, "a33": {"definition": "a[2][2]", "templateType": "anything", "group": "Ungrouped variables", "name": "a33", "description": ""}}, "metadata": {"notes": "

Had to use a script in the preamble rather than scripting the individual gap fills.

\n

Used the satisfy function to make sure we have non-trivial examples.

", "description": "

A 3 x 3 matrix is given with 6 values already entered. The remaining 3 have to be entered by the user so that the matrix is singular i.e. determinant=0. This question is in formative mode, with the determinant of the matrix given when all entries are filled.

", "licence": "Creative Commons Attribution 4.0 International"}, "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}]}]}], "name": "Matrices exercises", "feedback": {"advicethreshold": 0, "allowrevealanswer": true, "showanswerstate": true, "showactualmark": true, "showtotalmark": true}, "duration": 0, "navigation": {"showfrontpage": true, "preventleave": true, "reverse": true, "showresultspage": "oncompletion", "browse": true, "onleave": {"action": "none", "message": ""}, "allowregen": true}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Matrix addition, multiplication. Finding inverse. Determinants. Systems of equations.

\n

rebelmaths

"}, "allQuestions": true, "percentPass": 0, "questions": [], "showQuestionGroupNames": false, "type": "exam", "timing": {"timeout": {"action": "none", "message": ""}, "allowPause": true, "timedwarning": {"action": "none", "message": ""}}, "pickQuestions": "1", "shuffleQuestions": false, "contributors": [{"name": "Blathnaid Sheridan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/447/"}], "extensions": ["stats"], "custom_part_types": [], "resources": []}