13.3  Gram Matrices

Chapter 11 attached to every list of vectors the matrix of its pairwise inner products and read three facts off it: it is Hermitian, its quadratic form is a squared length, and it is invertible exactly when the list is independent (Definition 11.2.3, Theorem 11.2.5). One question was left standing. Given a square matrix, is it the Gram matrix of something? The answer is the shortest possible one: exactly when it is positive semidefinite. This section proves that, and then spends it twice — the determinant of a Gram matrix is a squared volume, and a ratio of two Gram determinants is a distance to a subspace.

Throughout, F=R or F=C and all inner product spaces are over F. When the list must be named we write G(v1,…,vk) for its Gram matrix, whose entries are ⟨vj,vi⟩ as in Definition 11.2.3.

13.3.1. Which matrices are Gram matrices?

Half of the answer is already proved. By Theorem 11.2.5 (a) and (b), a Gram matrix G is Hermitian and satisfies

x∗Gx=‖∑jxjvj‖2 ≥ 0

for every x∈Fk. That is word for word the definition of positive semidefiniteness (Definition 13.1.1). So being positive semidefinite is necessary. The content of the next theorem is that nothing else is needed, and this is where the chapter’s second signature move earns its keep: a positive semidefinite matrix factors as B∗B, and the columns of B are then the list we were looking for.

Theorem 13.3.1 (Gram Matrices Are Exactly the Positive Semidefinite Matrices)

Let G∈Mk(F). The following are equivalent.

  • (a) G is the Gram matrix of some list of k vectors in some inner product space over F;
  • (b) G is the Gram matrix of some list of k vectors in Fr with the standard inner product, where r=rankG;
  • (c) G⪰O.

Moreover the list is unique up to an isometry: if (v1,…,vk) in V and (w1,…,wk) in W have the same Gram matrix, then there is an isometry from span(v1,…,vk) onto span(w1,…,wk) carrying vj to wj for every j.

Idea.

  • (a) ⇒ (c) is the display above. For (c) ⇒ (b), diagonalize: the spectral theorem writes G=UDU∗ with D diagonal and, by Theorem 13.1.4, with nonnegative diagonal. Then D1/2U∗ is a square root of G in the B∗B sense, and its rows beyond the r-th are zero, so the columns already live in Fr. For the uniqueness clause, the Gram matrix is the recipe for every inner product among the vectors, so the obvious map ∑ajvj↦∑ajwj has no choice but to preserve them; the only thing needing care is that it is well defined, and part (b) of Theorem 11.2.5 says precisely that.

Proof.

  • (b) ⇒ (a) is immediate, since Fr with the standard inner product is an inner product space.

  • (c) ⇒ (c). Let G be the Gram matrix of (v1,…,vk). By Theorem 11.2.5 (a), G∗=G, and by (b) of the same theorem x∗Gx=‖∑jxjvj‖2≥0 for every x∈Fk. Hence G⪰O by Definition 13.1.1.

  • (d) ⇒ (b). Since G is Hermitian, the spectral theorem for matrices gives a unitary U and a diagonal D with G=UDU∗ (Corollary 12.4.3 over C; Corollary 12.5.2 over R, with U orthogonal and D real). The diagonal entries of D are the eigenvalues of G, so they are real and ≥0 by Theorem 13.1.4, and we may prescribe their order: let d1,…,dr>0 and dr+1=⋯=dk=0. Here r is the number of nonzero eigenvalues, which is rankG, because G and D have the same rank.

Put B=D1/2U∗∈Mk(F), where D1/2=diag(d1,…,dk). Then B∗B=UD1/2D1/2U∗=UDU∗=G, using (D1/2)∗=D1/2. Rows r+1,…,k of B are zero, since row p of D1/2U∗ is dp times row p of U∗. Let B′∈Mr×k(F) consist of the first r rows of B; deleting zero rows changes no entry of B∗B, so (B′)∗B′=G as well. Let v1,…,vk∈Fr be the columns of B′. With the standard inner product ⟨x,y⟩=y∗x on Fr, ⟨vj,vi⟩=vi∗vj=((B′)∗B′)ij=(G)ij, so G is the Gram matrix of (v1,…,vk).

The uniqueness clause. Let (v1,…,vk) in V and (w1,…,wk) in W both have Gram matrix G, and put U=span(v1,…,vk) and U′=span(w1,…,wk). Define T:U→U′ by T(∑jajvj)=∑jajwj. This is well defined: if ∑jajvj=∑jbjvj, let x∈Fk be the vector with entries xj=aj−bj; then Theorem 11.2.5 (b), applied to each list in turn, gives ‖∑jxjwj‖2=x∗Gx=‖∑jxjvj‖2=0, so ∑jajwj=∑jbjwj. The same display with every bj=0 shows ‖Tu‖=‖u‖ for every u∈U, so T is an isometry (Definition 11.7.1); it is linear and surjective by its definition on spanning vectors. This proves the theorem.

Three consequences are worth naming at once.

First, the corollary promised in Chapter 7 is now proved from the right principle. Corollary 7.7.3 said that det(AA⊤)≥0 for real A, with equality exactly when the rows of A are dependent, and it proved this by writing the determinant as a sum of squares of minors. The structural reason is the theorem above: AA⊤ is a Gram matrix, hence positive semidefinite, hence has nonnegative eigenvalues, and its determinant is their product. Positivity of the determinant is not an accident of Cauchy–Binet; it is one shadow of a much stronger property, and the other shadows come free — every principal minor of a Gram matrix is ≥0 too, since a principal submatrix of G(v1,…,vk) is the Gram matrix of a sublist.

Second, the smallest space that can hold a realization of G has dimension rankG, and no smaller one will do: a list of k vectors in a space of dimension s has a Gram matrix of rank at most s, because G=A∗A for the s×k coordinate matrix A of the list and rank(A∗A)=rankA≤s by Corollary 11.6.6 (b).

Third, the theorem is a free source of examples in both directions: any vectors at all produce a positive semidefinite table, and conversely positivity is a real constraint on a table of numbers — a stronger one than most readers expect.

Warning. Plausible-looking symmetric tables need not be Gram matrices. The condition is not “symmetric with nonnegative diagonal”, and it is not even “every 2×2 principal minor is ≥0”. Take G=(5−3−3−35−3−3−35). Its three 2×2 principal minors are all 25−9=16>0, so any two of the three vectors would be a legitimate pair. But G(1,1,1)⊤=(−1,−1,−1)⊤, so −1 is an eigenvalue and G⪰̸O: no three vectors in any inner product space have this table. In words, three vectors of squared length 5 cannot be pairwise at an angle with cosine −3/5; two of them can.

Quick check. Is the k×k matrix with every entry equal to 1 a Gram matrix? If so, exhibit a list; if not, say which clause fails.

Solution. It is. Take v1=⋯=vk=v for any unit vector v: then ⟨vj,vi⟩=1 for all i,j. Consistently, the matrix has rank 1, and Theorem 13.3.1 (b) predicts a realization in F1; the list (1,1,…,1) in F is one.

13.3.2. The Gram determinant is a squared volume

Chapter 7 defined the volume of a parallelepiped spanned by n vectors of Rn as |det| of the matrix of their coordinates (Definition 7.9.1). That definition needs a square matrix, so it says nothing about two vectors in R3. The missing notion was already present in Chapter 7’s motivation, though: volume is base times height. Turning that into a definition costs one line, now that we have distances to subspaces.

Definition 13.3.1 (Volume of a list)

Let (v1,…,vk) be a list in an inner product space V over F. Its k-dimensional volume vol(v1,…,vk)≥0 is defined recursively by vol(v1)=‖v1‖,vol(v1,…,vk)=vol(v1,…,vk−1)⋅d(vk,Uk−1), where Uk−1=span(v1,…,vk−1) and d(⋅,⋅) is the distance of Definition 11.3.3.

In words: the volume of the last vector’s parallelepiped is the volume of the one below it, times the height of the last vector above the subspace the others span. For k=2 this is base times height for a parallelogram, and it is 0 exactly when v2 lies on the line through v1.

Diagram. Labels: elem v_1, elem v_2, d(elem v_2, U_1), U = Span (elem v_1,elem v_2), base times height: vol (elem v_1,elem v_2) = norm elem v_1\,d(elem v_2, U_1)

The recursion is easy to state and awkward to compute with, because each step needs a projection. The Gram determinant computes all of it at once.

Lemma 13.3.2 (Bordering a Gram matrix)

Let (v1,…,vk) be a list in an inner product space V, let U=span(v1,…,vk), and let w∈V. Then detG(v1,…,vk,w)=detG(v1,…,vk)⋅d(w,U)2.

Idea. Replace w by w−PUw. That is a column operation on the list, and a column operation on the list is a congruence G↦E∗GE on the Gram matrix, with E unitriangular, so the determinant does not move. After the replacement the last vector is orthogonal to all the others, and the Gram matrix has become block diagonal.

Proof. First record how the Gram matrix responds to a change of list. If uj=∑tetjvt for a matrix E=(etj), then by sesquilinearity ⟨uj,ui⟩=∑t∑setjesi―⟨vt,vs⟩, which is the (i,j)-entry of E∗GE; that is, G(u1,…,um)=E∗G(v1,…,vk)E.

Now write w=p+h with p=PUw∈U and h=w−p∈U⊥, which is possible by Theorem 11.3.2 (a). Since p∈U, there are scalars c1,…,ck with p=∑tctvt. Let E∈Mk+1(F) be the identity matrix with its last column replaced by (−c1,…,−ck,1). Applying the rule above to the list (v1,…,vk,w) and this E turns it into (v1,…,vk,h), so G(v1,…,vk,h)=E∗G(v1,…,vk,w)E. The matrix E is triangular with ones on the diagonal, so detE=1 by Theorem 7.4.6, and det(E∗)=detE―=1. By Theorem 7.5.4 the two Gram determinants are equal.

Finally, h∈U⊥ gives ⟨h,vi⟩=⟨vi,h⟩=0 for every i, so G(v1,…,vk,h)=(G(v1,…,vk)00‖h‖2), whose determinant is detG(v1,…,vk)⋅‖h‖2 by cofactor expansion along the last row. Since ‖h‖=‖w−PUw‖=d(w,U) by Definition 11.3.3, this proves the lemma.

The recursion names the vectors in a particular order, and the last one plays a special role. The value does not depend on that choice: Theorem 13.3.3 below identifies vol(v1,…,vk)2 with detG, and permuting the list permutes the rows of G and the columns in the same way, which leaves the determinant unchanged (Theorem 7.5.1 (a) applied once to the rows and once to the columns, so the two sign changes cancel). So the volume is an invariant of the list as a set of vectors, and we are free to order it however a computation prefers.

Theorem 13.3.3 (The Gram Determinant Is the Squared Volume)

Let (v1,…,vk) be a list in an inner product space over F. Then detG(v1,…,vk)=vol(v1,…,vk)2. In particular, if A∈Mm×k(F) has columns v1,…,vk∈Fm, then vol(v1,…,vk)=det(A∗A).

Proof. Induction on k. For k=1, G(v1)=(‖v1‖2) and vol(v1)=‖v1‖.

Let k≥2 and assume the statement for k−1. With Uk−1=span(v1,…,vk−1), Lemma 13.3.2 and then the induction hypothesis give detG(v1,…,vk)=detG(v1,…,vk−1)⋅d(vk,Uk−1)2=vol(v1,…,vk−1)2⋅d(vk,Uk−1)2, and the right-hand side is vol(v1,…,vk)2 by Definition 13.3.1.

For the last claim, ⟨vj,vi⟩=vi∗vj=(A∗A)ij in Fm with the standard inner product, so G(v1,…,vk)=A∗A, and the volume is the nonnegative square root of its determinant.

Two checks that the definition is the right one. If k=m and F=R, then A is square and det(A⊤A)=(detA)2 by Theorem 7.5.4 and Theorem 7.4.5, so vol(v1,…,vm)=|detA|: Definition 13.3.1 agrees with Definition 7.9.1 whenever both apply. And for k=2 in R3, Exercise (C1: Area of a triangle in space) defined the area of a parallelogram in space to be det(A⊤A) and promised a justification from inner products; the theorem is that justification, since base times height is what an area should be.

The volume vanishes exactly when the list is dependent, which is Theorem 11.2.5 (d) read through the theorem: a flat parallelepiped has no volume.

13.3.3. Distance to a subspace, by determinants

Dividing in Lemma 13.3.2 gives a formula for a distance with no projection in sight.

Theorem 13.3.4 (Distance by Gram Determinants)

Let U be a finite-dimensional subspace of an inner product space V, let (v1,…,vk) be a basis of U, and let w∈V. Then d(w,U)2=detG(v1,…,vk,w)detG(v1,…,vk).

Proof. The list (v1,…,vk) is independent, so detG(v1,…,vk)>0 by Theorem 11.2.5 (d) and the quotient is defined. Dividing the identity of Lemma 13.3.2 by it gives the formula.

No orthonormal basis, no Gram–Schmidt, and no projection: two determinants and a division. The price is a (k+1)×(k+1) determinant in the numerator, so for large k the projection route of Chapter 11 is faster. The quotient is also a ratio of squared volumes, vol(v1,…,vk,w)2/vol(v1,…,vk)2: volume over base area, which is the height.

Example (The same distance twice)

In R3 with the dot product, let U={(x,y,z):x+y+z=0} and w=(1,2,3). Compute d(w,U) by Theorem 13.3.4, and compare with Example (Distance from a point to a plane).

Solution. The vectors v1=(1,−1,0) and v2=(0,1,−1) lie in U and are independent, and dim⁡U=2, so they are a basis of U. Their inner products are ⟨v1,v1⟩=2, ⟨v2,v2⟩=2, ⟨v1,v2⟩=−1, and with w: ⟨w,w⟩=14, ⟨w,v1⟩=1−2=−1, ⟨w,v2⟩=2−3=−1. Hence G(v1,v2)=(2−1−12),G(v1,v2,w)=(2−1−1−12−1−1−114). The first determinant is 4−1=3. Expanding the second along the first row, 2(28−1)+1(−14−1)−1(1+2)=54−15−3=36. So d(w,U)2=36/3=12 and d(w,U)=23. Example (Distance from a point to a plane) obtained ‖(2,2,2)‖=23 by projecting onto the normal line. The two routes never meet on the page, and they agree.

Remark. The numerator 36 is the squared volume of the parallelepiped on v1,v2,w, and the denominator 3 is the squared area of its base. The determinant of the coordinate matrix of (v1,v2,w) is 6, and indeed 62=36: Theorem 13.3.3 in the square case.

13.3.4. Exercises

A. Check your understanding

Exercise (A1)
  • (a) State the criterion for a matrix G∈Mk(F) to be the Gram matrix of some list of vectors.
  • (b) Determine whether the following statement is correct, and justify your answer: every symmetric matrix with nonnegative entries is a Gram matrix.
  • (c) A list of 5 vectors in R3 has a 5×5 Gram matrix. What are the possible values of its rank, and what is its determinant?
  • (d) Write down the formula for d(w,U) in terms of Gram determinants, saying what list is used.
  • (e) Define the k-dimensional volume of a list, and say what Theorem 13.3.3 asserts about it.

Solution.

  • (a) G is a Gram matrix if and only if G⪰O (Theorem 13.3.1). The list may then be taken in Fr with r=rankG.

  • (b) Incorrect. (1221) has nonnegative entries and eigenvalues 3 and −1, so it is not positive semidefinite and by Theorem 13.3.1 it is no Gram matrix. (Concretely: two unit vectors cannot have inner product 2, by Cauchy–Schwarz, Theorem 11.1.5.)

  • (c) The rank is rankG=dim⁡span(v1,…,v5)≤3, so it is 0,1,2 or 3; in particular G is singular and detG=0. (A list of 5 vectors in a 3-dimensional space is dependent, so Theorem 11.2.5 (d) gives detG=0 directly.)

  • (d) If (v1,…,vk) is a basis of U, then d(w,U)2=detG(v1,…,vk,w)detG(v1,…,vk) by Theorem 13.3.4.

  • (e) vol(v1)=‖v1‖ and vol(v1,…,vk)=vol(v1,…,vk−1)d(vk,span(v1,…,vk−1)) (Definition 13.3.1). Theorem 13.3.3 says detG(v1,…,vk)=vol(v1,…,vk)2.

B. Practice

Exercise (B1: Which are Gram matrices?)

Determine which of the following are Gram matrices of some list of vectors in some real inner product space. For those that are, exhibit a list; for those that are not, give a reason.

  • (i) (2112)
  • (ii) (1101)
  • (iii) (2−1−1−12−1−1−12)
  • (iv) (101011111)

Solution.

  • (i) Yes. It is symmetric with eigenvalues 1 and 3, both >0, so it is positive definite and Theorem 13.3.1 applies. A list: v1=(1,1,0), v2=(1,0,1) in R3, whose Gram matrix is exactly this.

  • (ii) No. It is not symmetric, so it is not Hermitian and Definition 13.1.1 fails at once; a Gram matrix over R is symmetric by Theorem 11.2.5 (a).

  • (iii) Yes. Its rank is 2: the rows sum to zero, and the top-left 2×2 minor is 3≠0. Its eigenvalues are 0 (eigenvector (1,1,1)) and 3 (twice, on the plane x+y+z=0), all ≥0. A list in R2, as Theorem 13.3.1 (b) promises with r=2: the three vectors (2,0), (−12,32), (−12,−32), three vectors of length 2 at 120∘ to each other.

  • (iv) No. It is symmetric, but its leading principal minors are 1,1,−1, and the determinant of a positive semidefinite matrix is ≥0 (its eigenvalues are ≥0). So it is not positive semidefinite, and by Theorem 13.3.1 it is not a Gram matrix. (Its eigenvalues are 1 and 1±2, one of which is negative.)

Exercise (B2: A volume two ways)

In R3, let v1=(1,1,0), v2=(1,0,1), v3=(0,1,1). Compute vol(v1,v2,v3) with Theorem 13.3.3, and check the answer against Definition 7.9.1.

Solution. The pairwise dot products give G=(211121112), and expanding along the first row, detG=2(4−1)−1(2−1)+1(1−2)=6−1−1=4. By Theorem 13.3.3, vol(v1,v2,v3)=4=2.

Directly, the matrix A with these columns has detA=1(0−1)−1(1−0)+0=−2, so Definition 7.9.1 gives |−2|=2. The two agree, as they must, since det(A⊤A)=(detA)2.

Exercise (B3: A distance in R4)

In R4 with the dot product, let U=span((1,1,0,0),(0,1,1,0)) and w=(1,0,0,1). Find d(w,U) using Theorem 13.3.4.

Solution. Write v1=(1,1,0,0) and v2=(0,1,1,0); they are independent, hence a basis of U. The inner products are ⟨v1,v1⟩=⟨v2,v2⟩=2, ⟨v1,v2⟩=1, ⟨w,w⟩=2, ⟨w,v1⟩=1, ⟨w,v2⟩=0. So G(v1,v2)=(2112),G(v1,v2,w)=(211120102), with determinants 3 and 2(4)−1(2)+1(−2)=4. Hence d(w,U)2=4/3 and d(w,U)=2/3.

Check. The projection is PUw=13(2,1,−1,0), so w−PUw=13(1,−1,1,3), of norm 1312=2/3.

C. Going deeper

Exercise (C1: Rank of a Gram matrix)

Let (v1,…,vk) be a list in a finite-dimensional inner product space V over F, with Gram matrix G.

  • (a) Prove that rankG=dim⁡span(v1,…,vk).
  • (b) Deduce Theorem 11.2.5 (c): G is invertible if and only if the list is independent.

Hint for (a): the coordinate matrix of the list in an orthonormal basis of the span.

Solution.

  • (a) Let U=span(v1,…,vk), r=dim⁡U, and let (e1,…,er) be an orthonormal basis of U, which exists by Theorem 11.2.2. Let A∈Mr×k(F) have as its j-th column the coordinate vector of vj. As computed in the proof of Theorem 11.2.5 (d), G=A∗A. By Corollary 11.6.6 (b), rankG=rank(A∗A)=rankA. Finally rankA=r: the columns of A span Fr, because the coordinate map U→Fr is an isomorphism carrying the spanning list (v1,…,vk) of U to the columns of A.

  • (b) G is a k×k matrix, so it is invertible if and only if rankG=k (Theorem 7.5.3 (d)). By (a) that says dim⁡span(v1,…,vk)=k, which holds exactly when the list is independent.

Exercise (C2: Why the conjugate is not optional)

Over C, one might try to build a table of inner products with the bilinear expression vi⊤vj, without any conjugate. Let v=(1,i)∈C2.

  • (a) Compute v⊤v and v∗v, and explain why only one of them is a legitimate squared length.
  • (b) The list (v) is independent, yet the 1×1 “bilinear Gram matrix” (v⊤v) is singular. Which hypothesis of Theorem 13.3.1 is being violated, and which statement of Chapter 7 does this illustrate?

Solution.

  • (a) v⊤v=12+i2=0, while v∗v=|1|2+|i|2=2. A squared length must be ≥0 and must vanish only for the zero vector (Definition 11.1.1), and v≠0; so v⊤v cannot be one, and v∗v=‖v‖2 is the correct value.

  • (b) Theorem 13.3.1 is a statement about the Gram matrix of Definition 11.2.3, whose entries are ⟨vj,vi⟩=vi∗vj. The matrix (v⊤v)=O1 is not that matrix, so the theorem simply does not apply; the genuine Gram matrix here is (2), which is positive definite, as it must be for an independent list. This is exactly the failure recorded after Corollary 7.7.3: over C, A=(1i) has rank 1 while AA⊤=O1, so the real equality case of that corollary has no complex analogue — unless the transpose is replaced by the conjugate transpose.

Exercise (C3: Height and volume)

Let (v1,…,vk) be an independent list in an inner product space over F. For each j, write Uj for the span of v1,…,vj.

  • (a) Prove that vol(v1,…,vk)≤‖v1‖‖v2‖⋯‖vk‖, with equality if and only if the list is orthogonal.
  • (b) Deduce that detG(v1,…,vk)≤‖v1‖2⋯‖vk‖2.

Hint for (a): compare each height with the corresponding length.

Solution.

  • (a) Fix j≥2 and write vj=PUj−1vj+hj with hj∈Uj−1⊥, as in Theorem 11.3.2 (a). The two summands are orthogonal, so Theorem 11.1.3 gives ‖vj‖2=‖PUj−1vj‖2+‖hj‖2 ≥ ‖hj‖2=d(vj,Uj−1)2, with equality if and only if PUj−1vj=0. Multiplying the k inequalities d(vj,Uj−1)≤‖vj‖ (with d(v1,U0) read as ‖v1‖) and using Definition 13.3.1 repeatedly gives vol(v1,…,vk)≤‖v1‖⋯‖vk‖. All factors are >0, since the list is independent, so equality holds if and only if it holds in every factor, that is PUj−1vj=0 for every j≥2. That says each vj is orthogonal to Uj−1, hence to every earlier vi; and conversely an orthogonal list has PUj−1vj=0 by Theorem 11.3.3 (a).

  • (b) Square (a) and apply Theorem 13.3.3.

Found a typo or a mistake? Report it, or read this page’s source

The text of this book is licensed under CC BY-NC-SA 4.0.