Let $V$ be a vector space with $\dim V = n <\infty$ and $U_1, U_2,\ldots, U_r$ subspaces of $V$, whosesum space is all of $V$.
Prove that
$V = U_1\oplus U_2\oplus\ldots\oplus U_r\iff \dim U_1 + \dim U_2 +\ldots + \dim U_r = n$
I know I have to choose a basis in each $U_i$, so it has $\dim(U_i)$ elements and show that all these basis vectors together form a basis of $V$ but I don't know how to form an actual proof.