being somewhat bad at "memorizing things" i often have to "re-derive" this formula. here is how i do it:

suppose A =

[a b]

[c d].

i want to find B =

[x y]

[z w], so that AB = I. so:

ax + bz = 1

ay + bw = 0

cx + dz = 0

cy + dw = 1

that's 4 linear equations in 4 unknowns (x,y,z,w). if it has a solution, there will be only one.

from the first equation, and the third, we have:

adx + bdz = d

-bcx - bdz = 0

thus (ad - bc)x = d. if ad - bc ≠ 0, this gives:

x = d/(ad - bc).

from the second, and fourth equation, we get:

ady + bdw = 0

-bcy - bdw = -b

thus (ad - bc)y = -b, and again if ad - bc ≠ 0, this gives us:

y = -b/(ad - bc).

to solve for z, we use equations one and three again:

acx + bcz = c

-acx - adz = 0

thus (bc - ad)z = c, so

z = c/(bd - ac) = -c/(ad - bc)

finally, from equations two and four:

acy + bcw = 0

-acy - adw = -a

(bc - ad)w = -a

w = -a/(bc - ad) = a/(ad - bc).

it should come as no surprise that is is 1/(det(A) (= 1/(ad - bc)) times:

[d -b]

[-c a], as Soroban points out above.