## Free variables and basis for $$N(A)$$

Let $$A \in \mathbb{F}^{m \times n}$$ be a matrix in reduced row-echelon form. Recall that we can get all the solutions to $$Ax = 0$$ by setting the free variables to distinct parameters. Then the set of solutions can be written as a linear combination of $$n$$-tuples where the parameters are the scalars. These $$n$$-tuples give a basis for the nullspace of $$A$$. Hence, the dimension of the nullspace of $$A$$, called the nullity of $$A$$, is given by the number of non-pivot columns.

We now look at an example of finding a basis for $$N(A)$$. Let $$A \in \mathbb{R}^{2\times 4}$$ be given by $$\begin{bmatrix} 1 & -1 & -1 & 3\\2 & -2 & 0 & 4\end{bmatrix}$$. We perform the following elementary row operations: \begin{eqnarray} & & \begin{bmatrix} 1 & -1 & -1 & 3\\2 & -2 & 0 & 4\end{bmatrix} \\ & \stackrel{R_2 \leftarrow R_2 - 2R_1}{\longrightarrow} & \begin{bmatrix} 1 & -1 & -1 & 3\\0 & 0 & 2 & -2\end{bmatrix} \\ & \stackrel{R_2 \leftarrow \frac{1}{2}R_2}{\longrightarrow} & \begin{bmatrix} 1 & -1 & -1 & 3\\0 & 0 & 2 & -2\end{bmatrix} \\ & \stackrel{R_2 \leftarrow \frac{1}{2}R_2}{\longrightarrow} & \begin{bmatrix} 1 & -1 & -1 & 3\\0 & 0 & 1 & -1\end{bmatrix} \\ & \stackrel{R_1 \leftarrow R_1 + R_2}{\longrightarrow} & \begin{bmatrix} 1 & -1 & 0 & 2\\0 & 0 & 1 & -1\end{bmatrix} \end{eqnarray}

To obtain all solutions to $$Ax = 0$$, note that $$x_2$$ and $$x_4$$ are the free variables. Set $$x_2 = s$$ and $$x_4 = t$$. Then all the solutions are given by $\begin{bmatrix} x_1\\x_2\\x_3\\x_4\end{bmatrix} = \begin{bmatrix} s-2t\\s\\t\\t\end{bmatrix} = s~\begin{bmatrix} 1\\1\\0\\0\end{bmatrix}+ t~\begin{bmatrix} -2\\0\\1\\1\end{bmatrix}.$

Hence, a basis for $$N(A)$$ is given by $$\left\{\begin{bmatrix} 1\\1\\0\\0\end{bmatrix}, \begin{bmatrix} -2\\0\\1\\1\end{bmatrix}\right\}$$ and $$\dim(N(A)) = 2$$.

Remark: Note that one could have obtained directly the first vector by setting $$x_2 = 1$$, $$x_4 = 0$$ and then solving for $$x_1$$ and $$x_3$$ and the second vector by setting $$x_2 = 0$$, $$x_4 = 1$$ and then solving for $$x_1$$ and $$x_3$$. In general, if $$A$$ is in RREF, then a basis for the nullspace of $$A$$ can be built up by doing the following: For each free variable, set it to 1 and the rest of the free variables to zero and solve for the pivot variables. The resulting solution will give a vector to be included in the basis.

## Exercises

For each of the matrices, find a basis for its nullspace.

1. $$A \in \mathbb{R}^{3 \times 4}$$ given by $$\begin{bmatrix} 1 & -1 & 0 & 1\\0 & 2 & 1 & -1\\1 & 1 &1 &0\end{bmatrix}.$$

2. $$A \in GF(2)^{2 \times 4}$$ given by $$\begin{bmatrix} 1 & 1 & 0 & 1\\0 & 1 & 1 & 1\end{bmatrix}.$$ Recall that $$GF(2)$$ is the field consisting of only 0 and 1 with the usual integer addition and multiplication except that “$$1+1 =0$$”.