Post · 9 min read· pp. 773–777

What Is the Wilson Matrix?

The 4×44\times 4 matrix

W=[5765710876810957910]\notag W = \begin{bmatrix} 5 & 7 & 6 & 5 \\ 7 & 10 & 8 & 7 \\ 6 & 8 & 10 & 9 \\ 5 & 7 & 9 & 10 \end{bmatrix}

appears in a 1946 paper by Morris, in which it is described as having been “devised by Mr. T. S. Wilson.” The matrix is symmetric positive definite with determinant 11 and inverse

W−1=[68−41−1710−412510−6−17105−310−6−32],\notag W^{-1} = \begin{bmatrix} 68 & -41 & -17 & 10\\ -41 & 25 & 10 & -6\\ -17 & 10 & 5 & -3\\ 10 & -6 & -3 & 2 \end{bmatrix},

so it is moderately ill conditioned with κ2(W)=∥W∥2∥W−1∥2≈2.98409×103\kappa_2(W) = \|W\|_2 \|W^{-1}\|_2 \approx 2.98409\times 10^3. This little matrix has been used as an example and for test purposes in many research papers and books over the years, in particular by John Todd, who described it as “the notorious matrix WW of T. S. Wilson”.

Rutishauser (1968) stated that “the famous Wilson matrix is not a very striking example of an ill-conditioned matrix”, on the basis that κ2(A)≤40,000\kappa_2(A)\le 40{,}000 for a “positive definite symmetric 4×44\times 4 matrix with integer elements not exceeding 1010” and he gave the positive definite matrix

A0=[101401105−1451070−179],A0−1=[105167−304255167266−484406−304−484881−739255406−739620],\notag A_0 = \begin{bmatrix} 10 & 1 & 4 & 0 \\ 1 & 10 & 5 & -1 \\ 4 & 5 & 10 & 7 \\ 0 & -1 & 7 & 9 \end{bmatrix}, \quad A_0^{-1} =\begin{bmatrix} 105& 167 & -304 & 255\\ 167 & 266 & -484 & 406\\ -304 & -484 & 881 & -739\\ 255 & 406 & -739 & 620 \end{bmatrix},

for which κ2(A0)=3.57924×104\kappa_2(A_0) = 3.57924\times 10^4. The matrix A0A_0 is therefore a factor 12 more ill conditioned than WW. Rutishauser did not give a proof of the stated bound.

Moler (2018) asked how ill-conditioned WW is relative to matrices in the set

S={ A∈R4×4:A=AT is nonsingular with integer entriesbetween 1 and 10 }.\notag \begin{aligned} \mathcal{S} &= \{\, A\in\mathbb{R}^{4\times 4}: A=A^T \mathrm{~is~nonsingular~with~integer~entries}\nonumber\\ & \hspace{2.9cm} \mathrm{between~1~and~10} \,\}. \end{aligned}

He generated one million random matrices from S\mathcal{S} and found that about 0.21 percent of them had a larger condition number than WW. The matrix with the largest condition number was the indefinite matrix

A1=[13101034891083910993],A1−1=[573−80415925−8041128−223−35159−22344725−3571],\notag A_1 = \begin{bmatrix} 1 & 3 & 10 & 10\\ 3 & 4 & 8 & 9\\ 10 & 8 & 3 & 9\\ 10 & 9 & 9 & 3 \end{bmatrix}, \quad A_1^{-1} = \begin{bmatrix} 573 & -804 & 159 & 25\\ -804 & 1128 & -223 & -35\\ 159 & -223 & 44 & 7\\ 25 & -35 & 7 & 1 \end{bmatrix},

for which κ2(A1)≈4.80867×104\kappa_2(A_1) \approx 4.80867\times 10^4. How far is this matrix from being a worst case?

As the Wilson matrix is positive definite, we are also interested in how ill conditioned a matrix in the set

P={ A∈R4×4:A=AT is symmetric positive definite with integer entriesbetween 1 and 10 }\notag \begin{aligned} \mathcal{P} &= \{\, A\in\mathbb{R}^{4\times 4}: A=A^T \mathrm{~is~symmetric~positive~definite ~with~integer~entries}\nonumber\\ & \hspace{2.9cm} \mathrm{between~1~and~10} \,\} \end{aligned}

can be.

Condition Number Bounds

We first consider bounds on κ2(A)\kappa_2(A) for A∈SA \in \mathcal{S}. It is possible to obtain a bound from first principles by using the relation A−1=adj(A)/det⁡(A)A^{-1} = \mathrm{adj}(A)/\det(A), where adj(A)\mathrm{adj}(A) is the adjugate matrix, along with the fact that ∣det⁡(A)∣≥1|\det(A)| \ge 1 since AA has integer entries. Higham and Lettington (2021) found that the smallest bound they could obtain came from a bound of Merikoski et al. (1997): for nonsingular B∈Rn×nB\in\mathbb{R}^{n\times n},

κ2(B)≤(1+x1−x)1/2,x=1−(n/∥B∥F2)n∣det⁡(B)∣2.\notag \kappa_2(B) \le \left(\displaystyle\frac{1+x}{1-x}\right)^{1/2}, \quad x = \sqrt{1 - (n/\|B\|_F^2)^n |\det(B)|^2 }.

Applying this bound to A∈SA\in\mathcal{S}, using the fact that (1+x)/(1−x)(1+x)/(1-x) is monotonically increasing for x∈(0,1)x\in(0,1), gives

κ2(A)≤2.97606⋯×105=:βS,A∈S.(1)\notag \kappa_2(A) \le 2.97606\dots \times 10^5 =: \beta_S, \quad A\in\mathcal{S}. \qquad (1)

Another result from Merikoski et al. (1997) gives, for symmetric positive definite C∈∈Rn×nC\in\in\mathbb{R}^{n\times n},

κ2(C)≤1+x1−x,x=1−(n/trace(C))ndet⁡(C).\notag \kappa_2(C) \le \displaystyle\frac{1+x}{1-x}, \quad x = \sqrt{1 - (n/\mathrm{trace}(C))^n \det(C) }.

For A∈PA\in\mathcal{P}, since det⁡(A)≥1\det(A) \ge 1 we have x≤1−(1/10)4x \le \sqrt{1 - (1/10)^4}, and hence

κ2(A)≤3.99980×104=:βP,A∈P.(2)\notag \kappa_2(A) \le 3.99980 \times 10^4 =: \beta_P, \quad A\in\mathcal{P}. \qquad (2)

Recall that Rutishauser’s bound is 4×1044\times 10^4. The bounds (1) and (2) remain valid if we modify the definitions of S\mathcal{S} and P\mathcal{P} to allow zero elements (note that Rutishauser’s matrix A0A_0 has a zero element).

Experiment

The sets S\mathcal{S} and P\mathcal{P} are large: S\mathcal{S} has on the order of 101010^{10} elements. Exhaustively searching over the sets in reasonable time is possible with a carefully optimized code. Higham and Lettington (2021) use a MATLAB code that loops over all symmetric matrices with integer elements between 11 and 1010 and

  • evaluates det⁡(A)\det(A) from an explicit expression (exactly computed for such matrices) and discards AA if the matrix is singular;
  • computes the eigenvalues λi\lambda_i of AA and obtains the condition number as κ2(A)=max⁡i∣λi∣/min⁡i∣λi∣\kappa_2(A) = \max_i |\lambda_i|/\min_i |\lambda_i| (since AA is symmetric); and
  • for P\mathcal{P}, checks whether AA is positive definite by checking whether the smallest eigenvalue is positive.

The code is available at https://github.com/higham/wilson-opt.

The maximum over S\mathcal{S} is attained for

A2=[271010710109101010110919],A2−1=[640−987323240−9871522−498−370323−498163121240−37012190],\notag A_2 = \begin{bmatrix} 2 & 7 & 10 & 10\\ 7 & 10 & 10 & 9\\ 10 & 10 & 10 & 1\\ 10 & 9 & 1 & 9 \end{bmatrix}, \quad A_2^{-1} = \begin{bmatrix} 640 & -987 & 323 & 240\\ -987 & 1522 & -498 & -370\\ 323 & -498 & 163 & 121\\ 240 & -370 & 121 & 90 \end{bmatrix},

which has κ2(A2)≈7.6119×104\kappa_2(A_2) \approx 7.6119 \times 10^4. and determinant −1-1. The maximum over P\mathcal{P} is attained for

A3=[9115110191110159110],A3−1=[188347−13−405347641−24−748−13−24128−405−74828873].\notag A_3 = \begin{bmatrix} 9 & 1 & 1 & 5\\ 1 & 10 & 1 & 9\\ 1 & 1 & 10 & 1\\ 5 & 9 & 1 & 10 \end{bmatrix}, \quad A_3^{-1} = \begin{bmatrix} 188 & 347 & -13 & -405\\ 347 & 641 & -24 & -748\\ -13 & -24 & 1 & 28\\ -405 & -748 & 28 & 873 \end{bmatrix}.

which has κ2(A3)≈3.5529×104\kappa_2(A_3) \approx 3.5529 \times 10^4 and determinant 11. Obviously, symmetric permutations of these matrices are also optimal.

The following table summarizes the condition numbers of the matrices discussed and how close they are to the bounds.

Matrix AACommentκ2(A)\kappa_2(A)βS/κ2(A)\beta_S/\kappa_2(A)βP/κ2(A)\beta_P/\kappa_2(A)
WWWilson matrix2.98409×1032.98409\times 10^399.7313.40
A9A_9Rutishauser’s matrix3.57924×1043.57924\times 10^48.311.12
A1A_1By random sampling4.80867×1044.80867\times 10^46.19—
A2A_2Optimal matrices in S\mathcal{S}7.61190×1047.61190\times 10^43.91—
A3A_3Optimal matrices in P\mathcal{P}3.55286×1043.55286\times 10^48.381.13

Clearly, the bounds are reasonably sharp.

We do not know how Wilson constructed his matrix or to what extent he tried to maximize the condition number subject to the matrix entries being small integers. One possibility is that he constructed it via the factorization in the next section.

Integer Factorization

The Cholesky factor of the Wilson matrix is

R=[57 556 555055−2 5500023 2200022](W=RTR).\notag R = \begin{bmatrix} \sqrt{5} & \frac{7\,\sqrt{5}}{5} & \frac{6\,\sqrt{5}}{5} & \sqrt{5}\\[3pt] 0 & \frac{\sqrt{5}}{5} & -\frac{2\,\sqrt{5}}{5} & 0\\[3pt] 0 & 0 & \sqrt{2} & \frac{3\,\sqrt{2}}{2}\\[3pt] 0 & 0 & 0 & \frac{\sqrt{2}}{2} \end{bmatrix} \quad (W = R^TR).

Apart from the zero (2,4)(2,4) element, it is unremarkable. If we factor out the diagonal then we obtain the LDLTLDL^T factorization, which has rational elements:

L=[10007510065−21010321],D=[500001500002000012](W=LDLT).\notag L = \begin{bmatrix}1 & 0 & 0 & 0\\ \frac{7}{5} & 1 & 0 & 0\\ \frac{6}{5} & -2 & 1 & 0\\ 1 & 0 & \frac{3}{2} & 1 \end{bmatrix}, \quad D = \begin{bmatrix}5 & 0 & 0 & 0\\ 0 & \frac{1}{5} & 0 & 0\\ 0 & 0 & 2 & 0\\ 0 & 0 & 0 & \frac{1}{2} \end{bmatrix} \quad (W = LDL^T).

Suppose we drop the requirement of triangularity and ask whether the Wilson matrix has a factorization W=ZT ⁣ZW = Z^T\!Z with a 4×44\times4 matrix ZZ of integers. It is known that every symmetric positive definite n×nn\times n matrix AA of integers with determinant 11 has a factorization A=ZT ⁣ZA = Z^T\!Z with ZZ an n×nn\times n matrix of integers as long as n≤7n \le 7, but examples are known for n=8n = 8 for which the factorization does not exist. This result is mentioned by Taussky (1961) and goes back to Hermite, Minkowski, and Mordell. Higham and Lettington (2021) found the integer factor

Z0=[2322112100120011]\notag Z_0 = \begin{bmatrix} 2 & 3 & 2 & 2\\ 1 & 1 & 2 & 1\\ 0 & 0 & 1 & 2\\ 0 & 0 & 1 & 1 \end{bmatrix}

of WW, which is block upper triangular so can be thought of as a block Cholesky factor. Higham, Lettington, and Schmidt (2021) draw on recent research that links the existence of such factorizations to number-theoretic considerations of quadratic forms to show that for the existence of an integer solution ZZ to A=ZTZA = Z^TZ it is necessary that a certain quadratic equation in nn variables has an integer solution. In the case of the Wilson matrix the equation is

2w2+x12+x1x2+x1x3+x22+x2x3+x32=952.2 w^2+x_1^2+x_1 x_2+x_1 x_3+x_2^2+x_2 x_3+x_3^2=952.

The authors solve this equation computationally and find Z1Z_1 and two rational factors:

\notag Z_1=\left[ \begin{array}{cccc} \frac{1}{2} & 1 & 0 & 1 \\ \frac{3}{2} & 2 & 3 & 3 \\ \frac{1}{2} & 1 & 0 & 0 \\ \frac{3}{2} & 2 & 1 & 0 \\ \end{array} \right], \quad Z_2=\left[ \begin{array}{@{\mskip2mu}rrrr} \frac{3}{2} & 2 & 2 & 2 \\ \frac{3}{2} & 2 & 2 & 1 \\ \frac{1}{2} & 1 & 1 & 2 \\ -\frac{1}{2} & -1 & 1 & 1 \\ \end{array} \right].

They show that these matrices are the only factors Z∈116ZZ\in\frac{1}{16}\mathbb{Z} of WW up to left multiplication by integer orthogonal matrices.

Conclusions

The Wilson matrix has provided sterling service throughout the digital computer era as a convenient symmetric positive definite matrix for use in textbook examples and for testing algorithms. The recent discovery of its integer factorization has led to the development of new theory on when general n×nn\times n integer matrices AA can be factored as A=ZTZA = Z^TZ (when AA is symmetric positive definite) or A=Z2A = Z^2 (a problem also considered in Higham, Lettington, and Schmidt (2021)), with integer ZZ.

Olga Taussky Todd wrote in 1961 that “matrices with integral elements have been studied for a very long time and an enormous number of problems arise, both theoretical and practical.” We wonder what else can be learned from the Wilson matrix and other integer test matrices.

References

This is a minimal set of references, which contain further useful references within.

This article is part of the “What Is” series, available from https://nhigham.com/category/what-is and in PDF form from the GitHub repository https://github.com/higham/what-is.