Let be an arbitrary orthogonal matrix (that is, ) with rational elements. Also, let be an arbitrary matrix. Define
that is, is the set of all matrices that are obtained by premultiplying by any matrix with integer elements; two such matrices in are considered equivalent if their difference is a matrix with integer elements. Also, let
that is, is the number of elements in the set containing all -dimensional vectors obtained by multiplying on the right by a vector with integer elements. Two such vectors are considered equivalent if their difference is a vector with integer elements. Then
where , , denote respectively the th columns of , , . This is the Riemann identity. On using theta functions with characteristics, it becomes
where and are arbitrary -dimensional vectors. Many identities involving products of theta functions can be established using these formulas.