Gram matrix

In linear algebra, the Gram matrix (or Gramian matrix, Gramian) of a set of vectors formula_1 in an inner product space is the Hermitian matrix of inner products, whose entries are given by formula_2. If the vectors formula_1 are real and the columns of matrix formula_4, then the Gram matrix is formula_5.
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 formula_6 with the usual Euclidean dot product, the Gram matrix is simply formula_7, where formula_8 is a matrix whose columns are the vectors formula_9. For complex vectors in formula_10, formula_11, where formula_12 is the conjugate transpose of formula_8.
Given square-integrable functions formula_14 on the interval formula_15, the Gram matrix formula_16 is:
For any bilinear form formula_18 on a finite-dimensional vector space over any field we can define a Gram matrix formula_19 attached to a set of vectors formula_1 by formula_21. The matrix will be symmetric if the bilinear form formula_18 is symmetric.
Properties.
Positive-semidefiniteness.
The Gram matrix is symmetric in the case the real 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:
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 formula_24 are linearly independent (that is, formula_25 for all formula_26).
Finding a vector realization.
Given any positive semidefinite matrix formula_27, one can decompose it as:
where formula_29 is the conjugate transpose of formula_18 (or formula_31 in the real case).
Here formula_18 is a formula_33 matrix, where formula_34 is the rank of formula_27. Various ways to obtain such a decomposition include computing the Cholesky decomposition or taking the non-negative square root of formula_27.
The columns formula_37 of formula_18 can be seen as "n" vectors in formula_39 (or "k"-dimensional Euclidean space formula_40, in the real case). Then
where the dot product formula_42 is the usual inner product on formula_39.
Thus a Hermitian matrix formula_27 is positive semidefinite if and only if it is the Gram matrix of some vectors formula_37. Such vectors are called a vector realization of formula_27. The infinite-dimensional analog of this statement is Mercer's theorem.
Uniqueness of vector realizations.
If formula_27 is the Gram matrix of vectors formula_48 in formula_40,
then applying any rotation or reflection of formula_40 (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 formula_51 orthogonal matrix formula_52, the Gram matrix of formula_53 is also formula_27.
This is the only way in which two real vector realizations of formula_27 can differ: the vectors formula_48 are unique up to orthogonal transformations. In other words, the dot products formula_57 and formula_58 are equal if and only if some rigid transformation of formula_40 transforms the vectors formula_48 to formula_61 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 formula_62 is equal to the Gram matrix of vectors formula_61 in formula_39, then there is a unitary formula_51 matrix formula_66 (meaning formula_67) such that formula_68 for formula_69.
Gram determinant.
The Gram determinant or Gramian is the determinant of the Gram matrix:
If formula_73 are vectors in formula_74, 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. When m=n, This reduces to the standard theorem that determinant of n n-dimensional vectors is the n dimensional volume.
The Gram determinant can also be expressed in terms of the exterior product of vectors by