Hadamard codes are named after the French mathematician, Jacques Hadamard. They are error correcting codes that have a variety of other uses, including signal processing, encryption, and telecommunications.
A Hadamard code matrix, or Hadamard matrix, can be constructed procedurally using Sylverter’s Construction. A 2×2 Hadamard matrix can be written as:
A 4×4 Hadamard matrix is created by multiplying each element of the 2×2 matrix by another 2×2 matrix.
Which becomes…
This matrix can be placed in each quadrant of a 2×2 matrix to construct an 8×8 matrix. This can be repeated indefinitely to create even larger matrices.
Hadamard codes are sometimes called Walsh codes or Hadamard-Walsh codes. The codes are fundamentally the identical. Hadamard is often identified as creating the Hadamard matrix. Walsh was then discovered that each row of the Hadamard matrix could be used as a code sequence, or code word. Typically when people refer to Walsh codes, they refer to binary Walsh codes which contain ones and zeros instead of plus and minus ones. Binary Walsh codes can be constructed procedurally as well, however higher order matrices are constructed from lower order matrices using “exclusive or” operations rather than multiplication. For example:
Which becomes…
Again, this matrix can be placed in each quadrant of a 2×2 matrix to construct an 8×8 matrix. This can be repeated indefinitely to create even larger matrices.
Every row in a Hadamard/Walsh matrix is unique. Furthermore, it differs from every other row by exactly 1/2 of the length. For example, in a 4×4 matrix, 2 of the columns will be different from every other row. Since the matrices have diagonal symmetry, every column also differs from every other column by exactly 1/2 the height.
Hadamard/Walsh matrices can by replacing the two numeric values in each matrix with a different color. Then plotting that color on a grid representing the matrix. The resulting image is fractal pattern that repeats as you zoom out.
One common use of Hadamard codes is as spreading codes for CDMA communications. Encoded signals look like noise because the codes are orthogonal from one another. This allows multiple encoded signals to be combined and broadcast as a single signal. Each recipient can then apply their code to extract their portion of the signal. This works because each code differs from every other code by half the code length. So if the wrong code is applied, the half of the bits will be decoded properly and half will be decoded incorrectly and the resulting decoded signal will look like noise. An example of this is demonstrated in the following video (where the person explains it much better than I could).