Explaining invertible matrices with linear transformations

Suppose that $A$ and $B$ are square matrices and that $AB$ is invertible. Using the interpretation of multiplication by $A$ (or $B$) as a linear transformation from $\Bbb{R}^n \to \Bbb{R}^n$, explain why both $A$ and $B$ must be invertible.

So I think it has to do with $x \mapsto Ax$ and $x \mapsto Bx$ being onto and one-to-one and then using the invertible matrix theorem, but I don't quite understand how to answer this precisely.

A matrix/transformation is invertible if and only if its kernel is $\{\vec 0\}$. In other words, a matrix/transformation is invertible if and only if the only vector it sends to zero is the zero vector itself.
Now, assume that $AB$ is invertible, i.e. $ABv\ne0$ for every $v\ne0$:
1. If $Bv=0$ (with $v\ne0$) then clearly also does $ABv=0$, which is a contradiction. Thus, invertibility of $AB$ implies invertibility of $B$.
2. If $Av=0$ then $AB(B^{-1}v)=0$ (we already know that $B$ is invertible), which is a contradiction again.
• @user3427042 $T : V \rightarrow W$ is injective (one-to-one) iff $\ker(T) = \{ 0 \}$ – bthmas Oct 24 '16 at 2:18