Let A = [[1, 2], [3, 4]] and B = [[0, 1], [1, 0]]. The product AB takes rows of A against columns of B: row 1 gives 1×0 + 2×1 = 2 and 1×1 + 2×0 = 1; row 2 gives 3×0 + 4×1 = 4 and 3×1 + 4×0 = 3. So AB = [[2, 1], [4, 3]]. But BA = [[3, 4], [1, 2]], which is different, showing that multiplication is not commutative (here B swaps columns when it multiplies on the right and rows on the left).
The determinant of A is 1×4 − 2×3 = −2, which is not zero, so the inverse exists: A⁻¹ = (1 / −2) × [[4, −2], [−3, 1]] = [[−2, 1], [1.5, −0.5]]. Check the first row against A: 1×(−2) + 2×1.5 = 1 and 1×1 + 2×(−0.5) = 0, and the second row similarly gives 0 and 1, so A A⁻¹ = I.
Eigenvalues come from the trace (5) and determinant (−2): λ² − 5λ − 2 = 0, so λ = (5 ± √33) / 2, about 5.372 and −0.372. They sum to 5, the trace, and multiply to −2, the determinant.
Common mistakes
Shape mismatch. A 3×2 matrix times a 3×2 matrix is undefined; the inner dimensions (2 and 3) must match.
Element-wise versus matrix product. In NumPy, * multiplies element by element and @ is the matrix product.
Wrong order when inverting a product. (AB)⁻¹ = B⁻¹A⁻¹, and (AB)ᵗ = BᵗAᵗ; the order reverses.
Inverting a singular or nearly singular matrix. If the determinant is zero there is no inverse; if it is tiny compared with the entries, results are numerically unreliable.
Assuming det(A + B) = det(A) + det(B). It does not; the determinant is multiplicative, not additive.
Was this article helpful?
Cookies & ads
Tools run client-side — your inputs stay in your browser. No ad network is installed, so no ad cookies are set. Choose what this site may store on your device. Privacy · Cookies
Essential StorageTheme, consent state, CSRF tokens. Required for the site to work.
Always on
PersonalizationRecently used tools, custom colors, accessibility preferences. Stored locally on your device.
AdvertisingOnly applies if an ad network is installed. None is today, so no ad cookies are set either way. Details.
AnalyticsAggregate, anonymous page-view counts so we know which tools to improve.
AI IntegrationStores your API key locally for optional AI features. Key never leaves your device.