What are the $\sin$ and $\cos$ of discrete calculus?

$(1+i)^x$ and $(1-i)^x$ and their linear combinations. The real part of $(1+i)^x$ is OEIS sequence A146559, the imaginary part A009545.


There are solutions to $\Delta^2 f = -f$, but sadly they lack some of the interesting properties of their continuous counterparts: they are not periodic.

Fortunately there is a way to construct periodic analogues of $\sin$ and $\cos$, and both solutions (periodic and nonperiodic) have a connection with a much deeper question: if the discrete counterparts of real numbers are ordinary integers, which are the discrete counterparts of complex numbers?

It turns out there are two "natural" candidates: the Gaussian integers $a+bi$ and the Eisenstein integers $a+b\omega$, where $a,b\in\mathbb{Z}$ and $\omega = \frac{\sqrt{3}i-1}{2}$ is a third root of unity. These are special in that they are the only choices that generate a regular periodic lattice in the complex plane.

In analogy with the discrete real exponential, which is $(1+1)^x = 2^x$, one can define for each of these complex integers a discrete version of the imaginary exponential $e^{ix}$:

  • Gaussian imaginary exponential: $(1+i)^x$

  • Eisenstein imaginary exponential: $(1+\omega)^x$

Of these, only the Eisenstein imaginary exponential turns out to be periodic, the reason being that $|1+\omega| = |e^{\pi i/3}|=1$ (this has a geometrical interpretation: you can construct a regular hexagon of side $L$ inscribed in a circle of radius $L$, while you can't do that with a square). From these one can define the corresponding sines and cosines with a discrete Euler's formula:

$$(1+i)^x = \cos_G (x) + i \sin_G (x)$$ $$(1+\omega)^x = \cos_E (x) + \omega \sin_E (x)$$

Thanks to the periodicity of the Eisenstein exponential, you even have an analogue of Euler's identity and a discrete version of $\pi$:

$$(1+\omega)^3 + 1 = 0$$

where the discrete $\pi$ is $3$. In the Gaussian case the solutions have a sort of "semiperiod" equal to $4$, but it's not as satisfying.

At the level of difference equations, to get the periodic trigonometric functions one has to replace $\Delta^2$ by the central difference $\nabla \Delta$ (where $\nabla f(n) = f(n)-f(n-1)$).


Note that if $f(n)$ is a discrete sinusoid, then $$ f(n+1)=f(n)+\Delta f(n) $$ and $$ \Delta f(n+1) = \Delta f(n) + \Delta^2 f(n) = \Delta f(n) - f(n), $$ or $$ \left(\begin{matrix}f(n+1) \\ \Delta f(n+1)\end{matrix}\right)=\left(\begin{matrix}1 & 1 \\ -1 & 1 \end{matrix}\right)\left(\begin{matrix}f(n)\\ \Delta f(n)\end{matrix}\right). $$ Also, $$ \left(\begin{matrix}1 & 1 \\ -1 & 1 \end{matrix}\right)^2 = \left(\begin{matrix}1 & 1 \\ -1 & 1 \end{matrix}\right)\left(\begin{matrix}1 & 1 \\ -1 & 1 \end{matrix}\right)=\left(\begin{matrix}0 & 2 \\ -2 & 0 \end{matrix}\right), $$ $$ \left(\begin{matrix}1 & 1 \\ -1 & 1 \end{matrix}\right)^3 = \left(\begin{matrix}1 & 1 \\ -1 & 1 \end{matrix}\right)\left(\begin{matrix}0 & 2 \\ -2 & 0 \end{matrix}\right)=\left(\begin{matrix}-2 & 2 \\ -2 & -2 \end{matrix}\right), $$ $$ \left(\begin{matrix}1 & 1 \\ -1 & 1 \end{matrix}\right)^4 = \left(\begin{matrix}1 & 1 \\ -1 & 1 \end{matrix}\right)\left(\begin{matrix}-2 & 2 \\ -2 & -2 \end{matrix}\right)=\left(\begin{matrix}-4 & 0 \\ 0 & -4 \end{matrix}\right)=-4\hat{I}. $$ So the discrete $\cos$, which starts with $f(0)=1$ and $\Delta f(0)=0$, is $$ \left( 1, 1, 0, -2, -4, -4, 0, 8, 16, \ldots\right), $$ and the discrete $\sin$, which starts with $f(0)=0$ and $\Delta f(0)=1$, is $$ \left(0, 1, 2, 2, 0, -4, -8, -8, 0, \ldots\right). $$ The fact that these grow as $2^{n/2}$, rather than being periodic, is a consequence of your non-symmetric choice of $\Delta^2$. If you define $\Delta^2 f(n)=f(n-1) - 2f(n) + f(n+1)$, say, you will find functions closer to what you might have expected.