What must I do to plot the graph of $\sin x=\sin y$ I must represent the domain of the function: $$z=\frac{x-y}{\sin x-\sin y}$$ 
Therefore, $\sin x\neq\sin y$. 
So I must plot $\sin x=\sin y$. How do I do this?
 A: $\sin y = \sin x \iff y = n\pi +(-1)^nx,\text{ for some $n\in \mathbb{Z}$}$.
Putting $n=0$, we see that $y = x$ is on the graph.
Putting $n=1$, we see that $y = -x +\pi$ is also on the graph.
So for all even $n$, we have the set of straight lines:
$y = x + -4\pi,\,\quad y = x + -2\pi,\,\quad y = x,\,\quad y = x + 2\pi$ and so on so forth.
Likewise, for all odd $n$:
$y = -x + -3\pi,\,\quad y = -x + -\pi,\,\quad y = -x + \pi,\,\quad y = -x + 3\pi$ and so forth.
A: $\sin y = \sin x \iff y = x +2k\pi \text{ or } y = \pi-x+2k\pi,\text{ for some $k\in \mathbb{Z}$}$.
The two equations on the RHS of the equivalence correspond to lines.
Therefore, the set $\{(x,y) \in \mathbb{R}^2 \mid \sin x = \sin y\}$ (over which the function is not defined) is a "crisscross" of such lines; the restriction of that set over $[-40,40]^2$ looks as follows:


$\LaTeX$ code:
\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
 \def\PI{3.1416}
 \begin{axis}[xlabel=$x$, ylabel=$y$,ymin=-40,ymax=40]
  \foreach \k in {-15,...,15}{
   \addplot[red, ultra thin,domain=-40:40] (x,x+2*\PI*\k);
   \addplot[red, ultra thin,domain=-40:40] (x,\PI-x+2*\PI*\k);
  }
 \end{axis}
\end{tikzpicture}
\end{document}

A: $$\begin{align}
\sin(y) &=\sin(x)\\
\implies y&=\arcsin(\sin(x))+2\pi\,n\text{ or }\pi-\arcsin(\sin(x))+2\pi\,n\\
\implies y&=\arcsin(\sin(x))+2\pi\,n\text{ or }\pi-\arcsin(\sin(x))+2\pi\,n\\
\end{align}$$
for some $n\in\mathbb{Z}$.
Now $\arcsin(\sin(x))$ is a sawtooth function with slope $1$ over $(-\pi/2,\pi/2)$ and slope $-1$ over $(\pi/2,3\pi/2)$. Accounting for all vertical translations by an integer multiple of $2\pi$, and then also for all vertical reflections over the $x$-axis followed by a vertical translation by $\pi$, the domain is the complement of a criss-cross lattice with a generating square with vertices $(-\pi/2,-\pi/2),(-3\pi/2,\pi/2),(-\pi/2,3\pi/2),(\pi/2,\pi/2)$.
