If $U$ and $W$ are subspaces of a finite dimensional vector space, $ \dim U + \dim W = \dim(U\cap W) + \dim(U + W)$
Proof: let $B_{U\cap W} = \{v_1,\ldots,v_m\}$ be a base of $U\cap W$. If we extend the basis to $B_U = \{v_1,\ldots,v_m, u_{m+1}, \ldots, u_r\}$ and $B_W = \{v_1,\ldots,v_m, w_{m+1},\ldots,w_s\}$ then $S:=\{v_1,\ldots,v_m,u_{m+1},\ldots,u_r, w_{m+1},\ldots,w_s\}$ is a generating set of $U+W$. Now I have to prove that $S$ is linearly independent: $ 0 = \sum_{i=1}^m a_i v_i + \sum_{j=m+1}^r b_j u_j + \sum_{k=r+1}^s c_k w_k \implies v = \sum_{i = 1}^m a_i v_i+\sum_{j=m+1}^r b_j u_j = -\sum_{k=r+1}^m c_k w_k $
is a vector of $U\cap W$ and $b_j = 0$ since $B_U$ is independent. Therefore $0 = \sum_{i=1}^m a_i v_i + \sum_{k=m+1}^s c_k w_k$ and, since $B_W$ is independent we have that $a_i = c_k = 0$, and $\dim(U+W) = \dim U + \dim W - \dim(U\cap W)$.
Question: I can't understand why $v\in U\cap W$, since we have expressed it as linear combination of bases of $U$.
Thanks in advance!