TITLE: Prove that $\dim(U+W) + \dim(U\cap W) = \dim U + \dim W$
QUESTION [7 upvotes]: Let $V$ be a vector space over a field $k$ and let $U$, $W$ be finite-dimensional subspaces of $V$.
Prove that $\dim(U+W) + \dim(U\cap W) = \dim U + \dim W$

I'm given that to begin this problem I can find the bases:
$\{v_1,\dots,v_p\}$ for $U\cap W$
$\{v_1,\dots,v_p, u_1,\dots,u_q\}$ for $U$
and $\{v_1,\dots,v_p, w_1,\dots,w_r\}$ for $W$
and then I just need to show that $\{v_1,\dots,v_p, u_1,\dots,u_q, w_1,\dots,w_r\}$ is a basis for $U+W$.
My question is: how does one go about showing that it is a basis for $U+W$ and then use that to prove the above question?

Side note: This question has already been asked here: Given two subspaces $U,W$ of vector space $V$, how to show that $\dim(U)+\dim(W)=\dim(U+W)+\dim(U\cap W)$
However, the first answer given does not apply to solving it the way I want to with finding the bases. The second answer simply gives me what I already knew to start with. Thus, I am asking this question again since I'm asking how to solve it a particular way instead of just any general hints towards solving it.

REPLY [3 votes]: A shorter proof: consider $T:U \times W \to U + W$ by $T(u, w) = u - w,$ then $\ker T = U \cap W$ and the theorem of dimension $\dim \ker T + \dim \ \mathrm{image}\ T = \dim\ \mathrm{domain}\ T$ gives the result at once (since $T(U \times W) = U + W$ and $\dim U \times W = \dim U + \dim W$).