// Numbas version: exam_results_page_options {"name": "Matrix Multiplication", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Matrix Multiplication", "tags": [], "metadata": {"description": "

Matrix by scalar and matrix by matrix multiplication exercises.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

Matrix Multiplication

\n

\n

Answer the following questions on matrix multiplication.

", "advice": "

Scalar Multiplication

\n

For scalar multiplication, multiply each element by the scalar value. The resultant matrix will be of the same order (size) as the starting matrix.

\n

e.g. for the first question:

\n

$\\simplify{{maS1}}\\times\\var{rand1} = \\begin{pmatrix}
\\var{maS1[0][0]}\\times\\var{rand1} & \\var{maS1[0][1]}\\times\\var{rand1} \\\\
\\var{maS1[1][0]}\\times\\var{rand1} & \\var{maS1[1][1]}\\times\\var{rand1}
\\end{pmatrix} = \\simplify{{maS1a}}$

\n

\n

Matrix by Matrix Multiplcation

\n

Matrices can only be multiplied together when the number of columns in the first matrix is equal to the number of rows in the second matrix. The resultant matrix will have the same number of rows as the first matrix, and the same number of columns as the second matrix.

\n

For $AC$,

\n

$A = \\simplify{{maMa}} C = \\simplify{{maMc}}$

\n

The order of $A$ is [3 x 2] and the order of $C$ is [2 x 4].

\n

[3 x 2] x [2 x 4] : The inner numbers match, therefore these matrices can be multiplied. The outer numbers give the size of the new matrix, which will be [3 x 4].

\n

The answer matrix will look like this: $\\begin{pmatrix}
ac_{11} & ac_{12} & ac_{13} & ac_{14} \\\\
ac_{21} & ac_{22} & ac_{23} & ac_{24} \\\\
ac_{31} & ac_{32} & ac_{33} & ac_{34}
\\end{pmatrix}$

\n

To work out the values for the answer matrix we multiply:-

\n\n

So:

\n

$ac_{11} = a_{11}c_{11}+a_{12}c_{21} = \\var{maMa[0][0]}\\times\\var{maMc[0][0]} + \\var{maMa[0][1]}\\times\\var{maMc[1][0]} = \\var{maMac[0][0]}$

\n

$ac_{12} = a_{11}c_{12}+a_{12}c_{22} = \\var{maMa[0][0]}\\times\\var{maMc[0][1]} + \\var{maMa[0][1]}\\times\\var{maMc[1][1]} = \\var{maMac[0][1]}$

\n

$ac_{13} = a_{11}c_{13}+a_{12}c_{23} = \\var{maMa[0][0]}\\times\\var{maMc[0][2]} + \\var{maMa[0][1]}\\times\\var{maMc[1][2]} = \\var{maMac[0][2]}$

\n

$ac_{14} = a_{11}c_{14}+a_{12}c_{24} = \\var{maMa[0][0]}\\times\\var{maMc[0][3]} + \\var{maMa[0][1]}\\times\\var{maMc[1][3]} = \\var{maMac[0][3]}$

\n

$ac_{21} = a_{21}c_{11}+a_{22}c_{21} = \\var{maMa[1][0]}\\times\\var{maMc[0][0]} + \\var{maMa[1][1]}\\times\\var{maMc[1][0]} = \\var{maMac[1][0]}$

\n

and so on...

", "rulesets": {}, "extensions": [], "variables": {"maS1": {"name": "maS1", "group": "Ungrouped variables", "definition": "matrixrandom(2,2)", "description": "", "templateType": "anything"}, "rand1": {"name": "rand1", "group": "Ungrouped variables", "definition": "random(1..9)*random(1,1,1,-1)", "description": "", "templateType": "anything"}, "maS2": {"name": "maS2", "group": "Ungrouped variables", "definition": "matrixrandom(2,3)", "description": "", "templateType": "anything"}, "rand2": {"name": "rand2", "group": "Ungrouped variables", "definition": "random(1..9)*random(1,1,1,-1)", "description": "", "templateType": "anything"}, "maS3": {"name": "maS3", "group": "Ungrouped variables", "definition": "matrixrandom(1,4)", "description": "", "templateType": "anything"}, "rand3": {"name": "rand3", "group": "Ungrouped variables", "definition": "random(1..9)*random(1,1,1,-1)", "description": "", "templateType": "anything"}, "maMa": {"name": "maMa", "group": "Ungrouped variables", "definition": "matrixrandomN(3,2)", "description": "", "templateType": "anything"}, "maMb": {"name": "maMb", "group": "Ungrouped variables", "definition": "matrixrandomN(3,3)", "description": "", "templateType": "anything"}, "maMc": {"name": "maMc", "group": "Ungrouped variables", "definition": "matrixrandomN(2,4)", "description": "", "templateType": "anything"}, "maMd": {"name": "maMd", "group": "Ungrouped variables", "definition": "matrixrandomN(4,3)", "description": "", "templateType": "anything"}, "maMe": {"name": "maMe", "group": "Ungrouped variables", "definition": "matrixrandomN(4,2)", "description": "", "templateType": "anything"}, "maS1a": {"name": "maS1a", "group": "Ungrouped variables", "definition": "maS1*rand1", "description": "", "templateType": "anything"}, "maMac": {"name": "maMac", "group": "Ungrouped variables", "definition": "maMa*maMc", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["maS1", "rand1", "maS2", "rand2", "maS3", "rand3", "maMa", "maMb", "maMc", "maMd", "maMe", "maS1a", "maMac"], "variable_groups": [], "functions": {"matrixrandom": {"parameters": [["rows", "integer"], ["columns", "integer"]], "type": "matrix", "language": "jme", "definition": "matrix(repeat(repeat(random(0..9)*(random(1,1,1,-1)),columns),rows))"}, "matrixrandomN": {"parameters": [["rows", "integer"], ["columns", "integer"]], "type": "matrix", "language": "jme", "definition": "matrix(repeat(repeat(random(0..9),columns),rows))"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "information", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Scalar Multiplication

"}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Perform the following matrix scalar multiplications.

\n

\n

$\\simplify{{maS1}}\\times\\simplify{{rand1}} =$ [[0]]

\n

\n

$\\simplify{{maS2}}\\times\\simplify{{rand2}} =$ [[1]]

\n

\n

$\\simplify{{maS3}}\\times\\simplify{{rand3}} =$ [[2]]

\n

\n

\n

", "gaps": [{"type": "matrix", "useCustomName": false, "customName": "", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "correctAnswer": "maS1*rand1", "correctAnswerFractions": false, "numRows": 1, "numColumns": 1, "allowResize": true, "tolerance": 0, "markPerCell": true, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}, {"type": "matrix", "useCustomName": false, "customName": "", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "correctAnswer": "maS2*rand2", "correctAnswerFractions": false, "numRows": 1, "numColumns": 1, "allowResize": true, "tolerance": 0, "markPerCell": true, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}, {"type": "matrix", "useCustomName": false, "customName": "", "marks": "2", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "correctAnswer": "maS3*rand3", "correctAnswerFractions": false, "numRows": 1, "numColumns": 1, "allowResize": true, "tolerance": 0, "markPerCell": true, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}], "sortAnswers": false}, {"type": "information", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Matrix by Matrix Multiplication

\n

Consider the following matrices

\n

\n

$A=\\simplify{{maMa}}$  $B=\\simplify{{maMb}}$  $C=\\simplify{{maMc}}$  $D=\\simplify{{maMd}}$  $E=\\simplify{{maMe}}$

\n

\n

"}, {"type": "m_n_x", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Which of the following combinations can be defined?

", "minMarks": 0, "maxMarks": "7", "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": true, "shuffleAnswers": false, "displayType": "radiogroup", "warningType": "none", "showCellAnswerState": true, "choices": ["AB", "DB", "AC", "CE", "EC", "DE", "BD"], "matrix": [[0, "1"], ["1", 0], ["1", 0], ["1", 0], ["1", 0], [0, "1"], [0, "1"]], "layout": {"type": "all", "expression": ""}, "answers": ["Yes", "No"]}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What will the order of the matrix produced be for each of these multiplications?

\n

\n

AC:    [[0]]x  [[1]]

\n

BA:    [[2]]x  [[3]]

\n

CE:    [[4]]x  [[5]]

\n

EC:    [[6]]x  [[7]]

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "numrows(maMa*maMc)", "maxValue": "numrows(maMa*maMc)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "numcolumns(maMa*maMc)", "maxValue": "numcolumns(maMa*maMc)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "numrows(maMb*maMa)", "maxValue": "numrows(maMb*maMa)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "numcolumns(maMb*maMa)", "maxValue": "numcolumns(maMb*maMa)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "numrows(maMc*maMe)", "maxValue": "numrows(maMc*maMe)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "numcolumns(maMc*maMe)", "maxValue": "numcolumns(maMc*maMe)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "numrows(maMe*maMc)", "maxValue": "numrows(maMe*maMc)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "0.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "numcolumns(maMe*maMc)", "maxValue": "numcolumns(maMe*maMc)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "matrix", "useCustomName": false, "customName": "", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate the product of AC.

\n

AC = $\\simplify{{maMa}}\\times\\simplify{{maMc}} =$ ? 

", "correctAnswer": "maMa*maMc", "correctAnswerFractions": false, "numRows": 1, "numColumns": 1, "allowResize": true, "tolerance": 0, "markPerCell": true, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}, {"type": "matrix", "useCustomName": false, "customName": "", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate the product of CE.

\n

CE = $\\simplify{{maMc}}\\times\\simplify{{maMe}} =$ ? 

", "correctAnswer": "maMc*maMe", "correctAnswerFractions": false, "numRows": 1, "numColumns": 1, "allowResize": true, "tolerance": 0, "markPerCell": true, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}, {"type": "matrix", "useCustomName": false, "customName": "", "marks": "4", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate the product of EC.

\n

EC = $\\simplify{{maMe}}\\times\\simplify{{maMc}} =$ ? 

", "correctAnswer": "maMe*maMc", "correctAnswerFractions": false, "numRows": 1, "numColumns": 1, "allowResize": true, "tolerance": 0, "markPerCell": true, "allowFractions": false, "minColumns": 1, "maxColumns": 0, "minRows": 1, "maxRows": 0}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Mark Patterson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5064/"}]}]}], "contributors": [{"name": "Mark Patterson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5064/"}]}