// Numbas version: exam_results_page_options {"name": "14: Matrices - Basic Operations", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"rulesets": {}, "variablesTest": {"maxRuns": "100", "condition": "det(a) <> 0 and det(b) <> 0 and a <> a"}, "ungrouped_variables": ["a", "b", "c", "d"], "functions": {"inverse": {"type": "matrix", "language": "jme", "definition": "matrix([mat,-mat],[-mat,mat])/det(mat)", "parameters": [["mat", "matrix"]]}}, "metadata": {"licence": "All rights reserved", "description": "

Perform basic operations with 2x2 matrices - addition, subtraction, multiplication by scalar, matrix multiplication, determinant, transpose

"}, "statement": "

The following questions use the matrices below.

\n

$A = \\left( \\begin{array}{cc}\\var{a} & \\var{a}\\\\\\var{a} & \\var{a}\\end{array} \\right)$, $B =\\left( \\begin{array}{cc}\\var{b} & \\var{b}\\\\\\var{b} & \\var{b}\\end{array} \\right)$, $C =\\left( \\begin{array}{cc}\\var{c} & \\var{c}\\\\\\var{c} & \\var{c}\\end{array} \\right)$, $D = \\left( \\begin{array}{cc}\\var{d} & \\var{d}\\\\\\var{d} & \\var{d}\\end{array} \\right)$

\n

\n

Make sure to read through the explanation in the advice section at the bottom of the page after revealing the answers if you have any difficulties with these questions.

An n x m matrix has n rows and m columns.

\n

a) Matrix addition is the 'slotwise' addition of each element in the two matrices, i.e. every element which is in the same location in the matrix is added together. It requires that both matrices are of the same size. For example,

\n

$\\left( \\begin{array}{ccc}3 & 2 & 2\\\\4 & 2& 0\\\\1 & 0 & 1\\end{array} \\right) + \\left( \\begin{array}{ccc}2 & 1 & 0\\\\7 & -3& 7\\\\-2 & 4 & 1\\end{array} \\right) = \\left( \\begin{array}{ccc}3 + 2& 2 +1& 2+0\\\\4+7 & 2-3& 0+7\\\\1-2 & 0+4 & 1+1\\end{array} \\right)=\\left( \\begin{array}{ccc}5 & 3 & 2\\\\11 & -1& 7\\\\-1 & 4 & 2\\end{array} \\right)$.

\n

This is a commutative operation (order doesn't matter).

\n

Scalar multiplication of a matrix is achieved by multiplying each element in the matrix by the scalar indivudually. For example,

\n

$3\\times\\left( \\begin{array}{cc}1 & -1\\\\3 & 0\\end{array} \\right) =\\left( \\begin{array}{cc}3 & -3 \\\\12 &0\\end{array} \\right)$

\n

This is again a commutative operation (order doesn't matter), since it boils down to slotwise multiplication, and multiplication of two numbers is a commutative operation.

\n

b) Matrix multiplication is not quite as simple. It is a non-commutative operation, so the order matters. We can only multiply two matrices if the number of columns in the first matrix is the same as the number of rows in the second matrix. The dimension of the resulting matrix will be (no. rows in first matrix) x (no. columns in second matrix). For example, if we have a 2x4 matrix, $A$, and a 4x3 matrix, $B$, then $AB$ has dimension 2x3, i.e. 2 rows and 3 columns.

\n

The process of matrix multiplication is as follows:

\n
\n
• Check that the dimensions of the matrices meet the above criterion and determine what the dimension of the resulting matrix should be
• \n
• Choose a position in the answer matrix and note which row and column it is in.
• \n
• Look at this same row of the first matrix and the respective column in the second matrix. (Left $\\rightarrow$ right and top $\\rightarrow$ bottom)
• \n
• Multiply together the elements in each position, i.e. first element of the required row in the first matrix times first element of the required column in the second matrix, second x second, ... and sum these to find the final answer for the element in that position
• \n
\n

Here is an example of matrix multiplication of a 2x3 matrix and a 3x2 matrix. The resulting matrix is 2x2 as explained above.

\n

$\\left( \\begin{array}{ccc}2 & 4 & 3\\\\1 & -1 & 2\\end{array}\\right) \\times \\left(\\begin{array}{cc}1 & 4\\\\-2 & 0\\\\3 & -1\\end{array}\\right) = \\left(\\begin{array}{cc}3 & 5\\\\9 & 2\\end{array}\\right)$

\n

Here is an expanded form of the element in the second row and first column of the answer matrix: $9 = (1\\times1) + (-1\\times-2) + (2\\times3) = 1 + 2 + 6$. The first number in each bracket is taken from the second row of the first matrix, going left to right, and the second number is taken from the first column of the second matrix, going top to bottom. Check that you understand this process by finding the expanded form of the other 3 elements of the 2x2 answer matrix.

\n

It is obvious that for two non-square matrices that we are allowed to multiply together, the operation of matrix multiplication is non-commutative, since the dimension of the answer matrix will be different in each case. For two square matrices of the same dimension, in general, $AB \\neq BA$, so it is non-commutative. However, sometimes we find matrices which do commute. For example, the identity matrix, $I_n$, which is an nxn square matrix consisting of zeros with ones along the diagonal from top left to bottom right, commutes with all other matrices. Always assume that we cannot switch around the order of matrix multiplication unless we know for certain that we have two matrices which commute with each other, e.g. any nxn matrix and the nxn identity matrix, $I_n$, or an (invertible) matrix and its inverse.

\n

c) We usually label the elements in a matrix with lowercase letters. For example, we write a general 2x2 matrix, $M$, as $M = \\left(\\begin{array}{cc}a&b\\\\c&d\\end{array}\\right)$. The determinant of a 2x2 matrix, $M$, denoted $det(M)$ or $\\begin{vmatrix}M\\end{vmatrix}$, is $det(M) = ad - bc$. For example,

\n

$\\begin{vmatrix}\\left(\\begin{array}{cc}3&5\\\\-2&1\\end{array}\\right)\\end{vmatrix} = 3\\times 1 - (5 \\times -2) = 3 -(-10) = 13$

\n

d) To transpose a matrix we switch its rows and columns. For example,

\n

$\\left(\\begin{array}{ccc}a & b & c\\\\d& e & f\\end{array}\\right)^\\textbf{T} = \\left(\\begin{array}{cc}a &d\\\\b&e\\\\c&f\\end{array}\\right)$

\n

We can see that the first row becomes the first column and so on. We could also think of this as the first column becoming the first row and so on.

\n

\n

We can only find the inverse of a square matrix which has a non-zero determinant. For a 2x2 matrix, we use this formula to calculate the inverse of a matrix:

\n

$M^{-1} = \\left(\\begin{array}{cc}a & b\\\\c&d\\end{array}\\right)^{-1} = \\dfrac{1}{\\begin{vmatrix}M\\end{vmatrix}}\\left(\\begin{array}{cc}d & -b\\\\-c & a\\end{array}\\right)$

\n

You might wish to check that this is correct by multiplying $M$ and $M^{-1}$ both ways around to check that you get the 2x2 identity matrix, $I_2$.

\n

Find the following using matrix addition/subtraction and scalar multiplication:

\n

i) $A + B =$ []

\n

ii) $A - B =$ []

\n

iii) $C + D =$ []

\n

iv) $\\simplify{{scalarCoeff}A}=$ []

\n

v) $\\simplify{{scalarCoeff}A + {scalarCoeff}B} =$ []

\n

vi) $\\simplify{{scalarCoeff}D} =$ []

\n

$A = \\left( \\begin{array}{cc}\\var{a} & \\var{a}\\\\\\var{a} & \\var{a}\\end{array} \\right)$, $B =\\left( \\begin{array}{cc}\\var{b} & \\var{b}\\\\\\var{b} & \\var{b}\\end{array} \\right)$, $C =\\left( \\begin{array}{cc}\\var{c} & \\var{c}\\\\\\var{c} & \\var{c}\\end{array} \\right)$, $D = \\left( \\begin{array}{cc}\\var{d} & \\var{d}\\\\\\var{d} & \\var{d}\\end{array} \\right)$

\n

Find the following using matrix multiplication:

\n

i) $AB =$ []

\n

ii $BC =$ []

\n

iii) $CD =$ []

\n

iv) $DC =$ []

", "variableReplacements": [], "marks": 0}, {"type": "gapfill", "scripts": {}, "gaps": [{"type": "numberentry", "showCorrectAnswer": true, "correctAnswerFraction": false, "maxValue": "det(a)", "allowFractions": false, "variableReplacementStrategy": "originalfirst", "minValue": "det(a)", "scripts": {}, "showPrecisionHint": false, "variableReplacements": [], "marks": 1}, {"type": "numberentry", "showCorrectAnswer": true, "correctAnswerFraction": false, "maxValue": "det(b)", "allowFractions": false, "variableReplacementStrategy": "originalfirst", "minValue": "det(b)", "scripts": {}, "showPrecisionHint": false, "variableReplacements": [], "marks": 1}, {"type": "numberentry", "showCorrectAnswer": true, "correctAnswerFraction": false, "maxValue": "det(c)", "allowFractions": false, "variableReplacementStrategy": "originalfirst", "minValue": "det(c)", "scripts": {}, "showPrecisionHint": false, "variableReplacements": [], "marks": 1}, {"type": "numberentry", "showCorrectAnswer": true, "correctAnswerFraction": false, "maxValue": "det(d)", "allowFractions": false, "variableReplacementStrategy": "originalfirst", "minValue": "det(d)", "scripts": {}, "showPrecisionHint": false, "variableReplacements": [], "marks": 1}], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "prompt": "

$A = \\left( \\begin{array}{cc}\\var{a} & \\var{a}\\\\\\var{a} & \\var{a}\\end{array} \\right)$, $B =\\left( \\begin{array}{cc}\\var{b} & \\var{b}\\\\\\var{b} & \\var{b}\\end{array} \\right)$, $C =\\left( \\begin{array}{cc}\\var{c} & \\var{c}\\\\\\var{c} & \\var{c}\\end{array} \\right)$, $D = \\left( \\begin{array}{cc}\\var{d} & \\var{d}\\\\\\var{d} & \\var{d}\\end{array} \\right)$

\n

$\\begin{vmatrix}M\\end{vmatrix}$ is another way of writing $det(M)$.

\n

Find the following determinants:

\n

i) $\\begin{vmatrix}A\\end{vmatrix} =$ []

\n

ii) $\\begin{vmatrix}B\\end{vmatrix} =$ []

\n

\n

iii) $\\begin{vmatrix}C\\end{vmatrix} =$ []

\n

\n

iv) $\\begin{vmatrix}D\\end{vmatrix} =$ []

\n

$A = \\left( \\begin{array}{cc}\\var{a} & \\var{a}\\\\\\var{a} & \\var{a}\\end{array} \\right)$, $B =\\left( \\begin{array}{cc}\\var{b} & \\var{b}\\\\\\var{b} & \\var{b}\\end{array} \\right)$, $C =\\left( \\begin{array}{cc}\\var{c} & \\var{c}\\\\\\var{c} & \\var{c}\\end{array} \\right)$, $D = \\left( \\begin{array}{cc}\\var{d} & \\var{d}\\\\\\var{d} & \\var{d}\\end{array} \\right)$

\n

$A^\\textbf{T}$ is the transpose of $A$ and $A^{-1}$ is the inverse of $A$.

\n

Find the following: (give your answers to 3 decimal places where applicable)

\n

i) $A^\\textbf{T} =$ []

\n

ii) $A^{-1} =$ []

\n

iii) $B^{-1} =$ []

\n

iv) $A\\space A^{-1}$ []

", "variableReplacements": [], "marks": 0}], "variables": {"d": {"group": "Ungrouped variables", "name": "d", "definition": "matrix(repeat(repeat(random(-5..5),2),2))", "templateType": "anything", "description": ""}, "b": {"group": "Ungrouped variables", "name": "b", "definition": "matrix(repeat(repeat(random(-5..5),2),2))", "templateType": "anything", "description": ""}, "scalarCoeff": {"group": "Part a)", "name": "scalarCoeff", "definition": "repeat(random(-5..5 except 0..1),4)", "templateType": "anything", "description": ""}, "a": {"group": "Ungrouped variables", "name": "a", "definition": "matrix(repeat(repeat(random(-5..5),2),2))", "templateType": "anything", "description": ""}, "c": {"group": "Ungrouped variables", "name": "c", "definition": "matrix(repeat(repeat(random(-5..5),2),2))", "templateType": "anything", "description": ""}}, "extensions": [], "tags": [], "name": "14: Matrices - Basic Operations", "type": "question", "variable_groups": [{"name": "Part a)", "variables": ["scalarCoeff"]}], "showQuestionGroupNames": false, "question_groups": [{"pickingStrategy": "all-ordered", "name": "", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "John Hodkinson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/921/"}]}]}], "contributors": [{"name": "John Hodkinson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/921/"}]}