A Hadamard matrix is a square matrix whose elements are either 1 or –1 such that

where is the dimension of and is the identity matrix of order . The order is necessarily 1, 2, or a positive integer that is a multiple of 4.

For example, the following matrix is a Hadamard matrix of dimension = 8: