For what $z\in\mathbb{N}$ is "$x\equiv y\iff xyz$ is a square" an equivalence relation? Consider the set $\mathbb{N}\cup\{0\}$ and fix $z\in \mathbb{N}\setminus\{0\}$.
Define the relation $x \equiv y \iff xyz$ is a square number.
I am trying to verify that this is an equivalence relation, but I have discovered that this need not be the case as it depends on the restrictions on $z$.
So I was wondering for which $z\in \mathbb{N}\setminus\{0\}$ the relation $\equiv$ is reflexive, symmetric and transitive.
 A: Let's look at ensuring reflexivity is satisfied first. This will be perhaps the most constraining property on the value(s) of $z$.
For reflexivity, we need $x \equiv x $ for all $x \in \mathbb N\cup\{0\}$.
This means, we need a fixed $z\in \mathbb N \setminus \{0\}$ such that $x\cdot x \cdot z = x^2 z$ is a perfect square for every $x$. Certainly, $x^2$ is a perfect square. So if $x^2z$ is to be a perfect square, no matter what the value of $x$, what does that force $z$ to be?
Now, with those values of $z$, you need to check whether symmetry and transitivity are satisfied to determine if we have an equivalence relation on $\mathbb N \cup \{0\}$.
A: Hint $ $ By reflexivity deduce that $\,z = a^2\,$ is a square, using the Fundamental Theorem of Arthmetic (existence and uniqueness of prime factorizations), i.e. $\,x\equiv x\iff x^2 z = n^2,\,$ so comparing the parity of exponents of primes in the unique prime factorizations of both sides shows that the exponents in $\,z\,$ are all even, so $\,z\,$ is square. Therefore, by the same parity we deduce 
$\qquad\qquad  x\equiv y \iff xy a^2$ is square $\iff xy\,$ is square $\iff {\rm sf}(x) = {\rm sf}(y)$
for $\,{\rm sf}(n) :=\,$ squarefree part of $\,n.\,$ But relations of this form are always equivalence relations:

It is straightforward to prove relations of  form $\rm\,  x\sim y {\overset{\ def}{\color{#c00}\iff}} f(x) = f(y)\, $ are equivalence relations.
More generally, suppose $\rm\ u\sim v\ \smash[t]{\overset{\ def}{\color{#c00}\iff}}\, f(u) \approx f(v)\ $ for a function $\rm\,f\,$ and equivalence relation $\,\approx.\, \ $ Then the equivalence relation $\rm\color{#0a0}{properties\ (E)}\,$  of $\,\approx\,$ transport (pullback) to $\,\sim\,$ along $\rm\,f$ as follows


*

*reflexive  $\rm\quad\ \color{#0a0}{\overset{(E)}\Rightarrow}\, f(v) \approx f(v)\:\color{#c00}\Rightarrow\:v\sim v$

*symmetric  $\rm\,\ u\sim v\:\color{#c00}\Rightarrow\ f(u) \approx f(v)\:\color{#0a0}{\overset{(E)}\Rightarrow}\:f(v)\approx f(u)\:\color{#c00}\Rightarrow\:v\sim u$

*transitive $\rm\ \ \ u\sim v,\, v\sim w\:\color{#c00}\Rightarrow\: f(u)\approx f(v),\,f(v)\approx f(w)\:\color{#0a0}{\overset{(E)}\Rightarrow}\:f(u)\approx f(w)\:\color{#c00}\Rightarrow u\sim w$
Such relations are called (equivalence) kernels. One calls $\, \sim\,$ the $\,(\approx)\,$ kernel of $\rm\,f.$ 
Yours is the special case when $\,\approx\,$ is the equivalence relation of equality.
