# Functional Square Root of Piecewise Functions

Let $s:\mathbb R\to\mathbb R$ be the function defined as $$s(x)=x+(-1)^{\lfloor x\rfloor}$$ Find a function $t:\mathbb R\to \mathbb R$ such that $t^{\circ 2}=s$, or prove that no such function exists.

I was fairly sure that I could construct such a function $t$ by taking multiple cases and defining it as a piecewise function. I started by expressing $s$ as a piecewise function: $$s\left(x\right) = \left\{ \begin{array}{lr} x+1 & : \lfloor x\rfloor \operatorname{even}\\ x-1 & : \lfloor x\rfloor \operatorname{odd} \end{array} \right.\\$$ This gave me the idea of trying to construct $t$ as a piecewise function. And since $s$ depended on parity, I decided to construct $t$ according to the remainder of $x$ modulo $4$.

Through a bit of trial and error, I figured out that this wouldn't work, so I tried modulo $3$, which also didn't work. I eventually came up with the following, based on remainders modulo $5$: $$t\left(x\right) = \left\{ \begin{array}{lr} x+2 & : \lfloor x\rfloor \equiv 0 \pmod 5\\ x+2 & : \lfloor x\rfloor \equiv 1 \pmod 5\\ x-1 & : \lfloor x\rfloor \equiv 2 \pmod 5\\ x-3 & : \lfloor x\rfloor \equiv 3 \pmod 5\\ x+4 & : \lfloor x\rfloor \equiv 3 \pmod 5\\ \end{array} \right.\\$$

Anyways, that question took way too long to solve (too much trial and error). Are there any general methods for constructing half-iterates of piecewise functions, without resorting to trial and error? It would be very helpful to know how I should attack this kind of problem.

For example, suppose I wanted to find the functional square root of $$f\left(x\right) = \left\{ \begin{array}{lr} x+5 & : -\infty\lt x\le -5 \\ 1-2x & : -5\lt x\le 1\\ 4x-4 & : 1\lt x\le \infty\\ \end{array} \right.\\$$ How might I go about doing this?

Note that $t^{\circ 4}=s^{\circ 2}=\operatorname{id}$. While $s$ maps $0+\epsilon\mapsto 1+\epsilon\mapsto 0+\epsilon$ and $2+\epsilon\mapsto 3+\epsilon\mapsto 2+\epsilon$, we can simply let $t$ map $0+\epsilon\mapsto2+\epsilon\mapsto1+\epsilon\mapsto3+\epsilon\mapsto0+\epsilon$. Simply extend this pattern, i.e.
$$t(x)=\begin{cases}x+2&\text{if }\lfloor x\rfloor\equiv 0\pmod 4\\ x+2&\text{if }\lfloor x\rfloor\equiv 1\pmod 4\\ x-1&\text{if }\lfloor x\rfloor\equiv 2\pmod 4\\ x-3&\text{if }\lfloor x\rfloor\equiv 3\pmod 4 \end{cases}$$
• This can't be right. If $s$ is an involution, then so is $2s(x/2)$, making $t$ an involution, and thus not the half-iterate of $s$. – Franklin Pezzuti Dyer Oct 14 '17 at 16:59