In the last lesson, we introduced the two powerful views of a matrix: as a container for data and as a transformation of space. Before we can fully harness the power of transformations, we need to get comfortable with the basic "grammar" of matrices.
How do we add, subtract, and scale them? These operations are simple and intuitive, closely mirroring the vector operations we've already learned. They are the essential groundwork for everything that follows.
Before we can perform any operation, we have to talk about the shape or dimensions of a matrix. The dimensions are always given as rows x columns.
- A matrix with 3 rows and 4 columns is a matrix.
- A matrix with 1 row and 5 columns is a matrix (which is also a row vector!).
This is crucial because most matrix operations have strict rules about the dimensions of the matrices involved.
Example:
Let be a matrix and be a matrix.
Addition ():
Subtraction ():
If we tried to add to a matrix, the operation would be undefined.
Example:
Let's take our matrix and multiply it by the scalar 3.
Geometric Intuition: If a matrix represents a transformation, multiplying it by a scalar `c` scales the entire transformation.
Example:
Let's take a matrix .
To find , the first row becomes the first column. The second row becomes the second column.
Notice that the dimensions also flip. A matrix becomes a matrix.
Why is the Transpose So Important?
The transpose is the key to unlocking the Four Fundamental Subspaces. It also appears constantly in key formulas, like the Normal Equations for linear regression () and in the definition of a symmetric matrix ().
- Addition/Subtraction: Add/subtract element-wise. Matrices must have the same dimensions.
- Scalar Multiplication: Multiply every element by the scalar.
- Transpose (): Flip the matrix along its diagonal. The rows become columns.
These are the simple rules. But what about multiplying a matrix by another matrix? That's a completely different beast, and the subject of our next, very important lesson.