-must be a square matrix
And 1/a * a = a * 1/a = 1
First we will augment Matrix A with an identity matrix and call the result A0.
We will also need an identity matrix called I0.
Step 1
Now we will work on the first column of I0. The diagonal element in the first column of
A0 is called the pivot. We will replace the first diagonal element of I0
with 1/a11. Then we will
replace the non-pivot elements with -aij/a11 and call the result I1.
Compute A1 = I1 * A0.
Step 2
Now we repeat the process by modifying the second column of I0.
This time the pivot value is the 22 element. The new matrix is called I2.
Compute A2 = I2 * A1.
Step 3
Lastly we repeat the process by modifying the third column of I0.
This time the pivot value is the 33 element. The new matrix is called I3.
Compute A3 = I3 * A2.
The last three columns of A3 are the inverse of A, thus:
Mata Example:
i=I(3)
a = (4,2,2\4,6,8\-2,2,4)
a
a = a,i
a
i1 = (.25,0,0\-1,1,0\.5,0,1)
i1
i2 = (1,-.125,0\0,.25,0\0,-.75,1)
i2
i3=(1,0,.5\0,1,-3\0,0,2)
i3
ainv = i3*i2*i1*a
ainv
ainv = ainv[1..., 4..6]
ainv
U' * X = T [1 1 1] * |3 1| |2 0| = [7 5] |2 4| (1,3) (3,2) (1,2)
X * U = T |3 1| |1| |4| |2 0| * |1| = |2| |2 4| |6| (3,2) (2,1) (3,1)
Multivariate Course Page
Phil Ender, 11oct05, 30Jun98