Gram Matrices: Packaging Every Inner Product into One Matrix
Given a list of vectors v1,…,vk in an inner product space, the Gram matrix G is the k×k matrix that records every pairwise inner product in one place:
That is the entire definition, and it is worth saying what it is not: the entries of G are numbers produced by the inner product, never the coordinates of the vectors themselves.
The size of G is set by how many vectors there are, not by the dimension they live in, five vectors in R100 still give a 5×5 Gram matrix.
Matrix form
If the vectors sit in Rn with the standard dot product and V is the n×k matrix whose columns are v1,…,vk, then
Watch the order. VTV is k×k and is the Gram matrix; VVT is n×n and is something else entirely (a projection-related operator on the ambient space). Getting these the wrong way round is the single most common error with Gram matrices, and a dimension check catches it immediately.
Three properties that do all the work
- Symmetry. Gij=⟨vi,vj⟩=⟨vj,vi⟩=Gji for a real inner product, so G is always symmetric.
- Positive semidefiniteness. For any coefficient vector c, cTGc=⟨∑icivi, ∑jcjvj⟩=∥∑icivi∥2≥0. So G is positive semidefinite, always.
- Independence test. That same identity says cTGc=0 exactly when ∑icivi=0. So G is positive definite precisely when the only such c is zero, that is, when v1,…,vk are linearly independent. Since a symmetric positive definite matrix has strictly positive determinant, this gives the clean criterion det(G)=0 if and only if the vectors are linearly dependent.
Geometry: the determinant is a squared measure
For two vectors, det(G) is the squared area of the parallelogram they span; for three vectors in R3 it is the squared volume of the parallelepiped.
The square is not decoration, it is what keeps the quantity computable from inner products alone, with no cross product and no ambient dimension required.
So an area is recovered as detG, and forgetting the square root is an easy way to report a number that is far too large.
For two unit vectors separated by an angle θ, the Gram matrix takes a particularly transparent form, since ⟨v1,v1⟩=⟨v2,v2⟩=1 and ⟨v1,v2⟩=cosθ:
The determinant collapses to zero when the vectors are parallel or antiparallel and is largest when they are orthogonal, exactly the behaviour a squared area should have. Note that det(G) depends only on cos2θ, so an angle and its supplement give the same determinant; recovering θ itself needs the sign of the off-diagonal entry as well.
Worked example
Let v1=(1,−1) and v2=(2,1) with the standard dot product. Then ⟨v1,v1⟩=1+1=2, ⟨v1,v2⟩=2−1=1, and ⟨v2,v2⟩=4+1=5, so
Since det(G)=0, the vectors are linearly independent, and the parallelogram they span has area 9=3. Notice that both conclusions came out of four dot products and a 2×2 determinant; the vectors' coordinates were needed only to compute those inner products.
Mark Yourself Question
- Grab a piece of paper and try this problem yourself.
- When you're done, check the "I have answered this question" box below.
- View the solution and report whether you got it right or wrong.
Let v1 and v2 be unit vectors in an inner product space separated by an angle of θ=60∘, so that ⟨v1,v2⟩=cosθ. Answer all three parts.
- Write down the Gram matrix G of the pair (v1,v2), with numerical entries.
- Compute det(G).
- Give the area of the parallelogram spanned by v1 and v2, to three decimal places.
Vectors v1,v2,v3 lie in R3, and their 3×3 Gram matrix G satisfies det(G)=0. Which statement must be true?