4.2 Special Matrices: The Identity Matrix
In normal arithmetic, we have the number . The number is special because multiplying any number by it leaves that number completely unchanged:
In matrix algebra, we have a similar concept called the Identity Matrix, denoted by the letter . It acts as the number "1" of the matrix world.
1. Defining the Identity Matrix
The Identity matrix is always a square matrix (it has the same number of rows and columns). It features:
- Ones () along the main diagonal (running from top-left to bottom-right).
- Zeros () everywhere else.
Depending on the dimension, here is how we write it:
2. Geometric Intuition: The "Do Nothing" Transformation
Let's look at the Identity matrix columns to see what it does geometrically:
- Column 1 is : This means basis vector lands at (it doesn't move).
- Column 2 is : This means basis vector lands at (it doesn't move).
Because the basis vectors do not budge, the Identity transformation leaves the entire coordinate space completely untouched. Every single vector in the universe stays exactly where it was.
3. Algebraic Property: Neutral Element
If you multiply any matrix by the Identity matrix , the result is exactly .
Let's test this with a example:
Let's compute :
- Row 1 of A Col 1 of I:
- Row 1 of A Col 2 of I:
- Row 2 of A Col 1 of I:
- Row 2 of A Col 2 of I:
It works exactly as advertised!
4. Machine Learning Application: Initialization & Regularization
Why is the Identity matrix important in Machine Learning?
I. Identity Initialization
In deep learning, particularly for recurrent networks (RNNs), we initialize weight matrices. If we initialize weights to zero, neurons learn nothing. If we initialize them too large, values explode. A common technique is initializing weight matrices close to the Identity Matrix. This guarantees that, initially, information flows through network layers without being distorted or shrunk.
II. Ridge Regression ( Regularization)
In linear regression, if features are highly correlated, the matrix is singular (non-invertible). To fix this, we add a small diagonal term using the identity matrix:
This adds a tiny number () to the diagonal elements, guaranteeing the matrix is non-singular and invertible, which makes the model numerically stable.