1001Ferramentas
🪞 Calculators

Matrix 2x2 Inverse

Computes the inverse of a 2x2 matrix from its 4 elements a, b, c and d when det is non zero.

2×2 inverse: A⁻¹ = (1/det) · [[d, -b], [-c, a]]

Take A = [[a, b], [c, d]] with det(A) = ad - bc. The inverse works out to A⁻¹ = (1/det) · [[d, -b], [-c, a]]. In plain terms, you swap the diagonal entries, flip the sign on the off-diagonal ones, and divide the whole thing by the determinant. The matrix is invertible if and only if det ≠ 0. When the determinant is zero, A is singular and there's simply no inverse. Here's a worked example with A = [[1, 2], [3, 4]]: det = 1·4 - 2·3 = -2, which gives A⁻¹ = (-1/2) · [[4, -2], [-3, 1]] = [[-2, 1], [1.5, -0.5]]. You can confirm it by checking that A · A⁻¹ = I. The inverse undoes whatever linear transformation A applied, so it lets you solve systems Ax = b ⇒ x = A⁻¹b and run geometric transformations in reverse.

Applications

It shows up when you solve a 2×2 linear system Ax = b head-on, in computer graphics where you need to undo a rotation, scale or shear, and whenever you switch between 2D coordinate systems. Closed-form linear regression on 2 features relies on it too (β = (XᵀX)⁻¹Xᵀy, the formula sklearn uses), along with 2D Kalman filters and plane physics problems involving forces and accelerations.

FAQ

What if det = 0? Then there's no inverse. The two rows are linearly dependent, meaning one is just a multiple of the other, and the matrix squashes the whole plane down onto a single line.

Does (AB)⁻¹ = A⁻¹B⁻¹? No. The right identity is (AB)⁻¹ = B⁻¹A⁻¹, with the order flipped. A couple of others worth remembering: (A⁻¹)⁻¹ = A and det(A⁻¹) = 1/det(A).

Is solving Ax = b with the inverse a good idea? At 2×2 it's perfectly fine. Once the matrices get large, though, computing A⁻¹ and multiplying tends to accumulate error, so Gaussian elimination or LU decomposition holds up better numerically.

Related Tools

The results provided by this tool are for general informational and educational purposes only and do not constitute professional, financial, medical, legal, tax or accounting advice. Always confirm important decisions with a qualified professional and official sources.