Line 24: | Line 24: | ||
* i.e. all such $\mathbf x$ that solve $A \mathbf x = \mathbf 0$ | * i.e. all such $\mathbf x$ that solve $A \mathbf x = \mathbf 0$ | ||
* $\mathbf 0 \in N(A)$ always | * $\mathbf 0 \in N(A)$ always | ||
− | * | + | * <math>\begin{bmatrix} |
1 \\ 1 \\ -1 | 1 \\ 1 \\ -1 | ||
− | \end{bmatrix} | + | \end{bmatrix}</math> or any multiple of this vector <math>c \cdot \begin{bmatrix} |
1 \\ 1 \\ -1 | 1 \\ 1 \\ -1 | ||
− | \end{bmatrix} | + | \end{bmatrix}</math> |
* so it's a subspace - a line in $\mathbb R^3$ through the origin | * so it's a subspace - a line in $\mathbb R^3$ through the origin | ||
Line 66: | Line 66: | ||
Let $A$ be some rectangular matrix and we find it's rref $R$ | Let $A$ be some rectangular matrix and we find it's rref $R$ | ||
− | * | + | * <math>A = \begin{bmatrix} |
1 & 2 & 3 & 1 \\ | 1 & 2 & 3 & 1 \\ | ||
1 & 1 & 2 & 1 \\ | 1 & 1 & 2 & 1 \\ | ||
Line 75: | Line 75: | ||
0 & 1 & 1 & 0 \\ | 0 & 1 & 1 & 0 \\ | ||
0 & 0 & 0 & 0 \\ | 0 & 0 & 0 & 0 \\ | ||
− | \end{bmatrix} = R | + | \end{bmatrix} = R</math> |
* we see that one of the rows are $\mathbf 0$ - so the nullspace of $A^T$ should have something apart from $\mathbf 0$ | * we see that one of the rows are $\mathbf 0$ - so the nullspace of $A^T$ should have something apart from $\mathbf 0$ | ||
Line 88: | Line 88: | ||
Example cont'd | Example cont'd | ||
− | * | + | * <math>\left[ \begin{array}{cccc|ccc} |
1 & 2 & 3 & 1 & 1 & 0 & 0 \\ | 1 & 2 & 3 & 1 & 1 & 0 & 0 \\ | ||
1 & 1 & 2 & 1 & 0 & 1 & 0 \\ | 1 & 1 & 2 & 1 & 0 & 1 & 0 \\ | ||
Line 97: | Line 97: | ||
0 & 1 & 1 & 0 & 1 & -1 & 0 \\ | 0 & 1 & 1 & 0 & 1 & -1 & 0 \\ | ||
0 & 0 & 0 & 0 & -1 & 0 & 1 \\ | 0 & 0 & 0 & 0 & -1 & 0 & 1 \\ | ||
− | \end{array}\right] | + | \end{array}\right]</math> |
− | * now if we take | + | * now if we take <math>E = \begin{bmatrix} |
-1 & 2 & 0 \\ | -1 & 2 & 0 \\ | ||
1 & -1 & 0 \\ | 1 & -1 & 0 \\ | ||
-1 & 0 & 1 \\ | -1 & 0 & 1 \\ | ||
− | \end{bmatrix} | + | \end{bmatrix}</math> and multiply it by $A$, we get |
− | ** | + | ** <math>\begin{bmatrix} |
-1 & 2 & 0 \\ | -1 & 2 & 0 \\ | ||
1 & -1 & 0 \\ | 1 & -1 & 0 \\ | ||
Line 117: | Line 117: | ||
- & - & - & - \\ | - & - & - & - \\ | ||
0 & 0 & 0 & 0 \\ | 0 & 0 & 0 & 0 \\ | ||
− | \end{bmatrix} | + | \end{bmatrix}</math> |
** so indeed we manage to get the last row with zeros | ** so indeed we manage to get the last row with zeros | ||
* so we need the last row of $E$ to get $\mathbf 0^T$ | * so we need the last row of $E$ to get $\mathbf 0^T$ | ||
Line 128: | Line 128: | ||
* vectors of $V$ that correspond to $\sigma_i = 0$ are from the nullspace | * vectors of $V$ that correspond to $\sigma_i = 0$ are from the nullspace | ||
− | + | def null(A, eps=1e-15): | |
− | + | u, s, vh = np.linalg.svd(A) | |
− | def null(A, eps=1e-15): | + | null_space = np.compress(s <= eps, vh, axis=0) |
− | + | return null_space.T | |
− | + | ||
− | + | ||
− | + | ||
From [http://stackoverflow.com/questions/1835246/how-to-solve-homogeneous-linear-equations-with-numpy] | From [http://stackoverflow.com/questions/1835246/how-to-solve-homogeneous-linear-equations-with-numpy] |
Nullspace $N(A)$ of a matrix $A$ is one of the Four Fundamental Subspaces of the matrix $A$
The nullspace of $A$ contains all $\mathbf x$ that solve the system $A \mathbf x = \mathbf 0$ (this system is called homogeneous)
$A = \begin{bmatrix} 1 & 1 & 2 \\ 2 & 1 & 3 \\ 3 & 1 & 4 \\ 4 & 1 & 5 \\ \end{bmatrix}$, $\mathbf x = \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix}$, $\mathbf b = \mathbf 0_4 = \begin{bmatrix} 0 \\ 0 \\ 0 \\ 0 \end{bmatrix}$
Let's find what's inside $N(A)$
Does it form a Vector Space on its own?
Basis for $N(A)$ is formed by the "special" solutions
We can also consider another nullspace of $A$ - the nullspace of $A^T$ (this is the 4th fundamental subspace of a matrix)
Let's have a look at a system $A^T \mathbf y = \mathbf 0$
Let's take the transpose of $A^T \mathbf y = \mathbf 0$:
$\big[ - \, \mathbf y^T - \big] \Bigg[ ~ ~ ~ ~ ~ {A} ~ ~ ~ ~ ~ \Bigg] = \big[ - \, \mathbf 0^T - \big]$
Let's consider this example
Let $A$ be some rectangular matrix and we find it's rref $R$
How to best find this left nullspace?
Example cont'd
Use SVD to compute the nullspace
def null(A, eps=1e-15): u, s, vh = np.linalg.svd(A) null_space = np.compress(s <= eps, vh, axis=0) return null_space.T
From [1]