Is there a way to define modulo division (or functions of modular arithmetic in general) as superposition of (elementary?) functions?

For example, the multiplication is first introduced as summation, the exponentiation - as multiplication, etc. The trigonometric functions can be expressed through other elementary functions. Moreover, a wide range of "continuous" functions can be expressed as infinite series of different nature, whether we are talking about complete set of functions in $L_p$ space, or about derivatives of infinitely differentiable function combined in Taylor series.

I wonder if it is possible to define functions from modulo arithmetics as closed-form expressions of functions which belong to classes listed in the table below. I have no doubts that it is possible to do so via infinite series, although I do not know how. However, I am particularly interested in closed-form expressions from the table

enter image description here

I find this table from this wikipedia article extremely interesting, although it is devoted to the closed-form expressions only and missing modulo arithmetic.


2 Answers 2


I believe what you are looking for is this:

$$ x \bmod M = [\frac{1}{2} + \frac{i}{2\pi}\ln(-e^{-i2\pi x/M})]\times M $$

You can check it out graphed here:

I stumbled upon this post because I was playing around with the function $(-1)^x$ which has a real and imaginary part that are periodic and out of phase. Using Euler's formula I pulled out the part of the function that was cyclical and graphed it and saw that it was a saw wave. I generalized it by scaling it in the x and y direction by M.

Here is the Euler formula transform of the same function:

$$ x \bmod M = [\pi + \frac{\ln(\cos(\frac{2\pi (x+M/2)}{M}+M+\ln(2))+i*\sin(\frac{2\pi (x+M/2)}{M}+M+\log(2)))}{i}]\times \frac{M}{2\pi} $$

You can also derive this by taking the closed form solution that drops out of the infinite Fourier series:

Note that the Gibbs phenomenon that you get with a finite number of terms when approximating the saw wave disappears with the closed form solution.

  • $\begingroup$ This website uses MathJax for math formulas and symbols. $\endgroup$ Jun 27, 2016 at 18:18
  • $\begingroup$ I converted it to MathJax. $\endgroup$ Jun 28, 2016 at 18:29

Though it isn't perfect, you can create a "saw-tooth" function which is pretty much a periodic linear function. For example, if you want to take $\mod 3$, you have the function $f$ which has period $3$ and looks like $f(x) = x$ for $x \in [0, 3)$.

You can approximate this saw-tooth function using a Fourier series which involves harmonics of the form $e^{2 \pi i n x}$.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .