Show that $\text{dim}(U) + \text{dim}(W) = \text{dim}(U + W) + \text{dim}(U \cap W)$ The problem states:

Show that for $U,W$ subspaces of a finite dimensional vector space $V$
  $$\text{dim}(U) + \text{dim}(W) = \text{dim}(U + W) + \text{dim}(U \cap W)$$
  Hint: Let $\mathscr{B}_U = \{u_1, ..., u_s\}$ be basis for U and $\mathscr{B}_W = \{w_1, ..., w_t\}$ be a basis for W.
  Since intersection of two spaces might not be empty, let $\mathscr{B}_{U \cap W}= \{u_1, ..., u_r\}$ where $r \leq \text{min}\{s,t\}$. Argue how many linearly independent vectors should be in the basis
  for $U\cap W$.

Obviously there are grammar errors but that is the question verbatim.  I understand the argument that is being suggested, but I'm not sure how to argue it formally.  I suspect that it is related to the union rule $$n(U\cup W) = n(U) + n(W) - n(U\cap W)$$ but I am not sure how to bridge the gap between cardinality of the sets and the dimension of the subspace.  I know that the dimension of the subspace is the number of linearly independent columns.  I'm also assuming that $U + W$ could be written $U\cup W$.
 A: Let $\{b_1, \ldots, b_k\}$ be a basis for $U \cap W$. Then first you need to argue you can extend this basis to a basis $b_1, \ldots, b_k, c_1, \ldots, c_l$ of $U$ and $b_1, \ldots, b_k, d_1, \ldots, d_n$ of $W$.
Now argue that $b_1, \ldots, b_k, c_1, \ldots, c_l, d_1, \ldots, d_n$ is a basis of $U+W$, so $\dim(U) + \dim(W) = (k + l) + (k + n) = (k + l + n) + k = \dim(U+W) + \dim(U \cap W)$.
I'll gladly fill in any details you are unclear about.
A: Define a map $f$ from $U \times W \to U + W$, given by $f((u,w)) = u+w$. It is clear that $f$ is linear on $U \times W$. 
The range of $f$ is the entire of $U+W$, since for  every $v \in U+W$, $v$ can be written as $u+w$, hence $v = f((u,w))$. 
Now,suppose that $f(u,w) = 0$. Then $u+w=0$ and $u=-w$,  in which case $u \in U \cap W$ and $w \in U \cap W$. So $\ker f \times \ker f \subset (U \cap W) \times (U \cap W)$.
The other way, if $u \in U \cap W$, then $f(u,-u)=0$, so $(U \cap W) \times (U \cap W) \subset \ker f \times \ker f $
Hence, $\ker f = U \cap W$. Using the rank nullity theorem, $\dim(U  \times W) = \dim(U+W) + \dim(U \cap W)$. But then, this just becomes $\dim(U) + \dim(W) = \dim(U+W) + \dim(U \cap W)$, since $\dim(U \times W) = \dim U + \dim V$.
