Construct hadamard matrix of order 12

3.7k Views Asked by At

How do you construct a hadamard matrix of order 12?

Thank you!

3

There are 3 best solutions below

0
On

One possibility of constructing such Hadamard matrix is to use Paley construction.

In this construction we use a finite field with $q$ elements and:

  • For $q\equiv3\pmod4$ we get a matrix of order $(q+1)$.
  • For $q\equiv1\pmod4$ we get a matrix of order $2(q+1)$.

So for $q=5$ or $q=11$ we get a $12\times12$-matrix.

This construction is described also in the book van Lint J., Wilson R. A course in combinatorics, see Theorem 18.5.

0
On

I'll translate what is said in the document I gave you the link for (from Hadamard's work). He explains how to construct a Hadamard matrix of order 12 (although he doesn't call them Hadamard matrices :))

Basically he starts by saying that columns must be groupped 3 by 3 in 4 seperate groups.

Next, he describes the first $3$ lines:

  • The first line only has $1$'s.
  • The second line has only $1$'s in the first two groups and $(-1)$'s in the last two groups
  • The third line has alternating $1$'s and $(-1)$'s

And finally, he describes how the last $9$ lines are arranged:

Each of these lines is constructed in such a way that:

  • The first and last groups each have $2$ positive elements and $1$ negative element.
  • The second and third groups each have $1$ positive element and $2$ negative elements.

Note that in every line, each group has one element which sign is different from the two other elements in the group.

Also, these lines have to verify the following table:

$$\begin{array}{cc}1 & 1 & 1 & 1 \\ 1 & 2 & 2 & 2 \\1 & 3 & 3 & 3 \\ 2 & 1 & 2 & 3 \\ 2 & 2 & 3 & 1 \\ 2 & 3 & 1 & 2 \\ 3 & 1 & 3 & 2 \\ 3 & 2 & 1 & 3 \\ 3 & 3 & 2 & 1\end{array}$$

Where:

  • Each $i$-th column of the table represents the $i$-th column group of the matrix.
  • The numbers indicate the rank of the element which sign is different from the two other elements of the group

Note: He also has a similar approach for Hadamard matrices of order $20$ if you're interested ;)

0
On

Here is a short skript using my matrix-calculator-program MatMate: (see matrix-results at bottom of post)

n=12
M = einh(n)*sqrt(n)          // define a diagonal matrix containing only sqrt(n)
W = M * gettrans(randomn(n,n),"drei")  // rotate it in some random direction just
                             // to make it non-diagonal

// now find a Hadamard-version from that "random" matrix: 
X = rot ( W, "-varimax")     // do a "varimax"-rotation with minimizing condition  

The reason why I post here a skript straightaway is, that it is as simple as this to produce any $n=4 \times m$, given that some hypothese can actually be proven: that the "varimax"-rotation can be configured to find the global optimum (and as opposed need not stick in local minima).
Unfortunately it seems, that the numerical process needs a high digits-accuracy depending on n; so for n=20 I needed 80 to 100 digits and I could not yet make the varimax-rotation definitely converging to the true result for more than n=28 (The finding of the solution depends on that we have a "nice" random configuration in W so far).
But for n=12 this works in a fraction of a second with double accuracy and always perfectly.

See also my question concerning this at mathoverflow


A bit background: The "varimax"-rotation is an iterative process, which for each rotation of pairs of columns optimizes the rotation angle such that the variance in the squared entries of that columns arrives at a maximum. For our case that maximum-criterion is converted into a minimum-criterion instead (such that the variance of the squares in each pairs becomes minimal in each rotation - and in our case of a Hadamard-matrix becomes zero).
This rotation-idea stems from the "factor analysis" in multivariate statistics and more about it can be found for instance in wikipedia.

Unfortunately I didn't find a conclusive and explicite proof for that hypothese so far, although there is some work on it, for instance by J.M.F. ten Berge (Idon't have the exact citation at hand in the moment)


$$ \text{ w =} \tiny \left[ \begin{array} {rrrrrrrrrrrr} -0.5032& 0.3615& 0.0332& -1.2641& 1.4063& 0.4272& 0.3647& -1.6180& 1.7986& -0.9712& -0.7984& -0.5388\\ 0.8396& 1.6039& -0.5397& 0.1197& 0.8540& 1.4172& -1.0500& -0.0552& -0.3709& -0.4297& 1.9723& -0.6007\\ 1.9841& -0.3399& -0.9440& 1.1765& 0.1358& 0.3534& 1.7796& 0.0362& 1.4002& 0.5702& 0.1865& 0.2011\\ -1.5781& -0.7268& -1.6570& 0.5068& -0.6434& 1.7556& 0.1298& 0.9972& 0.4021& -1.1098& -0.2211& 0.1716\\ -0.0793& -0.9447& 1.5442& -0.9225& -0.3774& 1.8690& 1.1637& 0.0869& -0.4804& 0.9362& 0.4572& -1.2458\\ 0.4887& 0.1290& -0.6250& -1.8390& 0.4173& 0.9115& -0.3324& 0.4091& -0.1530& 1.2227& -0.4574& 2.2274\\ -0.7221& 0.1901& 0.7917& 0.9587& -1.1709& 0.5620& -1.3225& -0.9337& 1.7662& 1.3659& 0.4962& 0.5981\\ -0.2871& 1.6300& -0.9170& -0.6776& -2.0357& -0.1423& 1.2733& -1.3285& -0.6295& 0.0588& 0.0966& -0.0303\\ -0.9945& 1.5586& -0.1792& 1.1322& 1.2046& 0.4103& 0.4685& 0.4422& -0.4850& 1.5998& -1.4418& -0.6000\\ -0.5021& 1.4566& 1.4777& -0.2281& -0.1317& -0.2928& 1.0954& 1.7771& 1.0272& -0.8284& 0.6311& 0.8887\\ 0.2277& -0.0026& 1.1739& 1.3336& 0.3194& 1.0599& 0.4326& -1.3095& -1.1589& -1.1607& -0.5319& 1.6404\\ -1.5724& -0.7072& -0.4838& 0.1526& 1.2077& -0.7515& 1.0673& -0.7094& -0.3190& 0.6941& 1.9887& 0.7524 \end{array} \right] $$

$$ \text{ X =} \tiny \left[ \begin{array} {rrrrrrrrrrrr} -1.00& -1.00& 1.00& -1.00& 1.00& 1.00& 1.00& -1.00& 1.00& -1.00& -1.00& -1.00\\ -1.00& 1.00& -1.00& -1.00& 1.00& 1.00& -1.00& 1.00& -1.00& -1.00& 1.00& -1.00\\ 1.00& 1.00& -1.00& 1.00& 1.00& 1.00& 1.00& -1.00& 1.00& 1.00& 1.00& -1.00\\ -1.00& 1.00& -1.00& 1.00& -1.00& 1.00& 1.00& 1.00& 1.00& -1.00& -1.00& 1.00\\ -1.00& -1.00& 1.00& 1.00& -1.00& 1.00& 1.00& 1.00& -1.00& 1.00& 1.00& -1.00\\ 1.00& -1.00& -1.00& -1.00& 1.00& 1.00& 1.00& 1.00& -1.00& 1.00& -1.00& 1.00\\ -1.00& -1.00& -1.00& -1.00& -1.00& 1.00& -1.00& -1.00& 1.00& 1.00& 1.00& 1.00\\ -1.00& 1.00& -1.00& -1.00& -1.00& -1.00& 1.00& -1.00& -1.00& 1.00& -1.00& -1.00\\ -1.00& 1.00& 1.00& 1.00& 1.00& 1.00& -1.00& -1.00& -1.00& 1.00& -1.00& 1.00\\ -1.00& 1.00& 1.00& -1.00& 1.00& -1.00& 1.00& 1.00& 1.00& 1.00& 1.00& 1.00\\ 1.00& 1.00& 1.00& -1.00& -1.00& 1.00& 1.00& -1.00& -1.00& -1.00& 1.00& 1.00\\ -1.00& -1.00& -1.00& 1.00& 1.00& -1.00& 1.00& -1.00& -1.00& -1.00& 1.00& 1.00 \end{array} \right]$$