# What Is A\A?

In a recent blog post What is $A\backslash A$?, Cleve Moler asked what the MATLAB operation $A \backslash A$ returns. I will summarize what backslash does in general, for $A \backslash B$ and then consider the case $B = A$.

$A \backslash B$ is a solution, in some appropriate sense, of the equation

$\notag AX = B, \quad A \in\mathbb{C}^{m\times n} \quad X \in\mathbb{C}^{n\times p} \quad B \in\mathbb{C}^{m\times p}. \qquad (1)$

It suffices to consider the case $p = 1$, because backslash treats the columns independently, and we write this as

$\notag Ax = b, \quad A \in\mathbb{C}^{m\times n} \quad x \in\mathbb{C}^{n} \quad b \in\mathbb{C}^{m}.$

The MATLAB backslash operator handles several cases depending on the relative sizes of the row and column dimensions of $A$ and whether it is rank deficient.

## Square Matrix: $m = n$

When $A$ is square, backslash returns $x = A^{-1}b$, computed by LU factorization with partial pivoting (and of course without forming $A^{-1}$). There is no special treatment for singular matrices, so for them division by zero may occur and the output may contain NaNs (in practice, what happens will usually depend on the rounding errors). For example:

>> A = [1 0; 0 0], b = [1 0]', x = A\b
A =
1     0
0     0
b =
1
0
Warning: Matrix is singular to working precision.

x =
1
NaN


Backslash take advantage of various kinds of structure in $A$; see MATLAB Guide (section 9.3) or doc mldivide in MATLAB.

## Overdetermined System: $m > n$

An overdetermined system has no solutions, in general. Backslash yields a least squares (LS) solution, which is unique if $A$ has full rank. If $A$ is rank-deficient then there are infinitely many LS solutions, and backslash returns a basic solution: one with at most $\mathrm{rank}(A)$ nonzeros. Such a solution is not, in general, unique.

## Underdetermined System: $m < n$

An underdetermined system has fewer equations than unknowns, so either there is no solution of there are infinitely many. In the latter case $A\backslash b$ produces a basic solution and in the former case a basic LS solution. Example:

>> A = [1 1 1; 1 1 0]; b = [3 2]'; x = A\b
x =
2.0000e+00
0
1.0000e+00


Another basic solution is $[0~2~1]^T$, and the minimum $2$-norm solution is $[1~1~1]^T$.

## A\A

Now we turn to the special case $A\backslash A$, which in terms of equation (1) is a solution to $AX = A$. If $A = 0$ then $X = I$ is not a basic solution, so $A\backslash A \ne I$; in fact, $0\backslash 0 = 0$ if $m\ne n$ and it is matrix of NaNs if $m = n$.

For an underdetermined system with full-rank $A$, $A\backslash A$ is not necessarily the identity matrix:

>> A = [1 0 1; 0 1 0], X = A\A
A =
1     0     1
0     1     0
X =
1     0     1
0     1     0
0     0     0


But for an overdetermined system with full-rank $A$, $A\backslash A$ is the identity matrix:

>> A'\A'
ans =
1.0000e+00            0
-1.9185e-17   1.0000e+00


## Minimum Frobenius Norm Solution

The MATLAB definition of $A\backslash b$ is a pragmatic one, as it computes a solution or LS solution to $Ax = b$ in the most efficient way, using LU factorization ($m = n$) or QR factorization $(m\ne n$). Often, one wants the solution of minimum $2$-norm, which can be expressed as $A^+b$, where $A^+$ is the pseudoinverse of $A$. In MATLAB, $A^+b$ can be computed by lsqminnorm(A,b) or pinv(A)*b, the former expression being preferred as it avoids the unnecessary computation of $A^+$ and it uses a complete orthogonal factorization instead of an SVD.

When the right-hand side is a matrix, $B$, lsqminnorm(A,B) and pinv(A)*B give the solution of minimal Frobenius norm, which we write as $A \backslash\backslash B$. Then $A\backslash\backslash A = A^+A$, which is the orthogonal projector onto $\mathrm{range}(A^*)$, and it is equal to the identity matrix when $m\ge n$ and $A$ has full rank. For the matrix above:

>> A = [1 0 1; 0 1 0], X = lsqminnorm(A,A)
A =
1     0     1
0     1     0
X =
5.0000e-01            0   5.0000e-01
0   1.0000e+00            0
5.0000e-01            0   5.0000e-01


## 3 thoughts on “What Is A\A?”

1. José-Javier Martínez says:

Dear Professor Higham,
In the last paragraph, maybe the correct name for the title (if you write about the 2-norm) is “spectral norm”, and not “Frobenius norm”.
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 51, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}