Let the matrix be (A=begin{bmatrix}a&b&c\ d&e&f\ g&h&iend{bmatrix})
Compute the determinant:
[
det(A)=a(ei-fh)-b(di-fg)+c(dh-eg)
]
If (det(A)=0), the inverse does not exist
Find the cofactor matrix:
[
C=begin{bmatrix}
(ei-fh) & -(di-fg) & +(dh-eg)\
(bi-ch) & +(ai-cg) & -(ah-bg)\
(bf-ce) & -(af-cd) & +(ae-bd)
end{bmatrix}
]
Take the transpose of the cofactor matrix to get the adjugate:
[
operatorname{adj}(A)=C^T
]
Divide the adjugate by the determinant:
[
A^{-1}=frac{1}{det(A)}operatorname{adj}(A)
]
Write the inverse as:
[
A^{-1}=frac{1}{det(A)}
begin{bmatrix}
ei-fh & ch-bi & bf-ce\
fg-di & ai-cg & cd-af\
dh-eg & bg-ah & ae-bd
end{bmatrix}
]
