how to check whether a vector in a subspace or not?
41 views (last 30 days)
Show older comments
I want to know how to check a vector in b can be expressed by the basis of a subspace. Or whether the vector in b in the subspace or not?
V=[2 3 1 -3 11 2 5;3 3 2 -3 10 3 9;4 3 0 2 -3 9 4;2 -1 -1 1 -3 2 -1;3 -1 3 0 -4 2 12;1 0 4 3 -13 4 13]
ra=rank(V)
R = rref(V)
b1=[4;4;7;2;-1;0]
b2=[1;2;5;6;8;9;]
b=[b1 b2]
Your help would be highly appreciated!
0 Comments
Accepted Answer
John D'Errico
on 22 Oct 2022
Edited: John D'Errico
on 22 Oct 2022
You want to test if a new vector (not two at a time!) lies in the column space of a matrix V. Here, V is a 6x7 matrix.
V=[2 3 1 -3 11 2 5;3 3 2 -3 10 3 9;4 3 0 2 -3 9 4;2 -1 -1 1 -3 2 -1;3 -1 3 0 -4 2 12;1 0 4 3 -13 4 13]
ra=rank(V)
So even though V has more columns than rows,
size(V)
it only as rank 4. If V were full rank, then ANY new vector must lie in the column space of V. But V has rank only 4, so there is "room".
So append the new vector as a new column of V. IF the rank of the new matrix does not change, then the appended vector was already representable as a linear combination of the columns of V. If the rank changes, then your vector is linearly independent of the columns of V.
Again, you must do this test twice, so once for each vector you wish to test. (Don't keep on appending new vectors to V, so that V is growing in size with each test.)
0 Comments
More Answers (0)
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!