Skip to content
One hour with George, then a written plan the next working day. Book yours.

Matrix operations with solved problems

A matrix is a rectangular grid of numbers, and almost every matrix problem is one of five operations: add, scale, multiply, transpose or invert. Adding and scaling work entry by entry. Multiplying works row by column, and it is the one operation where the order matters. The worked problems below use two small matrices so you can follow every entry.

For students and parents planning test prep or coursework: one hour with George Li, one to one by video, is $180, $200 or $160, by subject. You leave with a written plan within one working day.

Book your first session
The five basic matrix operations and when each is allowed
OperationRule for the resultWhen it is allowed
Add or subtractcombine entries in the same positionboth matrices have the same size
Scalar multiplemultiply every entry by the numberalways
Product ABeach entry is a row of A times a column of B, multiplied pair by pair and summedcolumns of A equal rows of B
Transposeswap rows and columnsalways
Inversea matrix whose product with the original is the identitysquare matrix with a nonzero determinant

A matrix with m rows and n columns is called m by n. A square matrix has the same number of rows and columns.

George Li Tutoring, summarizing the definitions in OpenStax College Algebra 2e, sections 7.5 and 7.7

How do you add, subtract and scale matrices?

Line up entries in the same position and combine them. A scalar multiple scales every entry. Take A with rows (2, 1) and (0, 3), and B with rows (1, 4) and (2, negative 1).

The sum A plus B is the matrix with rows (3, 5) and (2, 2). For 2A minus B, first double A to get rows (4, 2) and (0, 6), then subtract B entry by entry. The result has rows (3, negative 2) and (negative 2, 7). If the two matrices had different sizes, neither the sum nor the difference would exist.

How do you multiply two matrices?

To get the entry in row i and column j of AB, take row i of A and column j of B, multiply matching entries and add. This is why the number of columns in A must equal the number of rows in B.

Worked example: A product in both orders. With A having rows (2, 1) and (0, 3), and B having rows (1, 4) and (2, negative 1), find AB and BA.

  1. Entry (1, 1) of AB is row 1 of A times column 1 of B: 2 times 1 plus 1 times 2, which is 4.
  2. Entry (1, 2) is 2 times 4 plus 1 times negative 1, which is 7.
  3. Entry (2, 1) is 0 times 1 plus 3 times 2, which is 6.
  4. Entry (2, 2) is 0 times 4 plus 3 times negative 1, which is negative 3. So AB has rows (4, 7) and (6, negative 3).
  5. For BA, entry (1, 1) is 1 times 2 plus 4 times 0, which is 2. Entry (1, 2) is 1 times 1 plus 4 times 3, which is 13.
  6. Entry (2, 1) is 2 times 2 plus negative 1 times 0, which is 4. Entry (2, 2) is 2 times 1 plus negative 1 times 3, which is negative 1. So BA has rows (2, 13) and (4, negative 1).

Answer: AB has rows (4, 7) and (6, negative 3) and BA has rows (2, 13) and (4, negative 1). They differ, so matrix multiplication is not commutative.

This is the fact that catches students most often. Algebra with numbers lets you swap factors freely, and with matrices you cannot. Two matrices might even have a defined product in one order and none in the other, such as a 2 by 3 times a 3 by 4.

What does the transpose do to a product?

The transpose reverses the order of a product: the transpose of AB equals the transpose of B times the transpose of A. Check it with the matrices above. The transpose of B has rows (1, 2) and (4, negative 1), and the transpose of A has rows (2, 0) and (1, 3). Their product, in that order, has rows (4, 6) and (7, negative 3). That equals the transpose of AB, which swaps the rows and columns of (4, 7) and (6, negative 3). The order reversal is what to remember.

How do you find an inverse?

For a 2 by 2 matrix with entries a, b, c, d, the determinant is ad minus bc. If it is zero there is no inverse. If not, swap a and d, change the signs of b and c, and divide everything by the determinant. For C with rows (3, 1) and (5, 2), the determinant is 6 minus 5, which is 1. The inverse has rows (2, negative 1) and (negative 5, 3). Check by multiplying: the first row of C times the first column of the inverse is 3 times 2 plus 1 times negative 5, which is 1, and the first row times the second column is 3 times negative 1 plus 1 times 3, which is 0. The second row gives 0 and 1, so the product is the identity.

For larger matrices, the Gauss-Jordan method places the matrix beside the identity and does row operations until the left side becomes the identity. What appears on the right is the inverse.

Worked example: An inverse by row operations, then a system solved with it. Find the inverse of D with rows (2, 1) and (7, 4), then solve 2x plus y = 5 and 7x plus 4y = 20.

  1. Write [D | I] with rows (2, 1 | 1, 0) and (7, 4 | 0, 1).
  2. Divide row 1 by 2: (1, one half | one half, 0).
  3. Subtract 7 times row 1 from row 2: (0, one half | negative seven halves, 1).
  4. Double row 2: (0, 1 | negative 7, 2).
  5. Subtract one half of row 2 from row 1: (1, 0 | 4, negative 1).
  6. The inverse of D has rows (4, negative 1) and (negative 7, 2).
  7. The system is D times the column (x, y) equal to the column (5, 20), so the column (x, y) is the inverse times (5, 20): x = 4 times 5 minus 20, which is 0, and y = negative 35 plus 40, which is 5.

Answer: x = 0 and y = 5. Check: 2 times 0 plus 5 is 5, and 7 times 0 plus 4 times 5 is 20.

How are matrices used to organize a real count?

A factory builds two models, P and Q, in two finishes, X and Y. Model P uses 10 units in finish X and 5 in finish Y. Model Q uses 4 in X and 8 in Y. Finish X needs 2 shop hours and 1 admin hour per unit. Finish Y needs 3 shop hours and 1 admin hour.

Put the units in a matrix with rows for models and columns for finishes: rows (10, 5) and (4, 8). Put the hours in a matrix with rows for finishes: rows (2, 1) and (3, 1). Their product has a row per model and a column per kind of hour. For model P the shop hours are 10 times 2 plus 5 times 3, which is 35, and admin hours are 10 plus 5, which is 15. For model Q they are 4 times 2 plus 8 times 3, which is 32, and 4 plus 8, which is 12. The answer is the matrix with rows (35, 15) and (32, 12). The row-by-column rule is just the bookkeeping of that sum.

What patterns appear in powers of a matrix?

Take M with rows (1, 1) and (0, 1). Then M squared has rows (1, 2) and (0, 1), and M cubed has rows (1, 3) and (0, 1). The upper right entry matches the power, so M to the n has rows (1, n) and (0, 1). To confirm the rule, multiply the proposed form for n by M. The result is the same form with n plus 1 in the corner, so the pattern holds for every n.

Practice with answers

  1. Add the matrix with rows (1, 2) and (3, 4) to the matrix with rows (5, 0) and (negative 1, 2). Answer: rows (6, 2) and (2, 6).
  2. Find the product of rows (1, 2) and (0, 1) with rows (3, 0) and (1, 1). Answer: rows (5, 2) and (1, 1).
  3. Find the determinant and inverse of rows (4, 3) and (1, 1). Answer: determinant 1, inverse rows (1, negative 3) and (negative 1, 4).
  4. Does the matrix with rows (2, 4) and (1, 2) have an inverse? Answer: no, the determinant is 4 minus 4, which is 0.

When does a tutor help with matrices?

A tutor helps when the arithmetic is right but the setup is shaky, such as deciding the order of a product or whether a size lets an operation exist. A session can start from your last problem set and pair each mistake with a short drill. See the courses page, the packages page, or book a first session.

Common questions

Is matrix multiplication commutative?

No. AB and BA can be different, and one of them may not exist at all, as the example with a 2 by 3 and a 3 by 4 shows.

When does a matrix have an inverse?

When it is square and its determinant is not zero. A matrix with a zero determinant has no inverse.

How do you check an inverse?

Multiply the matrix by the proposed inverse. If you get the identity matrix, the inverse is right.

Why does the order flip in the transpose of a product?

Because rows of the first factor become columns of the result, and the only way the sizes can still line up is to put the transposed second factor first.

Sources