I'm trying to solve this problem:
If $A, B$ and $X$ are squared matrices with $X\neq 0$ and $AX=BX$, not necessarily $A=B$. What is the condition for A = B?
I know that X must be non-singular because
$$ AXX^{-1}=BXX^{-1} $$ $$ \Rightarrow AI=BI \Rightarrow A=B.$$
My question is: Is there another way to show this?
You have successfully argued that if $X$ is non-singular, then $A=B.$ However, you have not yet ruled out the possibility that there exists a singular $X$ and yet it is still the case that $A$ must equal $B$
$AX = BX\\ (A-B)X = 0$
If $X$ is singular it has a non-trivial left null space. There exist matrices $A,B$ with $A\ne B$ such that $(A-B)X = \mathbf 0$
If X is non-singular the left null-space is trivial and it must be the case that $A=B$