Loading content...
In linear algebra, the multiplicative inverse (also known as the reciprocal matrix) of a square matrix A is another matrix denoted A⁻¹ that satisfies the fundamental property:
$$A \times A^{-1} = A^{-1} \times A = I$$
where I is the identity matrix (a matrix with 1s on the main diagonal and 0s elsewhere). This property is analogous to how multiplying a number by its reciprocal yields 1.
For a 2×2 matrix expressed as:
$$A = \begin{bmatrix} a & b \ c & d \end{bmatrix}$$
The inverse exists if and only if the determinant of the matrix is non-zero. The determinant for a 2×2 matrix is calculated as:
$$\det(A) = ad - bc$$
When the determinant is non-zero, the inverse is given by the closed-form formula:
$$A^{-1} = \frac{1}{ad - bc} \begin{bmatrix} d & -b \ -c & a \end{bmatrix}$$
A matrix whose determinant equals zero is called a singular matrix or degenerate matrix. Such matrices have no multiplicative inverse because they represent transformations that "collapse" the space (losing a dimension), which cannot be reversed. Geometrically, a singular 2×2 matrix maps all points in a 2D plane onto a line or a single point.
Your Task: Write a Python function that computes the multiplicative inverse of a given 2×2 matrix. The function should:
matrix = [[4, 7], [2, 6]][[0.6, -0.7], [-0.2, 0.4]]For the matrix [[a, b], [c, d]] = [[4, 7], [2, 6]]:
Step 1: Calculate the determinant det = ad - bc = (4 × 6) - (7 × 2) = 24 - 14 = 10
Step 2: Verify invertibility Since det = 10 ≠ 0, the matrix is invertible.
Step 3: Apply the inverse formula A⁻¹ = (1/det) × [[d, -b], [-c, a]] A⁻¹ = (1/10) × [[6, -7], [-2, 4]] A⁻¹ = [[0.6, -0.7], [-0.2, 0.4]]
Verification: Multiplying the original matrix by its inverse yields the identity matrix: [[4, 7], [2, 6]] × [[0.6, -0.7], [-0.2, 0.4]] = [[1, 0], [0, 1]] ✓
matrix = [[1, 2], [2, 4]]NoneFor the matrix [[a, b], [c, d]] = [[1, 2], [2, 4]]:
Step 1: Calculate the determinant det = ad - bc = (1 × 4) - (2 × 2) = 4 - 4 = 0
Step 2: Check invertibility Since det = 0, the matrix is singular (non-invertible).
The second row [2, 4] is exactly 2× the first row [1, 2], making the rows linearly dependent. This matrix collapses 2D space onto a line, which cannot be reversed. Therefore, the function returns None.
matrix = [[1, 0], [0, 1]][[1.0, 0.0], [0.0, 1.0]]This is the identity matrix I₂.
Step 1: Calculate the determinant det = ad - bc = (1 × 1) - (0 × 0) = 1 - 0 = 1
Step 2: Apply the inverse formula A⁻¹ = (1/1) × [[1, -0], [-0, 1]] = [[1, 0], [0, 1]]
The identity matrix is its own inverse! This makes intuitive sense: the identity transformation leaves all vectors unchanged, so applying it twice (or any number of times) still leaves vectors unchanged. Mathematically: I × I = I.
Constraints