TITLE: Finding the basis of a null space
QUESTION [49 upvotes]: I am trying to understand why the method used in my linear algebra textbook to find the basis of the null space works. The textbook is 'Elementary Linear Algebra' by Anton.
According to the textbook, the basis of the null space for the following matrix:
$A=\left(\begin{array}{rrrrrr} 1 & 3 & -2 & 0 & 2 & 0 \\ 2 & 6 & -5 & -2 & 4 & -3 \\ 0 & 0 & 5 & 10 & 0 & 15 \\ 2 & 6 & 0 & 8 & 4 & 18 \end{array}\right)
$
is found by first finding the reduced row echelon form, which leads to the following:
$(x_1,x_2,x_3,x_4,x_5,x_6)=(-3r-4s-2t,r,-2s,s,t,0)$
or, alternatively as
$(x_1,x_2,x_3,x_4,x_5,x_6)=r(-3,1,0,0,0,0)+s(-4,0,-2,1,0,0)+t(-2,0,0,0,1,0)$
This shows that the vectors
${\bf v_1}=(-3,1,0,0,0,0),\hspace{0.5in} {\bf v_2}=(-4,0,-2,1,0,0),\hspace{0.5in} {\bf v_3}=(-2,0,0,0,1,0)$
span the solution space.
It can be shown that for a homogenous linear system, this method always produces a basis for the solution space of the system.
Question

I don't understand why this method will always produce a basis for $Ax=0$. Could someone please explain to me why this method will always work? If it helps to explain, I already understand the process of finding the basis of a column space and row space. I also understand why elementary row operations do not alter the null space of a matrix.
What specific properties of matrices or vector space that I need to be aware of in order to understand why this method works?

REPLY [10 votes]: There is a mechanical part in the accepted (+1) answer that may possibly need a more step-by-step explanation, namely the process behind

what we can do is take $\mathbf x$ and split it up

Reducing the matrix $A$ to the reduced row echelon (rref) form results in:
$$A=\left(\begin{array}{rrrrrr} 1 & 3 & -2 & 0 & 2 & 0 \\ 2 & 6 & -5 & -2 & 4 & -3 \\ 0 & 0 & 5 & 10 & 0 & 15 \\ 2 & 6 & 0 & 8 & 4 & 18 \end{array}\right)\to\left(\begin{array}{rrrrrr} \bbox[5px,border:2px solid red]1 & 3 & 0 & 4 & 2 & 0 \\ 0 & 0 & \bbox[5px,border:2px solid red]1 & 2 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & \bbox[5px,border:2px solid red]1 \\ 0 & 0 & 0 & 0 & 0 & 0 \end{array}\right)$$
There are three pivot columns corresponding to the pivot $1$'s in red, and the rank-nullity theorem tells us that there are $n-r=3$ vectors in any basis of the $N(A)$, corresponding to the free variables.
At this point it is worth remembering where all this comes from: the homogeneous system of linear equations $A\vec x = \vec 0,$ which has now been reduced to:
$$\begin{align}
1x_1 + 3x_2+ 0x_3+4x_4+2x_5 +0x_6 &=0\\
0x_1 + 0x_2+ 1x_3+2x_4+0x_5 +0x_6 &=0\\
0x_1 + 0x_2+ 0x_3+0x_4+0x_5 +1x_6 &=0\\
0x_1 + 0x_2+ 0x_3+0x_4+0x_5 +0x_6 &=0\\
\end{align}$$
Expressing the pivot variables in terms of the free variables:
$$\begin{align}
1x_1  &= - 3\;\color{blue}{x_2}  - 4\;\color{red}{x_4} - 2\;\color{magenta}{x_5} \\
1x_3 &=  -2\;\color{red}{x_4}\\
1x_6 &=\;0\\
\end{align}$$
immediately shows the way the basis vectors of the $N(A)$ will be filled in from their "skeleton" form simply indicating the column where the free variable in question is located (i.e. $x_2,x_4,x_5$):
$$\left\{\begin{bmatrix}0\\\color{blue}1\\0\\0\\0\\0\end{bmatrix},\begin{bmatrix}0\\0\\0\\\color{red}1\\0\\0\end{bmatrix},\begin{bmatrix}0\\0\\0\\0\\\color{magenta}1\\0\end{bmatrix}\right\}\to \color{blue}{x_2}\,\begin{bmatrix}0\\1\\0\\0\\0\\0\end{bmatrix}+\color{red}{x_4}\,\begin{bmatrix}0\\0\\0\\1\\0\\0\end{bmatrix}+\color{magenta}{x_5}\,\begin{bmatrix}0\\0\\0\\0\\1\\0\end{bmatrix}$$
to the final form:
$$\color{blue}{x_2}\,\begin{bmatrix}-3\\1\\0\\0\\0\\0\end{bmatrix}+\color{red}{x_4}\,\begin{bmatrix}-4\\0\\-2\\1\\0\\0\end{bmatrix}+\color{magenta}{x_5}\,\begin{bmatrix}-2\\0\\0\\0\\1\\0\end{bmatrix}\to \text{basis }N(A)= \left\{\begin{bmatrix}-3\\\color{blue}1\\0\\0\\0\\0\end{bmatrix},\begin{bmatrix}-4\\0\\-2\\\color{red}1\\0\\0\end{bmatrix},\begin{bmatrix}-2\\0\\0\\0\\\color{magenta}1\\0\end{bmatrix}\right\}$$
So it boils down to changing the signs of the entries in the rref, and keeping track of the free variables.

require("pracma")
A = matrix(c(1,3,-2,0,2,0,2,6,-5,-2,4,-3,0,0,5,10,0,15,2,6,0,8,4,18), nrow=4, byrow=T)
x2= c(-3,1,0,0,0,0); A %*% x2; x4=c(-4,0,-2,1,0,0); A %*% x4; x5=c(-2,0,0,0,1,0); A %*% x5