Skip to content

Gram Matrix

Tabulate the pairwise inner products of a finite vector family in one square matrix, preserving its relative geometry and dependence.

Version
v1 · 2026-10-03 · History
Domain-specific #
13285
Domain group
Formal Sciences
Origin domain
Mathematics
Subdomains
Linear Algebra, Inner Product Spaces → Mathematics

Core Idea

For a finite family \(v_1,\ldots,v_n\) in a real or complex inner-product space, the Gram matrix records \(G_{ij}=\langle v_i,v_j\rangle\). With vectors as columns under the standard inner product, \(G=X^*X\). It is symmetric over the reals, Hermitian over the complexes, and always positive semidefinite: \(c^*Gc=\|\sum_i c_i v_i\|^2\geq0\). It is positive definite exactly when the family is linearly independent.[1][2]

Its rank equals the span dimension. Its determinant is zero precisely when the family is dependent; for independent real vectors it gives squared Euclidean parallelotope volume (with a Hermitian exterior-product analogue over the complexes). These are inner-product consequences, not properties of an arbitrary bilinear-form table. The Gram matrix preserves relative lengths and angles, but a common orthogonal or unitary change of the original vectors leaves it unchanged, so absolute orientation is not recovered.[1]

How would you explain it like I'm…

The Arrow Pair Chart

Imagine you have a few arrows. For every pair of arrows, you work out a number that shows how long they are and how much they point the same way. Each arrow paired with itself tells you how long it is. You write all these numbers in a square chart, and that chart is a Gram Matrix.

Every-Pair Arrow Table

Think of a few arrows, which mathematicians call vectors. There's a way to combine two arrows into one number, called an inner product. It is big when both arrows are long and point the same way, zero when they are at right angles, and negative when they point opposite ways. A Gram Matrix is a square table that lists this number for every pair of arrows, including each arrow with itself, which gives its length squared. From this one table you can work out the arrows' lengths, the angles between them, and whether some arrows are just combinations of others.

Pairwise Inner-Product Matrix

Given vectors v₁,…,vₙ with an inner product (like the dot product), the Gram Matrix G has entries G_ij = ⟨v_i, v_j⟩. It records every pairwise inner product, so it encodes lengths, angles and linear dependence. For real vectors it is symmetric. It is also positive semidefinite: for any coefficients c, the expression cᵀGc equals the squared length of Σ c_i v_i, which can't be negative. Its rank equals the dimension of the space the vectors span. It is invertible exactly when the vectors are linearly independent. For independent real vectors, its determinant is the squared volume of the box-like shape (parallelotope) they span. If the vectors are dependent, the determinant is 0.

 

For a finite family v_1, …, v_n in a real or complex inner-product space, the Gram Matrix is G_ij = ⟨v_i, v_j⟩. Taking the inner product to be conjugate-linear in the first slot and the vectors as columns of X, we get G = X*X. G is Hermitian (symmetric in the real case) and positive semidefinite, since c*Gc = ‖Σ c_i v_i‖² ≥ 0. Because the inner product is positive definite, G encodes lengths, angles and linear dependence. Its rank equals the dimension of the span, and G is positive definite, hence invertible, iff the vectors are linearly independent. For independent real vectors, det G is the squared n-volume of their parallelotope; in the complex case it is the squared norm of their exterior product. For dependent vectors det G = 0. These facts can fail for indefinite bilinear forms. The construction works for coordinate vectors, for functions under an integral inner product (monomials yield a Hilbert matrix), and for kernel methods, where a kernel evaluation table is the Gram Matrix of implicit feature vectors. A valid kernel is a function that produces positive semidefinite Gram matrices on every finite sample; it is not the same thing as any single matrix.

Scope of Application

For real coordinate vectors, \(G=X^TX\) exposes dependence and appears in least-squares normal equations \(Gc=X^Tb\). Full column rank gives unique coefficients. If columns are dependent, \(G\) is singular and coefficients for the same projected vector may be nonunique; one cannot invert it as if full rank.[1][3]

For functions under an integral inner product, Elkies's monomials \(1,x,x^2\) on \([0,1]\) yield \(G_{ij}=\int_0^1x^{i+j-2}dx=1/(i+j-1)\), a positive-definite Hilbert matrix. In kernel methods, a finite sample has \(K_{ij}=k(x_i,x_j)=\langle\phi(x_i),\phi(x_j)\rangle\) for an appropriate feature map. The kernel function is a different object: positivity must hold over every finite sample, not just one matrix.[1][4]

Clarity

The defining condition is pairwise inner products of one indexed family under a genuine positive-definite inner product. A table from an indefinite form may not be PSD and need not carry the same dependence or volume information. A distance matrix records distances, while a cross-covariance matrix records cross-variable moments; neither is automatically a Gram matrix.[2]

The frozen requested title Gramian matrix is retained as a lexical hold rather than a global alias. In some linear-algebra usage it names a Gram table, but control theory also uses controllability and observability Gramians for dynamics-derived constructions. Shared wording is not enough to merge those identities.

Manages Complexity

One square table holds all pairwise inner products and supports rank, determinant and projection calculations without repeatedly comparing the original family. With feature-space kernels, the table can be computed even when vectors are not explicitly constructed in a possibly infinite-dimensional space. That efficiency has a limit: the table loses absolute embedding orientation and cannot recover information that inner products do not encode.[1][4]

In least squares, the same Gram is a normal-equation coefficient matrix. Redundant columns may preserve useful named variables but make the coefficients nonunique; reducing to an independent basis restores invertibility yet removes some original labels.[3]

Abstract Reasoning

State the scalar field, inner-product convention and finite family; calculate every \(G_{ij}\). Prove PSD by \(c^*Gc=\|\sum_i c_i v_i\|^2\), then test independence to decide strict positivity and invertibility. In \(\mathbb R^2\), vectors \((1,0)\), \((0,1)\) and \((1,1)\) give \(G=\begin{pmatrix}1&0&1\\0&1&1\\1&1&2\end{pmatrix}\): rank $2\(, determinant \$0\), and nonunique coefficients along \((-1,-1,1)\). For functions \(1,x,x^2\), the integral gives an invertible \(3\times3\) Hilbert matrix because those functions are independent.[1]

If solving \(Gc=X^*b\), do not infer uniqueness from the equation alone. Full column rank is the relevant extra condition. For an implicit kernel, one favorable Gram table also does not prove the kernel globally positive definite.[3][4]

Knowledge Transfer

The inner-product table transfers literally between coordinate vectors, polynomial functions and kernel feature vectors. Live Matrix is the proposed strict parent because a Gram matrix is a square scalar array with an additional entry rule. Live Positive Definite Kernel is a neighboring function that generates Gram matrices on finite samples, not a strict genus of one such matrix. Distance Matrix, Cross-covariance Matrix and Rank are similarly distinct.[1][4]

The broader idea of pairwise relation tabulation could be a future-prime question. Gram Matrix itself remains an inner-product and linear-algebra identity; removing those requirements removes the reason its PSD, rank and determinant conclusions hold.[2]

Relationships to Other Abstractions

Local relationship map for Gram MatrixParents appear above the current abstraction, mutual partners to the right, and children below. Node labels state whether each abstraction is prime or domain-specific; colors identify relation types.Gram MatrixDOMAINDomain-specific abstraction: Matrix — is a kind ofMatrixDOMAIN

Current abstraction Gram Matrix Domain-specific

Parents (1) — outgoing typed relations

  • Gram Matrix is a kind of Matrix Domain-specific

    A Gram matrix is a square matrix of pairwise inner products from one finite family.

Hierarchy paths (5) — routes to 5 parentless roots

Neighborhood in Abstraction Space

Gram Matrix sits in a moderately populated region (54th percentile for distinctiveness): it has near-neighbors but no dense thicket of look-alikes.

Family — Codes, Matrices & Combinatorial Problems (33 abstractions)

Nearest neighbors

Computed from structural-signature embeddings · 2026-11-14

References

[1] Noam Elkies, Math 55a Honors Abstract Algebra course notes, original Harvard lecture page, positive-definiteness and Gram paragraphs with Hilbert matrix and determinant growth, inspected 2026-10-01. registry ↩a ↩b ↩c ↩d ↩e ↩f ↩g

[2] David Bindel, CS 6210 Matrix Computations lecture slides, 25 August 2025, original Cornell notes, “Inner products” and “Gram matrices,” inspected 2026-10-01. registry ↩a ↩b ↩c

[3] David Bindel, CS 6210 Matrix Computations lecture slides, 24 September 2025, original Cornell notes, normal equations and full-rank uniqueness, inspected 2026-10-01. registry ↩a ↩b ↩c

[4] Thomas Hofmann, Bernhard Schölkopf and Alexander J. Smola, “Kernel Methods in Machine Learning”, original author-hosted Annals of Statistics 36 (2008), §2.1–2.2 Definitions 1–3, inspected 2026-10-01. registry ↩a ↩b ↩c ↩d