Matrix Multiplication • Not Commutative (AB ≠ BA)

Problem

Show there exist square matrices A,B with AB ≠ BA

We will use explicit 2×2 matrices and several independent checks.

Notation: matrices over ℤ (integers), standard matrix product. “Commutative” would require AB = BA for all A,B — which is false.

Answer

Not commutative. A concrete counterexample is A = [[1,2],[0,1]] and B = [[1,0],[3,1]], for which AB = [[7,2],[3,1]] but BA = [[1,2],[3,7]], so AB ≠ BA.

Reason Why

Mathematical English justification

  1. Take A = [[1, 2], [0, 1]] and B = [[1, 0], [3, 1]].
  2. Compute AB = [[1·1 + 2·3, 1·0 + 2·1], [0·1 + 1·3, 0·0 + 1·1]] = [[7, 2], [3, 1]].
  3. Compute BA = [[1·1 + 0·0, 1·2 + 0·1], [3·1 + 1·0, 3·2 + 1·1]] = [[1, 2], [3, 7]].
  4. Since AB ≠ BA, matrix multiplication is not commutative in general (a single counterexample suffices).
Check (harness) #1

Counterexample computation

Compute AB and BA for the fixed A,B above.

Check (harness) #2

Random 2×2 integer matrices

Sample 300 random pairs with entries in −3..3 (not all zero). Report how many satisfy AB = BA.

Check (harness) #3

Exhaustive tiny space

Enumerate all 2×2 matrices with entries in {0,1} (except both zero simultaneously for all entries) and count commuting pairs.

Check (harness) #4

Special cases that do commute

Identity I, zero 0, and scalars λI commute with everything; diagonal matrices commute with each other.

Check (harness) #5

Commutator

Compute [A,B]=AB-BA for the counterexample; nonzero commutator certifies non-commutativity.

Check (harness) #6

Your matrices (CSV)

Paste A and B as four comma-separated rows each. Example:
A: 1,2; 0,1
B: 1,0; 3,1

Check (harness) #7

Geometric intuition via shears

Apply the two shears to a sample of points in both orders. The sets differ, showing the compositions differ.