# Calculating the Span of a Matrix in MATLAB

If I have a matrix (or a set of vectors) say A=[1 2 4] [2 9 8] [7 9 3] how can I calculate its span in MATLAB? There is no direct command for it? Do I have to form a set of linear equations, but I am confused;how will I be able to find all the possible linear combinations from it? Any help is appreciated.

• have you tried rref? – user251257 Aug 22 '15 at 16:02
• Use rank(A) command. – kaka Aug 22 '15 at 16:07
• Does not the "rref" command returns the reduced echelon form for calculation of the rank? How is this supposed to give the entire span (all possible linear combinations) of A, or am I mixing things up? – Candy Aug 22 '15 at 16:13
• RREF will show you which vectors are linearly independent. The span of A will be the span of those vectors. You should enter the vectors as columns of the matrix. – user217285 Aug 22 '15 at 16:36
• How do you expect to be given "the entire span (all possible linear combinations)"? There are infinitely many of those (uncountably many, in fact). One needs some sort of mathematical notation (free variables) to describe this. Which means you are doing symbolic computations, which isn't really a strength of MATLAB; there is a Symbolic Toolbox for it but it isn't built-in. – user147263 Aug 22 '15 at 22:33