Monday, July 22, 2024
HomeMatlabWhat Is AA?

What Is AA?

In a latest weblog submit What’s A\backslash A?, Cleve Moler requested what the MATLAB operation A \backslash A returns. I’ll summarize what backslash does on the whole, for A \backslash B after which contemplate the case B = A.

A \backslash B is an answer, in some applicable 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 think about the case p = 1, as a result of 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 a number of circumstances relying on the relative sizes of the row and column dimensions of A and whether or not it’s rank poor.

Sq. Matrix: m = n

When A is sq., backslash returns x = A^{-1}b, computed by LU factorization with partial pivoting (and naturally with out forming A^{-1}). There isn’t a particular remedy for singular matrices, so for them division by zero could happen and the output could include NaNs (in observe, what occurs will normally rely upon the rounding errors). For instance:

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

x =

Backslash make the most of numerous sorts of construction in A; see MATLAB Information (part 9.3) or doc mldivide in MATLAB.

Overdetermined System: m > n

An overdetermined system has no options, on the whole. Backslash yields a least squares (LS) resolution, which is exclusive if A has full rank. If A is rank-deficient then there are infinitely many LS options, and backslash returns a primary resolution: one with at most \mathrm{rank}(A) nonzeros. Such an answer shouldn’t be, on the whole, distinctive.

Underdetermined System: m < n

An underdetermined system has fewer equations than unknowns, so both there is no such thing as a resolution of there are infinitely many. Within the latter case A\backslash b produces a primary resolution and within the former case a primary LS resolution. Instance:

>> A = [1 1 1; 1 1 0]; b = [3 2]'; x = Ab
x =

One other primary resolution is [0~2~1]^T, and the minimal 2-norm resolution is [1~1~1]^T.


Now we flip to the particular case A\backslash A, which by way of equation (1) is an answer to AX = A. If A = 0 then X = I shouldn’t be a primary resolution, so A\backslash A \ne I; actually, 0\backslash 0  = 0 if m\ne n and it’s matrix of NaNs if m = n.

For an underdetermined system with full-rank A, A\backslash A shouldn’t be essentially the id matrix:

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

However for an overdetermined system with full-rank A, A\backslash A is the id matrix:

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

Minimal Frobenius Norm Resolution

The MATLAB definition of A\backslash b is a realistic one, because it computes an answer or LS resolution to Ax = b in essentially the most environment friendly approach, utilizing LU factorization (m = n) or QR factorization (m\ne n). Typically, one desires the answer of minimal 2-norm, which may be expressed as A^+b, the place A^+ is the pseudoinverse of A. In MATLAB, A^+b may be computed by lsqminnorm(A,b) or pinv(A)*b, the previous expression being most well-liked because it avoids the pointless computation of A^+ and it makes use of an entire orthogonal factorization as an alternative of an SVD.

When the right-hand facet is a matrix, B, lsqminnorm(A,B) and pinv(A)*B give the answer 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 the same as the id 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

Associated Weblog Posts

This text is a part of the “What Is” sequence, accessible from and in PDF type from the GitHub repository



Please enter your comment!
Please enter your name here

Most Popular

Recent Comments