// Numbas version: finer_feedback_settings {"name": "Simon's copy of Simon's copy of 3x3 matrix: Cofactors, Determinant, Inverse, Equation solving", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"statement": "", "functions": {}, "rulesets": {}, "preamble": {"js": "", "css": ""}, "parts": [{"sortAnswers": false, "prompt": "

Calculate the nine cofactors of A=$\\var{matrixA}$

\n

(where $cof _{ij}$ represents the element in position $i,j$ of the cofactor matrix)

\n

$cof _{11}=$ [[0]]

\n

$cof_{12}=$ [[1]]

\n

$cof_{13}=$ [[2]]

\n

$cof_{21}=$ [[3]]

\n

$cof_{22}=$ [[4]]

\n

$cof_{23}=$ [[5]]

\n

$cof_{31}=$ [[6]]

\n

$cof_{32}=$ [[7]]

\n

$cof_{33}=$ [[8]]

", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "gaps": [{"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "{cof11}", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "allowFractions": true, "showCorrectAnswer": true, "showFeedbackIcon": true, "marks": "1", "scripts": {}, "variableReplacementStrategy": "originalfirst", "maxValue": "{cof11}", "customMarkingAlgorithm": "", "correctAnswerStyle": "plain", "type": "numberentry", "mustBeReducedPC": 0, "mustBeReduced": false}, {"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "{cof12}", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "allowFractions": false, "showCorrectAnswer": true, "showFeedbackIcon": true, "marks": "0.5", "scripts": {}, "variableReplacementStrategy": "originalfirst", "maxValue": "{cof12}", "customMarkingAlgorithm": "", "correctAnswerStyle": "plain", "type": "numberentry", "mustBeReducedPC": 0, "mustBeReduced": false}, {"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "{cof13}", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "allowFractions": false, "showCorrectAnswer": true, "showFeedbackIcon": true, "marks": "0.5", "scripts": {}, "variableReplacementStrategy": "originalfirst", "maxValue": "{cof13}", "customMarkingAlgorithm": "", "correctAnswerStyle": "plain", "type": "numberentry", "mustBeReducedPC": 0, "mustBeReduced": false}, {"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "{cof21}", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "allowFractions": false, "showCorrectAnswer": true, "showFeedbackIcon": true, "marks": "0.5", "scripts": {}, "variableReplacementStrategy": "originalfirst", "maxValue": "{cof21}", "customMarkingAlgorithm": "", "correctAnswerStyle": "plain", "type": "numberentry", "mustBeReducedPC": 0, "mustBeReduced": false}, {"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "{cof22}", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "allowFractions": false, "showCorrectAnswer": true, "showFeedbackIcon": true, "marks": "0.5", "scripts": {}, "variableReplacementStrategy": "originalfirst", "maxValue": "{cof22}", "customMarkingAlgorithm": "", "correctAnswerStyle": "plain", "type": "numberentry", "mustBeReducedPC": 0, "mustBeReduced": false}, {"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "{cof23}", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "allowFractions": false, "showCorrectAnswer": true, "showFeedbackIcon": true, "marks": "0.5", "scripts": {}, "variableReplacementStrategy": "originalfirst", "maxValue": "{cof23}", "customMarkingAlgorithm": "", "correctAnswerStyle": "plain", "type": "numberentry", "mustBeReducedPC": 0, "mustBeReduced": false}, {"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "{cof31}", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "allowFractions": false, "showCorrectAnswer": true, "showFeedbackIcon": true, "marks": "0.5", "scripts": {}, "variableReplacementStrategy": "originalfirst", "maxValue": "{cof31}", "customMarkingAlgorithm": "", "correctAnswerStyle": "plain", "type": "numberentry", "mustBeReducedPC": 0, "mustBeReduced": false}, {"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "{cof32}", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "allowFractions": false, "showCorrectAnswer": true, "showFeedbackIcon": true, "marks": "0.5", "scripts": {}, "variableReplacementStrategy": "originalfirst", "maxValue": "{cof32}", "customMarkingAlgorithm": "", "correctAnswerStyle": "plain", "type": "numberentry", "mustBeReducedPC": 0, "mustBeReduced": false}, {"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "{cof33}", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "allowFractions": false, "showCorrectAnswer": true, "showFeedbackIcon": true, "marks": "0.5", "scripts": {}, "variableReplacementStrategy": "originalfirst", "maxValue": "{cof33}", "customMarkingAlgorithm": "", "correctAnswerStyle": "plain", "type": "numberentry", "mustBeReducedPC": 0, "mustBeReduced": false}], "showCorrectAnswer": true, "showFeedbackIcon": true, "marks": 0, "scripts": {}, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "type": "gapfill"}, {"sortAnswers": false, "prompt": "

What is the determinant of A=$\\var{matrixA}$?

\n

[[0]]

", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "gaps": [{"correctAnswerFraction": false, "notationStyles": ["plain", "en", "si-en"], "minValue": "det(matrixA)", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "allowFractions": false, "showCorrectAnswer": true, "showFeedbackIcon": true, "marks": "4", "scripts": {}, "variableReplacementStrategy": "originalfirst", "maxValue": "det(matrixA)", "customMarkingAlgorithm": "", "correctAnswerStyle": "plain", "type": "numberentry", "mustBeReducedPC": 0, "mustBeReduced": false}], "showCorrectAnswer": true, "showFeedbackIcon": true, "marks": 0, "scripts": {}, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "type": "gapfill"}, {"sortAnswers": false, "prompt": "

\n

What is the inverse of A=$\\var{matrixA}$? Write each element as a decimal correct to 3 decimal places.

\n

[[0]]

", "unitTests": [], "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "gaps": [{"correctAnswer": "precround(inverseA,3)", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "correctAnswerFractions": false, "numRows": "3", "showCorrectAnswer": true, "showFeedbackIcon": true, "precisionMessage": "You have not given your answer to the correct precision.", "scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "matrix", "precisionPartialCredit": 0, "allowResize": false, "unitTests": [], "strictPrecision": false, "markPerCell": true, "precision": "3", "numColumns": "3", "marks": "4.5", "customMarkingAlgorithm": "", "tolerance": "0", "precisionType": "dp", "allowFractions": false}], "showCorrectAnswer": true, "showFeedbackIcon": true, "marks": 0, "scripts": {}, "variableReplacementStrategy": "originalfirst", "customMarkingAlgorithm": "", "type": "gapfill"}, {"correctAnswer": "precround(inverseA*vectorb,2)", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "correctAnswerFractions": false, "numRows": "3", "showCorrectAnswer": true, "showFeedbackIcon": true, "precisionMessage": "You have not given your answer to the correct precision.", "scripts": {}, "variableReplacementStrategy": "originalfirst", "type": "matrix", "precisionPartialCredit": 0, "allowResize": false, "prompt": "

Hence solve the equation

\n

$ \\var{matrixA} \\left(\\matrix{x\\\\y\\\\z}\\right) = \\var{vectorb}$

\n

\n

Write each element as a decimal correct to 2 decimal places.

\n

\n

$ \\left(\\matrix{x\\\\y\\\\z}\\right) = $

", "unitTests": [], "strictPrecision": false, "markPerCell": true, "precision": "2", "numColumns": 1, "marks": "1.5", "customMarkingAlgorithm": "", "tolerance": "0", "precisionType": "dp", "allowFractions": false}], "variables": {"b3": {"definition": "random(0..9)", "description": "", "templateType": "anything", "group": "Vector b", "name": "b3"}, "inverseA": {"definition": "matrix([cof11,cof21,cof31],[cof12,cof22,cof32],[cof13,cof23,cof33])/det(matrixA)", "description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "inverseA"}, "a31": {"definition": "random(0..4)", "description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "a31"}, "a12": {"definition": "random(-2..4)", "description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "a12"}, "a23": {"definition": "random(-4..4)", "description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "a23"}, "a22": {"definition": "random(0..5 except(a21*a12/a11))", "description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "a22"}, "cof21": {"definition": "a32*a13-a12*a33", "description": "", "templateType": "anything", "group": "cofactors", "name": "cof21"}, "matrixA": {"definition": "matrix([a11,a12,a13],[a21,a22,a23],[a31,a32,a33])", "description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "matrixA"}, "a32": {"definition": "random(-4..2)", "description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "a32"}, "cof31": {"definition": "a12*a23-a22*a13", "description": "", "templateType": "anything", "group": "cofactors", "name": "cof31"}, "b2": {"definition": "random(-3..6 except 0)", "description": "", "templateType": "anything", "group": "Vector b", "name": "b2"}, "a13": {"definition": "random(-5..5)", "description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "a13"}, "vectorb": {"definition": "matrix([b1],[b2],[b3])", "description": "", "templateType": "anything", "group": "Vector b", "name": "vectorb"}, "cof33": {"definition": "a11*a22-a12*a21", "description": "", "templateType": "anything", "group": "cofactors", "name": "cof33"}, "a21": {"definition": "random(3..8)", "description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "a21"}, "cof13": {"definition": "a21*a32-a31*a22", "description": "", "templateType": "anything", "group": "cofactors", "name": "cof13"}, "b1": {"definition": "random(-5..5)", "description": "", "templateType": "anything", "group": "Vector b", "name": "b1"}, "cof22": {"definition": "a11*a33-a31*a13", "description": "", "templateType": "anything", "group": "cofactors", "name": "cof22"}, "a33": {"definition": "random(-4..4)", "description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "a33"}, "cof23": {"definition": "a12*a31-a11*a32", "description": "

cof23

", "templateType": "anything", "group": "cofactors", "name": "cof23"}, "cof11": {"definition": "a22*a33-a32*a23", "description": "", "templateType": "anything", "group": "cofactors", "name": "cof11"}, "cof12": {"definition": "a23*a31-a21*a33", "description": "", "templateType": "anything", "group": "cofactors", "name": "cof12"}, "a11": {"definition": "random(-3..3)", "description": "", "templateType": "anything", "group": "Ungrouped variables", "name": "a11"}, "cof32": {"definition": "a13*a21-a11*a23", "description": "", "templateType": "anything", "group": "cofactors", "name": "cof32"}}, "ungrouped_variables": ["matrixA", "a11", "a12", "a21", "a22", "a13", "a23", "a31", "a32", "a33", "inverseA"], "advice": "

(a)

\n

If \\[  A=\\left( \\begin{array}{ccc}
a & b & c \\\\d & e&f\\\\ g&h&j \\end{array} \\right),\\]

\n

\n

To obtain $cof _{ij}$ we take the determinant of the matrix obtained by removing row $i$ and column $j$, and multiply it by $(-1)^{i+j}$

\n

\n

Hence cofactors are given by 

\n

$cof _{11} =  +\\left| \\begin{array}{ccc}
e&f\\\\ h&j \\end{array} \\right|$           $cof _{12}=  -\\left| \\begin{array}{ccc}
d & f\\\\ g&j \\end{array} \\right|$           $cof _{13}=  +\\left| \\begin{array}{ccc}
d & e\\\\ g&h\\end{array} \\right|$

\n

$cof _{21}= -\\left| \\begin{array}{ccc}
b & c \\\\h&j \\end{array} \\right|$           $cof _{22}=  +\\left| \\begin{array}{ccc}
a  & c \\\\ g&j \\end{array} \\right|$           $cof _{23}=  -\\left| \\begin{array}{ccc}
a & b \\\\g&h\\end{array} \\right|$

\n

$cof _{31}=  +\\left| \\begin{array}{ccc}
b & c \\\\e&f\\end{array} \\right|$           $cof _{32}= -\\left| \\begin{array}{ccc}
a  & c \\\\d & f\\end{array} \\right|$           $cof _{33}=  +\\left| \\begin{array}{ccc}
a & b\\\\d & e \\end{array} \\right|$

\n

\n

e.g. For our example:

\n

$cof _{11} =  +\\left| \\begin{array}{ccc} \\var{a22}&\\var{a23}\\\\ \\var{a32}&\\var{a33} \\end{array} \\right|=+(\\var{a22}\\times\\var{a33}-\\var{a23}\\times\\var{a32})=\\var{a22*a33-a23*a32}$     

\n

$cof _{12} =  -\\left| \\begin{array}{ccc} \\var{a21}&\\var{a23}\\\\ \\var{a31}&\\var{a33} \\end{array} \\right|=-(\\var{a21}\\times\\var{a33}-\\var{a23}\\times\\var{a31})=\\var{-a21*a33+a23*a31}$     

\n

etc.

\n

\n

So our cofactor matrix is

\n

$\\left( \\begin{array}{ccc}\\var{cof11} & \\var{cof12} & \\var{cof13} \\\\\\var{cof21} & \\var{cof22}&\\var{cof23}\\\\ \\var{cof31}&\\var{cof32}&\\var{cof33} \\end{array} \\right)$

\n

\n

(b)

\n

Then, the determinant, det(A) is given by the sum of the product of any row ( or column) elements by their cofactors

\n

e.g using row 1, we obtain the determinant = $a \\times cof_{11}+b \\times cof_{12}+c \\times cof_{13}$

\n

$= \\var{a11} \\times \\var{cof11} +\\var{a12} \\times \\var{cof12}+\\var{a13} \\times \\var{cof13} = \\var{det(matrixA)}$

\n

\n

\n

(c)

\n

The inverse of A, $\\ A^{-1}$ is given by dividing adj(A) by det(A)

\n

where the adjoint, adj(A) is given by taking the transpose of the cofactor matrix, i.e.

\n

adj(A) =\\[ \\left( \\begin{array}{ccc}
cof11 & cof21 & cof31 \\\\cof12 & cof22&cof32\\\\ cof13&cof23&cof33 \\end{array} \\right),\\]

\n

Then $\\ A^{-1}$=\\[  \\frac{1}{det(A)} \\times \\left( \\begin{array}{ccc}
cof11 & cof21 & cof31 \\\\cof12 & cof22&cof32\\\\ cof13&cof23&cof33 \\end{array} \\right),\\]

\n

$\\ A^{-1}$=\\[  \\frac{1}{\\var{det(matrixA)}} \\times \\left( \\begin{array}{ccc}
\\var{cof11} & \\var{cof21} & \\var{cof31} \\\\\\var{cof12} & \\var{cof22}&\\var{cof32}\\\\ \\var{cof13}&\\var{cof23}&\\var{cof33} \\end{array} \\right),\\]

\n

 $\\ A^{-1}=\\var{precround(inverseA,3)}$

\n

\n

\n

(d)

\n

The equation $ A \\mathbf{x}=\\mathbf{b} $ can be solved by premultiplying each side by $A^{-1}$ giving $\\mathbf{x} = A^{-1}\\mathbf{b}$

\n

i.e. $ \\left(\\matrix{x\\\\y\\\\z}\\right) = \\var{matrixA}^{-1} \\var{vectorb}$

\n

$ \\left(\\matrix{x\\\\y\\\\z}\\right) = \\var{precround(inverseA,3)} \\var{vectorb} = \\var{precround(inverseA*vectorb,2)}$

", "metadata": {"description": "

Cofactors Determinant and inverse of a 3x3 matrix.

", "licence": "Creative Commons Attribution 4.0 International"}, "variable_groups": [{"variables": ["cof11", "cof12", "cof13", "cof21", "cof22", "cof23", "cof31", "cof32", "cof33"], "name": "cofactors"}, {"variables": [], "name": "Unnamed group"}, {"variables": ["b1", "b2", "b3", "vectorb"], "name": "Vector b"}], "tags": [], "name": "Simon's copy of Simon's copy of 3x3 matrix: Cofactors, Determinant, Inverse, Equation solving", "variablesTest": {"maxRuns": "5", "condition": "det(matrixA)<>0"}, "extensions": [], "type": "question", "contributors": [{"name": "Violeta CIT", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1030/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}]}], "contributors": [{"name": "Violeta CIT", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1030/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}]}