# Revision history [back]

### Can sage extend bases?

Say I have subspaces $X\subset Y$ of a vector space $V$. I want to extend a basis for $X$ to a basis for $Y$. Does sage have this capability?

### Can sage extend bases?

Say I have subspaces $X\subset Y$ of a vector space $V$. I want to extend a basis for $X$ to a basis for $Y$. Does sage have this capability?

For example, I have two matrices

sage: d1 = matrix(GF(2), [
....: [1,0,1,0,1,0,1,0,1,0],
....: [1,1,0,0,0,0,0,0,0,1],
....: [0,1,1,1,0,0,0,0,0,0],
....: [0,0,0,1,1,1,0,0,0,0],
....: [0,0,0,0,0,1,1,1,0,0],
....: [0,0,0,0,0,0,0,1,1,1]])
sage: d2 =  matrix(GF(2), [
....: [1,1,1,0,0,0,0,0,0,0],[0,0,1,1,1,0,0,0,0,0]]).transpose()


Since d1*d2=0 we know that the column space of d2 is a subspace of the null space of d1. We can obtain a basis for the column space of d2 with

sage: d2.column_space().basis()


How could we extend this basis to a basis of the null space of d1?

### Can sage extend bases?

Say I have subspaces $X\subset Y$ of a vector space $V$. I want to extend a basis for $X$ to a basis for $Y$. Does sage have this capability?

For example, I have two matrices

sage: d1 = matrix(GF(2), [
....: [1,0,1,0,1,0,1,0,1,0],
....: [1,1,0,0,0,0,0,0,0,1],
....: [0,1,1,1,0,0,0,0,0,0],
....: [0,0,0,1,1,1,0,0,0,0],
....: [0,0,0,0,0,1,1,1,0,0],
....: [0,0,0,0,0,0,0,1,1,1]])
[0,0,0,0,0,0,0,1,1,1]
....: ])
sage: d2 =  matrix(GF(2), [
....: [1,1,1,0,0,0,0,0,0,0],[0,0,1,1,1,0,0,0,0,0]]).transpose()
[[1,1,1,0,0,0,0,0,0,0],[0,0,1,1,1,0,0,0,0,0]]).transpose()


Since d1*d2=0 we know that the column space of d2 is a subspace of the null space of d1. We can obtain a basis for the column space of d2 with

sage: d2.column_space().basis()


How could we extend this basis to a basis of the null space of d1?