TITLE: Functions satisfying $g(1 - g(x)) = x$
QUESTION [7 upvotes]: I need to find all functions with $g(1 - g(x)) = x$ and $x\in \mathbb{R}$. I must also provide a specific example of such function. My first attempt was to invert the expression yielding $g(x) = 1 - g^{-1}(x)$ and inverting again $x = g^{-1}(1 - g^{-1}(x))$. But this doesn´t bring me any further. I am not familiar with this type of problem and appreciate some guidance.

REPLY [6 votes]: There is no such continuous function. Notice that if for all $\,x\,$ we have $\, g(1-g(x)) = x, \,$ then the inverse function $\, g^{-1}(x) = 1 - g(x) \,$ implies that $\,g\,$ is a bijection. Since it is defined on the reals this implies that the function is strictly monotone increasing or decreasing. In both cases the composition $\, g(1-g(x)) \,$ is monotone decreasing which contradicts it being equal to $\,x.$
If there are no restrictions on the function $\,g\,$ then it can be very arbitrary. We prove a general result. Suppose $\, t(x) \,$ is any involution and suppose $\, g(t(g(x)) = x \,$ for all $\,x \in \mathbb{R}.\,$ Thus
 $\,g\,$ is a bijection.
 Given any $\, a \in \mathbb{R},\,$ then let
 $\, b := g(a),\, c := t(b),\, \,$ and now, $\, a = g(c). \,$ Thus
 $\, b = g(g(c)) = t(c), \,$ because $\, t \,$ is an involution. Thus
 $\, t(x) = g(g(x)) \,$ for all $\, x\in \mathbb{R}.\,$ This is the only restriction on $\,g.$
In other words, this general result uses only elementary group theory.
Suppose $\, t,g \in G \,$ a group such that $\, 1 = tt = gtg. \,$
Then $\, t(tg) = (tt)g = g = g(gtg) = (gg)(tg), \,$ and therefore
 $\, t = gg.\,$
Note that in our original question, if we define $\, f(x) = g(x+\frac12)-\frac12, \,$ then $\, -x = f(f(x)). \,$ Some good solutions to this are
in question 312385 
"Find a real function f:R->R such that f(f(x))=-x?" If you want concrete
examples of functions $\, g \,$ then take a look at the solutions there.
A nice solution is given as $\, f(x) = \text{sign}(x) (1 - (-1)^{\lceil x\rceil}) \,$ which is only piecewise continuous.