The basis of a kernel So I am having trouble constructing the basis of the kernel of a matrix, after I doing rref to the matrix. 
For example, I want to find the basis of the kernel of  {$\begin{bmatrix}2&2&0&-2&4\\ 1&1&1&2&1\\2&2&1&1&3\end{bmatrix}$
and rreft(A) = {$\begin{bmatrix}1&1&0&-1&2\\ 0&0&1&3&-1\\0&0&0&0&0\end{bmatrix}$
I try to set the x1,x2,x3 as free variable, the I get 
x1=x1
x2=x2
x3=x3
x4=x1+x2+2x5
x5=x3+3x4
so the basis are [1,0,0,1,0]$^T$, [0,1,0,1,0]$^T$,[0,0,1,0,1]$^T$,[0,0,0,1,3]$^T$,[0,0,0,2,1]$^T$ but I really think I messed them up. 
What the solution of the question says: 
Letting s, t, u be the free variables corresponding to the columns of rref(A).
Then the general solution of Av = 0 is
s$\begin{bmatrix}-1\\ 1\\0\\0\\0\end{bmatrix}$+t$\begin{bmatrix}1\\ 0\\-3\\1\\0\end{bmatrix}$+u$\begin{bmatrix}-2\\ 0\\1\\0\\1\end{bmatrix}$
But how do they get there, I mean I see why they are setting the first,second and the third variables as the free variables, but how do they get to the next step? 

You should set x2, x4 and x5 instead as they correspond to the non-pivot columns. So if we let $x_2=x_2, x_4=x_4,x_5=x_5$ and for $Av=0$, then we have the following:
$x_1=-x_2+x_3-2x_5$ 
$x_2=x_2$ 
$x_3=-3x_4+x_5$
$x_4=x_4$
$x_5=x_5$
Then we can express 
$\begin{bmatrix}x_1\\x_2\\x_3\\x_4\\x_5\end{bmatrix}=x_1\begin{bmatrix}-1\\1\\0\\0\\0\end{bmatrix}+x_4\begin{bmatrix}1\\0\\-3\\1\\0\end{bmatrix}+x_5\begin{bmatrix}-2\\0\\1\\0\\1\end{bmatrix}$
as required.
