You can express the solution set as a linear combination of certain constant vectors in which the coefficients are the free variables.
E.g., to get the kernel of
1 2 3
2 4 6
one gets the rref
1 2 3
0 0 0
and then one solves x+2y+3z = 0 (this is already reduced). The general solution is
-2y-3z
{ y : y, z in R}
z
which you can write as
-2 -3
y 1 + z 0
0 1
The column vectors
-2
1
0
and
-3
0
1
span the kernel, clearly. They are independent because, each one, in the coordinate spot corresponding to the free variable which is its coefficient, has a 1, while the other vector(s) have a 0 in that spot.
So the vectors produced to span the kernel by this method are always a basis for the kernel, and the dimension of the kernel = number of free variables in solving AX = 0.
In getting a basis for the image one wants to pick out certain columns. The relations on the columns of the rref are the same as the relations on the columns of the original matrix. (Solutions of the equations again.) Therefore, if a set of columns of the rref is a basis for the image of the rref, the CORRESPONDING columns of the original matrix A are also a basis. One thing that always works is to use the pivot columns of the original matrix: these are the columns where the rref has leading ones.
For example, consider
0 0 0
1 2 3
2 4 7
The rref is
1 2 0
0 0 1
0 0 0
The pivot columns are the first and third. This shows that the first and third columns of the original matrix are a basis for its image. HOWEVER, these two matrices do not have the same image.
The simplest example where a matrix A and its rref do not have the same image (column space) is when A =
0
1
The column space is the line spanned by that vector: the e_2 or y-axis.
But the rref is
1
0
and the column space is the line spanned by that one vector: the e_1 or x-axis.