|   | 1 |  initial version  | 
In Sage, matrices have an image method.
The image is given as a vector space with basis.
Using random coefficients in a square matrix we are likely to get an invertible matrix whose image is the whole space.
sage: a = matrix(QQ, 4, [randint(-5, 5) for _ in range(16)])
sage: a
[-5 -1 -1  0]
[ 4 -1  1  5]
[-5 -4  3  3]
[ 1  1 -1  2]
sage: a.image()
Vector space of degree 4 and dimension 4 over Rational Field
Basis matrix:
[1 0 0 0]
[0 1 0 0]
[0 0 1 0]
[0 0 0 1]
Now change the last line to be a combination of the first three lines.
sage: b = copy(a)
sage: b
[-5 -1 -1  0]
[ 4 -1  1  5]
[-5 -4  3  3]
[ 1  1 -1  2]
sage: b[3] = 3*b[2] + b[1] - b[0]
sage: b
[ -5  -1  -1   0]
[  4  -1   1   5]
[ -5  -4   3   3]
[ -6 -12  11  14]
sage: b.image()
Vector space of degree 4 and dimension 3 over Rational Field
Basis matrix:
[     1      0      0  29/33]
[     0      1      0 -97/33]
[     0      0      1 -16/11]
 Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
 
                
                Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.