[proofplan]
We prove that neither basis can have strictly smaller cardinality than the other. If $|B_1|<|B_2|$, the independent-set exchange axiom produces an element of $B_2\setminus B_1$ that can be added to $B_1$ while preserving independence. This contradicts the defining maximality of $B_1$ as a basis. Reversing the roles of the two bases rules out the opposite strict inequality, so finite cardinal comparison gives equality.
[/proofplan]
[step:Rule out that $B_1$ has smaller cardinality than $B_2$]
Assume, for contradiction, that $|B_1|<|B_2|$. Since $B_1$ and $B_2$ are bases, they are independent sets, so $B_1,B_2\in\mathcal I$. By the independent-set exchange axiom for the matroid $M$, applied to the independent sets $B_1$ and $B_2$, there exists an element $e\in B_2\setminus B_1$ such that
\begin{align*}
B_1\cup\{e\}\in\mathcal I.
\end{align*}
Because $e\notin B_1$, the inclusion $B_1\subsetneq B_1\cup\{e\}$ is proper. Thus $B_1$ is properly contained in a larger independent set, contradicting that $B_1$ is maximal under inclusion among elements of $\mathcal I$. Therefore $|B_1|<|B_2|$ is impossible.
[guided]
Suppose, aiming for a contradiction, that the first basis is strictly smaller:
\begin{align*}
|B_1|<|B_2|.
\end{align*}
The reason this inequality is useful is that the matroid exchange axiom compares two independent sets of different finite sizes. Since $B_1$ and $B_2$ are bases, they are in particular independent sets, so $B_1,B_2\in\mathcal I$. Applying the independent-set exchange axiom to these two independent sets gives an element
\begin{align*}
e\in B_2\setminus B_1
\end{align*}
such that
\begin{align*}
B_1\cup\{e\}\in\mathcal I.
\end{align*}
Now $e\notin B_1$, so adding $e$ genuinely enlarges $B_1$:
\begin{align*}
B_1\subsetneq B_1\cup\{e\}.
\end{align*}
But the enlarged set is still independent. This is exactly what the definition of a basis forbids: a basis is a maximal independent set under inclusion, meaning there is no independent set in $\mathcal I$ that properly contains it. Hence the assumption $|B_1|<|B_2|$ contradicts the fact that $B_1$ is a basis.
[/guided]
[/step]
[step:Reverse the roles of the bases and conclude equality]
The same argument with $B_1$ and $B_2$ interchanged shows that $|B_2|<|B_1|$ is also impossible. Since $E$ is finite, the cardinalities $|B_1|$ and $|B_2|$ are natural numbers. Exactly one of
\begin{align*}
|B_1|<|B_2|,\qquad |B_1|=|B_2|,\qquad |B_2|<|B_1|
\end{align*}
holds. The two strict alternatives have been ruled out, so
\begin{align*}
|B_1|=|B_2|.
\end{align*}
This proves that all bases of $M$ have the same cardinality.
[/step]