I teach precalculus and I was addressing a common misconception that students have when I came across something puzzling to me. When we graph $\sin^{-1}(\sin(x))$ and $\cos^{-1}(\cos(x))$ we get a zigzag line as the graph. Are there other ways that do not involve piecewise functions to get a zigzag line with finitely many bumps, or a different formula that gives infinitely many bumps?
For the finite question, I can think of using nested absolute values to get finitely many bumps with the sequence of functions $f_0(x) = |x|, f_n(x) = |1-f_{n-1}(x)|$, where $f_n$ has $n$ bumps. This is where my ideas dry up. I can't seem to find another method that gives similar results for finite bumps and I don't know where to start for infinite bumps.