Is the expected value of a function of a random variable given said function the same as if only the random variable was given?

17 Views Asked by At

This problem stems from this problem I have to solve:

Given $M_n = (-1)^n\cos(\pi(S_n+K))$ where $S_n$ is a simple, symmetric random walk and $K$ a non zero integer, prove that $M_n$ is a martingale

Now proving that $E[M_n] < \infty$ is easy, to prove the martingale property I just broke $S_{n+1}$ into $S_n+1$ and $S_n-1$ like this:

$E[M_{n+1} | M_0,...,M_n] = \frac{1}{2} E[(-1)^{n+1}\cos(\pi(S_n+1+K)) | M_0,...,M_n] + \frac{1}{2} E[(-1)^{n+1}\cos(\pi(S_n-1+K))| M_0,...,M_n]$

If $E[(-1)^{n+1}\cos(\pi(S_n+1+K)) | M_0,...,M_n] = E[(-1)^{n+1}\cos(\pi(S_n+1+K)) | S_0,...,S_n]$ then the problem would be easily solvable with some basic steps, but I'm not sure if I can do this.

More generally I want to know this: let's say I have a random variable $X$ and a function $f(X)$ of said variable. Is then $E[X|f(X)] = E[X|X] = X$? Or is it true only with certain requirements on the function like it being injective?