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))
Check that (det(A)neq 0)
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})
Find the adjugate matrix:
(operatorname{adj}(A)=C^T)
Compute the inverse:
(A^{-1}=dfrac{1}{det(A)}operatorname{adj}(A))
If (det(A)=0), the inverse does not exist
