§2 Matrices and Matrix Operations
1. The Big Idea
A matrix is a rectangular array of numbers.
That sounds simple, but matrices are powerful because they let us organize many numbers at once. In linear algebra, matrices can represent systems of equations, transformations, data tables, or rules for combining vectors.
Example:
This matrix has 2 rows and 3 columns, so its size is
Always read matrix size as
Rows go across. Columns go down.
2. Matrix Anatomy
Before doing operations with matrices, it helps to know the vocabulary.
| Word | Meaning |
|---|---|
| row | a horizontal line of entries |
| column | a vertical line of entries |
| entry | one number inside the matrix |
| size | number of rows by number of columns |
| square matrix | same number of rows and columns |
| main diagonal | entries from top-left to bottom-right |
| trace | sum of the main diagonal entries |
Entries
The entry in row , column is written as
For example, in
we have
because row 2, column 1 contains 4.
The order of the subscripts matters: means row 2, column 1, not row 1, column 2.
Square Matrices
A square matrix has the same number of rows and columns.
Example of a square matrix:
Example of a square matrix:
Square matrices are special because ideas like determinants, inverses, and trace only make sense for square matrices.
Main Diagonal and Trace
In a square matrix, the main diagonal goes from top left to bottom right.
For
the main diagonal entries are
The trace is the sum of those entries:
For an matrix,
Trace is only defined for square matrices because non-square matrices do not have a complete main diagonal from corner to corner.
3. Entrywise Operations
Some matrix operations happen entry by entry. Nothing fancy happens with rows and columns yet: matching positions are combined with matching positions.
Addition and Subtraction
Matrices can be added or subtracted only if they have the same size.
If
then
You can subtract the same way:
If the sizes do not match, addition and subtraction are not defined.
Scalar Multiplication
A scalar is just a number.
To multiply a matrix by a scalar, multiply every entry by that scalar:
Scalar multiplication stretches every entry by the same factor.
4. Matrix Multiplication
Matrix multiplication is the first operation that is not entry-by-entry.
Instead, it combines rows of the first matrix with columns of the second matrix.
Size Rule
If is and is , then is defined and has size .
The inside dimensions must match:
The outside dimensions give the size of the answer:
So the quick rule is:
Example:
| Product | Defined? | Result size |
|---|---|---|
| yes | ||
| no | inside dimensions do not match | |
| yes |
How to Multiply
To get entry of :
- Take row of .
- Take column of .
- Multiply matching entries.
- Add the results.
This is a dot product between a row and a column.
Example:
Then
So
Order Matters
Usually,
Matrix multiplication is not commutative.
This is not just a technical detail. Matrix multiplication often represents doing one action after another. If you change the order, you change the process.
For ordinary numbers, . For matrices, that kind of swapping usually fails.
5. The Identity Matrix
The identity matrix is the matrix version of the number .
For :
For :
The identity matrix satisfies
and
when the multiplication is defined.
The phrase "when the multiplication is defined" matters. The identity matrix has to have the correct size. For example, if is , then and .
6. Transpose
The transpose of , written , is found by switching rows and columns.
If
then
The first row of becomes the first column of .
Transpose Rules
The important product rule is
Notice that the order reverses. Transpose flips how rows and columns interact, so a product has to be reversed when transposed.
7. Inverse Matrices
An inverse is something that undoes another thing.
For ordinary numbers, multiplying by undoes multiplying by . For matrices, multiplying by undoes multiplying by .
A square matrix is invertible if there exists a matrix such that
Then is called the inverse of , written
So an invertible matrix satisfies
Only square matrices can be invertible, but not every square matrix is invertible.
Why Inverses Matter
For ordinary equations, to solve
we divide by :
For matrices, division is replaced by multiplying by an inverse.
If
then multiply on the left by :
But if
then multiply on the right by :
The side matters because matrix multiplication is not commutative.
8. Inverse of a Matrix
For a matrix,
the inverse is
provided
The number
is the determinant of .
If
then is not invertible.
You will study determinants more deeply in the next section. For now, remember this practical test: for a matrix, the inverse formula only works if is not zero.
9. Algebraic Properties of Inverses
If and are invertible matrices of compatible sizes, then:
| Rule | Meaning |
|---|---|
| undoing the inverse gets back to | |
| undo a product in reverse order | |
| scalar factors invert too, if | |
| transpose and inverse work nicely together |
The product rule is the one to remember carefully:
The order reverses for the same reason you undo steps backward. If you put on socks and then shoes, you remove shoes first and socks second.
10. Elementary Matrices
An elementary matrix is created by performing one elementary row operation on an identity matrix.
Start with
If you swap two rows, multiply a row by a nonzero constant, or add a multiple of one row to another, the result is an elementary matrix.
Elementary matrices matter because row operations can be represented as matrix multiplication.
| Row operation | What the elementary matrix does |
|---|---|
| swap rows | swaps rows of another matrix |
| scale a row | scales a row of another matrix |
| add a multiple of one row to another | performs elimination |
Row Operations as Multiplication
Suppose a row operation is represented by an elementary matrix . Then applying that row operation to is the same as multiplying:
So if a sequence of elementary matrices reduces to the identity matrix, we can write something like
That means
The original matrix is built by undoing those row operations in the opposite direction:
For example, if three elementary matrices reduce to ,
then
and
This is the theoretical reason row-reduction can find inverses.
Small Example
Let
Eliminate the below the first pivot:
This row operation is represented by
Then eliminate the above the second pivot:
This is represented by
Since applying and then reduces to , we have
Therefore
and the original matrix can be recovered by undoing those elementary matrices in reverse:
The main takeaway is not that you should always write inverses this way. The takeaway is that row operations and matrix multiplication are deeply connected.
11. Row Equivalence
Two matrices and are row equivalent if one can be changed into the other using elementary row operations.
This means they have the same row-reduction structure.
For augmented matrices, row equivalence is especially important because row operations preserve the solution set of a system. So row-equivalent augmented matrices represent systems with the same solutions.
12. Finding an Inverse by Row Reduction
To find , place beside the identity matrix:
Then row-reduce until the left side becomes .
If the row-reduction succeeds,
The right side is the inverse.
For a matrix, the setup looks like
Row-reduce the left side to the identity matrix. Whatever appears on the right side is .
When the Method Fails
If the left side cannot become , then is not invertible.
So this method is both a way to find inverses and a way to test whether an inverse exists.
13. Equivalent Conditions for Invertibility
For a square matrix , the following statements all mean the same thing:
These are different languages for the same idea: does not collapse information, so it can be undone.
14. Problem-Solving Routine
When working with matrices, check the structure before doing calculations.
- Check sizes first. Many mistakes happen before any arithmetic begins.
- For addition or subtraction, sizes must match. Add or subtract corresponding entries.
- For scalar multiplication, multiply every entry. No size restriction beyond having a matrix.
- For matrix multiplication, check inside dimensions. If they match, the outside dimensions give the answer size.
- For inverses, check that the matrix is square. Non-square matrices do not have ordinary inverses.
- When solving with inverses, multiply on the correct side. and are different situations.
- To find an inverse, row-reduce . If the left side becomes , the right side is .
15. Key Takeaways
- Matrix size is always rows by columns.
- Addition, subtraction, and scalar multiplication happen entry-by-entry.
- Matrix multiplication uses row-dot-column products.
- For , the inside dimensions must match.
- Matrix multiplication usually depends on order: .
- The identity matrix acts like for matrix multiplication.
- The inverse matrix undoes multiplication by a matrix.
- Inverse and transpose product rules reverse the order.
- Row-reduction can find inverses using .
Mini-Self-Check
- If is and is , what size is ?
The inside dimensions match: . The answer has the outside dimensions, so is .
- Can a matrix have an ordinary inverse?
No. Ordinary inverses are only defined for square matrices.
- Why is instead of ?
Because undoing a sequence happens in reverse order. If means one combined product, the inverse must undo the part first, then the part.
- What does mean?
It means that if row-reduction turns the left side into the identity matrix, then the right side has become the inverse of .