Commutator

The commutator of two Operator A^,B^\hat{A},\hat{B} is defined as

[A^,B^]=A^B^B^A^\begin{gather*} [\hat{A},\hat{B}]=\hat{A}\hat{B}-\hat{B}\hat{A} \end{gather*}

If [A^,B^]=0[\hat{A},\hat{B}]=0 then that means you can commute via Matrix Multiplication

If "A^\hat{A} commutes with B^\hat{B}", then that means A^B^=B^A^\hat{A}\hat{B}=\hat{B}\hat{A} which also means [A^,B^]=0[\hat{A},\hat{B}]=0.

Leibniz Rule

[A^B^,C^]=A^[B^,C^]+[A^,C^]B^[\hat{A}\hat{B}, \hat{C}] = \hat{A}[\hat{B}, \hat{C}] + [\hat{A}, \hat{C}]\hat{B}