// Numbas version: exam_results_page_options {"name": "Hollie's copy of Inverse Matrix", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {}, "ungrouped_variables": ["ra", "rb", "rc", "f", "g"], "name": "Hollie's copy of Inverse Matrix", "tags": [], "advice": "

#### a) Introduce zeros in the first column

\n

The first entry in the second row is $\\var{a[1][0]}$, and we have a $1$ in the first entry of the first row, so multiply the first row by $\\var{abs(zero_2_1)}$ and {if(zero_2_1<0,'subtract from','add to')} row 2 to get

\n

\$\\simplify[rowvector,all]{{step0[1]}+{zero_2_1}*{step0[0]} = {step1[1]}} \$

\n

The first entry in the third row is $\\var{a[2][0]}$, so multiply the first row by $\\var{abs(zero_3_1)}$ and {if(zero_3_1<0,'subtract from','add to')} row 3 to get

\n

\$\\simplify[rowvector,all]{{step0[2]}+{zero_3_1}*{step0[0]} = {step1[2]}} \$

\n

The matrix at this stage is

\n

\$\\var{step1} \$

\n

#### b) Introduce a zero in the second column of the third row

\n

The second entry in the third row is $\\var{step1[2][1]}$, and we have a $1$ in the second entry of the second row, so multiply the second row by $\\var{abs(zero_3_2)}$ and {if(zero_3_2<0,'subtract from','add to')} row 3 to get

\n

\$\\simplify[rowvector,all]{{step1[2]}+{zero_3_2}*{step1[1]} = {step1[2]+zero_3_2*step1[1]}} \$

\n

{if(one_3_3<>1,one_3_3_message,'')}

\n

The matrix at this stage is

\n

\$\\var{step2} \$

\n

#### c) Introduce zeros in the third column

\n

The third entry in the first row is $\\var{step2[0][2]}$, and we have a $1$ in the third entry of the third row, so multiply the third row by $\\var{abs(zero_1_3)}$ and {if(zero_1_3<0,'subtract from','add to')} row 1 to get

\n

\$\\simplify[rowvector,all]{{step2[0]}+{zero_1_3}*{step2[2]} = {step2[0]+zero_1_3*step2[2]}} \$

\n

The third entry in the second row is $\\var{step2[1][2]}$, so multiply the third row by $\\var{abs(zero_2_3)}$ and {if(zero_2_3<0,'subtract from','add to')} row 2 to get

\n

\$\\simplify[rowvector,all]{{step2[1]}+{zero_2_3}*{step2[2]} = {step2[1]+zero_2_3*step2[2]}} \$

\n

The matrix at this stage is

\n

\$\\var{step3} \$

\n

#### d) Introduce a zero in the second column of the first row

\n

The second entry in the first row is $\\var{step3[0][1]}$, and we have a $1$ in the second entry of the second row, so multiply the second row by $\\var{abs(zero_1_2)}$ and {if(zero_1_2<0,'subtract from','add to')} row 1 to get

\n

\$\\simplify[rowvector,all]{{step3[0]}+{zero_1_2}*{step3[1]} = {step3[0]+zero_1_2*step3[1]}} \$

\n

The matrix at this stage is

\n

\$\\var{step4} \$

\n

Note that we have a $3 \\times 3$ identity matrix in the left three columns, and $\\mathrm{A}^{-1}$ is written in the three columns on the right. That is,

\n

\$\\mathrm{A}^{-1} = \\var{inverse} \$

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

Introduce zeros in the first column below the first entry by adding suitable multiples of the first row to rows 2 and 3.

\n

If necessary, multiply the second row by a suitable constant so that the second entry in the second row is $1$.

\n

$\\left(\\begin{array}{ccc|ccc} \\var{step0[0][0]} & \\var{step0[0][1]} & \\var{step0[0][2]} & \\var{step0[0][3]} & \\var{step0[0][4]} & \\var{step0[0][5]} \\\\ 0 & 1 & ? & ? & ? & ? \\\\ 0 & ? & ? & ? & ? & ? \\end{array}\\right) =$ [[0]]

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"variableReplacementStrategy": "originalfirst", "numColumns": "6", "tolerance": 0, "allowFractions": false, "variableReplacements": [], "markPerCell": true, "numRows": "3", "showCorrectAnswer": true, "correctAnswer": "step1", "scripts": {}, "correctAnswerFractions": false, "marks": "4", "type": "matrix", "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "

Now, using this matrix, introduce a zero in the second column of the third row.

\n

If necessary, multiply the third row by a suitable constant so that the third entry in the third row is $1$.

\n

$\\left(\\begin{array}{ccc|ccc} \\var{step0[0][0]} & \\var{step0[0][1]} & \\var{step0[0][2]} & \\var{step0[0][3]} & \\var{step0[0][4]} & \\var{step0[0][5]} \\\\ 0 & 1 & ? & ? & ? & ? \\\\ 0 & 0 & 1 & ? & ? & ? \\end{array}\\right) =$ [[0]]

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"variableReplacementStrategy": "originalfirst", "numColumns": "6", "tolerance": 0, "allowFractions": false, "variableReplacements": [], "markPerCell": false, "numRows": "3", "showCorrectAnswer": true, "correctAnswer": "step2", "scripts": {}, "correctAnswerFractions": false, "marks": "4", "type": "matrix", "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "

Next, introduce zeros into the third column of the second and first rows, by adding suitable multiples of the third row to those rows.

\n

$\\left(\\begin{array}{ccc|ccc} ? & ? & 0 & ? & ? & ? \\\\ 0 & 1 & 0 & ? & ? & ? \\\\ 0 & 0 & 1 & ? & ? & ? \\end{array}\\right) =$ [[0]]

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"variableReplacementStrategy": "originalfirst", "numColumns": "6", "tolerance": 0, "allowFractions": false, "variableReplacements": [], "markPerCell": false, "numRows": "3", "showCorrectAnswer": true, "correctAnswer": "step3", "scripts": {}, "correctAnswerFractions": false, "marks": "4", "type": "matrix", "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}, {"prompt": "

One final operation is needed: add a multiple of the second row to the first row to introduce a zero in the second column of the first row.

\n

\n

$\\left(\\begin{array}{ccc|ccc} 1 & 0 & 0 & ? & ? & ? \\\\ 0 & 1 & 0 & ? & ? & ? \\\\ 0 & 0 & 1 & ? & ? & ? \\end{array}\\right) =$ [[0]]

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"variableReplacementStrategy": "originalfirst", "numColumns": "6", "tolerance": 0, "allowFractions": false, "variableReplacements": [], "markPerCell": false, "numRows": "3", "showCorrectAnswer": true, "correctAnswer": "step4", "scripts": {}, "correctAnswerFractions": false, "marks": "4", "type": "matrix", "allowResize": false}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "extensions": [], "statement": "

Find the inverse of the following matrix:
\$\\simplify{matrix:A = {a}} \$

\n

Form the $3 \\times 6$ augmented matrix $\\mathrm{B}$ by placing $I_3$ to the right of $\\mathrm{A}$ as below:

\n

\$\\mathrm{B} = \\left(\\begin{array}{rrr|ccc} \\var{a[0][0]} & \\var{a[0][1]} & \\var{a[0][2]} &\\var{1}&\\var{0}&\\var{0}\\\\ \\var{a[1][0]} & \\var{a[1][1]} & \\var{a[1][2]}&\\var{0}&\\var{1}&\\var{0}\\\\ \\var{a[2][0]} & \\var{a[2][1]} & \\var{a[2][2]}&\\var{0}&\\var{0}&\\var{1}\\\\ \\end{array}\\right)\$

\n

In subsequent parts work with this matrix using row operations to introduce the identity matrix on the left hand side, with the inverse of $\\mathrm{A}$ eventually appearing on the right hand side.

\n

Input all numbers as fractions or integers and not as decimals.

", "variable_groups": [{"variables": ["a"], "name": "matrix A"}, {"variables": ["step0", "zero_2_1", "zero_3_1", "one_2_2", "step1", "zero_3_2", "one_3_3", "step2", "zero_1_3", "zero_2_3", "step3", "zero_1_2", "step4", "inverse", "one_3_3_message"], "name": "Steps"}], "variablesTest": {"maxRuns": 100, "condition": "f[1]<>g[1]"}, "preamble": {"css": "", "js": ""}, "variables": {"a": {"definition": "matrix([\n [f[0]*g[0], f[0]*rb*g[1], f[0]*(rb*ra-rb)*g[2]],\n [f[1]*ra*g[0], f[1]*(ra*rb-1)*g[1], f[1]*(ra^2*rb-ra-ra*rb)*g[2]],\n [f[2]*ra*rc*g[0],f[2]*rc*rb*g[1], f[2]*g[2]]\n])", "templateType": "anything", "group": "matrix A", "name": "a", "description": "

This matrix is designed so its determinant is $-1$, meaning its inverse has integer components.

\n

Additionally, when you introduce zeros in the second and third rows, you should end up with a $1$ in each of the leading columns, so you don't have to do a division.

"}, "zero_3_1": {"definition": "-(step0[2][0]/step0[0][0])", "templateType": "anything", "group": "Steps", "name": "zero_3_1", "description": ""}, "inverse": {"definition": "matrix([\n list(step4[0])[3..6],\n list(step4[1])[3..6],\n list(step4[2])[3..6]\n])", "templateType": "anything", "group": "Steps", "name": "inverse", "description": "

The inverse of $\\mathrm{A}$

"}, "zero_3_2": {"definition": "-step1[2][1]/step1[1][1]", "templateType": "anything", "group": "Steps", "name": "zero_3_2", "description": ""}, "g": {"definition": "[f[0]]+repeat(random(-1,1),2)", "templateType": "anything", "group": "Ungrouped variables", "name": "g", "description": ""}, "f": {"definition": "repeat(random(-1,1),3)", "templateType": "anything", "group": "Ungrouped variables", "name": "f", "description": ""}, "zero_2_1": {"definition": "-(step0[1][0]/step0[0][0])", "templateType": "anything", "group": "Steps", "name": "zero_2_1", "description": ""}, "one_2_2": {"definition": "1/(step0[1][1]+step0[0][1]*zero_2_1)", "templateType": "anything", "group": "Steps", "name": "one_2_2", "description": ""}, "rb": {"definition": "//5\nrandom(2..6)", "templateType": "anything", "group": "Ungrouped variables", "name": "rb", "description": "

A random number

"}, "step4": {"definition": "matrix([\n step3[0]+zero_1_2*step3[1],\n step3[1],\n step3[2]\n])", "templateType": "anything", "group": "Steps", "name": "step4", "description": "

Make sure row 1 has a zero in the second column.

"}, "one_3_3_message": {"definition": "\"Note that the third column in the third row is $\\\\var{step1[2][2]+zero_3_2*step1[1][2]}$ and not $1$, so divide the third row by $\\\\var{one_3_3}$.\"", "templateType": "anything", "group": "Steps", "name": "one_3_3_message", "description": "

To be displayed if the third row needs to be scaled in step 2.

"}, "step3": {"definition": "matrix([\n step2[0]+zero_1_3*step2[2],\n step2[1]+zero_2_3*step2[2],\n step2[2]\n])", "templateType": "anything", "group": "Steps", "name": "step3", "description": "

Make sure rows 1 and 2 have a zero in the third column

"}, "step2": {"definition": "matrix([\n step1[0],\n step1[1],\n (step1[2]+zero_3_2*step1[1])*one_3_3\n])", "templateType": "anything", "group": "Steps", "name": "step2", "description": "

Make sure row 3 has a zero in the second column, and row 3 has a 1 in the third column.

"}, "step1": {"definition": "matrix([\n step0[0],\n (step0[1]+zero_2_1*step0[0])*one_2_2,\n step0[2]+zero_3_1*step0[0]\n])", "templateType": "anything", "group": "Steps", "name": "step1", "description": "

Make sure rows 2 and 3 have a 0 in the first column, and row 2 has a 1 in the second column.

"}, "rc": {"definition": "//2\nrandom(1,2,3)", "templateType": "anything", "group": "Ungrouped variables", "name": "rc", "description": "

A random number

"}, "zero_1_2": {"definition": "-(step3[0][1]/step3[1][1])", "templateType": "anything", "group": "Steps", "name": "zero_1_2", "description": ""}, "one_3_3": {"definition": "(1/(step1[2][2]+step1[1][2]*zero_3_2))", "templateType": "anything", "group": "Steps", "name": "one_3_3", "description": ""}, "zero_1_3": {"definition": "-(step2[0][2]/step2[2][2])", "templateType": "anything", "group": "Steps", "name": "zero_1_3", "description": ""}, "zero_2_3": {"definition": "-(step2[1][2]/step2[2][2])", "templateType": "anything", "group": "Steps", "name": "zero_2_3", "description": ""}, "step0": {"definition": "matrix([\n list(a[0])+[1,0,0],\n list(a[1])+[0,1,0],\n list(a[2])+[0,0,1]\n])", "templateType": "anything", "group": "Steps", "name": "step0", "description": ""}, "ra": {"definition": "//4\nrandom(2..6)", "templateType": "anything", "group": "Ungrouped variables", "name": "ra", "description": "

A random number

$A$ a $3 \\times 3$ matrix. Using row operations on the augmented matrix $\\left(A | I_3\\right)$ reduce to $\\left(I_3 | A^{-1}\\right)$.