[guided]The goal of this step is to prove the ordinary dimension formula without treating it as a black box. Let
\begin{align*}
r := \dim_K(A \cap B).
\end{align*}
Because $A \cap B$ is nonzero and finite-dimensional, it has a basis, which we denote by
\begin{align*}
\mathcal{C} := \{c_1,\ldots,c_r\}.
\end{align*}
The reason to begin with a basis of the intersection is that the vectors common to $A$ and $B$ are exactly the vectors that would otherwise be counted twice. Since $A \cap B \subset A$ and $A$ is finite-dimensional, the basis-[extension theorem](/theorems/59) gives vectors $a_1,\ldots,a_p \in A$ such that
\begin{align*}
\mathcal{A} := \{c_1,\ldots,c_r,a_1,\ldots,a_p\}
\end{align*}
is a basis of $A$. Similarly, since $A \cap B \subset B$ and $B$ is finite-dimensional, there are vectors $b_1,\ldots,b_q \in B$ such that
\begin{align*}
\mathcal{B} := \{c_1,\ldots,c_r,b_1,\ldots,b_q\}
\end{align*}
is a basis of $B$.
We now prove that the combined list
\begin{align*}
\mathcal{S} := \{c_1,\ldots,c_r,a_1,\ldots,a_p,b_1,\ldots,b_q\}
\end{align*}
is a basis of $A+B$. First, it spans $A+B$. Indeed, take any $x \in A+B$. By definition of the sum of subspaces, there exist $u \in A$ and $v \in B$ such that $x=u+v$. Since $\mathcal{A}$ is a basis of $A$, the vector $u$ is a $K$-linear combination of $c_1,\ldots,c_r,a_1,\ldots,a_p$. Since $\mathcal{B}$ is a basis of $B$, the vector $v$ is a $K$-linear combination of $c_1,\ldots,c_r,b_1,\ldots,b_q$. Adding these two expansions expresses $x$ as a $K$-linear combination of the vectors in $\mathcal{S}$.
Next, we prove linear independence. Suppose scalars $\alpha_i,\beta_j,\gamma_k \in K$ satisfy
\begin{align*}
\sum_{i=1}^{r}\alpha_i c_i + \sum_{j=1}^{p}\beta_j a_j + \sum_{k=1}^{q}\gamma_k b_k = 0.
\end{align*}
Move the $B$-extension part to the other side:
\begin{align*}
\sum_{i=1}^{r}\alpha_i c_i + \sum_{j=1}^{p}\beta_j a_j = -\sum_{k=1}^{q}\gamma_k b_k.
\end{align*}
The left-hand side belongs to $A$ because all $c_i$ and $a_j$ lie in $A$. The right-hand side belongs to $B$ because all $b_k$ lie in $B$. Therefore the common vector lies in $A \cap B$. Since $\mathcal{C}$ is a basis of $A \cap B$, there exist scalars $\delta_1,\ldots,\delta_r \in K$ such that
\begin{align*}
\sum_{i=1}^{r}\alpha_i c_i + \sum_{j=1}^{p}\beta_j a_j = \sum_{i=1}^{r}\delta_i c_i.
\end{align*}
After rearranging, we obtain
\begin{align*}
\sum_{i=1}^{r}(\alpha_i-\delta_i)c_i + \sum_{j=1}^{p}\beta_j a_j = 0.
\end{align*}
This is a linear relation among the basis vectors in $\mathcal{A}$. Since $\mathcal{A}$ is linearly independent, every coefficient in this relation is zero, so in particular $\beta_j=0$ for every $1 \leq j \leq p$.
Substituting $\beta_j=0$ into the original relation gives
\begin{align*}
\sum_{i=1}^{r}\alpha_i c_i + \sum_{k=1}^{q}\gamma_k b_k = 0.
\end{align*}
This is a linear relation among the basis vectors in $\mathcal{B}$. Since $\mathcal{B}$ is linearly independent, $\alpha_i=0$ for every $1 \leq i \leq r$ and $\gamma_k=0$ for every $1 \leq k \leq q$. Hence all coefficients in the original relation are zero, so $\mathcal{S}$ is linearly independent.
Thus $\mathcal{S}$ is a basis of $A+B$. Counting the vectors in the three bases gives
\begin{align*}
\dim_K(A+B) = r+p+q.
\end{align*}
The bases $\mathcal{A}$ and $\mathcal{B}$ give
\begin{align*}
\dim_K A = r+p
\end{align*}
and
\begin{align*}
\dim_K B = r+q.
\end{align*}
Since $r=\dim_K(A \cap B)$, these three equalities imply
\begin{align*}
\dim_K(A+B) = \dim_K A + \dim_K B - \dim_K(A \cap B).
\end{align*}
This is the exact vector-space identity needed to transfer the calculation to projective dimensions.[/guided]