Let’s say you have a set of vectors U = (u1,u2,u3) and V = (v1, v2,v3). The Gram matrix will be the inner product between one vector and all others (including itself).

Example:

u1 = [1 2 3]; u2 = [4 5 6]; u3 = [7 8 9]

V = [u1′ u2′ u3′] where V’ denotes the transpose of V.

G = V’ * V

G = [ u1*u1 u1*u2 u1*u3
u2*u1 u2*u2 u2*u3
u3*u1 u3*u2 u3*u3]

G = [ 14   32   50
32   77 122
50 122 194]

The determinant of G is 0 since u1 u2 and u3 are linearly dependent.