null#
Purpose#
Computes an orthonormal basis for the (right) null space of a matrix.
Format#
- b = null(x)#
- Parameters:
x (NxM matrix) – data
- Returns:
b (MxK matrix) –
where K is the nullity of x, such that:
// NxK matrix of 0's x * b = 0
and
// MxM identity matrix b'b = I
The error returns are returned in b:
error code
reason
1
there is no null space
2
b is too large to return in a single matrix
Use
scalerr()
to test for error returns.
Examples#
let x[2, 4] = 2 1 3 -1
3 5 1 2;
b = null(x);
z = x*b;
i = b'b;
After the code above:
-0.804 0.142
b = 0.331 -0.473 z = 0 0 i = 1 0
0.473 0.331 0 0 0 1
0.142 0.804
Remarks#
The orthogonal complement of the column space of x’ is computed using the QR decomposition. This provides an orthonormal basis for the null space of x.
Globals#
_qrdc, _qrsl
Source#
null.src