# How do I show that the equivalence relation defining the rational numbers is transitive?

I apologize if this is a super easy question, but there is something fishy about my proof.

I was to show:

$$(p,q) \sim (m,n) \wedge (m,n) \sim (a,b) \implies (p,q) \sim (a,b)$$

under the equivalences relation of rational numbers (i.e. $(a,b) \sim (c,d) \equiv a,b,c,d \in \mathbb{Z}, ad = bc \wedge b,d \neq 0$).

So what I have is that I know that the LHS ($(p,q) \sim (m,n) \wedge (m,n) \sim (a,b)$) of what I want to show means I know by assumption that the following is true:

1. $pn=mq$, $q,n \neq 0$
2. $mb=an$, $n,b \neq 0$ and we want to show:
3. $pb = aq$, $n,b \neq 0$

Its pretty obvious to show $n,b \neq 0$ but I feel I am doing something wrong when trying to apply the cancellation law.

I have $pn=mq$ is true and multiply that by $a$ and $b$ to get:

$$anpb = mbaq$$

since we know $mb=an$ we can use the cancellation law to get:

$$(an)pb = (mb)aq \rightarrow pb = aq$$

Just as I required. However, I don't think this proof is correct, because no where in the assumption did we ever say that $a \neq 0$, so $a$ might not have a multiplicative inverse in the group of integers. Is this proof correct or do I have to handle the case where the "numerators" might be zero separately?

• If $a=0$ then $p=0$ since by assumption $b \neq 0$ and therefore $m=0$ since by assumption $q \neq 0$ and the result holds. (In the same way if you take $m=0$ yo can deduce that $a=0$) Jun 7, 2015 at 18:49
• Handling the zero case separately is the safe thing to do, as it often is in algebra. Jun 7, 2015 at 18:50

We have $(p,q)\sim(m,n)$ and $(m,n)\sim(a,b)$ and we know that integer multiplication is commutative. Now we have the following using $pn=mq$ and $mb=an$:
$$pbn=pnb=mqb=qmb=qan=aqn$$
Hence we may cancel $n\neq0$ from the right hand side and obtain $pb=aq$. In particular we have shown that $(p,q)\sim(a,b)$ and so the relation is transitive as desired.