This is related to discrete dynamical systems, with the initial condition $X_1$ being a random variable with a non singular distribution. The system is driven by the iteration $X_{n+1} = g(X_n)$ for some rather smooth mapping $g$. The purpose here is to find a mapping $g$ so that the invariant distribution (also called attractor or invariant measure or fixed point distribution solution of an integral equation) is pre-specified. This is an inverse problem in the sense that typically $g$ is known and we are looking for the invariant distribution. Here the opposite is true: we assume the invariant distribution is known, and we want to find $g$ that will guarantee that no matter what the non-singular distribution of $X_1$ is, we end up with the the target invariant distribution. There are typically many possible solutions for $g$. The reason I am asking this question is because I believe I got the wrong solution in a simple case, and would like to know how to get it right.

The most basic example is when the invariant distribution is uniform on $[0, 1]$, that is, $F_X(x) = x$. In that case, $g(x) = \{ bx \}$ (the fractional part of $bx$), regardless of $b$ ( an integer $>1$) will work. Here I am trying to solve the case where the invariant distribution (the CDF) is $F_X(x) = x^2$, also with the same support domain being $[0, 1]$. Of course, this is a fist step towards dealing with much more complicated $F_X(x)$.

So, here is my investigation about $F_X(x)=x^2$, and my question is about what is wrong with my analysis. I know something is wrong. First, $g$ must be a many-to-one mapping. The easiest case is when $g$ is a two-to-one mapping, as in the logistic map where $g(x)=4x(1-x)$, with $x\in [0, 1]$. Besides that, if the density $f_X$ is symmetric around $x_0$, then $g(\cdot)$ can not be symmetric around $x_0$. The reason I say this is because I am focusing on mappings $g$ of $[0, 1]$ that are symmetric around some point $x_0$, and in this case, $x_0=\frac{1}{2}$. That is, $g(x)=g(1-x)$.

**My wrong solution that needs a fix**

Let $g$ be a two-to-one mapping, with $g(x)=g(1-x)$. If the (known) invariant distribution is $F_X(x)$, then $g$ must satisfy the functional equation $f_X(x)= f_X(h_1(x))-f_X(h_2(x))$ with $h_1(x)=g^{-1}(x)$ being one of the two inverses of $g(x)$ when $x<1/2$, and $h_2(x)=1-h_1(x)$ being the other inverse. Based on this, we must have, using the notation $y=g^{-1}(x)$,

$$x^2 = y^2 - (1-y^2)$$

which results in $y = (x^2+1)/2$. Inverting this again, we get $x=\sqrt{2y-1}$, valid if $y\geq \frac{1}{2}$. It follows that $g(x)=\sqrt{2x-1}$ if $\frac{1}{2}\leq x \leq 1$, and $g(x) = \sqrt{1-2x}$ if $0\leq x \leq \frac{1}{2}$. Yet the true mean of the invariant distribution ($F_X(x) = x^2$ on $[0, 1]$) does not seem to match that resulting from $g(\cdot)$ at equilibrium, when $n=\infty$. The system in question is ergodic.