A binary operation is commutative if ab = ba for ALL possible a and b in the set. Addition and multiplication in the reals are commutative operations whereas multiplication of matrices generally is not.
Note that the definition requires ab=ba for all pairs of elements. That some element commutes with all elements does not make the operation commutative.
For a finite set whose binary operation is given in a table, it is easy to
observe whether the operation is commutative. If we write the elements
along the rows in the same order as down the column then if the table is
symmetric about the diagonal then it is commutative.