Consider the matrix equation $$ ABx = Ay $$ where $A,B \in \mathbb{R}^{n \times n}$ are square matrices, and $x,y \in \mathbb{R}^n$ are column vectors. If $A$ is invertible, then I can multiply the equation by $A^{-1}$ and find $$ Bx = y $$ However, now if I modify $B$ to be $n \times m$ with $n > m$ and $x \in \mathbb{R}^m$, it seems to be no longer true that I can multiply by $A^{-1}$ and obtain $Bx = y$ (I've verified this with some matlab experiments).
So my question is under what circumstances can I multiply a matrix equation by $A^{-1}$ and still have the equation be true? This results seems a bit counter-intuitive.
$$ABx=Ay$$
$$A^{-1}ABx=A^{-1}Ay$$
$$I_nBx=I_ny$$
$$Bx=y$$
You can always do that. Perhaps you might want to check the code.