ArticleslgStudy

mathematics

Gram matrix

Gram matrix is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Gram matrix rather than just read about it. In short: In linear algebra, the Gram matrix (or Gramian matrix, Gramian) of vectors v1,…,vn in an inner product space is the Hermitian matrix of inner products, whose entries are given by the inner product Gij=⟨vi,vj⟩. If the vectors v1,…,vn are the columns of matrix X then the Gram matrix is X†X in the general case that the vector coordinates are complex numbers, which simplifies to X⊤X for the case that the vector coordina…

Key takeaways

  • Gram matrix belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Gram matrix to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Gram matrix from memory before moving on to harder problems.

Reference excerpt

In linear algebra, the Gram matrix (or Gramian matrix, Gramian) of vectors v1,…,vn in an inner product space is the Hermitian matrix of inner products, whose entries are given by the inner product Gij=⟨vi,vj⟩. If the vectors v1,…,vn are the columns of matrix X then the Gram matrix is X†X in the general case that the vector coordinates are complex numbers, which simplifies to X⊤X for the case that the vector coordinates are real numbers. An important application is to compute linear independence: a set of vectors are linearly independent if and only if the Gram determinant (the determinant of the Gram matrix) is non-zero. It is named after Jørgen Pedersen Gram.

Examples For finite-dimensional real vectors in ℝn with the usual Euclidean dot product, the Gram matrix is G=V⊤V, where V is a matrix whose columns are the vectors vk and V⊤ is its transpose whose rows are the vectors vk⊤. For complex vectors in ℂn, G=V†V, where V† is the conjugate transpose of V. Given square-integrable functions {ℓi(⋅),i=1,…,n} on the interval [t0,tf], the Gram matrix G=[Gij] is:

Gij=∫t0tfℓi∗(τ)ℓj(τ)dτ. where ℓi∗(τ) is the complex conjugate of ℓi(τ). For any bilinear form B on a finite-dimensional vector space over any field we can define a Gram matrix G attached to a set of vectors v1,…,vn by Gij=B(vi,vj). The matrix will be symmetric if the bilinear form B is symmetric.

Applications In Riemannian geometry, given an embedded k-dimensional Riemannian manifold M⊂ℝn and a parametrization ϕ:U→M for (x1,…,xk)∈U⊂ℝk, the volume form ω on M induced by the embedding may be computed using the Gramian of the coordinate tangent vectors: ω=det⁡G dx1⋯dxk,G=[⟨∂ϕ∂xi,∂ϕ∂xj⟩]. This generalizes the classical surface integral of a parametrized surface ϕ:U→S⊂ℝ3 for (x,y)∈U⊂ℝ2: ∫Sf dA=∬Uf(ϕ(x,y))|∂ϕ∂x×∂ϕ∂y|dxdy. If the vectors are centered random variables, the Gramian is approximately proportional to the covariance matrix, with the scaling determined by the number of elements in the vector. In quantum chemistry, the Gram matrix of a set of basis vectors is the overlap matrix. In control theory (or more generally systems theory), the controllability Gramian and observability Gramian determine properties of a linear system. Gramian matrices arise in covariance structure model fitting (see e.g., Jamshidian and Bentler, 1993, Applied Psychological Measurement, Volume 18, pp. 79–94). In the finite element method, the Gram matrix arises from approximating a function from a finite dimensional space; the Gram matrix entries are then the inner products of the basis functions of the finite dimensional subspace. In machine learning, kernel functions are often represented as Gram matrices. (Also see kernel PCA) Since the Gram matrix over the reals is a symmetric matrix, it is diagonalizable and its eigenvalues are non-negative. The diagonalization of the Gram matrix is the singular value decomposition.

Properties

Positive-semidefiniteness The Gram matrix is symmetric in the case the inner product is real-valued; it is Hermitian in the general, complex case by definition of an inner product. The Gram matrix is positive semidefinite, and every positive semidefinite matrix is the Gramian matrix for some set of vectors. The fact that the Gramian matrix is positive-semidefinite can be seen from the following simple derivation:

x†𝐆x=∑i,jxi∗xj⟨vi,vj⟩=∑i,j⟨xivi,xjvj⟩=⟨∑ixivi,∑jxjvj⟩=‖∑ixivi‖2≥0. The first equality follows from the definition of matrix multiplication, the second and third from the bi-linearity of the inner-product, and the last from the positive definiteness of the inner product. Note that this also shows that the Gramian matrix is positive definite if and only if the vectors vi are linearly independent (that is, ∑ixivi≠0 for all x).

Finding a vector realisation

Given any positive semidefinite matrix M, one can decompose it as:

M=B†B, where B† is the conjugate transpose of B (or M=B𝖳B in the real case). Here B is a k×n matrix, where k is the rank of M. Various ways to obtain such a decomposition include computing the Cholesky decomposition or taking the non-negative square root of M. The columns b(1),…,b(n) of B can be seen as n vectors in ℂk (or k-dimensional Euclidean space ℝk, in the real case). Then

Mij=b(i)⋅b(j) where the dot product a⋅b=∑ℓ=1kaℓ∗bℓ is the usual inner product on ℂk. Thus a Hermitian matrix M is positive semidefinite if and only if it is the Gram matrix of some vectors b(1),…,b(n). Such vectors are called a vector realization of M. The infinite-dimensional analog of this statement is Mercer's theorem.

Uniqueness of vector realizations If M is the Gram matrix of vectors v1,…,vn in ℝk then applying any rotation or reflection of ℝk (any orthogonal transformation, that is, any Euclidean isometry preserving 0) to the sequence of vectors results in the same Gram matrix. That is, for any k×k orthogonal matrix Q, the Gram matrix of Qv1,…,Qvn is also M. This is the only way in which two real vector realizations of M can differ: the vectors v1,…,vn are unique up to orthogonal transformations. In other words, the dot products vi⋅vj and wi⋅wj are equal if and only if some rigid transformation of ℝk transforms the vectors v1,…,vn to w1,…,wn and 0 to 0. The same holds in the complex case, with unitary transformations in place of orthogonal ones. That is, if the Gram matrix of vectors v1,…,vn is equal to the Gram matrix of vectors w1,…,wn in ℂk then there is a unitary k×k matrix U (meaning U†U=I) such that vi=Uwi for i=1,…,n.

Other properties Because G=G†, it is necessarily the case that G and G† commute. That is, a real or complex Gram matrix G is also a normal matrix. The Gram matrix of any orthonormal basis is the identity matrix. In particular, the Gram matrix of the rows or the columns of a real rotation matrix is the identity matrix. Likewise, the Gram matrix of the rows or columns of a unitary matrix is the identity matrix. The rank of the Gram matrix of vectors in ℝk or ℂk equals the dimension of the space spanned by these vectors.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Gram matrix

Start with the simplest possible case. Write down what Gram matrix claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Gram matrix before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Gram matrix ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Gram matrix

In research
Gram matrix appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Gram matrix in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Gram matrix is common in secondary-school and first-year university syllabi. It links to neighbouring topics Analytic geometry, Determinants, Kernel methods for machine learning, so understanding it makes those chapters shorter.
In everyday life
Look for Gram matrix outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Gram matrix” →

How to study Gram matrix in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Gram matrix means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Gram matrix out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Gram matrix in simple terms?

In linear algebra, the Gram matrix (or Gramian matrix, Gramian) of vectors v1,…,vn in an inner product space is the Hermitian matrix of inner products, whose entries are given by the inner product Gij=⟨vi,vj⟩. If the vectors v1,…,vn are the columns of matrix X then the Gram matrix is X†X in the gen…

Why does Gram matrix matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Gram matrix?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Gram matrix.

Tags

  • Analytic geometry
  • Determinants
  • Kernel methods for machine learning
  • Matrices (mathematics)
  • Systems theory

Keep exploring