It might be helpful to have some actual example code of what this looks like. In Python it would be
def invert_2_by_2_matrix(matrix):
# matrix is of form, for example ((1,2), (3,4))
((a, b), (c, d)) = matrix
det = (a*d - b*c)
return ((d/det, -b/det), (-c/det, a/det))
(This doesn't do any input checking including if the determinant is 0)