Suppose $ABC = ABD$ and $\text{rank}(AB) = \text{rank}(B)$.
It is said that $\text{rank}(AB) =\text{rank}(B)$ would imply $B = EAB$.
However, I fail to understand this implication as I understand that the rank gives us information about the dimension of column/rank space but not the values in the matrix.
Let $U$ be the image of $B$ and $W$ the image of $AB$. We are given that $\dim U=\dim W$ and conclude that $A|_U\colon U\to W$ is an isomorphism. Let $E$ be the inverse of $A$ on $W$ and arbitrary on a complement of $W$. Then $EAB=B$.