Search for a tool
Inverse of a Matrix

Tool to invert a matrix. The inverse of a square matrix M is a matrix denoted M^-1 such as que M.M^-1=I where I is the identity matrix.

Results

Inverse of a Matrix -

Tag(s) : Matrix

Share
Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!


Feedback and suggestions are welcome so that dCode offers the best 'Inverse of a Matrix' tool for free! Thank you!

Inverse of a Matrix

Square Matrix Inverse Calculator NxN

Loading...
(if this message do not disappear, try to refresh this page)

Matrix Modular Inverse Calculator

Loading...
(if this message do not disappear, try to refresh this page)

See also: Hill Cipher

Answers to Questions (FAQ)

What is the inverse of a matrix? (Definition)

The inverse of a square and invertible matrix $ A $ is a matrix $ A^{-1} $ such that $ A \times A^{-1} = A^{-1} \times A = I $, where $ I $ is the identity matrix.

Inverting a matrix undoes the initial transformation, returning each point to its original position.

How to calculate the inverse of an invertible matrix?

The inverse $ M^{-1} $ of a square matrix $ M $ can be calculated using several methods that dCode applies for all square matrix sizes.

— Calculation via transpose of the cofactor matrix:

$$ M^{-1} = \frac{1}{\det M} \left( \operatorname{cof}(M) \right)^\mathsf{T} = \frac{1}{\ det M} \operatorname{comp}(M) $$

This formula requires calculating the determinant of the matrix $ \det M $ as well as the transpose of the cofactor matrix (also called the complementary matrix $ \operatorname{comp}(M) $).

— Calculation using the Gauss pivot method:

The method requires carrying out elementary operations on the rows of the matrix M in order to bring it back to the identity matrix. To obtain the inverse matrix, perform the same operations but this time from the identity matrix.

How to calculate the inverse of a matrix using the minors?

If the matrix is small, the cofactor method does not require too many calculations and gives a general formula:

— For a matrix of order 1 (1x1):

$$ M^{-1} = \begin{bmatrix} a \end{bmatrix}^{-1} = \begin{bmatrix} \frac{1}{a} \end{bmatrix} $$

— For a matrix of order 2 (2x2):

$$ M = \begin{bmatrix} a & b \\ c & d \\ \end{bmatrix} \\ \det(M) = ad - bc \\ \operatorname{cof}(M) = \begin{bmatrix} d & -c \\ -b & a \end{bmatrix} \\ \operatorname{comp}(M) = \left( \operatorname{cof}(M) \right)^\mathsf{T} = \begin{bmatrix} d & -b \\ -c & a \end{bmatrix} \\ M^{-1} = \frac{1}{ad - bc} \begin{bmatrix} d & -b \\ -c & a \\ \end{bmatrix} $$

Example: $$ M = \begin{bmatrix} 1 & 2 \\ 3 & 4 \\ \end{bmatrix} \Rightarrow M^{-1} = \frac{1}{\det(M)} \begin{bmatrix} 4 & -2 \\ -3 & 1 \\ \end{bmatrix} = -\frac{1}{2} \begin{bmatrix} 4 & -2 \\ -3 & 1 \\ \end{bmatrix} $$

— For a matrix of order 3 (3x3):

$$ M^{-1} = \begin{bmatrix} a & b & c \\ d & e & f \\ g & h & i \end{bmatrix}^{-1} = \frac{1}{-c e g+b f g+c d h-a f h-b d i+a e i} \begin{bmatrix} e i-f h & c h-b i & b f-c e \\ f g-d i & a i-c g & c d-a f \\ d h-e g & b g-a h & a e-b d \end{bmatrix} $$

How to calculate the inverse of a matrix using Gauss's pivot?

Form an augmented matrix by concatenating the matrix A with the corresponding identity matrix, i.e. a matrix of the form [A | I].

Apply the Gaussian pivot method to reduce the left part (matrix A) to a reduced echelon form, by performing elementary row operations.

If the reduced form is the identity matrix, then the right part is the inverse of the A matrix.

This method may take longer in calculation time but can be used to check the inverse of a matrix.

How to prove that a matrix is invertible?

A matrix is invertible if its determinant is non-zero (different from 0). So to prove that a matrix has an inverse, calculate the determinant of the matrix, if it is different from 0, then the matrix is invertible.

The matrix must be square (same number of rows and columns) and not rectangular to be invertible.

A non invertible matrix is called singular (inversion is not possible).

Avoid the term inversible which is wrong.

How to prove that a diagonal matrix is invertible?

A diagonal matrix is invertible if all elements on its diagonal are non-zero.

The inverse of a diagonal matrix is also a diagonal matrix.

$$ A = \left( \begin{array}{cccc} a_{1,1} & 0 & \dots & 0 \\ 0 & a_{2,2} & \dots & 0 \\ \vdots & \vdots & & \vdots \\ 0 & 0 & \dots & a_{n,n} \end{array} \right) \quad A^{-1} = \left( \begin{array}{cccc} \frac{1}{a_{1,1}} & 0 & \dots & 0 \\ 0 & \frac{1}{a_{2,2}} & \dots & 0 \\ \vdots & \vdots & & \vdots \\ 0 & 0 & \dots & \frac{1}{a_{n,n}} \end{array} \right) $$

How to prove that a triangular matrix is invertible?

A triangular matrix is invertible if all elements on its diagonal are non-zero.

The inverse of a triangular matrix is also a triangular matrix.

How to inverse a matrix with zero determinant?

A matrix with a determinant equal to 0 is not invertible. It does not have an inverse, it is not possible to calculate its inverse.

How to inverse an orthoginal matrix?

The inverse of an orthogonal matrix $ Q $ is its matrix transpose: $ Q^{-1} = Q^T $

How to check that a matrix is the inverse of another?

The multiplication of the matrix by its inverse must give the identity matrix. So the computation of $ M . M^{-1} = I $.

How to calculate the modular inverse of a matrix?

The principle is the same, but instead of calculating the determinant, calculate the modular inverse of the matrix determinant. See Hill cipher.

How to solve a system of linear equations with an inverse matrix?

Solving a system of linear equations $ A \times X = B $ where $ A $ is an invertible matrix, involves calculating the inverse of $ A $, the matrix $ A^{-1} $ obtained can then be multiplied on both sides of the equation to obtain $ X = A^{-1} \times B $.

Source code

dCode retains ownership of the "Inverse of a Matrix" source code. Except explicit open source licence (indicated Creative Commons / free), the "Inverse of a Matrix" algorithm, the applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or the "Inverse of a Matrix" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and all data download, script, or API access for "Inverse of a Matrix" are not public, same for offline use on PC, mobile, tablet, iPhone or Android app!
Reminder : dCode is free to use.

Cite dCode

The copy-paste of the page "Inverse of a Matrix" or any of its results, is allowed (even for commercial purposes) as long as you credit dCode!
Exporting results as a .csv or .txt file is free by clicking on the export icon
Cite as source (bibliography):
Inverse of a Matrix on dCode.fr [online website], retrieved on 2024-12-04, https://www.dcode.fr/matrix-inverse

Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Questions / Comments

Feedback and suggestions are welcome so that dCode offers the best 'Inverse of a Matrix' tool for free! Thank you!


https://www.dcode.fr/matrix-inverse
© 2024 dCode — The ultimate 'toolkit' to solve every games / riddles / geocaching / CTF.
 
Feedback