# Calculating basis of null space

I have to get a basis and dimension for the null space of a matrix A: $$\begin{pmatrix} 1 & 2 & 0 & 0 & 2 & -3 \\ 2 & 2 & 2 & 2 & 2 & 2 \\ 1 & 2 & 1 & 4 & 3 & 6 \\ 3 & 4 & 3 & 6 & 5 & 8 \\ \end{pmatrix}$$

I attained the reduced row echelon form of the matrix: $$\begin{pmatrix} 1 & 0 & 0 & -6 & -2 & -13 \\ 0 & 1 & 0 & 3 & 2 & 5 \\ 0 & 0 & 1 & 4 & 1 & 9 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ \end{pmatrix}$$

I know that the dimension of the null space is equal to the number of free variables, which in the case is $3$ (the last three columns). So, the dimension of the null space of $A$ is $3$.

I'm aware of this method for finding the null space: Finding the basis of a null space

However, I'm finding it hard to wrap my head around as to how I can apply it here as the $RREF(A)$ is a little more complex.

It is always the same procedure. Consider the pivots in red.

$$\begin{pmatrix} \color{red}{1} & 0 & 0 & -6 & -2 & -13 \\ 0 & \color{red}{1} & 0 & 3 & 2 & 5 \\ 0 & 0 & \color{red}{1} & 4 & 1 & 9 \\ 0 & 0 & 0 & 0 & 0 & 0 \\ \end{pmatrix}$$

We always write stuff based on the pivots. The first row would become: $$x_1-6x_4-2x_5-13x_6=0\to x_1=6x_4+2x_5+13x_6$$

Similarly for row 2 and 3,

$$x_2+3x_4+2x_5+5x_6=0\to x_2=-3x_4-2x_5-5x_6$$

$$x_3+4x_4+x_5+9x_6=0\to x_3=-4x_4-x_5-9x_6$$

For row 4, there are no pivots, so we simply have $x_4=x_4$.

Notice that since we have $6$ columns, we do indeed have a $x_5$ and $x_6$, but similarly they are not pivots, and so $x_5 = x_5$, $x_6=x_6$.

Now, we can rewrite the system as the following:

$$\begin{pmatrix} x_1 \\ x_2 \\ x_3 \\ x_4 \\ x_5 \\ x_6 \end{pmatrix}= \begin{pmatrix} 6x_4+2x_5+13x_6 \\ -3x_4-2x_5-5x_6 \\ -4x_4-x_5-9x_6 \\ x_4 \\ x_5 \\ x_6 \\ \end{pmatrix} = x_4\begin{pmatrix} 6 \\ -3 \\ -4 \\ 1 \\ 0 \\ 0 \\ \end{pmatrix} + x_5 \begin{pmatrix} 2 \\ -2 \\ -1 \\ 0 \\ 1 \\ 0 \\ \end{pmatrix} + x_6 \begin{pmatrix} 13 \\ -5 \\ -9 \\ 0 \\ 0 \\ 1 \\ \end{pmatrix}$$

So your basis for null space would be:

$$\{\begin{pmatrix} 6 \\ -3 \\ -4 \\ 1 \\ 0 \\ 0 \\ \end{pmatrix} ,\begin{pmatrix} 2 \\ -2 \\ -1 \\ 0 \\ 1 \\ 0 \\ \end{pmatrix} ,\begin{pmatrix} 13 \\ -5 \\ -9 \\ 0 \\ 0 \\ 1 \\ \end{pmatrix}\}$$

The basis of the null space is very simple to achieve without any computation once the the matrix is in rref form. Just equalize the matrix

$$\begin{pmatrix} 1 & 0 & 0 & -6 & -2 & -13 \\ 0 & 1 & 0 & 3 & 2 & 5 \\ 0 & 0 & 1 & 4 & 1 & 9 \end{pmatrix}$$ by adding three more rows, consisting of zeroes except for the row's number, here you fill in a $$-1$$:

$$\begin{pmatrix} 1 & 0 & 0 & -6 & -2 & -13 \\ 0 & 1 & 0 & 3 & 2 & 5 \\ 0 & 0 & 1 & 4 & 1 & 9 \\ 0 & 0 & 0 & -1 & 0 & 0 \\ 0 & 0 & 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & 0 & 0 & -1 \end{pmatrix}$$ Now exactly those column vectors containing the $$-1$$’s are a basis for the kernel of the matrix.

Edit:

If the matrix in rref is not already quadratic expand the matrix to a quadratic one as follows. Each row of the matrix starts with a $$1$$. Now if this $$1$$ is in position $$k$$, that row would be the $$k^{\mathrm{th}}$$ row of the expanded matrix. To achieve the desired quadratic matrix fill up all the remaining lines by zeroes except of the row number's position: place a $$-1$$ there. If for example we have $$\begin{pmatrix} 0 & 1 & 0 & 0 & -2 & -13 \\ 0 & 0 & 0 & 1 & 2 & 5 \\ 0 & 0 & 1 & 0 & 1 & 9 \\ \end{pmatrix}$$ start with $$\begin{pmatrix} .&.&.&.&.&.\\ 0 & 1 & 0 & 0 & -2 & -13 \\ 0 & 0 & 1 & 0 & 1 & 9 \\ 0 & 0 & 0 & 1 & 2 & 5 \\ .&.&.&.&.&.\\ .&.&.&.&.&.\\ \end{pmatrix}.$$ Now fill in the gaps: $$\begin{pmatrix} -1&0&0&0&0&0\\ 0 & 1 & 0 & 0 & -2 & -13 \\ 0 & 0 & 1 & 0 & 1 & 9 \\ 0 & 0 & 0 & 1 & 2 & 5 \\ 0&0&0&0&-1&0\\ 0&0&0&0&0&-1\\ \end{pmatrix}.$$ Now the column vectors which contain the $$-1$$'s, that is the first, and fifth ant sixth of that matrix are a basis for the kernel of the matrix.

• How does this work? Do we just multiply by -1 all other entries and make the -1 to 1?
– user634512
Jun 13 '19 at 11:38