Gram matrix (source code)

= Gram matrix
{c}
{wiki}

For a finite family of <vectors> $v_1,\ldots,v_n$ in an <inner product space>, its <Gram matrix> records all pairwise <inner products>:
$$
G_{ij}=\langle v_i,v_j\rangle.
$$
Its diagonal entries are the squared <norms> of the <vectors>, and its off-diagonal entries describe their pairwise alignment. For example, $v_1=(1,0)$ and $v_2=(1,1)$ in $\mathbb R^2$ give
$$
G=\begin{pmatrix}1&1\\1&2\end{pmatrix}.
$$
The <positive definiteness of a Gram matrix> relates the resulting <quadratic form> to the squared <norm> of a <linear combination>. In particular, $G$ is a <positive semidefinite matrix>, and it is invertible exactly when the original <vectors> are <linearly independent>. This permits geometric questions about a family to be answered through one <matrix>.

Two finite families with the same <Gram matrix> are related by a <linear isometry> between their <linear spans>: send $\sum_i c_i v_i$ to the same <linear combination> of the second family. Equality of the <Gram matrices> preserves squared <norms>, so every zero combination maps to zero and the rule is well-defined. If the two ambient <inner product spaces> are finite-dimensional and have the same <dimension>, completing <orthonormal bases> extends this map to an ambient <unitary map>. Equality of the ambient dimensions is needed for that last extension.