Prove that $\dim(U+W) + \dim(U\cap W) = \dim U + \dim W$ 
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.
 A: 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$).
A: Just do the computations; the fact that the set spans $U+W$ should be clear, so we prove linear independence.
Suppose
$$
\alpha_1v_1+\dots+\alpha_pv_p+
\beta_1u_1+\dots+\beta_qu_q+
\gamma_1w_1+\dots+\gamma_rw_r=0
$$
Then
$$
x=\underbrace{\alpha_1v_1+\dots+\alpha_pv_p+
\beta_1u_1+\dots+\beta_qu_q}_{\in U}=
-(\underbrace{\gamma_1w_1+\dots+\gamma_rw_r}_{\in W})
$$
belongs to $U\cap W$. Thus
$$
x=\delta_1v_1+\dots+\delta_pv_p
$$
and therefore
$$
\delta_1v_1+\dots+\delta_pv_p=-(\gamma_1w_1+\dots+\gamma_rw_r)
$$
so that
$$
\delta_1v_1+\dots+\delta_pv_p+\gamma_1w_1+\dots+\gamma_rw_r=0
$$
Since the set $\{v_1,\dots,v_p,w_1,\dots,w_r\}$ is linearly independent, we conclude
$$
\delta_1=0,\quad\dots,\quad\delta_p=0,\quad
\gamma_1=0,\quad\dots,\quad\gamma_r=0
$$
and also that
$$
\alpha_1v_1+\dots+\alpha_pv_p+\beta_1u_1+\dots+\beta_qu_q=0
$$
so, from linear independence of $\{v_1,\dots,v_p,u_1,\dots,u_q\}$ we get
$$
\alpha_1=0,\quad\dots,\quad\alpha_p=0,\quad
\beta_1=0,\quad\dots,\quad\beta_q=0
$$
