Prove random variable is in a set a.s and determine its distribution This was one of the questions in my exam that i did not figure out.
For $\epsilon \in ]0,1[$, $\operatorname{f}:[0,1]\to[0,\infty[$ is a continuous function with $$\operatorname{f}(x) \le \min(x,1-x) ,\forall x \in[0,1].$$
$(Z_i)_i$, $i\in\mathbb{N}$ are i.i.d. random variables on probability space $(\Omega,\mathscr{F},\mathbb{P}$) with $$\mathbb{P}(Z_1=-1)=\frac{1}{2}=\mathbb{P}(Z_i=1)$$
We have Filtration $\mathscr{F}_n:=\sigma(Z_1,...,Z_n)$ for all $n\in\mathbb{N}$ and $\mathscr{F}_0:=\{\emptyset,\Omega\}$, also recursively,  $$X_n:=X_{n-1}+Z_n\cdot{f(X_{n-1})},X_0:=\epsilon.$$
Questions:
a) Prove  that $X_n$ is a [0,1]-martingale with respect to $\mathscr{F_n}$, and $(X_n)_n$ converges to a random variable $X_\infty$ almost surely. ($X_n$ takes value in [0,1])
b) $\pmb{S}:=\{x \in[0,1]\mid\operatorname{f}(x)=0\}$.
Prove: $\mathbb{P}(X_\infty\in \pmb{S})=1$
c) Assume that $\operatorname{f}(x)\gt0 $ for all $x\in]0,1[$ and $\operatorname{f}(0)=\operatorname{f}(1)=0 $. Determine the distribution of $X_\infty$.
I finished a), which gives existence of $X_{\infty}$.
My idea:

*

*If $X_{\infty}$$\in$$\pmb{S}$, we must have  $\operatorname{f}(X_\infty)$$\in${$0,1$}(if my opinion is correct ), that's where I get stuck, how to prove that.


*Since $\operatorname{f}(x)\le \min\{x,1-x\}$, we have $\operatorname{f}(x)\le\frac{1}{2}$, recursively  $X_n$ converges to 0 or 1. How can I prove it in the right format?


*Assumption in c) is obvious, is that helpful to determine the distribution and how to find it.
Thanks in advance!
 A: From $X_n:=X_{n-1}+Z_n\cdot{f(X_{n-1})}$, we derive that
$Z_nf\left(X_{n-1}\right)=X_n-X_{n-1}$ and the difference in the right hand side converges to $0$ almost surely (by a)). Therefore, $\left\lvert Z_nf\left(X_{n-1}\right)\right\rvert\to 0$ almost surely. Since $\left\lvert Z_n \right\rvert=1$ and $f$ is continuous, we infer than $f(X_\infty)=0$ almost surely which is exactly $\mathbb P(X_\infty\in S)=1$.
In c), the set $S$ reduces to $\{0,1\}$ hence $ \mathbb P(X_\infty\in \{0,1\})=1$ and we derive that $X_\infty$ has a Bernoulli distribution. Moreover, looking at the expectation, we see that $\mathbb P(X_\infty=1)=\varepsilon$.
A: I think you may have misread the definition of $S$.  We know that if $X_\infty \in S$, then $f(X_\infty) = 0$ just by the definition of $S$.
For b), we know $X_\infty = \lim X_n$ a.s., so on the set in which $X$ converges we have
\begin{align*}
X_\infty &= \lim_{n \rightarrow \infty} X_n \\
&= \lim_{n \rightarrow \infty} \big(X_{n-1}+Z_n f(X_{n-1}) \big) \\
&= X_\infty + \lim_{n \rightarrow \infty} Z_n f(X_{n-1})
\end{align*}
and hence $\lim_{n \rightarrow \infty} Z_n f(X_{n-1}) = 0$.  Since $|Z_n| = 1$, this implies $\lim_{n \rightarrow \infty} f(X_{n-1}) = 0$, and hence $f(X_\infty) = 0$ by continuity of $f$.  Thus, on the set in which $X$ converges, $X_\infty \in S$ and since $X$ converges a.s. we conclude $\mathbb{P}(X_\infty \in S) = 1$.
For c), we know $\mathbb{P}(X_\infty \in \{0,1\}) = 1$ by part b), so let $p := \mathbb{P}(X_\infty = 1)$.  Note that this implies $\mathbb{E}[X_\infty] = p$.  Since $|X_n| \le 1$, we know $X$ is uniformly integrable, and therefore
\begin{align*}
\mathbb{E}[X_\infty] = \lim_{n \rightarrow \infty} \mathbb{E}[X_n] = \mathbb{E}[X_0] = \epsilon,
\end{align*}
where we used that $X$ is a martingale to conclude $\mathbb{E}[X_n] = \mathbb{E}[X_0]$ for all $n$.  Therefore we have shown $\epsilon = \mathbb{E}[X_\infty] = p$, and thus determined the distribution of $X_\infty$ is  $\mathbb{P}(X_\infty = 1) = \epsilon$, $\mathbb{P}(X_\infty = 0) = 1-\epsilon$.
