Matrix operations
Addition, subtraction, scalar multiplication and the row-by-column product — with the conformability rules, the algebraic laws that survive and the ones that fail.
Module contents
Four operations, three of them easy and one of them the reason matrices exist.
Addition and subtraction
Conformable for addition means: same order. Then add element by element.
If the orders differ, the sum is simply not defined — that is the whole answer, and it earns marks.
Laws of addition
| Law | Statement |
|---|---|
| Closure | is a matrix of the same order |
| Commutative | |
| Associative | |
| Additive identity | |
| Additive inverse | , where |
| Cancellation |
Scalar multiplication
Multiply every element by the scalar :
Compare with determinants. multiplies every one of the elements, but , because a determinant only takes one factor of out of each row. Mixing these two up is a classic exam loss.
Properties: , , , , .
Matrix multiplication
This is the operation that does real work, and its rule is not element-by-element.
Conformability
is defined only when the number of columns of equals the number of rows of .
The inner dimensions must match and they vanish; the outer dimensions survive as the order of the product.
The rule
In words: the element in row , column of the product is row of dotted with column of .
A reliable procedure
- Write both orders. Check inner dimensions match. Write down the order of the answer and draw an empty frame of that size.
- Fill the frame one position at a time. For position : cover everything except row of and column of .
- Multiply the pairs in order and add.
Working position by position, in order, is what stops the errors.
Laws of multiplication — and the three that fail
| Law | Holds? |
|---|---|
| Associative | ✔ |
| Distributive | ✔ |
| Distributive | ✔ |
| Identity | ✔ |
| Scalar | ✔ |
| Commutative | ✘ |
| Zero product or | ✘ |
| Cancellation | ✘ |
These three failures are where exam questions live.
Non-commutativity. Usually ; often one is defined and the other is not. Matrices for which are said to commute.
Zero divisors. With and , though neither is .
No cancellation. does not give unless is non-singular (then multiply through by ).
The consequence for algebra
Familiar identities have to be re-derived. For instance
which equals only if and commute. Likewise
which is only when .
Transpose and its laws
The order reverses. Extending: .
Powers of a square matrix
Only square matrices can be raised to powers, since needs the column count to equal the row count.
Cost, and why it matters in computing
Computing an product by the definition performs multiplications and about additions. Doubling makes the work eight times larger. That single fact drives a large part of numerical computing — blocked algorithms, GPU kernels and Strassen-type methods all exist to fight the .
Worked examples
4 solvedEvery step is shown, in the order you would write it in an answer book.
Checking conformability before computing
Question
is , is , is . Which of , , , , , are defined, and of what order?
— inner dimensions match. Defined, order .
— . Not defined.
— match. Defined, order .
— match. Defined, order .
is ; then — match. Defined, order .
is ; then — match. Defined, order — the same as , as associativity demands.
Answer
, , , are defined. is not.
NoteWrite orders under the letters before doing any arithmetic. Two seconds here saves a whole wrong page.
A full 3 × 3 product, position by position
Question
Find where and .
Order check
— defined, result is .
Row 1 of =
Against column 1 :
Against column 2 :
Against column 3 :
Row 2 of =
Column 1:
Column 2:
Column 3:
Row 3 of =
Column 1:
Column 2:
Column 3:
Assemble
Answer
Demonstrating that AB ≠ BA
Question
For and , compute and and comment.
Compute
Compute
Compare
Reading the result: is a swap matrix. Multiplying on the right by swapped the columns of ; multiplying on the left by swapped the rows. Side of multiplication decides what happens — this is exactly why order matters.
Answer
, , so .
Expanding a matrix expression correctly
Question
If and , verify that .
Compute and its square
Compute the pieces on the right
Note immediately that .
Evaluate the false right-hand side
This is not , so the identity fails.
Confirm the correct expansion
which matches exactly.
Answer
but . The correct expansion is .
NoteNever write 2AB when expanding (A+B)² for matrices unless you have first shown AB = BA.
Practice problems
6 with solutionsWork each one on paper first. The full solution — not just the answer — is one click away.
Given and , find .
Show solutionHide solution
Find and where and .
Show solutionHide solution
: gives a matrix.
: gives a matrix.
Both products exist but they are not even the same order — the sharpest possible illustration that .
If , show that .
Show solutionHide solution
Step 1 — compute .
Row 1 : , ,
Row 2 : , ,
Row 3 : , ,
Step 2 — compute .
Row 1 : , ,
Row 2 : , ,
Row 3 : , ,
Step 3 — assemble term by term.
Step 4 — add position by position.
: : :
: : :
: : :
(This is the Cayley–Hamilton theorem in action — the polynomial is the characteristic polynomial of .)
Find a matrix such that , where and .
Show solutionHide solution
Rearrange first, then substitute — never the other way round.
Check: ✓
Verify for and .
Show solutionHide solution
Left side. is , is , so is .
Row 1 : , ,
Row 2 : , ,
Row 3 : , ,
Right side. is , is , so is ✓
Row 1 : , ,
Row 2 : , ,
Row 3 : , ,
Both sides agree. ∎ (Note is not even defined here: would be — wrong order. The reversal is not optional.)
Find all matrices that commute with .
Show solutionHide solution
Let and impose .
Equate corresponding elements:
:
:
: — no information
: — consistent
So , , and is free:
Equivalently where . Every such matrix commutes with ; nothing else does.
Sanity check with : and ✓