Positive real numbers $x$ and $y$ satisfy \[ || \cdots|||x|-y|-x| \cdots-y|-x|=|| \cdots|||y|-x|-y| \cdots-x|-y| \] where there are 2019 absolute value signs $|\cdot|$ on each side. Determine, with proof, all possible values of $\frac{x}{y}$.
Solution: Clearly $x=y$ works. Else WLOG $x<y$, define $d=y-x$, and define $f(z):=|| z-y|-x|$ so our expression reduces to \[ f^{1009}(x)=\left|f^{1009}(0)-y\right| . \] Now note that for $z \in[0, y], f(z)$ can be written as \[ f(z)= \begin{cases}d-z, & 0 \leq z \leq d \\ z-d, & d<z \leq y\end{cases} \] Hence $f(f(z))=f(d-z)=z$ for all $z \in[0, d]$. Therefore \[ \left|f^{1009}(0)-y\right|=|f(0)-y|=x \] If $x>d$ then $f^{1009}(x)<x$ which is impossible (if $f^{1009}(x) \leq d$ then the conclusion trivially holds, and if $f^{1009}(x)>d$ we must have $\left.f^{1009}(x)=x-1009 d<x\right)$. Therefore $x \leq d$, so $f^{1009}(x)=f(x)=d-x$ and we must have $d-x=x$. Hence $y=3 x$ which is easily seen to work. To summarize, the possible values of $\frac{x}{y}$ are $\frac{1}{3}, 1,3$. $\fbox{\frac{1}{3}, 1,3}$.