Difference between revisions of "Matrix inversion"

From Robotics
Jump to: navigation, search
(Created page with "==Matrix inversion== The inverse of an n-by-n square matrix <math>\mathbf{A}</math> is denoted as <math>\mathbf{A}^{-1}</math> and defined such that<br/><br/> <math>\mathbf{A...")
 
 
(42 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Matrix inversion==
+
{{Navigation|before=[[Minors and cofactors]]|overview=[[Matrix inversion]]|next=[[Gauß-Jordan-Algorithm]]}}
  
The inverse of an n-by-n square matrix <math>\mathbf{A}</math> is denoted as <math>\mathbf{A}^{-1}</math> and defined such that<br/><br/>
+
The inverse of an n-by-n square matrix <math>\mathbf{A}</math> is denoted as <math>\mathbf{A}^{-1}</math> and defined such that
<math>\mathbf{A}\mathbf{A}^{-1}=\mathbf{A}^{-1}\mathbf{A}=\mathbf{I}_n</math><br/><br/>
+
:<math>\mathbf{A}\mathbf{A}^{-1}=\mathbf{A}^{-1}\mathbf{A}=\mathbf{I}_n</math>
where <math>\mathbf{I}_n</math> is the n-by-n identity matrix.<br/>
+
where <math>\mathbf{I}_n</math> is the n-by-n identity matrix.
Prerequesite for the inversion is, that <math>\mathbf{A}</math> is an n-by-n square matrix and that <math>\mathbf{A}</math> is regular. Regular means that the row and column vectors are linearly independent and so the determinant is nonzero:<br/><br/>
+
 
<math>det(\mathbf{A})\ne0</math><br/><br/>
+
Prerequesite for the inversion is, that <math>\mathbf{A}</math> is an n-by-n square matrix and that <math>\mathbf{A}</math> is regular. Regular means that the row and column vectors are linearly independent and so the determinant is nonzero:
Otherwise the matrix is called singular. <br/><br/>
+
:<math>det(\mathbf{A})\ne0</math>
  '''Example:''' <br/>
+
Otherwise the matrix is called singular.
  <math>
+
 
 +
Before determining the inverse of a matrix it is always useful to compute the [[Determinant of a matrix|determinant]] and check whether the matrix is regular or singular. If it is singular it is not possible to determine the inverse because there is no inverse. The following two subarticles describe two of the common procedures to determine the inverse of a matrix.
 +
 
 +
# [[Gauß-Jordan-Algorithm]]
 +
# [[Adjugate Formula]]
 +
 
 +
Transformation matrices have a special structure, that is described in the [[Transformations|transformations]] chapter. For this special matrix structure an easier method to invert the matrix exists. This method is presented in
 +
 
 +
&nbsp; &nbsp; &nbsp; 3. [[Inverse transformation]].
 +
 
 +
{{Example
 +
|Title=inverse of a 2-by-2 matrix
 +
|Contents=
 +
This is a simple example for the inverse of a 2-by-2 matrix:<br/><br/>
 +
:<math>
 +
\mathbf{A}_2 =
 +
\left[\begin{array}{cc}
 +
2 & 3\\
 +
1 & 2
 +
\end{array}\right]
 +
,\quad
 +
{\mathbf{A}_2}^{-1}  =
 +
\left[\begin{array}{cc}
 +
2 & -3\\
 +
-1 & 2
 +
\end{array}\right]
 +
</math><br/><br/>
 +
:<math>\begin{align}
 +
{\mathbf{A}_2}{\mathbf{A}_2}^{-1}  &=
 +
\left[\begin{array}{cc}
 +
2 & 3\\
 +
1 & 2
 +
\end{array}\right]\cdot
 +
\left[\begin{array}{cc}
 +
2 & -3\\
 +
-1 & 2
 +
\end{array}\right]\\&=
 +
\left[\begin{array}{cc}
 +
2\cdot2+3\cdot(-1) & 2\cdot(-3)+3\cdot2\\
 +
1\cdot2+2\cdot(-1) & 1\cdot(-3)+2\cdot2
 +
\end{array}\right]\\&=
 +
\left[\begin{array}{cc}
 +
4-3 & -6+6\\
 +
2-2 & -3+4
 +
\end{array}\right]\\&=
 +
\left[\begin{array}{cc}
 +
{\color{Green}\mathbf{1}} & 0\\
 +
0 & {\color{Green}\mathbf{1}}
 +
\end{array}\right]=
 +
\mathbf{I}_2
 +
\end{align}</math>}}
 +
 
 +
{{Example
 +
|Title=inverse of a 3-by-3 matrix
 +
|Contents=
 +
This is an example for the inverse of a 3-by-3 matrix:<br/><br/>
 +
:<math>
 +
\mathbf{A}_3 =
 +
\left[\begin{array}{ccc}
 +
1&0&1\\
 +
3&1&0\\
 +
1&0&2
 +
\end{array}\right]
 +
,\quad
 +
{\mathbf{A}_3}^{-1}  =
 +
\left[\begin{array}{ccc}
 +
2&0&-1\\
 +
-6&1&3\\
 +
-1&0&1
 +
\end{array}\right]
 +
</math><br/><br/>
 +
:<math>\begin{align}
 +
{\mathbf{A}_3}{\mathbf{A}_3}^{-1}  &=
 +
\left[\begin{array}{ccc}
 +
1&0&1\\
 +
3&1&0\\
 +
1&0&2
 +
\end{array}\right]\cdot
 +
\left[\begin{array}{ccc}
 +
2&0&-1\\
 +
-6&1&3\\
 +
-1&0&1
 +
\end{array}\right]\\&=
 +
\left[\begin{array}{ccc}
 +
1\cdot2+0\cdot(-6)+1\cdot(-1) & 1\cdot0+0\cdot1+1\cdot0 & 1\cdot(-1)+0\cdot3+1\cdot1\\
 +
3\cdot2+1\cdot(-6)+0\cdot(-1) & 3\cdot0+1\cdot1+0\cdot0 & 3\cdot(-1)+1\cdot3+0\cdot1\\
 +
1\cdot2+0\cdot(-6)+2\cdot(-1) & 1\cdot0+0\cdot1+2\cdot0 & 1\cdot(-1)+0\cdot3+2\cdot1
 +
\end{array}\right]\\&=
 +
\left[\begin{array}{ccc}
 +
2+0-1 & 0+0+0 & -1+0+1\\
 +
6-6+0 & 0+1+0 & -3+3+0\\
 +
2+0-2 & 0+0+0 & -1+0+2
 +
\end{array}\right]\\&=
 +
\left[\begin{array}{ccc}
 +
{\color{Green}\mathbf{1}} & 0 & 0\\
 +
0 & {\color{Green}\mathbf{1}} & 0\\
 +
0 & 0 & {\color{Green}\mathbf{1}}
 +
\end{array}\right]=
 +
\mathbf{I}_3
 +
\end{align}</math>}}
 +
 
 +
{{Example
 +
|Title=inverse of a 4-by-4 matrix
 +
|Contents=
 +
This example is a proof of equation 3.40 in the robotics script (see page 3-61):<br/><br/>
 +
:<math>
 +
^R\mathbf{T}_N  =
 +
\left[\begin{array}{cccc}
 +
0 & 1 & 0 & 2a\\
 +
0 & 0 & -1 & 0\\
 +
-1 & 0 & 0 & 0\\
 +
0 & 0 & 0 & 1
 +
\end{array}\right]
 +
,\quad
 +
{^R\mathbf{T}_N}^{-1}  =
 +
\left[\begin{array}{cccc}
 +
0 & 0 & -1 & 0\\
 +
1 & 0 & 0 & -2a\\
 +
0 & -1 & 0 & 0\\
 +
0 & 0 & 0 & 1
 +
\end{array}\right]
 +
</math><br/><br/>
 +
:<math>\begin{align}
 +
{^R\mathbf{T}_N}{^R\mathbf{T}_N}^{-1}  &=
 +
\left[\begin{array}{cccc}
 +
0 & 1 & 0 & 2a\\
 +
0 & 0 & -1 & 0\\
 +
-1 & 0 & 0 & 0\\
 +
0 & 0 & 0 & 1
 +
\end{array}\right]\cdot
 +
\left[\begin{array}{cccc}
 +
0 & 0 & -1 & 0\\
 +
1 & 0 & 0 & -2a\\
 +
0 & -1 & 0 & 0\\
 +
0 & 0 & 0 & 1
 +
\end{array}\right]\\&=
 +
\left[\begin{array}{cccc}
 +
0\cdot0+1\cdot1+0\cdot0+2a\cdot0 & 0\cdot0+1\cdot0+0\cdot(-1)+2a\cdot0 & 0\cdot(-1)+1\cdot0+0\cdot0+2a\cdot0 & 0\cdot0+1\cdot(-2a)+0\cdot0+2a\cdot1\\
 +
0\cdot0+0\cdot1+(-1)\cdot0+0\cdot0 & 0\cdot0+0\cdot0+(-1)\cdot(-1)+0\cdot0 & 0\cdot(-1)+0\cdot0+(-1)\cdot0+0\cdot0 & 0\cdot0+0\cdot(-2a)+(-1)\cdot0+0\cdot1\\
 +
(-1)\cdot0+0\cdot1+0\cdot0+0\cdot0 & (-1)\cdot0+0\cdot0+0\cdot(-1)+0\cdot0 & (-1)\cdot(-1)+0\cdot0+0\cdot0+0\cdot0 & (-1)\cdot0+0\cdot(-2a)+0\cdot0+0\cdot1\\
 +
0\cdot0+0\cdot1+0\cdot0+1\cdot0 & 0\cdot0+0\cdot0+0\cdot(-1)+1\cdot0 & 0\cdot(-1)+0\cdot0+0\cdot0+1\cdot0 & 0\cdot0+0\cdot(-2a)+0\cdot0+1\cdot1\\
 +
\end{array}\right]\\&=
 +
\left[\begin{array}{cccc}
 +
{\color{Green}\mathbf{1}} & 0 & 0 & 0\\
 +
0 & {\color{Green}\mathbf{1}} & 0 & 0\\
 +
0 & 0 & {\color{Green}\mathbf{1}} & 0\\
 +
0 & 0 & 0 & {\color{Green}\mathbf{1}}
 +
\end{array}\right]=
 +
\mathbf{I}_4
 +
\end{align}</math>}}
 +
 
 +
<!--{{Example
 +
|Title=inverse of matrix
 +
|Contents=<br/>
 +
:<math>
 
\mathbf{A}_e  =  
 
\mathbf{A}_e  =  
 
\left[\begin{array}{cccc}
 
\left[\begin{array}{cccc}
Line 25: Line 179:
 
\end{array}\right]
 
\end{array}\right]
 
</math><br/><br/>
 
</math><br/><br/>
  <math>\begin{align}
+
:<math>\begin{align}
 
\mathbf{A}_e\mathbf{A}_e^{-1}  &=  
 
\mathbf{A}_e\mathbf{A}_e^{-1}  &=  
 
\left[\begin{array}{cccc}
 
\left[\begin{array}{cccc}
Line 52: Line 206:
 
\end{array}\right]=
 
\end{array}\right]=
 
\mathbf{I}_n
 
\mathbf{I}_n
\end{align}</math>
+
\end{align}</math>}}-->
<br/>
 
Before determining the inverse of a matrix it is always useful to compute the determinant and check whether the matrix is regular or singular. If it is singular it is not possible to determine the inverse because there is no inverse. For 3-by-3 and smaller matrices there are simple formulas to compute the determinant. To compute the determinant of larger matrices the following paragraph describes an example formula for a 4-by-4 matrix.<br/><br/>
 
To determine the inverse of a matrix there are several alternatives. Two of the common procedures are the Gauß-Jordan-Algorithm and the Adjugate Formula that are explained afterwards.
 
 
 
===Determinant of a 4-by-4 matrix===
 
  
This paragraph describes a formula to compute the determinant of a 4-by-4 matrix using minors and cofactors of a matrix.<br/>
+
[[Category:Article]]
 
+
[[Category:Matrices]]
The '''minor <math>M_{i,j}(\mathbf{A})</math>''' of an n-by-n square matrix <math>\mathbf{A}</math> is the determinant of a smaller square matrix obtained by removing the row <math>i</math> and the column <math>j</math> from <math>\mathbf{A}</math>.<br/><br/>
 
 
 
  The minors <math>M_{1,4}(\mathbf{A}_e)</math> and <math>M_{3,1}(\mathbf{A}_e)</math> for example are defined as<br/><br/>
 
  <math>M_{1,4}(\mathbf{A}_e)=
 
\left|\begin{array}{cccc}
 
\Box & \Box & \Box & \Box\\
 
3 & 0 & 1 & \Box\\
 
0 & 1 & 0 & \Box\\
 
0 & 0 & 2 & \Box
 
\end{array}\right|=
 
\left|\begin{array}{ccc}
 
3 & 0 & 1\\
 
0 & 1 & 0\\
 
0 & 0 & 2
 
\end{array}\right|=6-0=6
 
</math><br/>
 
  <math>
 
M_{3,1}(\mathbf{A}_e)=
 
\left|\begin{array}{cccc}
 
\Box & 2 & 0 & 0\\
 
\Box & 0 & 1 & 1\\
 
\Box & \Box & \Box & \Box\\
 
\Box & 0 & 2 & 1
 
\end{array}\right|=
 
\left|\begin{array}{ccc}
 
2 & 0 & 0\\
 
0 & 1 & 1\\
 
0 & 2 & 1
 
\end{array}\right|=2-4=-2
 
</math>
 
 
 
<br/>
 
Multiplying the minor with <math>(-1)^{i+j}</math> results in the '''cofactor <math>C_{i,j}(\mathbf{A})</math>''':<br/><br/>
 
<math>C_{i,j}(\mathbf{A})=(-1)^{i+j}M_{i,j}(\mathbf{A})</math><br/><br/>
 
 
 
  <math>C_{1,4}(\mathbf{A}_e)=(-1)^{1+4}M_{1,4}(\mathbf{A}_e)=(-1)^5\cdot6=-6</math>
 
 
 
<br/>
 
To compute the determinant of matrix <math>\mathbf{A}</math> first one row or column is choosen. The sum of the four corresponding values of the row or column multiplied by the related cofactors results in the determinant:<br/><br/>
 
 
 
<math>
 
\det(\mathbf{A})=\sum_{(i,j) \isin \text{ one row or column}}{a_{i,j}C_{i,j}}
 
</math>
 
 
 
  For the example matrix it is useful to choose the row 3 because it contains three zero values as factors:<br/>
 
  <math>\begin{align}
 
\det(\mathbf{A}_e)&=
 
\left|\begin{array}{cccc}
 
1 & 2 & 0 & 0\\
 
3 & 0 & 1 & 1\\
 
\mathbf{0} & \mathbf{1} & \mathbf{0} & \mathbf{0}\\
 
0 & 0 & 2 & 1
 
\end{array}\right| & \quad & \quad & \quad\\
 
&=
 
\mathbf{0}\cdot C_{3,1}&+&\mathbf{1}\cdot C_{3,2}&+&\mathbf{0}\cdot C_{3,3}&+&\mathbf{0}\cdot C_{3,4}\\
 
&=
 
0\cdot(-1)^{3+1}
 
\left|\begin{array}{ccc}
 
2 & 0 & 0\\
 
0 & 1 & 1\\
 
0 & 2 & 1
 
\end{array}\right|
 
&+&1\cdot(-1)^{3+2}
 
\left|\begin{array}{ccc}
 
1 & 0 & 0\\
 
3 & 1 & 1\\
 
0 & 2 & 1
 
\end{array}\right|
 
&+&0\cdot(-1)^{3+3}
 
\left|\begin{array}{ccc}
 
1 & 2 & 0\\
 
3 & 0 & 1\\
 
0 & 0 & 1
 
\end{array}\right|
 
&+&0\cdot(-1)^{3+4}
 
\left|\begin{array}{ccc}
 
1 & 2 & 0\\
 
3 & 0 & 1\\
 
0 & 0 & 2
 
\end{array}\right|\\
 
&= 0&+&1\cdot(-1)\cdot(-1)&+&0&+&0\\
 
&= 1&\quad&\quad&\quad
 
\end{align}</math><br/>
 
 
 
===Gauß-Jordan-Algorithm===
 
 
 
The Gauß-Jordan-Algorithm was developed to solve systems of linear equations. But it can also be used to determine the inverse of an n-by-n square matrix. <br/><br/>
 
The algorithm is based on the formula <math>\mathbf{A}\mathbf{A}^{-1}=\mathbf{I}_n</math>. First the block matrix <math>(\mathbf{A}|\mathbf{I}_n)</math> is build. On this matrix the Gauß-Jordan-Algorithm is applied. By using various conversion steps like interchanging of rows and addtition of factorized rows to other rows the block matrix is converted so that the left block equals the identity matrix <math>\mathbf{I}_n</math>. The right block then corresponds to the inverse of <math>\mathbf{A}</math>.<br/><br/>
 
[[Datei:RobWiki_GaußJordanAlgorithm.png|Gauß-Jordan-Algorithm]]<br/><br/>
 
 
 
  <math>\begin{align}
 
(\mathbf{A}_e|\mathbf{I}_n) =
 
&\left[\begin{array}{cccc|cccc}
 
1 & 2 & 0 & 0 & 1 & 0 & 0 & 0\\
 
3 & 0 & 1 & 1 & 0 & 1 & 0 & 0\\
 
0 & 1 & 0 & 0 & 0 & 0 & 1 & 0\\
 
0 & 0 & 2 & 1 & 0 & 0 & 0 & 1
 
\end{array}\right]\\ \\
 
&\text{--------------------------------------------------------------------------------------}\\ \\
 
&\left[\begin{array}{cccc|cccc}
 
1 & 2 & 0 & 0 & 1 & 0 & 0 & 0\\
 
3 & 0 & 1 & 1 & 0 & 1 & 0 & 0\\
 
0 & 1 & 0 & 0 & 0 & 0 & 1 & 0\\
 
0 & 0 & 2 & 1 & 0 & 0 & 0 & 1
 
\end{array}\right]
 
\begin{array}{c}
 
\\
 
\updownarrow\text{interchange row II and row III}\\
 
\\
 
\end{array}\\
 
&\qquad\qquad\quad\quad\Downarrow\\
 
&\left[\begin{array}{cccc|cccc}
 
1 & 2 & 0 & 0 & 1 & 0 & 0 & 0\\
 
0 & 1 & 0 & 0 & 0 & 0 & 1 & 0\\
 
3 & 0 & 1 & 1 & 0 & 1 & 0 & 0\\
 
0 & 0 & 2 & 1 & 0 & 0 & 0 & 1
 
\end{array}\right]
 
\begin{array}{c}
 
\text{substract 2 times row II}\\
 
\\
 
\\
 
\\
 
\end{array}\\
 
&\qquad\qquad\quad\quad\Downarrow\\
 
&\left[\begin{array}{cccc|cccc}
 
1 & 0 & 0 & 0 & 1 & 0 & -2 & 0\\
 
0 & 1 & 0 & 0 & 0 & 0 & 1 & 0\\
 
3 & 0 & 1 & 1 & 0 & 1 & 0 & 0\\
 
0 & 0 & 2 & 1 & 0 & 0 & 0 & 1
 
\end{array}\right]
 
\begin{array}{c}
 
\\
 
\\
 
\text{substract 3 times row I}\\
 
\\
 
\end{array}\\
 
&\qquad\qquad\quad\quad\Downarrow\\
 
&\left[\begin{array}{cccc|cccc}
 
1 & 0 & 0 & 0 & 1 & 0 & -2 & 0\\
 
0 & 1 & 0 & 0 & 0 & 0 & 1 & 0\\
 
0 & 0 & 1 & 1 & -3 & 1 & 6 & 0\\
 
0 & 0 & 2 & 1 & 0 & 0 & 0 & 1
 
\end{array}\right]
 
\begin{array}{c}
 
\\
 
\\
 
\updownarrow\text{interchange row III and row IV}\\
 
\end{array}\\
 
&\qquad\qquad\quad\quad\Downarrow\\
 
&\left[\begin{array}{cccc|cccc}
 
1 & 0 & 0 & 0 & 1 & 0 & -2 & 0\\
 
0 & 1 & 0 & 0 & 0 & 0 & 1 & 0\\
 
0 & 0 & 2 & 1 & 0 & 0 & 0 & 1\\
 
0 & 0 & 1 & 1 & -3 & 1 & 6 & 0
 
\end{array}\right]
 
\begin{array}{c}
 
\\
 
\\
 
\text{substract row IV}\\
 
\\
 
\end{array}\\
 
&\qquad\qquad\quad\quad\Downarrow\\
 
&\left[\begin{array}{cccc|cccc}
 
1 & 0 & 0 & 0 & 1 & 0 & -2 & 0\\
 
0 & 1 & 0 & 0 & 0 & 0 & 1 & 0\\
 
0 & 0 & 1 & 0 & 3 & -1 & -6 & 1\\
 
0 & 0 & 1 & 1 & -3 & 1 & 6 & 0
 
\end{array}\right]
 
\begin{array}{c}
 
\\
 
\\
 
\\
 
\text{substract row III}\\
 
\end{array}\\
 
&\qquad\qquad\quad\quad\Downarrow\\
 
&\left[\begin{array}{cccc|cccc}
 
{\color{Green}\mathbf{1}} & 0 & 0 & 0 & 1 & 0 & -2 & 0\\
 
0 & {\color{Green}\mathbf{1}} & 0 & 0 & 0 & 0 & 1 & 0\\
 
0 & 0 & {\color{Green}\mathbf{1}} & 0 & 3 & -1 & -6 & 1\\
 
0 & 0 & 0 & {\color{Green}\mathbf{1}} & -6 & 2 & 12 & -1
 
\end{array}\right]\\
 
&\qquad\quad\mathbf{I}_n\qquad\qquad\qquad\mathbf{A}_e^{-1}\\ \\
 
&\text{--------------------------------------------------------------------------------------}\\ \\
 
\mathbf{A}_e^{-1}  =
 
&\left[\begin{array}{cccc}
 
1 & 0 & -2 & 0\\
 
0 & 0 & 1 & 0\\
 
3 & -1 & -6 & 1\\
 
-6 & 2 & 12 & -1
 
\end{array}\right]
 
\end{align}</math>
 
 
 
===Adjugate Formula===
 
 
 
The adjugate formula defines the inverse of an n-by-n square matrix <math>\mathbf{A}</math> as<br/><br/>
 
<math>\mathbf{A}^{-1}=\frac{1}{\det(\mathbf{A})}\text{adj}(\mathbf{A})</math><br/><br/>
 
where <math>\text{adj}(\mathbf{A})</math> is the so called '''adjugate matrix''' of <math>\mathbf{A}</math>. The adjugate matrix is the transposed of the cofactor matrix:<br/><br/>
 
<math>
 
\text{adj}(\mathbf{A})=\mathbf{C}(\mathbf{A})^T
 
</math><br/><br/>
 
And the '''cofactor matrix''' <math>\mathbf{C}(\mathbf{A})</math> is just a matrix where each cell corresponds to the related cofactor:<br/><br/>
 
<math>
 
\mathbf{C}(\mathbf{A})=\left[\begin{array}{cccc}
 
C_{1,1}(\mathbf{A}) & C_{1,2}(\mathbf{A}) & \cdots & C_{1,n}(\mathbf{A})\\
 
C_{2,1}(\mathbf{A}) & C_{2,2}(\mathbf{A}) &  & C_{2,n}(\mathbf{A})\\
 
\vdots &  & \ddots & \vdots\\
 
C_{n,1}(\mathbf{A}) & C_{n,2}(\mathbf{A}) & \cdots & C_{n,n}(\mathbf{A})
 
\end{array}\right]
 
</math><br/><br/>
 
So to determine the inverse of an n-by-n square matrix you have to compute the n square cofactors, then transpose the resulting cofactor matrix and divide all the values by the determinant.<br/><br/>
 
 
 
  <math>\begin{align}
 
\mathbf{C}(\mathbf{A}_e)&=
 
\left[\begin{array}{cccc}
 
1 & 0 & 3 & -6\\
 
0 & 0 & -1 & 2\\
 
-2 & 1 & -6 & 12\\
 
0 & 0 & 1 & -1
 
\end{array}\right]\\ \\
 
\mathbf{C}(\mathbf{A}_e)^T&=
 
\left[\begin{array}{cccc}
 
1 & 0 & -2 & 0\\
 
0 & 0 & 1 & 0\\
 
3 & -1 & -6 & 1\\
 
-6 & 2 & 12 & -1
 
\end{array}\right]=\text{adj}(\mathbf{A}_e)\\ \\
 
\mathbf{A}_e^{-1}&=\frac{1}{\det(\mathbf{A}_e)}\text{adj}(\mathbf{A}_e)
 
=\frac{1}{1}
 
\left[\begin{array}{cccc}
 
1 & 0 & -2 & 0\\
 
0 & 0 & 1 & 0\\
 
3 & -1 & -6 & 1\\
 
-6 & 2 & 12 & -1
 
\end{array}\right]
 
=
 
\left[\begin{array}{cccc}
 
1 & 0 & -2 & 0\\
 
0 & 0 & 1 & 0\\
 
3 & -1 & -6 & 1\\
 
-6 & 2 & 12 & -1
 
\end{array}\right]
 
\end{align}</math>
 

Latest revision as of 18:12, 13 November 2015

← Back: Minors and cofactors Overview: Matrix inversion Next: Gauß-Jordan-Algorithm

The inverse of an n-by-n square matrix \mathbf{A} is denoted as \mathbf{A}^{-1} and defined such that

\mathbf{A}\mathbf{A}^{-1}=\mathbf{A}^{-1}\mathbf{A}=\mathbf{I}_n

where \mathbf{I}_n is the n-by-n identity matrix.

Prerequesite for the inversion is, that \mathbf{A} is an n-by-n square matrix and that \mathbf{A} is regular. Regular means that the row and column vectors are linearly independent and so the determinant is nonzero:

det(\mathbf{A})\ne0

Otherwise the matrix is called singular.

Before determining the inverse of a matrix it is always useful to compute the determinant and check whether the matrix is regular or singular. If it is singular it is not possible to determine the inverse because there is no inverse. The following two subarticles describe two of the common procedures to determine the inverse of a matrix.

  1. Gauß-Jordan-Algorithm
  2. Adjugate Formula

Transformation matrices have a special structure, that is described in the transformations chapter. For this special matrix structure an easier method to invert the matrix exists. This method is presented in

      3. Inverse transformation.

Example: inverse of a 2-by-2 matrix

This is a simple example for the inverse of a 2-by-2 matrix:


\mathbf{A}_2 = 
\left[\begin{array}{cc}
2 & 3\\
1 & 2
\end{array}\right]
,\quad
{\mathbf{A}_2}^{-1}  = 
\left[\begin{array}{cc}
2 & -3\\
-1 & 2
\end{array}\right]

\begin{align}
{\mathbf{A}_2}{\mathbf{A}_2}^{-1}  &= 
\left[\begin{array}{cc}
2 & 3\\
1 & 2
\end{array}\right]\cdot
\left[\begin{array}{cc}
2 & -3\\
-1 & 2
\end{array}\right]\\&=
\left[\begin{array}{cc}
2\cdot2+3\cdot(-1) & 2\cdot(-3)+3\cdot2\\
1\cdot2+2\cdot(-1) & 1\cdot(-3)+2\cdot2
\end{array}\right]\\&=
\left[\begin{array}{cc}
4-3 & -6+6\\
2-2 & -3+4
\end{array}\right]\\&=
\left[\begin{array}{cc}
{\color{Green}\mathbf{1}} & 0\\
0 & {\color{Green}\mathbf{1}}
\end{array}\right]=
\mathbf{I}_2
\end{align}
Example: inverse of a 3-by-3 matrix

This is an example for the inverse of a 3-by-3 matrix:


\mathbf{A}_3 = 
\left[\begin{array}{ccc}
1&0&1\\
3&1&0\\
1&0&2
\end{array}\right]
,\quad
{\mathbf{A}_3}^{-1}  = 
\left[\begin{array}{ccc}
2&0&-1\\
-6&1&3\\
-1&0&1
\end{array}\right]

\begin{align}
{\mathbf{A}_3}{\mathbf{A}_3}^{-1}  &= 
\left[\begin{array}{ccc}
1&0&1\\
3&1&0\\
1&0&2
\end{array}\right]\cdot
\left[\begin{array}{ccc}
2&0&-1\\
-6&1&3\\
-1&0&1
\end{array}\right]\\&=
\left[\begin{array}{ccc}
1\cdot2+0\cdot(-6)+1\cdot(-1) & 1\cdot0+0\cdot1+1\cdot0 & 1\cdot(-1)+0\cdot3+1\cdot1\\
3\cdot2+1\cdot(-6)+0\cdot(-1) & 3\cdot0+1\cdot1+0\cdot0 & 3\cdot(-1)+1\cdot3+0\cdot1\\
1\cdot2+0\cdot(-6)+2\cdot(-1) & 1\cdot0+0\cdot1+2\cdot0 & 1\cdot(-1)+0\cdot3+2\cdot1
\end{array}\right]\\&=
\left[\begin{array}{ccc}
2+0-1 & 0+0+0 & -1+0+1\\
6-6+0 & 0+1+0 & -3+3+0\\
2+0-2 & 0+0+0 & -1+0+2
\end{array}\right]\\&=
\left[\begin{array}{ccc}
{\color{Green}\mathbf{1}} & 0 & 0\\
0 & {\color{Green}\mathbf{1}} & 0\\
0 & 0 & {\color{Green}\mathbf{1}}
\end{array}\right]=
\mathbf{I}_3
\end{align}
Example: inverse of a 4-by-4 matrix

This example is a proof of equation 3.40 in the robotics script (see page 3-61):


^R\mathbf{T}_N  = 
\left[\begin{array}{cccc}
0 & 1 & 0 & 2a\\
0 & 0 & -1 & 0\\
-1 & 0 & 0 & 0\\
0 & 0 & 0 & 1
\end{array}\right]
,\quad
{^R\mathbf{T}_N}^{-1}  = 
\left[\begin{array}{cccc}
0 & 0 & -1 & 0\\
1 & 0 & 0 & -2a\\
0 & -1 & 0 & 0\\
0 & 0 & 0 & 1
\end{array}\right]

\begin{align}
{^R\mathbf{T}_N}{^R\mathbf{T}_N}^{-1}  &= 
\left[\begin{array}{cccc}
0 & 1 & 0 & 2a\\
0 & 0 & -1 & 0\\
-1 & 0 & 0 & 0\\
0 & 0 & 0 & 1
\end{array}\right]\cdot
\left[\begin{array}{cccc}
0 & 0 & -1 & 0\\
1 & 0 & 0 & -2a\\
0 & -1 & 0 & 0\\
0 & 0 & 0 & 1
\end{array}\right]\\&=
\left[\begin{array}{cccc}
0\cdot0+1\cdot1+0\cdot0+2a\cdot0 & 0\cdot0+1\cdot0+0\cdot(-1)+2a\cdot0 & 0\cdot(-1)+1\cdot0+0\cdot0+2a\cdot0 & 0\cdot0+1\cdot(-2a)+0\cdot0+2a\cdot1\\
0\cdot0+0\cdot1+(-1)\cdot0+0\cdot0 & 0\cdot0+0\cdot0+(-1)\cdot(-1)+0\cdot0 & 0\cdot(-1)+0\cdot0+(-1)\cdot0+0\cdot0 & 0\cdot0+0\cdot(-2a)+(-1)\cdot0+0\cdot1\\
(-1)\cdot0+0\cdot1+0\cdot0+0\cdot0 & (-1)\cdot0+0\cdot0+0\cdot(-1)+0\cdot0 & (-1)\cdot(-1)+0\cdot0+0\cdot0+0\cdot0 & (-1)\cdot0+0\cdot(-2a)+0\cdot0+0\cdot1\\
0\cdot0+0\cdot1+0\cdot0+1\cdot0 & 0\cdot0+0\cdot0+0\cdot(-1)+1\cdot0 & 0\cdot(-1)+0\cdot0+0\cdot0+1\cdot0 & 0\cdot0+0\cdot(-2a)+0\cdot0+1\cdot1\\
\end{array}\right]\\&=
\left[\begin{array}{cccc}
{\color{Green}\mathbf{1}} & 0 & 0 & 0\\
0 & {\color{Green}\mathbf{1}} & 0 & 0\\
0 & 0 & {\color{Green}\mathbf{1}} & 0\\
0 & 0 & 0 & {\color{Green}\mathbf{1}}
\end{array}\right]=
\mathbf{I}_4
\end{align}