Proof (commutative operators share eigenfunctions)

Commutative $\implies$ share eigenfunctions

Suppose $\hat O_1$ and $\hat O_2$ commute. Let $\psi$ be an eigenfunction of $\hat O_1$ with eigenvalue $\lambda$. Then $$ \begin{align*} \hat O_1 \hat O_2 \psi = \hat O_2 \hat O_1 \psi = \lambda \hat O_2 \psi, \end{align*} $$ so $\hat O_2\psi$ is also a $\lambda$-eigenfunction of $\hat O_1$. By non-degeneracy, $\hat O_2\psi = \mu\psi$ for some constant $\mu$. Hence $\psi$ is also an eigenfunction of $\hat O_2$.

Share eigenfunctions $\implies$ commutative

Let $\set{u_n}$ be the eigenfunctions with corresponding eigenvalues $\set{\lambda_n}$ of $\hat O_1$ and $\set{\mu_n}$ of $\hat O_2$.

For each $n$, $$ \begin{align*} \hat O_1 \hat O_2 u_n = \lambda_n \mu_n u_n = \hat O_2 \hat O_1 u_n \implies [\hat O_1, \hat O_2]u_n = 0. \end{align*} $$ Since the set $\set{u_n}$ is complete, $[\hat O_1,\hat O_2]\psi = 0$ for any normalisable wavefunction $\psi$, so $[\hat O_1, \hat O_2] = 0$.