2×2 inverse matrix formula

Previously we calculated $$ \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix}^{-1} = \begin{bmatrix} -2 & 1 \\ \frac{3}{2} & -\frac{1}{2} \end{bmatrix}. $$ There's a pattern in this inverse matrix. To see it, let's rewrite it as a multiplication with a matrix and a number: $$ \begin{bmatrix} 1&2 \\ 3&4 \end{bmatrix}^{-1} = \frac{1}{2} \begin{bmatrix} -4 & 2 \\ 3 & -1 \end{bmatrix} $$ If we ignore the $\frac{1}{2}$ for now, we see that the resulting matrix contains the same numbers as the original matrix. Specifically, it seems like the inverse of a $2 \times 2$ matrix $$ A = \begin{bmatrix} a & b \\ c & d \end{bmatrix} $$ is $$ A^{-1} = (\text{some number}) \begin{bmatrix} -d & b \\ c & -a \end{bmatrix}, $$ where the top left and bottom right corner are swapped, and they also have minuses in front.

With the correct inverse matrix, we have $A^{-1}A = I$. Let's see what we get if we instead use our guessed inverse matrix, ignoring the number in front for now: $$ \begin{align} \begin{bmatrix} \red{-d} & \red b \\ \blue c & \blue{-a} \end{bmatrix} \begin{bmatrix} \magenta a & \green b \\ \magenta c & \green d \end{bmatrix} &= \begin{bmatrix} \red{(-d,b)} \cdot \magenta{(a,c)} & \red{(-d,b)} \cdot \green{(b,d)} \\ \blue{(c,-a)} \cdot \magenta{(a,c)} & \blue{(c,-a)} \cdot \green{(b,d)} \end{bmatrix} \\ &= \begin{bmatrix} -ad+bc & 0 \\ 0 & bc-ad \end{bmatrix} = (-ad+bc)I \end{align} $$ If $-ad+bc \ne 0$, we can divide by it, and we get $$ \frac{1}{-ad+bc} \begin{bmatrix} -d & b \\ c & -a \end{bmatrix} \begin{bmatrix} a & b \\ c & d \end{bmatrix} = I. $$ Just like in this derivation, this shows that the original matrix $A$ is invertible, and we also get a formula for its inverse.

If $-ad+bc \ne 0$, then $$ \begin{bmatrix} a & b \\ c & d \end{bmatrix}^{-1} = \frac{1}{-ad+bc} \begin{bmatrix} -d & b \\ c & -a \end{bmatrix}. $$

We will later figure out what happens if $-ad+bc=0$.