Matrix Commutator Calculator
Enter two square matrices of the same size. The calculator returns AB, BA, the commutator matrix, and useful algebraic diagnostics.
Example Data Table
| Example | Matrix A | Matrix B | AB | BA | [A,B] | Commuting? |
|---|---|---|---|---|---|---|
| 2 × 2 demo | [1, 2]; [3, 4] | [0, 1]; [-1, 2] | [-2, 5]; [-4, 11] | [3, 4]; [5, 6] | [-5, 1]; [-9, 5] | No |
Formula Used
Matrix commutator: [A,B] = AB − BA
Matrix product entry: (AB)ij = Σ AikBkj
Trace: tr([A,B]) = Σ [A,B]ii
Frobenius norm: ‖[A,B]‖F = √Σ([A,B]ij2)
Commuting condition: A and B commute when [A,B] is the zero matrix.
Determinant and rank: These summarize the algebraic strength and dimensional effect of the commutator matrix.
How to Use This Calculator
- Select the square matrix size from 2 × 2 up to 6 × 6.
- Choose the output precision you want for displayed values.
- Enter all entries for Matrix A and Matrix B.
- Press Calculate to compute AB, BA, and the commutator.
- Review trace, determinant, rank, norm, and commuting status.
- Use the export buttons to save results as CSV or PDF.
- Click Load Example to test the calculator with sample values.
Frequently Asked Questions
1. What does the matrix commutator measure?
It measures how strongly two matrices fail to commute. When the commutator equals the zero matrix, multiplying in either order produces the same result.
2. Why must both matrices be square and equal in size?
The products AB and BA must both exist and have matching dimensions before subtraction. That requirement is automatically satisfied for same-size square matrices.
3. What does a zero commutator mean?
A zero commutator means A and B commute. In practical terms, the order of multiplication does not change the final matrix product.
4. Why is the trace of a commutator often zero?
For square matrices over standard number systems, tr(AB) equals tr(BA). Subtracting them gives tr([A,B]) = 0, aside from minor rounding effects.
5. What does the Frobenius norm tell me?
It gives a single magnitude for the commutator matrix. Larger values indicate stronger non-commuting behavior across the matrix entries.
6. Can this calculator handle decimal entries?
Yes. Each matrix entry accepts integers or decimals, and the final display uses the precision setting you choose.
7. What does the rank of the commutator show?
The rank shows how many linearly independent directions remain in the commutator matrix. It helps describe the structural impact of non-commutation.
8. When should I export the result?
Export when you need to document calculations, compare cases, share results, or keep a reusable record for coursework, proofs, or numerical experiments.