# How to obtain a linear space from the direct sum of two spaces?

Dear all,

Given a linear space $V$ of dimension $m$ over a finite field. $W_1$ is $t_1$-dimensional space of $V$. $W_2$ is $t_2$-dimensional space of $V$ . $W_1$ and $W_2$ are in direct sum. If $W=W_1 + W_2$ and $W_1$ are known, then how to solve $W_2$ by Sage?

```
def random_small_space_gen(t,m):
B = matrix(GF(q),t,m,0)
while B.rank() != t:
B = random_matrix(GF(q),t,m)
return B.row_space()
(q,m,t1,t2) = (2,30,3,4)
Fqm = GF(q)
V = random_small_space_gen(m,m)
W1 = random_small_space_gen(t1,m)
W2 = random_small_space_gen(t2,m)
W = W1 + W2
print("W :", W)
print()
print("W1 :", W1)
```

Thanks all very much!