Choose the matrix size (2×2 to 4×4) and enter the entries in the grid. An inverse is defined only for a square matrix (rows = columns) and exists only when the determinant is not 0 (if it is 0, the calculator says so).
Table of Contents
-
What you can do on this page
-
What is this calculation used for?
-
How to Use
-
Formula
-
Symbols and terms
-
Good to know before you start
-
How to calculate it in Excel
-
How to calculate it in Google Sheets
-
How to calculate it in Python
-
How to write it in LaTeX and other math languages (copy and paste)
-
How to have ChatGPT do the calculation
-
DataChef Features
-
Related Features
-
NumberChef Calculators List
What you can do on this page
- Find the inverse \(A^{-1}\) of a 2×2, 3×3 or 4×4 square matrix on the spot
- It also shows the determinant \(\det(A)\) and tells you whether the inverse exists (whether the matrix is invertible)
- Steps use the formula "\(A^{-1} = \dfrac{1}{ad-bc}\begin{pmatrix} d & -b \\ -c & a \end{pmatrix}\)" for 2×2 and the adjugate matrix method for 3×3 and 4×4
- A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets (MINVERSE) and Python are all on this page
What is this calculation used for?
A system of linear equations with as many equations as unknowns can be written as \(A\boldsymbol{x} = \boldsymbol{b}\) using the matrix of coefficients \(A\). Multiply both sides on the left by \(A^{-1}\) and you get \(\boldsymbol{x} = A^{-1}\boldsymbol{b}\). So once you have the inverse, a single multiplication gives the solution.
This is especially powerful when you solve the system again and again with only the right side \(\boldsymbol{b}\) changed (as in structural analysis or circuit analysis). If the inverse does not exist (the determinant is 0), that is a sign that the system does not have exactly one solution.
In 3D graphics, games and robot control, transformations such as rotating, scaling and moving are calculated by matrix multiplication. Going back from the coordinates after a transformation to the coordinates before it is done with the inverse matrix.
For example, switching between coordinates seen from the camera and coordinates of the whole world (the view matrix), or working out where a point clicked on the screen lies in 3D space, uses inverse matrices almost every frame.
Turn letters into numbers and multiply by a matrix, and a message becomes a coded message (the Hill cipher). The receiver gets the original message back by multiplying by the inverse of the key matrix.
The pair "what a matrix does, its inverse undoes" is exactly the pair of encoding and decoding, which makes this the most direct example of the idea of an inverse. (In practice, the numbers are handled as remainders after dividing by 26, so the key must be a matrix that has an inverse in that number system.)
Ripple effects between industries, such as "if car production grows, how much more steel and electricity must be produced", are calculated by putting the trade between industries into a matrix \(A\) and multiplying by \((I - A)^{-1}\) (the Leontief inverse).
It is a standard method when governments announce the economic impact of public works or events such as festivals, and a leading example of inverse matrices supporting public decisions.
Regression analysis (least squares), which draws "the line that fits best" through data such as advertising spending and sales, writes its solution with an inverse matrix: \(\hat{\boldsymbol{\beta}} = (X^{\mathsf{T}}X)^{-1}X^{\mathsf{T}}\boldsymbol{y}\) (the solution of the normal equations).
This formula appears in every statistics and machine learning textbook, and the inverse matrix sits at the starting point of how AI learns trends from data.
Formula
Symbols and terms
Symbols
| \(A\) | A | The name given to a matrix. By custom, matrices are named with capital letters. |
| \(A^{-1}\) | A inverse | The inverse of matrix \(A\). The \(-1\) at the upper right is written like "to the power −1", the same idea as the reciprocal of a number, \(a^{-1} = \dfrac{1}{a}\) (but a matrix is never written as a fraction \(\dfrac{1}{A}\)). |
| \(I\) | I (identity matrix) | The identity matrix: a square matrix with 1s on the diagonal from top left to bottom right and 0s everywhere else. Multiplying any matrix by it changes nothing, so it plays the role of the number 1. It is sometimes written \(I_n\) to show its size, and some books (such as Japanese textbooks) write \(E\). |
| \(\det(A),\ |A|\) | determinant of A | The determinant of matrix \(A\). If it is not 0, the inverse exists; if it is 0, it does not. The vertical-bar form \(|A|\) is also common. |
| \(\operatorname{adj}(A)\) | adjugate of A | The adjugate matrix of \(A\): the cofactors of all entries, arranged and then transposed. It is written adj, from the first three letters of "adjugate" (an older name is "adjoint", or classical adjoint). |
| \(a_{ij}\) | a sub i j | The entry of matrix \(A\) in row \(i\), column \(j\) (the number in the \(i\)th row from the top and the \(j\)th column from the left). The small letters at the lower right (the subscripts) give its position. |
Terms
| inverse matrix | The matrix that gives the identity matrix when multiplied. It is the matrix version of a reciprocal and is written \(A^{-1}\). It exists only for square matrices whose determinant is not 0, and it is used to solve systems of linear equations and to undo transformations. |
| identity matrix | A square matrix with 1s on the diagonal (top left to bottom right) and 0s everywhere else. Multiplying any matrix by it changes nothing, so it corresponds to the number 1. |
| square matrix | A matrix with the same number of rows and columns (shaped like a square). Inverses and determinants exist only for square matrices. |
| determinant | A single number determined by a square matrix. It tells you that an inverse exists when \(\det(A) \neq 0\). How to find it is explained in detail on the sister page "Determinant Calculator". |
| invertible matrix | A square matrix whose determinant is not 0. It is also called nonsingular, and it has an inverse. A matrix with determinant 0 is called singular and has no inverse. |
| cofactor | The determinant of the smaller matrix left after removing row \(i\) and column \(j\) (the minor), multiplied by the sign \((-1)^{i+j}\). Cofactors are the building blocks of the adjugate matrix. |
| adjugate matrix | The matrix of the cofactors of all positions, with rows and columns swapped (transposed). It is written \(\operatorname{adj}(A)\), and dividing it by the determinant gives the inverse. It is also called the classical adjoint, but be careful: in more advanced books, "adjoint" often means a different matrix (the conjugate transpose), so "adjugate" is the safer name. |
| Gauss-Jordan elimination | A method where you place matrix \(A\) and the identity matrix \(I\) side by side and repeat row operations until the left half becomes \(I\); the right half is then \(A^{-1}\). For large matrices, this is the main method. |
| linear algebra | The branch of mathematics that deals with matrices and vectors. It is often a required first- or second-year college course and is the foundation of computer graphics, statistics, AI and more. |
Good to know before you start
Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
| Operations with negative numbers (Grade 7) |
|
| Reciprocals (Grades 6–7) |
|
| Matrix basics and multiplication (linear algebra) |
|
| Determinants (linear algebra) |
|
How to calculate it in Excel
| Row 1 of matrix A | 4 | 7 |
| Row 2 of matrix A | 2 | 6 |
| Inverse A⁻¹ | =MINVERSE(B1:C2) |
| Row 1 of matrix A | 1 | 2 | 3 |
| Row 2 of matrix A | 0 | 1 | 4 |
| Row 3 of matrix A | 5 | 6 | 0 |
| Inverse A⁻¹ | =MINVERSE(B1:D3) |
In the first table, row 1 is 0.6 and -0.7 and row 2 is -0.2 and 0.4. In the second table, row 1 is -24, 18, 5, row 2 is 20, -15, -4, and row 3 is -5, 4, 1.
If you give MINVERSE a matrix whose determinant is 0 (one with no inverse), it returns a #NUM! error. You can check the determinant itself with the MDETERM function.
How to calculate it in Google Sheets
| Row 1 of matrix A | 4 | 7 |
| Row 2 of matrix A | 2 | 6 |
| Inverse A⁻¹ | =MINVERSE(B1:C2) |
| Row 1 of matrix A | 1 | 2 | 3 |
| Row 2 of matrix A | 0 | 1 | 4 |
| Row 3 of matrix A | 5 | 6 | 0 |
| Inverse A⁻¹ | =MINVERSE(B1:D3) |
In the first table, row 1 is 0.6 and -0.7 and row 2 is -0.2 and 0.4; in the second table, row 1 is -24, 18, 5, row 2 is 20, -15, -4, and row 3 is -5, 4, 1.
How to calculate it in Python
from fractions import Fraction
A = [[4, 7], [2, 6]]
def determinant(matrix): # determinant (cofactor expansion along row 1, computed recursively)
n = len(matrix)
if n == 1:
return matrix[0][0]
total = 0
for j in range(n):
minor = [row[:j] + row[j + 1:] for row in matrix[1:]] # submatrix without row 1 and column j
total += (-1) ** j * matrix[0][j] * determinant(minor)
return total
def inverse(matrix): # inverse (adjugate matrix divided by the determinant)
n = len(matrix)
det = Fraction(determinant(matrix))
if det == 0:
return None # when the determinant is 0, there is no inverse
inverse_rows = []
for i in range(n):
row = []
for j in range(n):
# entry (i, j) = minor without row j and column i x sign / determinant (includes the transpose)
minor = [r[:i] + r[i + 1:] for k, r in enumerate(matrix) if k != j]
row.append((-1) ** (i + j) * determinant(minor) / det)
inverse_rows.append(row)
return inverse_rows
inverse_matrix = inverse(A)
if inverse_matrix is None:
print("The inverse does not exist (det(A) = 0)")
else:
for row in inverse_matrix:
print([float(x) for x in row])
How to write it in LaTeX and other math languages (copy and paste)
AA⁻¹ = A⁻¹A = I
A A^{-1} = A^{-1} A = I
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>A</mi>
<msup><mi>A</mi><mrow><mo>-</mo><mn>1</mn></mrow></msup>
<mo>=</mo>
<msup><mi>A</mi><mrow><mo>-</mo><mn>1</mn></mrow></msup>
<mi>A</mi>
<mo>=</mo>
<mi>I</mi>
</mrow>
</math>
A A^-1 = A^-1 A = I
A . Inverse[A]
A . LinearAlgebra:-MatrixInverse(A);
I = A * inv(A);
AA^(-1) = A^(-1)A = I
A⁻¹ = 1/(ad − bc) × [d, −b; −c, a]
A^{-1} = \frac{1}{ad - bc} \begin{pmatrix} d & -b \\ -c & a \end{pmatrix}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msup><mi>A</mi><mrow><mo>-</mo><mn>1</mn></mrow></msup>
<mo>=</mo>
<mfrac>
<mn>1</mn>
<mrow><mi>a</mi><mi>d</mi><mo>-</mo><mi>b</mi><mi>c</mi></mrow>
</mfrac>
<mrow>
<mo>(</mo>
<mtable>
<mtr><mtd><mi>d</mi></mtd><mtd><mrow><mo>-</mo><mi>b</mi></mrow></mtd></mtr>
<mtr><mtd><mrow><mo>-</mo><mi>c</mi></mrow></mtd><mtd><mi>a</mi></mtd></mtr>
</mtable>
<mo>)</mo>
</mrow>
</mrow>
</math>
A^-1 = 1/(ad - bc) [[d, -b], [-c, a]]
Inverse[{{a, b}, {c, d}}]
LinearAlgebra:-MatrixInverse(Matrix([[a, b], [c, d]]));
B = inv(A);
A^(-1) = 1/(ad − bc) (■(d&−b@−c&a))
A⁻¹ = adj(A)/det(A)
A^{-1} = \frac{1}{\det(A)} \operatorname{adj}(A)
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msup><mi>A</mi><mrow><mo>-</mo><mn>1</mn></mrow></msup>
<mo>=</mo>
<mfrac>
<mn>1</mn>
<mrow><mi>det</mi><mo>⁡</mo><mrow><mo>(</mo><mi>A</mi><mo>)</mo></mrow></mrow>
</mfrac>
<mi>adj</mi><mo>⁡</mo><mrow><mo>(</mo><mi>A</mi><mo>)</mo></mrow>
</mrow>
</math>
A^-1 = 1/(det(A)) "adj"(A)
Inverse[A]
LinearAlgebra:-MatrixInverse(A);
B = inv(A);
A^(-1) = adj(A)/det(A)
How to have ChatGPT do the calculation
You are a calculation assistant for matrices. Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing). Find the inverse of each of the following two square matrices. 1. A = [[4, 7], [2, 6]] 2. B = [[1, 2], [2, 4]] For each one, first show the value of the determinant and whether the inverse exists; if it exists, show the entries of the inverse. Finally, also run a check that the product of the original matrix and its inverse is the identity matrix.
How to Use
-
1Enter your numbersType the numbers you want to calculate with into the input fields
-
2CalculatePress the "Calculate" button
-
3Check the resultThe result appears on the spot. The same page also explains the idea behind the calculation and the formula
DataChef Features
No technical knowledge required.
Intuitive and user-friendly operation.
Can be used without registering personal information.
Automatic file deletion by clicking "download".
and rapid file conversion.
No attribution required.
No need to contact us for commercial use permission.
