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

where k is the dimension of and is the identity matrix of order k. The order k 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 k = 8: