# dimension of quotient space

I am applying the the following theorem on dimension of quotient spaces. Let $x \neq 0$ be an element of a vector space $V$ over a field $K.$ Then

$$ dim(V) = dim(Span(x)) + dim(V/Span(x)).$$

How can I write a Sage code to compute $dim(V)$ by recursively using this formula where you choose a nonzero element x until $dim(V/Span(x))$ is 1?

```
dim(V) = dim(Span(x1)) + dim(V/Span(x1))
= dim(Span(x1)) + [ dim(Span(x2)) + dim((V/Span(x1))/Span(x2)) ]
= ...
= dim(Span(x1)) + dim(Span(x2)) + ... + dim(Span(xn))
= 1 + 1 + .... + n
= n
```

Thanks.

Homework? What have you tried so far?

@John-Palmieri, i I found the solution. Thanks. Should I close it?

You could post your solution, in case others are interested.