In a latest weblog submit What’s ?, Cleve Moler requested what the MATLAB operation
returns. I’ll summarize what backslash does on the whole, for
after which contemplate the case
.
is an answer, in some applicable sense, of the equation
It suffices to think about the case , as a result of backslash treats the columns independently, and we write this as
The MATLAB backslash operator handles a number of circumstances relying on the relative sizes of the row and column dimensions of and whether or not it’s rank poor.
Sq. Matrix: 
When is sq., backslash returns
, computed by LU factorization with partial pivoting (and naturally with out forming
). 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 = 1 0 Warning: Matrix is singular to working precision. x = 1 NaN
Backslash make the most of numerous sorts of construction in ; see MATLAB Information (part 9.3) or
doc mldivide
in MATLAB.
Overdetermined System: 
An overdetermined system has no options, on the whole. Backslash yields a least squares (LS) resolution, which is exclusive if has full rank. If
is rank-deficient then there are infinitely many LS options, and backslash returns a primary resolution: one with at most
nonzeros. Such an answer shouldn’t be, on the whole, distinctive.
Underdetermined System: 
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 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 = 2.0000e+00 0 1.0000e+00
One other primary resolution is , and the minimal
-norm resolution is
.
AA
Now we flip to the particular case , which by way of equation (1) is an answer to
. If
then
shouldn’t be a primary resolution, so
; actually,
if
and it’s matrix of NaNs if
.
For an underdetermined system with full-rank ,
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 ,
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 is a realistic one, because it computes an answer or LS resolution to
in essentially the most environment friendly approach, utilizing LU factorization (
) or QR factorization
). Typically, one desires the answer of minimal
-norm, which may be expressed as
, the place
is the pseudoinverse of
. In MATLAB,
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 and it makes use of an entire orthogonal factorization as an alternative of an SVD.
When the right-hand facet is a matrix, ,
lsqminnorm(A,B)
and pinv(A)*B
give the answer of minimal Frobenius norm, which we write as . Then
, which is the orthogonal projector onto
, and it is the same as the id matrix when
and
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
- What Is an LU Factorization? (2021)
- What Is a QR Factorization? (2020)
- What Is a Rank-Revealing Factorization? (2021)
This text is a part of the “What Is” sequence, accessible from https://nhigham.com/index-of-what-is-articles/ and in PDF type from the GitHub repository https://github.com/higham/what-is.