Angles and Orthogonality
Formal
(Angles)
From Lengths and Distances, it follows that
Therefore, there exists a unique ,
The number is the angle between the vectors and . Intuitively, the angle between two vectors tells us how similar their orientations are.
(Orthogonality)
Two vectors and are orthogonal if and only if written as . Additionally if , i.e., the vectors are unit vectors, then and are orthonormal.
(Orthogonal Matrix)
A square matrix is an orthogonal matrix if and only if its columns are orthonormal so that
which implies that
i.e., the inverse is obtained by transposing the matrix. Note: Transformations using orthogonal matrices does not alter the length of the vector. Note: Angle between two vectors remains unchanged as long as they both are transformed using the same orthogonal matrix.
(Orthonormal Basis)
Consider an -dimensional vector space and a basis of . If
for all , then the basis is called an Orthonormal basis (ONB).
(Orthogonal Complement)
Consider a -dimensional vector space and an -dimensional subspace . Then its orthogonal complement is a -dimensional subspace of which contains all the vectors in that are orthogonal to every vector in .
Intuition
At its heart, an orthogonal matrix represents a rigid transformation. When you apply it to a vector or a set of data points, it can only do two things: rotate them or reflect them. It cannot stretch, shrink, or skew the data.
Imagine you have a set of data points. Multiplying them by an orthogonal matrix is like picking up the entire coordinate system and rotating it. The key is that all the intrinsic geometric properties of the data are preserved:
- The length of any individual vector remains unchanged.
- The angle between any two vectors remains unchanged.
- The distance between any two points remains unchanged.
This property is incredibly desirable in machine learning. We often want to change the basis or viewpoint of our data to make a problem easier (e.g., align it with axes of maximum variance) without fundamentally distorting the data’s internal structure. An orthogonal matrix is the perfect tool for this job. It’s a transformation that preserves geometry.
Orthogonal Complement (The “What’s Left Over” Space)
- What it is: If you have a subspace (like a plane in 3D), its orthogonal complement is everything that is perpendicular to it (like a line sticking straight out of the plane).
- ML Intuition: This is the foundation of Linear Regression. The model makes a prediction that lives in the “feature subspace.” The error (the residual) must live in the orthogonal complement. This guarantees that the error is uncorrelated with the features, meaning our model has explained everything it possibly can.
Connections
- Forward Links: Gram-Schmidt Orthogonalization, Orthogonal Projections
- Backward Links: Lengths and Distances, Basis