# $AB=BA$ if there is an orthonormal basis of $\mathbb{R}^n$ of eigenvectors

Show that if there is an orthonormal basis of $\mathbb{R}^n$ that consists of eigenvectors of both of the $n \times n$ matrices $A$ and $B$, then $AB = BA$.

I'm not sure if what I have done suffices to solve the problem, but let $(v_1,v_2,v_3,v_4)$ be the basis of orthonormal eigenvevtors of $A$ and $B$.

Then for example, $Av_1=\lambda_1 v_1$ and $Bv_1=\mu_1 v_1$ (where $\lambda$ and $\mu$ are corresponding eigevalues).

Then we have $$ABv_1=A\mu_1 v_1=\mu_1 A v_1=\mu_1 \lambda_1 v_1 = \lambda_1 B v_1=BAv_1$$

And since we can do this for all $(v_1,v_2,v_3,v_4)$, thus $AB=BA$

If that that does not suffice, could anybody point out why? Thanks!

That's fine. If two linear things agree on a basis then they agree everywhere. You should definitely make sure you can prove that!

HINT: Show that they agree on this orthonormal basis.

$$AB(v_{j}) = \lambda_{j}\mu_{j}v_{j} = BAv_{j}$$

for $1\leq j \leq n$.

• isn't this what I have done? – Sarunas Jul 20 '13 at 17:25
• Well, I thought you were looking for the proof. I was in a hurry and did not read the question properly. – Vishal Gupta Jul 21 '13 at 9:47