Generally let $\ x\sim y \iff ax = by\,$ for some $\,a,b\in M,\,$
where $M\subset \Bbb C$ is closed under $\rm\color{#0a0}{multiplication}$. Then
$\qquad\qquad\begin{align} &\ \ \overbrace{ax =\ \ by}^{\Large x\ \sim\ y}\\
\Rightarrow\ &cax = \color{#c00}{cb}y\\
\phantom{1}
\end{align}\ $
$\begin{align} &\overbrace{\ \,cy =\ dz}^{\Large y\ \sim\ z}\\
&\color{#c00}{bc}y = bdz\,\ \Rightarrow\ \underbrace{\color{#0a0}{ca}x = \color{#0a0}{bd} z}_{\Large x\ \sim\ z}\end{align}$
where $\,\color{#0a0}{ca,bd} \in M$ since $M$ is closed under $\rm\color{#0a0}{multiplication}$. Thus $\,\sim\,$ is transitive.
Remark $ $ We multiplied the 1st equation by $\,\color{#c00}c\,$ and the 2nd by $\,\color{#c00}b\,$ in order to unify (or overlap) the coefficients of $\,y,\,$ so that we could deduce transitivity of $\,\sim\,$ via transitivity of $\,=\,$.
Such unification or overlapping is ubiquitous method of deriving consequences of equations and axioms - often employed in term-rewriting and equational / axiomatic inference systems. See this answer for further discussion.