first of all, we have to know a priori that A and B are invertibile, so that A-1 and B-1 exist.
(AB)B-1 = A(BB-1) = AI = A
(AB)(B-1A-1) = [(AB)B-1]A-1 (by associativity)
and we just showed that the term inside the square brackets is A (above), so
= AA-1 = I
in the same way:
A-1(AB) = (A-1A)B = IB = B, so:
(B-1A-1)(AB) = B-1[A-1(AB)]
= B-1B = I
the basic idea is this:
multiplying AB by B-1A-1 on the right, is the same as multiplying AB by B-1 on the right first, and by A-1 second.
multiplying AB by B-1A-1 on the LEFT, is the same as multiplying AB by A-1 on the left first, and by B-1 second.
the way to remember this is:
if A is "putting on your socks" and B is "putting on your shoes", then to un-do it, you do the opposite actions "in reverse order" (it doesn't make much sense to take off the socks before the shoes, does it now?).
it's very important to know that if A is invertible, and B is invertible, so is AB. this means we can multiply invertible matrices, and get another invertible matrix. it also means that if we know how to compute the inverses of A and B, we get the inverse of AB "for free".
let's see this in action:
multiplying together the two inverses for A and B in reverse order, we have:
which is easily seen to be the inverse of AB.