**comp.graphics.algorithms**

## Subject: **Re: 4x4 matrix inversion**

The following holds for an invertible matrix:

M^-1 = adj(M) / det(M)

This is the direct formula and while not practical for large matrices I

guess it is ok for such a small matrix. To compute the inverse then, you

need a way to compute det(M) and adj(M).

Minors

------

Let M be a nxn matrix. Let Sij of M be a (n-1)x(n-1) matrix obtained

from M by removing the row i and the column j. An Sij is called a minor

of M.

The set of det(Sij) for all i and j are called the subdeterminants of

the matrix M.

Adjungate

---------

Form a matrix A such that A[i, j] = -1^(i + j) * det(Sji). This is

called the adjungate of M, adj(M).

Determinant

-----------

If B is a 1x1 matrix:

B = [b]

then

det(B) = b

Let M be a nxn matrix, with n > 1. Let [x1, x2, ... , xn] be the first

row of M. Then det(M) = sum[j = 1 to n](-1^(1 + j) * xj * det(Sij))

Example

-------

Let n = 3

M = [a b c]

[d e f]

[g h i]

Minors and subdeterminants

S11 = [e f] => det(S11) = e * det(i) - f * det(h) = e * i - f * h

[h i]

S12 = [d f] => det(S12) = d * det(i) - f * det(g) = d * i - f * g

[g i]

S13 = [d e] => det(S13) = d * det(h) - e * det(g) = d * h - e * g

[g h]

Similarly

det(S21) = bi - ch

det(S22) = ai - cg

det(S23) = ah - bg

det(S31) = bf - ce

det(S32) = af - dc

det(S33) = ae - bd

Determinant

det(M) = a * det(S11) - b * det(S12) + c * det(S13)

= a * (ei - fh) - b * (di - fg) + c * (dh - eg)

Adjungate

adj(M) = [+det(S11), -det(S21), +det(S31)]

[-det(S12), +det(S22), -det(S32)]

[+det(S13), -det(S23), +det(S33)]

Finally, we are ready to calculate M^-1:

M^-1 = adj(M) / det(M)

Deriving the n = 4 version is left as an exercise:)

--

Kalle Rutanen

http://kaba.hilvi.org

Reply

View All Messages in

**comp.graphics.algorithms**

path:

4x4 matrix inversion =>

Replies:

Re: 4x4 matrix inversion

Copyright © 2006 WatermarkFactory.com. All Rights Reserved.