// Numbas version: exam_results_page_options {"name": "Matrices: Basics 03", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Matrices: Basics 03", "tags": [], "metadata": {"description": "Square matrices, leading/principle diagonal and trace.", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "statement": "

Square Matrices

\n

When the number of rows is the same as the number of colums i.e. $m=n$, the matrix is said to be square and of order $n$ (or $m$ since they are the same).

\n

In an $n \\times n$ square matrix $A$, the leading diagonal (or principal diagonal) is the top-left to bottom right collection of elements   $a_{11}, a_{22}, a_{33}, . . . ,a_{nn}$.

\n

The sum of the elements in the leading diagonal of $A$ is called the trace of the matrix and we write it as $tr(A)$.

\n

If          $ A= \\left( \\begin{array}{ccc} a_{11} & a_{12} & ... & a_{1n}\\\\ a_{21} & a_{22} & ... & a_{2n}\\\\ \\vdots & \\vdots & \\vdots & \\vdots\\\\ a_{n1} & a_{n2} & ... & a_{nn} \\end{array} \\right)   $               then               $ tr(A)= a_{11}+a_{22}+...+a_{nn}$

", "advice": "

We are presented with random matrices and asked to calculate the trace of each one.

\n

\n

Remembering that, for a square matrix, the trace is the sum of the elements in the leading diagonal. 

\n

Begin at the top left element and work down to the bottom right element, adding as you go.

\n

$A=\\var{A}$

\n

$tr(A)=\\var{A[0][0]}+\\var{A[1][1]} +\\var{A[2][2]}=\\var{trA}                                              $

\n

 

\n

$B=\\var{B}$

\n

$tr(B)=\\var{B[0][0]}+\\var{B[1][1]}=\\var{trB}                                              $

\n

 

\n

$C=\\var{C}$

\n

$tr(C)=\\var{C[0][0]}+\\var{C[1][1]} +\\var{C[2][2]}+\\var{C[3][3]} +\\var{C[4][4]}=\\var{trC}                                              $

\n

 

\n

$D=\\var{D}$

\n

$tr(D)=\\var{D[0][0]}+\\var{D[1][1]} +\\var{D[2][2]}+\\var{D[3][3]}=\\var{trD}                                              $

\n

 

\n

$E=\\var{EE}$

\n

$tr(E)=\\var{EE[0][0]}+\\var{EE[1][1]} +\\var{EE[2][2]}=\\var{trE}                                              $

", "rulesets": {}, "extensions": [], "variables": {"m1": {"name": "m1", "group": "A", "definition": "n1", "description": "", "templateType": "anything"}, "A": {"name": "A", "group": "A", "definition": "transpose(matrix(repeat(repeat(random(-9..9),n1),m1)))", "description": "", "templateType": "anything"}, "n2": {"name": "n2", "group": "B", "definition": "2", "description": "", "templateType": "number"}, "m2": {"name": "m2", "group": "B", "definition": "n2", "description": "", "templateType": "anything"}, "B": {"name": "B", "group": "B", "definition": "transpose(matrix(repeat(repeat(random(-9..9),n2),m2)))", "description": "", "templateType": "anything"}, "n3": {"name": "n3", "group": "C", "definition": "5", "description": "", "templateType": "number"}, "m3": {"name": "m3", "group": "C", "definition": "n3", "description": "", "templateType": "anything"}, "C": {"name": "C", "group": "C", "definition": "transpose(matrix(repeat(repeat(random(-9..9),n3),m3)))", "description": "", "templateType": "anything"}, "n4": {"name": "n4", "group": "D", "definition": "m4", "description": "", "templateType": "anything"}, "m4": {"name": "m4", "group": "D", "definition": "4", "description": "", "templateType": "number"}, "n1": {"name": "n1", "group": "A", "definition": "3", "description": "", "templateType": "number"}, "D": {"name": "D", "group": "D", "definition": "transpose(matrix(repeat(repeat(random(-9..9),n4),m4)))", "description": "", "templateType": "anything"}, "n5": {"name": "n5", "group": "E", "definition": "n1", "description": "", "templateType": "anything"}, "m5": {"name": "m5", "group": "E", "definition": "n1", "description": "", "templateType": "anything"}, "EE": {"name": "EE", "group": "E", "definition": "transpose(matrix(repeat(repeat(random(-9..9),n5),m5)))", "description": "", "templateType": "anything"}, "e1": {"name": "e1", "group": "A", "definition": "A[n1-1][m1-1]", "description": "", "templateType": "anything"}, "E2": {"name": "E2", "group": "B", "definition": "b[n2-1][m2-1]", "description": "", "templateType": "anything"}, "E3": {"name": "E3", "group": "C", "definition": "c[n3-1][m3-1]", "description": "", "templateType": "anything"}, "E4": {"name": "E4", "group": "C", "definition": "c[n4-1][m4-1]", "description": "", "templateType": "anything"}, "trA": {"name": "trA", "group": "A", "definition": "(A[0][0])+(A[1][1])+(A[2][2])", "description": "", "templateType": "anything"}, "trB": {"name": "trB", "group": "B", "definition": "(B[0][0])+(B[1][1])", "description": "", "templateType": "anything"}, "trC": {"name": "trC", "group": "C", "definition": "(C[0][0])+(C[1][1])+(C[2][2])+(C[3][3])+(C[4][4])", "description": "", "templateType": "anything"}, "trD": {"name": "trD", "group": "D", "definition": "(D[0][0])+(D[1][1])+(D[2][2])+(D[3][3])", "description": "", "templateType": "anything"}, "trE": {"name": "trE", "group": "E", "definition": "(EE[0][0])+(EE[1][1])+(EE[2][2])", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": [], "variable_groups": [{"name": "A", "variables": ["n1", "m1", "A", "e1", "trA"]}, {"name": "B", "variables": ["n2", "m2", "B", "E2", "trB"]}, {"name": "C", "variables": ["n3", "m3", "C", "E3", "E4", "trC"]}, {"name": "D", "variables": ["n4", "m4", "D", "trD"]}, {"name": "E", "variables": ["n5", "m5", "EE", "trE"]}], "functions": {"calculateTrace": {"parameters": [], "type": "number", "language": "javascript", "definition": ""}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate the trace of the following matrices:

\n

\n

$A=\\var{A}$        

\n

$tr(A)=$ [[0]]

\n

 

\n

$B=\\var{B}$          

\n

$tr(B)=$ [[1]]

\n

 

\n

$C=\\var{C}$       

\n

$tr(C)=$ [[2]]

\n

 

\n

$D=\\var{D}$       

\n

$tr(D)=$ [[3]]

\n

 

\n

$E=\\var{EE}$       

\n

$tr(E)=$ [[4]]

\n

                    

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{trA}", "maxValue": "{trA}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{trB}", "maxValue": "{trB}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{trC}", "maxValue": "{trC}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{trD}", "maxValue": "{trD}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{trE}", "maxValue": "{trE}", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Michael Proudman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/269/"}]}]}], "contributors": [{"name": "Michael Proudman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/269/"}]}