Representation of $x \bmod a$ with Trigonometric Functions

modular arithmetictrigonometry

After fidgeting around with the compositions of trigonometric functions and inverses of them, I realized that the following function gives a graph strongly resembling a sawtooth wave (you can check from desmos.com or a graphing calculator):

$$ f(x) = \arctan(\cot(x))$$

This function has a period of $\pi$, an amplitude of $\frac \pi 2$, and a constant negative slope, so with the help of transformations, we can turn it into a function with a period and amplitude of $a$ as follows:

$$ f(x) = \frac a 2 – \frac {a \arctan(\cot(\frac {\pi x} a))} \pi$$

If looked carefully at this function, for all $x,a \in \mathbb{Z}$, it is exactly the same as the function $g(x) = x \bmod a$. To give an example, if we let a be 4:

$$ f(6) = 2 – \frac {4 \arctan(\cot(\frac {6 \pi} 4))} \pi = 2 – \frac a \pi \arctan(0) = 2 $$
$$ g(6) = 6 \bmod 4 = 2$$
$$ f(6) = g(6) =
2$$

My question is about the usefulness of this fact. What could be some applications of this identity, if any? Would it be of any use when dealing with modular arithmetic or trigonometric functions?

Best Answer

This behavior is a result of the definition of $\arctan$. Because $\tan$ is not a one-to-one function, it doesn't have an inverse. So we define $\arctan(y)$ to be the unique value $x$ in the interval $(-\frac{\pi}{2},\frac{\pi}{2})$ such that $\tan(x) = y$. Thus, the function $\arctan(\tan(x))+\frac{\pi}{2}$ reduces $x$ modulo $\pi$.

We can relate this to your function with the identity $\cot(x) = \tan(\frac{\pi}{2}-x)$, which explains the negative slope.

The modular arithmetic–like behavior that you noticed arises from this interaction between $\arctan$ and $\tan$: Because there are infinitely many $x$ such that $\tan(x)=y$, $\arctan$ chooses a unique representative, which is equivalent to reducing $\text{mod}\ \pi$. It's really just reflective of the (arbitrary) way we define $\arctan$.

Related Question