Ask Your Question

Revision history [back]

This is just standard linear algebra: form a 21 by 20 matrix whose rows consist of the linearly dependent vectors and the 20 linearly independent vectors, and find the one-dimensional left kernel (nullspace); alternatively transpose and find the right kernel. The coefficients of the single element in a basis of the kernel provide a linear combination of all 21 vectors which is zero. Hence the dependent vector can be written as a linear combination of the 20 independent vectors.

A small scale version in Sage:

sage: V = VectorSpace(QQ, 6)
sage: vectors = [V.random_element() for _ in range(6)]
sage: V.subspace(vectors).rank()
6

Confirming that the vectors are linearly independent, otherwise repeat. Then form a random linear combination, and create the matrix:

sage: w = sum(randint(-4, 4)*v for v in vectors)
sage: A = matrix([w] + vectors)

Now take the first (and only) generator of the kernel, and verify the result:

sage: c = A.kernel().basis()[0]
sage: w == -sum(c[i+1]*vectors[i] for i in range(6))
True