Is it possible to define a function $f$ from positive real to positive real such that $f(f(x)) = {1 \over x}$

Given a function $f:\mathbb R_{>0}\to\mathbb R_{>0}$, define a function $g:\mathbb R\to \mathbb R$ by $g(x)=\log f(e^x)$. Then $f$ satisfies the functional equation $f(f(x))=\frac1x$ if and only if $g$ satisfies the functional equation $g(g(x))=-x$. The latter equation is treated in great detail here:

Find a real function $f:\mathbb{R}\to\mathbb{R}$ such that $f(f(x)) = -x$?


Note that $f^4(x)=x$ (the operation here is composition). Each element is part of a length-4 orbit, going $x\to y\to \frac1x\to \frac1y\to x$. Well, OK, there's one exception $f(1)=1$ with a length-1 orbit.

Now, intuitively, it shouldn't be too hard to split the positive reals into orbits like this. The trick is to do it explicitly.

We can send open intervals to open intervals smoothly. If we take four intervals this way, then we get three additional endpoints, one of which is $1$ - trouble. In order to resolve this, we'll actually need to use infinitely many intervals. Let's pick something convenient: intervals $(\frac1{n+1},\frac1n)$ and $(n,n+1)$ for integers $n$.

If $n$ is odd and $n<x<n+1$, let $f(x)=x+1$.
If $n$ is even and $n<x<n+1$, let $f(x)=\frac1{x-1}$.
If $n$ is odd and $\frac1{n+1}<x<\frac1n$, let $f(x)=\frac1{\frac1x+1}=\frac{x}{x+1}$.
If $n$ is even and $\frac1{n+1}<x<\frac1n$, let $f(x) = \frac1x - 1$.

These cycle the way we want; starting at some $x$ in $(n,n+1)$, we get $x+1$, $\frac1x$, and $\frac1{x+1}$ in sequence before returning to $x$.

That leaves the endpoints - integers and reciprocals of integers.

Let $f(1)=1$.
If $n$ is even, let $f(n)=n+1$.
If $n$ is odd and greater than $1$, let $f(n)=\frac1{n-1}$.
If $n$ is even, let $f(\frac1n)=\frac1{n+1}$.
If $n$ is odd and greater than $1$, let $f(\frac1n)=n-1$.

OK, we could have made those open intervals in the earlier definition half-open. Anyway, this is an explicit function defined for all positive $x$ that works.