# How to find the span of a matrix in matlab?

117 views (last 30 days)
sofia on 1 Mar 2024
Answered: Catalytic on 1 Mar 2024
I am trying to find the span of a matrix but im not sure how to ask matlab to find it for me.
Let A = [−1 5 1 10 0 5; 1 5 0 4 0 5;2 10 1 2 1 7;−1 5 2 8 2 1] . Find spanning sets for N (A) and col(A)
this is the question but im not sure how to ask it on matlab.

Matt J on 1 Mar 2024
Edited: Matt J on 1 Mar 2024
You can use this,
A = [-1 -5 -1 10 0 5; 1 5 0 -4 0 -5;2 10 -1 -2 -1 -7;-1 -5 2 -8 2 -1]
A = 4×6
-1 -5 -1 10 0 5 1 5 0 -4 0 -5 2 10 -1 -2 -1 -7 -1 -5 2 -8 2 -1
Asub=licols(A)
Asub = 4×3
-5 10 5 5 -4 -5 10 -2 -7 -5 -8 -1
Torsten on 1 Mar 2024
And if by N(A) you mean the kernel of A, you can use:
A = [-1 -5 -1 10 0 5; 1 5 0 -4 0 -5;2 10 -1 -2 -1 -7;-1 -5 2 -8 2 -1]
A = 4×6
-1 -5 -1 10 0 5 1 5 0 -4 0 -5 2 10 -1 -2 -1 -7 -1 -5 2 -8 2 -1
null(A)
ans = 6×3
-0.8674 0.4588 0.0506 0.2671 0.1026 0.2325 -0.1868 -0.4006 0.8735 -0.0311 -0.0668 0.1456 0.3555 0.7434 0.3784 0.1185 0.2478 0.1261
Together with @Matt J 's answer, this shows that
is true.

Catalytic on 1 Mar 2024
Use orth and null,
A = [-1 -5 -1 10 0 5; 1 5 0 -4 0 -5;2 10 -1 -2 -1 -7;-1 -5 2 -8 2 -1];
spanset=orth(A)
spanset = 4×3
0.6338 0.3530 0.6882 -0.4482 0.0376 0.3935 -0.6224 0.4626 0.3359 -0.0998 -0.8124 0.5086
rank([A,spanset])==rank(A)
ans = logical
1