For a given value of $x$, find the basis We have the matrix $X = \begin{bmatrix}
2 & 0 & -1 & 1 \\
0 & 0 & 1 & 1 \\
1 & 0 & 0 & 1 \\
-1 & x & 2 & 1
\end{bmatrix}$
We want to find a basis for the row space, column space and null space of $X$ for values of $x \in \mathbb{R}$. What I did is put the matrix in rref, but I had to do it twice: once for $x=0$, once for $x \neq 0$. 


*

*$x=0 \implies $ $\text{rref}(X) = \begin{bmatrix}
1 & 0 & 0 & 1 \\
0 & 0 & 1 & 1 \\
0 & 0 & 0 & 0 \\
0 & 0 & 0 & 0
\end{bmatrix}$

*$x \neq 0 \implies$ $\text{rref}(X) = \begin{bmatrix}
1 & 0 & 0 & 1 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 1 \\
0 & 0 & 0 & 0
\end{bmatrix}$
And from there, we can find the row space (the above two rows of the rref if $x=0$ and the above three of the rref is $x \neq 0$). Then the column spaec is column 1 and column 3 of $X$ if $x=0$ and column 1,2,3 of $X$ if $x \neq 0$. 
I'm wondering if my ideas here are correct. I separated the problem into two cases, $x=0$ and $x \neq 0$, because to get the rref of $X$ I had to divide by $x$ at one point in a row operation. So I had to obtain the rref twice. If this is correct, is this also the best way of solving this problem, or can we do it in an easier way?
 A: What you did was fine, but you could’ve saved yourself a little work by taking advantage of the structure of $X$. Since all of the other entries in $x$’s column are zero, if $x\ne0$ then its row is linearly independent of the other rows. Similarly, if $x\ne0$ then its column will end up containing a pivot and so will be linearly independent of the other columns. We can conclude from this the bases for the row and column spaces for the case $x\ne0$ can be obtained by extending those for the case $x=0$ by the second row of the rref and the second column of the original matrix, respectively.  
So, start by assuming that $x\ne0$ and row-reduce as before, but carry $x$ along unchanged, giving $$\begin{bmatrix}
1 & 0 & 0 & 1 \\
0 & x & 0 & 0 \\
0 & 0 & 1 & 1 \\
0 & 0 & 0 & 0
\end{bmatrix}.$$ We can see that when $x=0$, we end up with an all-zero row, but it would not be the second row if using conventional row-reduction. However, by using the last method described here to compute the kernel basis, we’d end up with the second row being all-zero anyway, which means that we can read all of the bases for both the $x=0$ and $x\ne0$ cases directly from this matrix. For the case $x=0$, we get kernel basis $((0,-1,0,0)^T, (1,0,1,-1)^T)$, row space basis $((1,0,0,1)^T,(0,0,1,1)^T)$ and column space basis $((2,0,1,-1)^T,(-1,1,0,2)^T)$. For the case $x\ne0$, we set $x=1$ and read kernel basis $((1,0,1,-1)^T)$, row space basis $((1,0,0,1)^T,(0,1,0,0)^T,(0,0,1,1)^T)$ and column space basis $((2,0,1,-1)^T,(0,0,0,1)^T,(-1,1,0,2)^T)$. The respective row and column space bases differ by the inclusion $x$’s row and column as expected, as do the two kernel bases.
