Suppose we have a matrix M = [{a b} {c d}]
The inverse of a matrix M is any matrix, that when multiplied by M, gives the unit matrix (I) - in this case: [{1 0} {0 1}]
First, we have to determine if the matrix can be inverted or not. A matrix can only be inverted if it is square, and if the determinant is not zero (the determinant of a matrix is analogous to a single numeric value, representing the "size" of a matrix. the inverse of 0 makes no sense, as 1/0 is undefined)
The determinant of M, det(M), is calculated as follows:
det(M) = ad-bc.
Now, to calculate the inverse of M. In general, there are many methods for calculating inverse matrices, and these methods get progressively more complicated the larger the matrix. However, for a 2x2 matrix, there exists a simple method:
inverse of M = (1/det(M))[{d -b} {-c a}]
The top left and bottom right values are swapped, and the top right and bottom left values are multiplied by -1. Then every value of the matrix is divided by the determinant of the original matrix.
It is important to note that this method only works for 2x2 matrices - trying it with any other type of matrix would yield false results, if any.