Inner Products
Formal
(Inner Product)
- Allows for intuitive geometrical concepts like length of a vector and distance between two vectors.
- Determines if two vectors are orthogonal.
(Dot Product)
The scalar product/ dot product in is defined as
(General Inner Product)
Let be a vector space and be a bilinear mapping that takes two vectors and maps them onto a real number. Then
- is symmetric is i.e., the order of arguments don’t matter.
- is positive definite if
(Inner Product Space)
Let be a vector space and be a bilinear mapping that takes two vectors and maps them onto a real number. Then
- A positive definite, symmetric bilinear mapping is called an inner product on . We write them as instead of .
- The pair is called an inner product space or vector space with inner product.
Intuition
At its heart, an inner product is a generalization of the familiar dot product. It’s a single number that answers the question: “How much does vector a point in the same direction as vector b?” Think of it like this:
- If you take the inner product of two vectors that point in very similar directions, you get a large positive number. They are “aligned”.
- If they are perpendicular (orthogonal), their inner product is zero. They share no directional component.
- If they point in opposite directions, you get a large negative number. They are “anti-aligned”.
The problem this solves is fundamental: it allows us to introduce geometric concepts like angle and projection into vector spaces, especially in high dimensions where we can’t visualize things directly. If we can measure the “directional similarity” between vectors, we can determine if they are perpendicular, measure how “close” they are in terms of direction, and project one onto the other. This is the bedrock of geometric intuition in machine learning.
The most common example is the Euclidean inner product (or standard dot product) for vectors in :
This is the workhorse inner product in machine learning.
The key geometric insight comes from this equation:
where is the angle between the two vectors. This formula beautifully connects the algebraic computation to the geometric concepts of length and angle. From this, we can define orthogonality: two non-zero vectors are orthogonal if their inner product is 0, which implies and thus .
ML Applications
The inner product is not just an abstract geometric tool; it’s a computational primitive in many ML algorithms.
- Measuring Similarity (Cosine Similarity): In fields like Natural Language Processing (NLP), we represent documents or words as high-dimensional vectors. To determine how similar two documents are, we often don’t care about their magnitude (e.g., one document being longer than another) but rather their “topic” or direction. By rearranging the inner product formula, we get the cosine similarity, which isolates the angle:
- Projections and Decompositions: The inner product is the tool for calculating the projection of one vector onto another. This operation is at the core of Principal Component Analysis (PCA), where we project data onto a lower-dimensional subspace while preserving as much variance as possible. It is also fundamental to linear regression, where we are effectively projecting a target vector onto the space spanned by the feature vectors.
- Support Vector Machines (SVMs): The decision function for an SVM is . That is an inner product. It determines on which side of the decision boundary (a hyperplane defined by the normal vector ) the data point lies. This geometric interpretation is entirely dependent on the properties of the inner product.
In summary, the inner product provides the foundational mathematics for embedding geometric reasoning into machine learning algorithms, allowing us to build models that rely on concepts of similarity, projection, and separation.
Connections
- Forward Links: Symmetric, Positive Definite Matrices, Inner Product of Functions
- Backward Links: Norms