Post · 3 min read· pp. 689–690

What Is the Nearest Symmetric Matrix?

What is the nearest symmetric matrix to a real, nonsymmetric square matrix AA? This question arises whenever a symmetric matrix is approximated by formulas that do not respect the symmetry. For example, a finite difference approximation to a Hessian matrix can be nonsymmetric even though the Hessian is symmetric. In some cases, lack of symmetry is caused by rounding errors. The natural way to symmetrize AA is to replace it by (A+AT)/2(A + A^T)/2. Is this the best choice?

As our criterion of optimality we take that ∥A−X∥\| A - X \| is minimized over symmetric XX for some suitable norm. Fan and Hoffman (1955) showed that (A+AT)/2(A + A^T)/2 is a solution in any unitarily invariant norm. A norm is unitarily invariant if ∥A∥=∥UAV∥\|A\| = \|UAV\| for all unitary UU and VV. Such a norm depends only on the singular values of AA, and hence ∥A∥=∥AT∥\|A\| = \|A^T\| since AA and ATA^T have the same singular values. The most important examples of unitarily invariant norms are the 22-norm and the Frobenius norm.

The proof that (A+AT)/2(A+A^T)/2 is optimal is simple. For any symmetric YY,

∥A−12(A+AT)∥=12∥A−AT∥=12∥A−Y+YT−AT∥≤12∥A−Y∥+12∥(Y−A)T∥=∥A−Y∥.\notag \begin{aligned} \Bigl\| A - \frac{1}{2}(A + A^T) \Bigr\| &= \frac{1}{2} \|A - A^T \| = \frac{1}{2} \| A - Y + Y^T - A^T \| \\ &\le \frac{1}{2} \| A - Y \| + \frac{1}{2} \|(Y - A)^T \| \\ &= \| A - Y\|. \end{aligned}

Simple examples of a matrix and a nearest symmetric matrix are

A=[0100],    X=[012120],A=[01−10],    X=[0000].\notag A = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}, \;\; X = \begin{bmatrix} 0 & \frac{1}{2} \\ \frac{1}{2} & 0 \end{bmatrix},\qquad A = \begin{bmatrix} 0 & 1 \\ -1 & 0 \end{bmatrix}, \;\; X = \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix}.

Note that any AA can be written

A=12(A+AT)+12(A−AT)≡B+C,\notag A = \frac{1}{2} (A + A^T ) + \frac{1}{2} (A - A^T ) \equiv B + C,

where BB and CC are the symmetric part and the skew-symmetric part of AA, respectively, so the nearest symmetric matrix to AA is the symmetric part of AA.

For the Frobenius norm, (A+AT)/2(A + A^T)/2 is the unique nearest symmetric matrix, which follows from the fact that ∥S+K∥F2=∥S∥F2+∥K∥F2\|S + K\|_F^2 = \|S\|_F^2 + \|K\|_F^2 for symmetric SS and skew-symmetric KK. For the 22-norm, however, the nearest symmetric matrix is not unique in general. An example of non-uniqueness is

A=[000001000],X=[00000120120],Y=[θ0000120120],\notag A = \begin{bmatrix} 0 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & 0 & 0 \end{bmatrix}, \quad X = \begin{bmatrix} 0 & 0 & 0 \\ 0 & 0 & \frac{1}{2} \\ 0 & \frac{1}{2} & 0 \end{bmatrix}, \quad Y = \begin{bmatrix} \theta & 0 & 0 \\ 0 & 0 & \frac{1}{2} \\ 0 & \frac{1}{2} & 0 \end{bmatrix},

for which ∥A−X∥2=0.5\|A - X\|_2 = 0.5, and ∥A−Y∥2=0.5\|A - Y\|_2 = 0.5 for any θ\theta such that ∣θ∣≤0.5|\theta| \le 0.5.

Entirely analogous to the above is the nearest skew-symmetric matrix problem, for which the solution is the skew-symmetric part for any unitarily invariant norm. For complex matrices, these results generalize in the obvious way: (A+A∗)/2(A + A^*)/2 is the nearest Hermitian matrix to AA and (A−A∗)/2(A - A^*)/2 is the nearest skew-Hermitian matrix to AA in any unitarily invariant norm.

Reference

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.