Computing intersection of vector spaces spanned by two lists

237 Views Asked by At

Assume that I'm given two lists of vectors $l_1$ and $l_2$, where all the vectors have equal dimension. I want to compute a basis for the intersection of their spans. What is the easiest setup for computing this in a computer algebra system? I remember there being some way of computing this using augmented matrices, where $l_1$ forms one part $l_2$ another and then adding something and row reducing and picking up certain columns.

To be clear, I know how to set this up mathematically, but I'm looking for a way of doing it that won't require very much code. The reason I want this is that it looks like this is not an operation that's built into Mathematica.

1

There are 1 best solutions below

2
On

There are many systems capable of doing this. In GAP (which is distributed freely under GPL) you may do, for example, the following:

gap> V:= VectorSpace( Rationals, [ [ 1, 2, 7 ], [ 1/2, 1/3, 5 ] ] );;
gap> W:= VectorSpace( Rationals, [ [ 1, 3, 5 ], [ 1/3, 1/2, 7 ] ] );;
gap> H:=Intersection(V,W);                                            
<vector space of dimension 1 over Rationals>
gap> b:=Basis(H);
SemiEchelonBasis( <vector space of dimension 1 over Rationals>, 
[ [ 1, 306/101, 473/101 ] ] )
gap> AsList(b);
[ [ 1, 306/101, 473/101 ] ]