TITLE: Show that if $x^2 y=2x+y$, then if $y \neq 0$ then $x \neq 0$
QUESTION [6 upvotes]: Prove if $x^2 y=2x+y$, then if $y \neq 0$ then $x \neq 0$. Obviously, $x,y \in \mathbb R$.
I know this is rather simple. It is more about the process than this example.
Is it logically correct to do the following:
Suppose $x^2 y=2x+y$, and $x=0$. It follows that $y=0$. Therefore if $y \neq 0$ then $x \neq 0$. 
Is this correct use of the contrapositive?

REPLY [5 votes]: You are correct. What you've done is essentially a proof by contradiction (assume the opposite of what you're trying to prove, derive something that contradicts something you know to be true, and this implies that what you're trying to prove is true).