Add the identity matrix to the end of your matrix. If your matrix is a 2 x 2 matrix, then the identity matrix is written next to it, as such:
1 3 | 1 0
1 2 | 0 1
Multiply the first row by the number necessary to get the first value in the row to be 1. In this example, the first value is already 1, so you do not need to multiply the row by anything. This operation is done to all numbers in the first row, resulting in the following matrix:
1 3 | 1 0
1 2 | 0 1
The second row is unchanged.
If instead you were given the following matrix, you would multiply the first row by 1/3 to result in the second row shown below:
3 9 | 1 0
Multiply by 1/3 to result in:
1 3 | 1/3 0
Multiply all subsequent rows by the negative inverse of the first value in row one. This operation is done to all values in the row. In the example given, the second row is multiplied by -1, the negative inverse of 1, giving the values:
-1 -2 | 0 -1
This becomes the new second row of the matrix. The first row remains unchanged.
Add each subsequent row and the first row placing the result in each subsequent row's original place. You start with row two, add row two to row one and place the resulting values in row two. Continue until you've completed the rows. This operation will result in a value of 0 in every first location other than row one. We have essentially started to create the identity matrix on the left side of the matrices. In our example, this step will result in the following matrix:
1 3 | 1 0
0 1 | 1 -1
Repeat steps 2 through 4 until the left matrix is the identity matrix. The matrix on the right is the inverse matrix. For our example, the steps would result in:
1 0 | -2 3
0 1 | 1 -1
The resulting inverse matrix is:
-2 3
1 -1