# Homework Help: When is matrix multiplication commutative

1. Sep 15, 2009

### jaejoon89

Can somebody please explain to me when matrices commute? I've read that it's when they are diagonal with the same dimensions (and also scalar multiples?), but I don't understand why this is.

2. Sep 15, 2009

### HallsofIvy

Well, for example, what is
$$\begin{bmatrix}a & 0 & 0 \\ 0 & b & 0 \\ 0 & 0 & c\end{bmatrix}\begin{bmatrix}x & 0 & 0 \\ 0 & y & 0 \\ 0 & 0 & z\end{bmatrix}$$
and what is
$$\begin{bmatrix}x & 0 & 0 \\ 0 & y & 0 \\ 0 & 0 & z\end{bmatrix}\begin{bmatrix}a & 0 & 0 \\ 0 & b & 0 \\ 0 & 0 & c\end{bmatrix}$$

If you can see why those are the same, you should be able to generalize to any dimension.