The elements v1,…,vn of a module M over a ring R are said to be linearly dependent over R if there exist c1,…,cn in R, not all 0, such that c1v1+…cnvn=0. If such ci’s exist, they form what is called a linear dependence relation over R for the vi’s.
The package IntegerLinearDependence provides functions for testing whether some elements of a module over the integers are linearly dependent over the integers, and to find the linear dependence relations, if any.
Consider the domain of two by two square matrices with integer entries.
M := SQMATRIX(2,INT)
Now create three such matrices.
m1: M := squareMatrix matrix [ [1, 2], [0, -1] ]
m2: M := squareMatrix matrix [ [2, 3], [1, -2] ]
m3: M := squareMatrix matrix [ [3, 4], [2, -3] ]
This tells you whether m1, m2 and m3 are linearly dependent over the integers.
linearlyDependentOverZ? vector [m1, m2, m3]
Since they are linearly dependent, you can ask for the dependence relation.
c := linearDependenceOverZ vector [m1, m2, m3]
Type: Union(Vector Integer,...)
This means that the following linear combination should be 0.
c.1 * m1 + c.2 * m2 + c.3 * m3
When a given set of elements are linearly dependent over R, this also means that at least one of them can be rewritten as a linear combination of the others with coefficients in the quotient field of R.
To express a given element in terms of other elements, use the operation solveLinearlyOverQsolveLinearlyOverQIntegerLinearDependence.
solveLinearlyOverQ(vector [m1, m3], m2)
Type: Union(Vector Fraction Integer,...)