How to show that if $x=(p,q)$ and $y=(p',q')$ then $x \sim y $ if $pq'=p'q$ is an equivalence relation? Suppose you have: 

$x=(p,q)$ and $y=(p',q')$ with $p, q \in \mathbb{Z}$ and $q \not = 0$ then $x \sim y$ if $pq'=p'q$ is an equivalence relation?

So I managed to show that its reflexivity and symmetry, but I am unable to prove that it's transitive.
 A: Suppose $x\sim y$ and $y\sim z$ where $x=(p,q),y=(p',q'),z=(p'',q'')$
Before looking at whether $pq''=p''q$, let us take a roundabout way of seeing this.  Consider $pq''q'$.  We wish to show that $pq''q'=p''qq'$
Indeed:
$pq''q'=(pq')q''=(p'q)q''=(p'q'')q=(p''q')q=(p''q)q'$
At each step of the above chain of equalities, we either used commutativity and associativity of multiplication of integers, or we used $x\sim y$ or $y\sim z$.
Subtracting the far right from the far left we have:
$(pq''-p''q)q'=0$
As $\Bbb Z$ is an integral domain, this implies either that $pq''-p''q=0$ or that $q'=0$, but we are told ahead of time that $q'\neq 0$ since this relation is over $\Bbb Z\times (\Bbb Z\setminus\{0\})$
We have then $pq''-p''q=0$ which then implies that $pq''=p''q$.  In other words $x\sim z$
A: Assume that $(p,q)\sim(p′,q′)$ and $(p′,q′)\sim(p′′,q′′)$. Then $pq′=p′q$ and $p′q′′=p′′q′$ and so
$(pq′′)q′ = (pq′)q′′ = (p′q)q′′ = (p′q′′)q = (p′′q′)q = (p′′q)q′$.
Since $q′ \neq 0$, we have $pq′′ = p′′q$, that is, $(p,q)\sim(p′′,q′′)$.
