TITLE: A question about composition of functions
QUESTION [9 upvotes]: Recently, I heard this question: are there two functions $f:\mathbb{R}\to\mathbb{R}$ and $g:\mathbb{R}\to\mathbb{R}$ such that $f\circ g$ is strictly increasing on $\mathbb{R}$ and $g\circ f$ is strictly decreasing on $\mathbb{R}$? I have the feeling that it is not new. Does anybody know any references?

REPLY [13 votes]: Yes.
$$f(x)=(-1)^{\lceil x \rceil}\text{abs}(x+\text{sign}(x)),\
g(x)=(-1)^{\lceil x \rceil}\text{abs}(x)$$