Matrices as Inner Products

This concept, bridges the gap between abstract vector operations and concrete matrix representations. It shows how matrices can define custom inner products, which allows us to create flexible, data-dependent geometric spaces.

1. The Intuitive Core (The ‘Why’)

So far, we’ve treated the standard dot product (x⊤y) as the only way to calculate an inner product. This is like assuming that the only way to measure distance in a city is “as the crow flies” (Euclidean distance).

But what if we wanted a different way to measure the relationship between two vectors? What if we wanted to say that certain directions in our data space are “more important” or “longer” than others?

This is where matrices come in. A symmetric, positive definite matrix can be used to define a custom inner product. You can think of this matrix as a “rulebook” or a “metric tensor” that redefines the geometry of the vector space. It stretches and rotates the space, changing our fundamental notions of length, angle, and distance.

Analogy: Imagine a piece of stretchy fabric.

  • The standard inner product (xTyx^Ty) is like measuring distances on the flat, unstretched fabric.
  • A custom inner product, defined by a matrix AA as x,yA=xTAy\langle x,y\rangle A=x^TAy, is like stretching and weighting the fabric. Distances and angles change. Two points that were close might now be far apart, and directions that were perpendicular might not be anymore, all according to the “stretching rules” defined by matrix AA.

The problem this solves is creating data-dependent geometry. Instead of using a one-size-fits-all Euclidean space, we can use a matrix (often derived from the data itself) to define an inner product that is tailored to the structure of our specific problem.

2. The Mathematical Deep Dive (The ‘How’)

The standard Euclidean inner product is:

x,y=xTIy=xTy\langle x,y\rangle=x^TIy=x^Ty

Notice the identity matrix II hidden in the middle. The insight is that we can replace this identity matrix with any symmetric, positive definite matrix AA to create a new, valid inner product.

This generalized inner product is defined as:

x,yA:=xTAy\langle x,y \rangle A:=x^TAy

For this to be a valid inner product, the matrix AA must be symmetric and positive definite. Let’s see why:

  1. Symmetry: We need x,yA=y,xA⟨x,y⟩_A=⟨y,x⟩_A. Let’s check: y,xA=yTAx⟨y,x⟩_A=y^TAx. Since the result is a scalar, we can transpose it without changing its value: (yTAx)T=xTATy(y^TAx)^T=x^TA^Ty. For this to equal the original xTAyx^TAy, we must have A=ATA=A^T. So, A must be symmetric.
  2. Linearity: This property holds due to the distributive property of matrix multiplication. λx+z,yA=(λx+z)TAy=(λxT+zT)Ay=λxTAy+zTAy=λx,yA+z,yA⟨λx+z,y⟩_A=(λx+z)^TAy=(λx^T+z^T)Ay=λx^TAy+z^TAy=λ⟨x,y⟩_A+⟨z,y⟩_A.
  3. Positive Definiteness: We need x,xA>0⟨x,x⟩_A>0 for all x0x \ne 0. By definition, x,xA=xTAx⟨x,x⟩_A=x^TAx. The condition that this quantity must be positive for any non-zero vector x is precisely the definition of a positive definite matrix.

So, any symmetric, positive definite matrix A gives rise to a valid inner product. This new inner product, in turn, defines a new norm and distance metric:

  • Induced Norm (Mahalanobis Norm): xA=x,xA=xTAx||x||_{A}=\sqrt{ \langle x,x \rangle _{A} }=\sqrt{ x^TAx }.
  • Induced Distance (Mahalanobis Distance): dA(x,y)=xyA=(xy)TA(xy)d_{A}(x,y)=||x-y||_{A}=\sqrt{ (x-y)^TA(x-y) }.
Connections
  • #type/intuition
  • #analytical-geometry
  • #inner-products
  • #matrix