// Numbas version: exam_results_page_options {"name": "Find determinant of a 3x3 matrix with a free variable by row reduction", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variablesTest": {"condition": "d1[1][1]<>0\nand d1[1][1]*d1[2][1]<0", "maxRuns": 100}, "variables": {"q": {"templateType": "anything", "group": "Constants", "definition": "free_det(upper_triangular, upper_triangular_a)", "description": "", "name": "q"}, "aa": {"templateType": "anything", "group": "Short names for upper triangular matrices", "definition": "upper_triangular_a", "description": "", "name": "aa"}, "ac": {"templateType": "anything", "group": "Short names for upper triangular matrices", "definition": "upper_triangular", "description": "", "name": "ac"}, "c12": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..5)*100", "description": "", "name": "c12"}, "a1": {"templateType": "anything", "group": "A term", "definition": "matrix([\n [0,0,random(1..4)],\n [0,0,random(1..4)],\n [0,0,0]\n])", "description": "", "name": "a1"}, "d1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "matrix([\n m1[0],\n m1[1]-(m1[1][0]/m1[0][0])*m1[0],\n m1[2]-(m1[2][0]/m1[0][0])*m1[0]\n])", "description": "", "name": "d1"}, "upper_triangular_a": {"templateType": "anything", "group": "A term", "definition": "matrix([\n ad1[0],\n ad1[1],\n ad1[2]-(d1[2][1]/d1[1][1])*ad1[1]\n])", "description": "", "name": "upper_triangular_a"}, "m1": {"templateType": "anything", "group": "Constants", "definition": "matrix(repeat(repeat(random(1..4),3),3))", "description": "", "name": "m1"}, "c20": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..3)", "description": "", "name": "c20"}, "c11": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..5)*100", "description": "", "name": "c11"}, "m2": {"templateType": "anything", "group": "Constants", "definition": "matrix([m1[0],c11*m1[0]+m1[1],c12*m1[0]+m1[2]])", "description": "", "name": "m2"}, "a3": {"templateType": "anything", "group": "A term", "definition": "matrix(\n [a2[0]+c20*a2[1],a2[1],a2[2]]\n)", "description": "", "name": "a3"}, "upper_triangular": {"templateType": "anything", "group": "Ungrouped variables", "definition": "matrix([\n d1[0],\n d1[1],\n d1[2]-(d1[2][1]/d1[1][1])*d1[1]\n])", "description": "", "name": "upper_triangular"}, "determinant": {"templateType": "anything", "group": "Ungrouped variables", "definition": "det(m1)", "description": "", "name": "determinant"}, "a2": {"templateType": "anything", "group": "A term", "definition": "matrix([a1[0],c11*a1[0]+a1[1],c12*a1[0]+a1[2]])", "description": "", "name": "a2"}, "ad1": {"templateType": "anything", "group": "A term", "definition": "matrix([\n a1[0],\n a1[1]-(m1[1][0]/m1[0][0])*a1[0],\n a1[2]-(m1[2][0]/m1[0][0])*a1[0]\n])", "description": "", "name": "ad1"}, "m3": {"templateType": "anything", "group": "Constants", "definition": "matrix(\n [m2[0]+c20*m2[1],m2[1],m2[2]]\n)", "description": "", "name": "m3"}}, "ungrouped_variables": ["c12", "c11", "c20", "determinant", "d1", "upper_triangular"], "name": "Find determinant of a 3x3 matrix with a free variable by row reduction", "functions": {"show_matrix": {"type": "string", "language": "javascript", "definition": "var rows = [];\nfor(var i=0;iWrite a matrix $\\mathrm{M}'$ with the same determinant as $\\mathrm{M}$ as the sum of two upper triangular matrices, one of which is multiplied by $a$. Enter numbers as integers or fractions, not decimals.

\n

$\\mathrm{M}' = $ [[0]] $a + \\phantom{}$ [[1]]

", "showCorrectAnswer": true, "customMarkingAlgorithm": "correctDeterminant: \n free_det(upper_triangular, upper_triangular_a)\n\nstudentDeterminant:\n free_det(interpreted_answers[1], interpreted_answers[0])\n\nright_determinant:\n correctif(all(map(isclose(a,b),[a,b],zip(studentDeterminant,correctDeterminant))))\n\ngap_feedback (Feedback on each of the gaps):\n map(\n let(\n result,submit_part(gaps[gap_number][\"path\"],answer),\n name,gaps[gap_number][\"name\"],\n assert(name=\"\",feedback(translate('part.gapfill.feedback header',[\"name\": name])));\n concat_feedback(filter(x[\"op\"]<>\"warning\",x,result[\"feedback\"]), if(marks>0,result[\"marks\"]/marks,1));\n result\n ),\n [gap_number,answer,index],\n zip(gap_order,studentAnswer,list(1..len(gaps)))\n )\n\nboth_valid:\n map(assert(x[\"valid\"], concat_feedback(x[\"feedback\"],0.5)), x, marked_original_order)\n \n\nboth_upper_triangular:\n if(all(map(x[\"credit\"]=1, x, marked_original_order)),\n true\n ,\n incorrect(\"One or both of your matrices are not upper triangular - every value below the main diagonal should be zero.\");\n end();\n false\n )\n\nmark:\n apply(both_valid);\n apply(both_upper_triangular);\n apply(right_determinant)", "extendBaseMarkingAlgorithm": true, "useCustomName": false, "customName": "", "unitTests": [], "sortAnswers": false, "scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": true, "correctAnswer": "upper_triangular_a", "markPerCell": false, "useCustomName": false, "customName": "", "customMarkingAlgorithm": "is_upper_triangular:\n if(all(map(x<=y or studentmatrix[x][y]=0, [x,y], cell_indexes)),\n correct();\n true\n ,\n incorrect(\"Your matrix is not upper triangular\");\n end();\n false\n )\n\nmark:\n apply(any_empty);\n apply(any_invalid);\n apply(is_upper_triangular)", "unitTests": [], "correctAnswerFractions": true, "allowResize": false, "numRows": "3", "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "matrix", "numColumns": "3", "tolerance": 0, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": "1", "showFeedbackIcon": false}, {"showCorrectAnswer": true, "allowFractions": true, "correctAnswer": "upper_triangular", "markPerCell": false, "useCustomName": false, "customName": "", "customMarkingAlgorithm": "is_upper_triangular:\n if(all(map(x<=y or studentmatrix[x][y]=0, [x,y], cell_indexes)),\n correct();\n true\n ,\n incorrect(\"Your matrix is not upper triangular\");\n end();\n false\n )\n\nmark:\n apply(any_empty);\n apply(any_invalid);\n apply(is_upper_triangular)", "unitTests": [], "correctAnswerFractions": true, "allowResize": false, "numRows": "3", "scripts": {}, "extendBaseMarkingAlgorithm": true, "type": "matrix", "numColumns": "3", "tolerance": 0, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": "1", "showFeedbackIcon": false}], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "showFeedbackIcon": true}, {"answer": "{aa[0][0]*aa[1][1]*aa[2][2]}*a^3 + {aa[0][0]*aa[1][1]*ac[2][2] + aa[0][0]*ac[1][1]*aa[2][2] + ac[0][0]*aa[1][1]*aa[2][2]}*a^2 + {ac[0][0]*ac[1][1]*aa[2][2] + ac[0][0]*aa[1][1]*ac[2][2] + aa[0][0]*ac[1][1]*ac[2][2]}*a + {ac[0][0]*ac[1][1]*ac[2][2]}", "vsetRangePoints": 5, "useCustomName": false, "prompt": "

What is the determinant of $\\mathrm{M}$, in terms of $a$?

", "checkingType": "absdiff", "valuegenerators": [{"value": "", "name": "a"}], "vsetRange": [0, 1], "showFeedbackIcon": true, "type": "jme", "variableReplacementStrategy": "originalfirst", "checkingAccuracy": 0.001, "variableReplacements": [], "failureRate": 1, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "showPreview": true, "customName": "", "checkVariableNames": false, "unitTests": [], "scripts": {}, "showCorrectAnswer": true, "marks": 1}], "statement": "

You are given the matrix $\\mathrm{M} =
\\begin{pmatrix}
\\simplify{{m3[0][0]} + {a3[0][0]}a} & \\simplify{{m3[0][1]} + {a3[0][1]}a} & \\simplify{{m3[0][2]} + {a3[0][2]}a} \\\\
\\simplify{{m3[1][0]} + {a3[1][0]}a} & \\simplify{{m3[1][1]} + {a3[1][1]}a} & \\simplify{{m3[1][2]} + {a3[1][2]}a} \\\\
\\simplify{{m3[2][0]} + {a3[2][0]}a} & \\simplify{{m3[2][1]} + {a3[2][1]}a} & \\simplify{{m3[2][2]} + {a3[2][2]}a} \\\\
\\end{pmatrix}$ for some $a \\in \\mathbb{R}$.

", "tags": [], "rulesets": {}, "extensions": [], "type": "question", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Given a 3x3 matrix with very big elements, perform row operations to find a matrix with single-digit elements. Then reduce that to an upper triangular matrix, and hence find the determinant.

"}, "advice": "

a)

\n

Note that subtracting one row from another does not affect the determinant. In fact, adding or subtracting any multiple of one row from another does not affect the determinant. That is, the row operation $r_i \\to r_i + ar_j$, $i \\neq j$, does not affect the determinant.

\n

First, we can perform a couple of row operations to make the numbers in each entry smaller.

\n

Subtract $\\simplify{{c20}r_2}$ from $r_1$ to obtain $\\mathrm{M}_1 = \\var{show_matrix(m2,a2)}$.

\n

Subtract $\\simplify{{c11}r_1}$ from $r_2$ and $\\simplify{{c12}r_1}$ from $r_3$ of $\\mathrm{M}_1$ to obtain $\\mathrm{M}_2 = \\var{show_matrix(m1,a1)}$.

\n

Considering each column in turn, we use row operations to ensure that there are zeros in each entry below the main diagonal, $\\mathrm{M}_{ij}$, $i \\gt j$.

\n

Subtract $\\simplify[fractionnumbers,unitfactor]{{m1[1][0]/m1[0][0]}r_1}$ from $r_2$ and $\\simplify[fractionnumbers,unitfactor]{{m1[2][0]/m1[0][0]}r_1}$ from $r_3$ of $\\mathrm{M}_2$ to obtain $\\mathrm{M}_3 = \\var{show_matrix(d1,ad1)}$.

\n

Add $\\simplify[fractionnumbers,unitfactor]{{-d1[2][1]/d1[1][1]}r_2}$ to Subtract $\\simplify[fractionnumbers,unitfactor]{{d1[2][1]/d1[1][1]}r_2}$ from $r_3$ of $\\mathrm{M}_3$ to obtain $\\mathrm{M}_4 = \\var{show_matrix(upper_triangular,upper_triangular_a)}$.

\n

So, $\\mathrm{M}_4$ can be written in the required form as $\\var[fractionnumbers]{upper_triangular_a}a + \\var[fractionnumbers]{upper_triangular}$.

\n

b)

\n

Using the upper triangular matrix $\\mathrm{M}_4$ found in part a), the determinant of $\\mathrm{M}$ is

\n

\n

\\[ \\det(\\mathrm{M}) = \\det(\\mathrm{M}_4) = \\left(\\simplify[all,!noleadingminus,fractionnumbers]{({aa[0][0]}a+{ac[0][0]})}\\right) \\times \\left(\\simplify[all,fractionnumbers]{({aa[1][1]}a+{ac[1][1]})}\\right) \\times \\left(\\simplify[all,fractionnumbers]{({aa[2][2]}a+{ac[2][2]})}\\right) = \\simplify[all,fractionnumbers]{{aa[0][0]*aa[1][1]*aa[2][2]}*a^3 + {aa[0][0]*aa[1][1]*ac[2][2] + aa[0][0]*ac[1][1]*aa[2][2] + ac[0][0]*aa[1][1]*aa[2][2]}*a^2 + {ac[0][0]*ac[1][1]*aa[2][2] + ac[0][0]*aa[1][1]*ac[2][2] + aa[0][0]*ac[1][1]*ac[2][2]}*a + {ac[0][0]*ac[1][1]*ac[2][2]}} \\]

", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}