Matrix Operations
Matrices can be added, scaled, and multiplied, but the rules are not the ones from ordinary arithmetic. This lesson covers entrywise addition and scalar multiplication, the dimension rule and row-by-column recipe for matrix multiplication, and why and usually differ.
Before you start — give these a try
Attempting first primes your brain for the lesson — even if you miss. Nothing is graded or saved; it's just a warm-up.
Compute the product where and .
Let and . Compute the single entry (row , column ).
What you’ll be able to do
- Add and subtract two matrices of the same shape by operating entrywise.
- Compute a scalar multiple by scaling every entry of .
- Use the dimension rule to decide whether a product is defined and to predict its shape.
- Evaluate matrix products with the row-by-column rule, including any single entry .
- Explain why matrix multiplication is not commutative and describe the role of the identity matrix .
In your course
· MATH2015 · Linear Algebra & Probability- Definition 4.3Entrywise sum and scalar multiple
- Theorem 4.3Rules of matrix algebra, , , — but in general.
- Remark 4.2Multiplication = composition, non-commutative
Matrices, addition, and scalar multiplication
What a matrix is. A matrix is a rectangular grid of numbers. We say a matrix is (read " by ") when it has rows and columns; the pair is its shape (or dimension). We write , where the entry is the number in row , column (rows and columns are numbered starting at ). For example, is , and .
Addition (same shape, entrywise). You may add two matrices only when they have the same shape. Then is formed by adding corresponding entries: Subtraction works the same way. If the shapes differ, is simply undefined.
Scalar multiplication (entrywise). A scalar is just a number . The scalar multiple scales every entry: For instance, .
Useful facts. Addition is commutative and associative: and . Scalars distribute over sums: . These all hold because every rule is applied one entry at a time, where ordinary number arithmetic already obeys them.
Matrix multiplication: the dimension rule and row-by-column
When is defined? Unlike addition, multiplication does not require equal shapes. Instead it uses the dimension rule: if is and is — that is, the number of columns of equals the number of rows of — then is defined and has shape : The two inner numbers must match; the two outer numbers give the result's shape. If the inner numbers disagree, is undefined.
The row-by-column rule. The entry in row , column of is the dot product of row of with column of : Here the index runs across the shared dimension . Concretely, to get the top-left entry you slide row of across column of , multiply matching pairs, and add them up.
A quick computation. With the entry is and the entry is . Filling in all four entries,
Non-commutativity and the identity matrix
Order matters. For ordinary numbers , but for matrices and are usually different — matrix multiplication is non-commutative. Sometimes only one of the two products is even defined (the dimension rule can fail in the opposite order), and sometimes both are defined but give different results or even different shapes. For example, with we get while . Since , the blanket claim "" is false in general.
The identity matrix. The identity matrix has s on the main diagonal and s everywhere else, e.g. . It behaves like the number for multiplication: for every matrix , So multiplying by leaves a matrix unchanged — one of the few places where matrix multiplication is pleasantly simple.
If is and is , then the product is defined and is an matrix. If the number of columns of does not equal the number of rows of , then is undefined.
For () and (), the entry of the product is , the dot product of row of with column of .
Let be the matrix with s on the main diagonal and s elsewhere. For any matrix , we have and .
Worked examples
Let and . Compute , , and the product . Then compute and compare it with .
- 1
Check shapes. Both and are , so they are the same shape — addition is allowed — and the inner dimensions match for multiplication (), so is defined and will be .
- 2
Add entrywise. Add corresponding entries: .
- 3
Scale entrywise. Multiply every entry of by : .
- 4
Multiply, one entry at a time. Use . Top-left: row of is , column of is , so . Top-right: . Bottom-left: . Bottom-right: .
- 5
Assemble . .
- 6
Compute and compare. Repeating the rule with the factors swapped gives . Since , we confirm : order matters.
Let (which is ) and (which is ). Is defined? If so, compute it.
Let . Verify that , where .