# Moriarty's calculator: some bizarre and deceptive graphical anomalies

Background: This is a problem I first came across a few years ago in a calculus textbook (a James Stewart one), where it addressed some of the pitfalls of using graphing calculators. The original context addressed issues with the TI-83 calculator, but seeing as that most people use the vaunted TI-89 nowadays, I thought I would consider some issues with that one. My first few considerations proved to be simple to handle (and I will outline them below), but there is one that I have no idea how to address properly. I think it is sufficiently bizarre so as to call the challenge problem Moriarty's Enigma.

Necessary information: The TI-89 Guidebook gives information on how the calculator draws objects given the screen dimensions of the calculator. Screen dimensions for all TI graphing calculators may be found here. The relevant information from the guidebook may be found here (link provided so as not to make an already long post even longer).

The main point is that the graphing window is $159$ pixels wide and we want to start with $x=0$ and $x=2\pi$ (the reason for this will become very clear in a moment). Since there are $158$ "gaps" between pixels, the distance between pixels is $\frac{2\pi-0}{158}$. Thus, the $x$-values that the calculator actually plots are $x=0+\frac{2\pi}{158}\cdot n$, where $n=0,1,2,\ldots,158$.

Elementary, my dear TI-89: First consider the graph of $y=\sin(161x)$, which is graphed below in dot mode on the window $0\leq x\leq 2\pi, -1.5\leq y\leq 1.5$ (this will be the window used in all examples so that my results will be reproducible by other users if desired): Now consider when the functions $y=\pm\sin(3x)$ are graphed simultaneously in square mode: It certainly looks as if $\sin(161x)=\pm\sin(3x)$. This actually makes sense in terms of the pixel information noted earlier: for $y=\sin(161x)$, the actual points plotted by the calculator are $\left(\frac{2\pi}{158}\cdot n,\sin\left(161\cdot\frac{2\pi}{158}\cdot n\right)\right)$ for $n=0,1,2,\ldots,158$. But \begin{align} \sin\left(161\cdot\frac{2\pi}{158}\cdot n\right) &= \sin\left(158\cdot\frac{2\pi}{158}\cdot n+3\cdot\frac{2\pi}{158}\cdot n\right)\\[1em] &= \sin(2\pi n)\cos\left(3\cdot\frac{2\pi}{158}\cdot n\right)+\sin\left(3\cdot\frac{2\pi}{158}\cdot n\right)\cos(2\pi n)\quad\text{[$\sin(\alpha+\beta)$]}\\[1em] &= \pm\sin\left(3\cdot\frac{2\pi}{158}\cdot n\right),\qquad n=0,1,\ldots,158 \end{align} Thus, the $y$-values, and hence the points, plotted for $y=\sin(161x)$ lie on either $y=\sin(3x)$ or $-\sin(3x)$, as confirmed by the previous graph.

The same reasoning can be used to show that all of the $y$-values for $\sin(158x)$ are plotted as zero: At this point, I was feeling confident about my ability to understand and detect graphing anomalies for trigonometric functions due to periodicity and the like, but the next function has thus far thwarted my analysis completely.

Moriarty's Enigma: Graph $\sin(77x)$ in line mode: I can deduce how $\pm\sin(2x)$ comes into the mix (similar to the $\sin(161x)$ example), but I cannot see how $\pm\cos(2x)$ fits in. The $y$-values for $\sin(161x)$ seem to be a mixture of $\pm\sin(2x),\pm\cos(2x)$, and an array of different trigonometric functions. Here is the graph when all five functions are plotted simultaneously ($\sin(77x)$ plotted in line mode while $\pm\sin(2x),\pm\cos(2x)$ in square mode): As if that were not weird enough, graph $\sin(77x)$ and $\pm\sin(81x)$ in line mode: Finally, graph $\sin(77x)$ and $\cos(77x)$ in line mode: What other functions might be hidden in $\sin(77x)$ when graphing on the window $0\leq x\leq 2\pi, -1.5\leq y\leq 1.5$ for the TI-89? Where do $\pm\cos(2x)$ come into play? What about $\sin\left(\frac{77x}{79}\right)$ [fills in the diamond-looking regions] or $-\sin\left(\frac{77x}{79}\right)$ [runs tangent to / crosses middle max], etc.

• My reaction to the last image was the last image itself... xD – AvZ Feb 14 '15 at 7:36
• @AvZ Yeah, I thought that gif summed things up perfectly--like what in the deuce is going on here. Bizarre. – Daniel W. Farlow Feb 14 '15 at 7:38
• I had encountered something similar when I plotted an animated plot of $y=\sin(10xt)$ where $t$ is the time. You can add that GIF. It'd illustrate this effect very well. – AvZ Feb 14 '15 at 7:41
• This is related to sampling-theory it seems. Ever heard of the Niquist-Shannon sampling theorem? – Raskolnikov Feb 14 '15 at 9:42
• See an animation of $\sin\left(q\frac{\pi}{158}n\right)$ for $q=1..158$ and samples at $n=1..158$. There you'll see sort of a "reflection" of the series near the end. Of course it is related to Nyquist-Shannon sampling theorem. Various patterns from points appear even at about $q=40$. – Ruslan Feb 16 '15 at 16:24

## 1 Answer

Don't actually know how exactly Nyquist-Shannon theorem is related to this, but here's a crackdown of what happens with $\sin\left(77\frac{\pi}{158}n\right)$ for $n=1..158$ (equivalently, $\sin(77x)$ with $x=\frac{\pi n}{158}$):

$$f(n)=\sin\left(77\frac{\pi}{158}n\right)=\sin\left(\left(\frac{79}{158}\pi-\frac{2\pi}{158}\right)n\right)=\\ =\sin\left(\left(\frac\pi2-\frac\pi{79}\right)n\right)=\sin\frac{\pi n}2\cos\frac{\pi n}{79}+\cos\frac{\pi n}2\sin\frac{\pi n}{79}.$$

Now consider 4 cases:

1. $n=1+4k,\,k\in\mathbb Z$, then $f(n)=\cos\frac{\pi n}{79}$
2. $n=2+4k,\,k\in\mathbb Z$, then $f(n)=-\sin\frac{\pi n}{79}$
3. $n=3+4k,\,k\in\mathbb Z$, then $f(n)=-\cos\frac{\pi n}{79}$
4. $n=0+4k,\,k\in\mathbb Z$, then $f(n)=\sin\frac{\pi n}{79}$

This is exactly what you asked about $\pm\sin(2x)$ and $\pm\cos(2x)$ functions inside samples of $\sin(77x)$, where $x=\frac{\pi n}{158}$.