# Gramian matrix

In linear algebra, the Gram matrix (Gramian matrix or Gramian) of a set of vectors ${\displaystyle v_{1},\dots ,v_{n}}$ in an inner product space is the Hermitian matrix of inner products, whose entries are given by ${\displaystyle G_{ij}=\langle v_{i},v_{j}\rangle }$.[1]

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 ${\displaystyle \mathbb {R} ^{n}}$  with the usual Euclidean dot product, the Gram matrix is simply ${\displaystyle G=V^{\mathrm {T} }V}$ , where ${\displaystyle V}$  is a matrix whose columns are the vectors ${\displaystyle v_{k}}$ . For complex vectors in ${\displaystyle \mathbb {C} ^{n}}$ , ${\displaystyle G=V^{H}V}$ , where ${\displaystyle V^{H}}$  is the conjugate transpose of ${\displaystyle V}$ .

Given square-integrable functions ${\displaystyle \{\ell _{i}(\cdot ),\,i=1,\dots ,n\}}$  on the interval ${\displaystyle [t_{0},t_{f}]}$ , the Gram matrix ${\displaystyle G=[G_{ij}]}$  is:

${\displaystyle G_{ij}=\int _{t_{0}}^{t_{f}}\ell _{i}(\tau ){\bar {\ell _{j}}}(\tau )\,d\tau .}$

For any bilinear form ${\displaystyle B}$  on a finite-dimensional vector space over any field we can define a Gram matrix ${\displaystyle G}$  attached to a set of vectors ${\displaystyle v_{1},\dots ,v_{n}}$  by ${\displaystyle G_{ij}=B(v_{i},v_{j})}$ . The matrix will be symmetric if the bilinear form ${\displaystyle B}$  is symmetric.

### Applications

• In Riemannian geometry, given an embedded ${\displaystyle k}$ -dimensional Riemannian manifold ${\displaystyle M\subset \mathbb {R} ^{n}}$  and a coordinate chart ${\displaystyle \phi :U\to M}$  for ${\displaystyle (x_{1},\ldots ,x_{k})\in U\subset \mathbb {R} ^{k}}$ , the volume form ${\displaystyle \omega }$  on ${\displaystyle M}$  induced by the embedding may be computed using the Gramian of the coordinate tangent vectors:
${\displaystyle \omega ={\sqrt {\det G}}\ dx_{1}\cdots dx_{k},\quad G=\left[\left\langle {\tfrac {\partial \phi }{\partial x_{i}}},{\tfrac {\partial \phi }{\partial x_{j}}}\right\rangle \right].}$

This generalizes the classical surface integral of a parametrized surface ${\displaystyle \phi :U\to S\subset \mathbb {R} ^{3}}$  for ${\displaystyle (x,y)\in U\subset \mathbb {R} ^{2}}$ :

${\displaystyle \int _{S}f\ dA\ =\ \iint _{U}f(\phi (x,y))\,\left|{\tfrac {\partial \phi }{\partial x}}\,{\times }\,{\tfrac {\partial \phi }{\partial y}}\right|\,dx\,dy.}$

## Properties

### Positive-semidefiniteness

The Gramian matrix is positive-semidefinite, and every positive symmetric semidefinite matrix is the Gramian matrix for some set of vectors. Further, in finite-dimensions it determines the vectors up to isomorphism, i.e. any two sets of vectors with the same Gramian matrix must be related by a single unitary matrix. These facts follow from taking the spectral decomposition of any positive-semidefinite matrix ${\displaystyle P}$ , so that ${\displaystyle P=UDU^{\mathrm {H} }=(U{\sqrt {D}})(U{\sqrt {D}})^{\mathrm {H} }}$  and so ${\displaystyle P}$  is the Gramian matrix of the rows of ${\displaystyle U{\sqrt {D}}}$ . The Gramian matrix of any orthonormal basis is the identity matrix. The infinite-dimensional analog of this statement is Mercer's theorem.

### Derivation of positive-semidefiniteness

The fact that the Gramian matrix is positive-semidefinite can be seen from the following simple derivation:

${\displaystyle x^{\mathrm {T} }\mathbf {G} x=\sum _{i,j}\langle v_{i},v_{j}\rangle x_{i}x_{j}=\sum _{i,j}\langle v_{i}x_{i},v_{j}x_{j}\rangle =\langle \sum _{i}v_{i}x_{i},\sum _{j}v_{j}x_{j}\rangle =\|\sum _{i}v_{i}x_{i}\|^{2}\geq 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 ${\displaystyle v_{i}}$  are linearly independent.

## Gram determinant

The Gram determinant or Gramian is the determinant of the Gram matrix:

${\displaystyle G(x_{1},\dots ,x_{n})={\begin{vmatrix}\langle x_{1},x_{1}\rangle &\langle x_{1},x_{2}\rangle &\dots &\langle x_{1},x_{n}\rangle \\\langle x_{2},x_{1}\rangle &\langle x_{2},x_{2}\rangle &\dots &\langle x_{2},x_{n}\rangle \\\vdots &\vdots &\ddots &\vdots \\\langle x_{n},x_{1}\rangle &\langle x_{n},x_{2}\rangle &\dots &\langle x_{n},x_{n}\rangle \end{vmatrix}}.}$

If ${\displaystyle x_{1},\cdots ,x_{n}}$  are vectors in ${\displaystyle \mathbb {R} ^{n}}$ , then it is the square of the n-dimensional volume of the parallelotope formed by the vectors. In particular, the vectors are linearly independent if and only if the parallelotope has nonzero n-dimensional volume, if and only if Gram determinant is nonzero, if and only if the Gram matrix is nonsingular.

The Gram determinant can also be expressed in terms of the exterior product of vectors by

${\displaystyle G(x_{1},\dots ,x_{n})=\|x_{1}\wedge \cdots \wedge x_{n}\|^{2}.}$

Theorem 7.2.10 Let ${\displaystyle v_{1},\ldots ,v_{m}}$  be vectors in an inner product space ${\displaystyle V}$  with inner product ${\displaystyle \langle {\cdot ,\cdot }\rangle }$  and let ${\displaystyle G=[\langle {v_{j},v_{i}}\rangle ]_{i,j=1}^{m}\in M_{m}}$ . Then
(a) ${\displaystyle G}$  is Hermitian and positive-semidefinite
(b) ${\displaystyle G}$  is positive-definite if and only if the vectors ${\displaystyle v_{1},\ldots ,v_{m}}$  are linearly-independent.
(c) ${\displaystyle \operatorname {rank} G=\dim \operatorname {span} \{v_{1},\ldots ,v_{m}\}}$