# On Michael Penn's 'Strange Function'

## August 16, 2022 | 1 minute, 48 seconds

Michael Penn's new video introduced the function:

\[ f(x) = x-\frac{1}{2}+\frac{1}{\pi}{\arctan(\cot(\pi x))}\]

His video provides an awesome perspective into how to analyse a wild function like this and is well worth watching. With this being said, I figured this would be a good time to plug in some of the piecewise stuff, as composition of (inverse) trigonometric functions tend to lend themselves to being quite piecewise. For this post, we'll opt for the far simpler function:

\[ g(x) = \arctan(\cot(\pi x))\]

From there, we'll see why \(f(x)\) is of interest.

Let us take the \(\tan\) of both sides, giving us:

\[ \tan(g)=\cot(\pi x)\]

We're going to bruteforce this a bit by using the complex exponential definitions of \(\tan(g)\) and \(\cot(x)\):

\[ -1+\frac{2}{\exp(2gi)+1}=1+\frac{2}{\exp(2\pi xi)-1}\]

From here, we have that:

\[ \exp(2gi)+1=\frac{\exp(2\pi xi)-1}{\exp(2\pi xi)}=1-\frac{1}{\exp(2\pi xi)}\]

Writing everything in terms of exponentials, we get:

\[ \exp(2gi)=\exp(i\pi(1-2x))\]

Let \(n\in\mathbb{Z}\). Then solutions for this equation exist:

\[ 2g=\pi(1-2x)+2n\pi\implies g(x)=\frac{\pi}{2}(1-2x+2n)\]

Revisiting our original function \(g(x)\), we have that \(g(x)\in(-\frac{\pi}{2},\frac{\pi}{2})\) by definition of the inverse tan function. Substituting our linear solutions into this inequality gives us:

\[ x\in(n,n+1)\]

Therefore, our entire solution for \(g(x)\) is given by the following piecewise function:

\[ g(x)=\left\{\frac{\pi}{2}(1-2x+2n),\quad x\in(n,n+1)\mid n\in\mathbb{Z}\right\}\]

We can simplify this expression (refer to previous posts here, which gives a better insight into how this simplification is done), giving us:

\[ g(x)=\frac{\pi}{2}\left(1-2x+2\lfloor x\rfloor\right),\quad x\not\in\mathbb{Z}\]

Returning to the beginning, plugging this into \(f(x)\) gives us \(f(x)=\lfloor x\rfloor\) for non-integer \(x\). For what it's worth, this function can't be patched via our original expression; left and right limits of integer \(x\) differ. Desmos, on the other hand, might have you believing something else.