Constructing a random variable $Y$ whose values are $\pm 1$ with conditional expectation $\mathbb E[Y|X] = X$ Suppose $X$ is a random variable on a probability space $(\Omega, \mathcal A, \mathbb P)$ with $|X| \leq 1$ almost surely. I want to show there is a random variable $Y$ with values in $\{-1,1\}$ and for which $\mathbb E[Y|X] = X$.
Since $Y$ takes values in $\{-1,1\}$, we know $Y = \mathbb 1_A - \mathbb 1_{A^c}$ for some event $A \in \mathcal A$. Furthermore, the equation $\mathbb E[Y|X] = X$ is equivalent to saying that for all $a \in [-1,1]$,
$$
\mathbb E\left[X\mathbb 1_{\{X \leq a\}}\right] = \mathbb E\left[Y\mathbb 1_{\{X \leq a\}}\right].
$$
The right hand side of this equation is
$$\mathbb E\left[Y\mathbb 1_{X \leq a}\right] = \mathbb P\left[A \cap\{X \leq a\}\right] - \mathbb P\left[A^c \cap \{X \leq a\}\right] = 2\mathbb P\left[A \cap \{X \leq a\}\right] - \mathbb P\left[X \leq a\right]$$
In other words, I want to find an $A \in \mathcal A$ for which
$$
\mathbb P\left[A \cap \{X \leq a\}\right] = \frac 1 2 \left( \mathbb E\left[X\mathbb 1_{\{X \leq a\}}\right] + \mathbb P\left[X \leq a\right]\right) = \frac 1 2 \mathbb E \left[(X+1)\mathbb 1_{\{X \leq a\}}\right]
$$
But I'm not sure how to construct such an $A$, or show that such an $A$ exists. I tried using as a toy example $(\Omega, \mathcal A, \mathbb P) = \left([-1,1], \mathcal B([-1,1]), \frac 1 2 \lambda\right)$ (where $\lambda$ is the Lebesgue measure), and $X(\omega) = \omega$, and found that the $A \subset [-1,1]$ that I needed would require (using the above equation)
$$
\frac 1 2 \lambda(A \cap [-1,a]) = \frac 1 4 \int_{-1}^a (x+1)\,dx = \frac 1 4 \left(\frac 1 2 x^2 + x \right)\bigg|_{x=-1}^{x=a} = \frac 1 8 \left(a^2 + 2a + 1\right) = \frac 1 8 (a+1)^2
$$
or in other words, $\lambda(A \cap [-1,a)) = \frac 1 4 (a+1)^2$. But I'm not sure how to construct such an $A \subset [-1,1]$. Is there a better way for me to be thinking about this?
 A: Note that $Y$ takes values in $\{-1,1\}$, so we can characterize the conditional distribution of $Y|X$ in terms of $\mathbb{P}(Y=1|X)$. Suppose $\mathbb{P}(Y=1|X) = p(X)$, where $p:[-1,1] \to [0,1]$ is some measurable function. Then,
$$\mathbb{E}[Y|X] = \mathbb{P}(Y=1|X) - \mathbb{P}(Y=-1|X) = p(X) - (1 - p(X)) = 2p(X) - 1.$$
However, we also know that $\mathbb{E}[Y|X] = X$. Solving gives us $p(X) = \frac{X+1}{2}$. Thus, $Y$ is the random variable that takes the value $1$ with probability $\frac{X+1}{2}$. We can explicitly construct this in the following manner. Let $U$ be a uniformly distributed random variable over $[0,1]$ and assume that $U$ and $X$ are independent. Then we can write,
$$Y = \begin{cases}
1 &\text{ when } U \leq \frac{X+1}{2}\\
-1 &\text{ when } U > \frac{X+1}{2}
\end{cases} = \mathbb{I}_{A} - \mathbb{I}_{A^c},$$
where $A = \left\{U\leq \frac{X+1}{2}\right\}$. We can even explicitly compute the expectations you were looking at. Fix $a \in [-1,1]$. Let $F$ be the CDF of $X$. Then,
$$\mathbb{P}(A\cap{X\leq a}) = \int_{-1}^a\int_0^{\frac{x+1}{2}}\,du\,dF(x) = \mathbb{E}\left[\frac{X+1}{2}\mathbb{I}_{X\leq a}\right].$$
Putting it all together,
$$\mathbb{E}[Y\mathbb{I}_{X\leq a}] = 2\mathbb{P}(A\cap\{X\leq a\}) - \mathbb{P}(X\leq a) = \mathbb{E}[(X+1)\mathbb{I}_{X\leq a}] - \mathbb{E}[\mathbb{I}_{X\leq a}] = \mathbb{E}[X\mathbb{I}_{X\leq a}].$$
