// Numbas version: finer_feedback_settings {"name": "LM04 Multiplying matrices", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "LM04 Multiplying matrices", "tags": [], "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "
Multiplying Matrices
\nCalculate the following:
", "advice": "When you are multiplying two matrices together you need to know what elements of each matrix multiply with each other to produce the answer. In order to look at this let's define the two matrices:
\n$A=\\var{MatrixA1}$
\nand
\n$B=\\var{MatrixA2}.$
\nThese two matrices match the dimensions of the two given in is part a) of this question. When they are multiplied together as we have seen the answer will be a $\\var{row[0]}$ by $\\var{col[0]}$ matrix. So we can denote this matrix in the following way:
\n$\\var{MatrixA1}$X$\\var{MatrixA2}=\\var{Answermatrixa}$
\nThe way in which this is calculated is as follows in terms of a formula:
\n$\\var{Answermatrixa}=\\var{matrixmultcalc}$
\nIf you are trying to calculate $c_{11}$ for example one way to think of this is to imagine picking up the first column of the second matrix and tipping it on its side and laying it on top of the top row of the first matrix so, for example, $a_{11}$ gets paired with $b_{11}$ and $a_{12}$ gets paired with $b_{21}$ etc. As we can see in the above formula.
\n\na) $\\var{A}$X$\\var{Apair} = \\var{A*Apair}$
\nb) $\\var{B}$X$\\var{Bpair} = \\var{B*Bpair}$
\nb) $\\var{C}$X$\\var{Cpair} = \\var{C*Cpair}$
\nUse this link to find some resources which will help you revise this topic.
", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"A": {"name": "A", "group": "Ungrouped variables", "definition": "matrix(repeat(repeat(random(-9..9),match[0]),row[0]))", "description": "", "templateType": "anything", "can_override": false}, "col": {"name": "col", "group": "Ungrouped variables", "definition": "repeat(random(1..3),3)", "description": "", "templateType": "anything", "can_override": false}, "B": {"name": "B", "group": "Ungrouped variables", "definition": "matrix(repeat(repeat(random(-9..9),match[1]),row[1]))", "description": "", "templateType": "anything", "can_override": false}, "C": {"name": "C", "group": "Ungrouped variables", "definition": "matrix(repeat(repeat(random(-9..9),match[2]),row[2]))", "description": "", "templateType": "anything", "can_override": false}, "Apair": {"name": "Apair", "group": "Ungrouped variables", "definition": "matrix(repeat(repeat(random(-9..9),col[0]),match[0]))", "description": "", "templateType": "anything", "can_override": false}, "Bpair": {"name": "Bpair", "group": "Ungrouped variables", "definition": "matrix(repeat(repeat(random(-9..9),col[1]),match[1]))", "description": "", "templateType": "anything", "can_override": false}, "Cpair": {"name": "Cpair", "group": "Ungrouped variables", "definition": "matrix(repeat(repeat(random(-9..9),col[2]),match[2]))", "description": "", "templateType": "anything", "can_override": false}, "match": {"name": "match", "group": "Ungrouped variables", "definition": "repeat(random(2..4),3)", "description": "", "templateType": "anything", "can_override": false}, "Rawanswermatrixa": {"name": "Rawanswermatrixa", "group": "Advice", "definition": "map('c_{'+'{j}'+'{l}}'+latexcodebits(row[0],col[0])[j-1][l-1],[j,l],product(1..row[0],1..col[0]))", "description": "\"Latexcodebits\" is a JME function written in the Extensions and scripts section. It is a useful function for creating a list of symbols such as \"a_11\" to populate a matrix for the explanation section.
", "templateType": "anything", "can_override": false}, "row": {"name": "row", "group": "Ungrouped variables", "definition": "repeat(random(2..4),3)", "description": "", "templateType": "anything", "can_override": false}, "answermatrixa": {"name": "answermatrixa", "group": "Advice", "definition": "latex('\\\\begin{pmatrix}'+ stringify(rawanswermatrixa) + '\\\\end{'+'pmatrix}')", "description": "\"stringify\" is a javascript written in the Extensions and scripts section - this converts a list of things into a string suitable for latex to read as a matrix.
", "templateType": "anything", "can_override": false}, "RawmatrixA1": {"name": "RawmatrixA1", "group": "Advice", "definition": "map('a_{'+'{j}'+'{l}}'+latexcodebits(row[0],match[0])[j-1][l-1],[j,l],product(1..row[0],1..match[0]))", "description": "", "templateType": "anything", "can_override": false}, "RawmatrixA2": {"name": "RawmatrixA2", "group": "Advice", "definition": "map('b_{'+'{j}'+'{l}}'+Latexcodebits(match[0],col[0])[j-1][l-1],[j,l],product(1..match[0],1..col[0]))", "description": "", "templateType": "anything", "can_override": false}, "matrixA1": {"name": "matrixA1", "group": "Advice", "definition": "latex('\\\\begin{pmatrix}'+ stringify(RawmatrixA1) + '\\\\end{'+'pmatrix}')", "description": "", "templateType": "anything", "can_override": false}, "matrixA2": {"name": "matrixA2", "group": "Advice", "definition": "latex('\\\\begin{pmatrix}'+ stringify(RawmatrixA2) + '\\\\end{'+'pmatrix}')", "description": "", "templateType": "anything", "can_override": false}, "Rawmatrixmultcalc": {"name": "Rawmatrixmultcalc", "group": "Advice", "definition": "map('a_\\{{r+1}{t+1}\\}'+'\\\\cdot'+' b_\\{{t+1}{s+1}\\}'+latexcodebitsproductcalc(row[0],match[0],col[0])[r][s][t],[r,s,t],product(0..(row[0]-1),0..(col[0]-1),0..(match[0]-1)))", "description": "", "templateType": "anything", "can_override": false}, "matrixmultcalc": {"name": "matrixmultcalc", "group": "Advice", "definition": "latex('\\\\begin{pmatrix}'+ stringify(rawmatrixmultcalc) +'\\\\end{'+'pmatrix}')", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["col", "row", "match", "A", "Apair", "B", "Bpair", "C", "Cpair"], "variable_groups": [{"name": "matrix notation", "variables": []}, {"name": "Advice", "variables": ["RawmatrixA1", "matrixA1", "RawmatrixA2", "matrixA2", "Rawanswermatrixa", "answermatrixa", "Rawmatrixmultcalc", "matrixmultcalc"]}], "functions": {"Latexcodebits": {"parameters": [["m", "number"], ["n", "number"]], "type": "list", "language": "jme", "definition": "repeat(repeat('&',n-1)+['\\\\\\\\'],m-1)+[repeat('&',n-1)+['']]"}, "stringify": {"parameters": [["input", "list"]], "type": "string", "language": "javascript", "definition": "var output = '';\nvar i;\nfor (i = 0; i < input.length; i++) {\n output += input[i];\n} \nreturn output;"}, "Latexcodebitsproductcalc": {"parameters": [["m", "number"], ["k", "number"], ["n", "number"]], "type": "anything", "language": "jme", "definition": "repeat(repeat(repeat('+',k-1)+['&'],n-1)+[repeat('+',k-1)+['\\\\\\\\']],m-1)+[repeat(repeat('+',k-1)+['&'],n-1)+[repeat('+',k-1)+['']]]"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "matrix", "useCustomName": true, "customName": "a)", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "$\\var{A}$X$\\var{Apair}=$
", "correctAnswer": "{A}*{Apair}", "correctAnswerFractions": false, "numRows": "{row[0]}", "numColumns": "{col[0]}", "allowResize": false, "tolerance": 0, "markPerCell": false, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0, "prefilledCells": ""}, {"type": "matrix", "useCustomName": true, "customName": "b)", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "$\\var{B}$X$\\var{Bpair}$
", "correctAnswer": "{B}*{Bpair}", "correctAnswerFractions": false, "numRows": "{row[1]}", "numColumns": "{col[1]}", "allowResize": false, "tolerance": 0, "markPerCell": false, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0, "prefilledCells": ""}, {"type": "matrix", "useCustomName": true, "customName": "c)", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "$\\var{C}$X$\\var{Cpair}$
", "correctAnswer": "{C}*{Cpair}", "correctAnswerFractions": false, "numRows": "{row[2]}", "numColumns": "{col[2]}", "allowResize": false, "tolerance": 0, "markPerCell": false, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0, "prefilledCells": ""}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Mash Sheffield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4679/"}, {"name": "Will Morgan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21933/"}], "resources": []}]}], "contributors": [{"name": "Mash Sheffield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/4679/"}, {"name": "Will Morgan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/21933/"}]}