Conditional Expectation of a function and another Conditional Expectation Suppose $\{X_1,X_2,Z\}$ is a vector of 3 real valued continuous random variables with compact support, $f_1(X_1,X_2)$, $f_2(X_1,X_2)$, and $g(X_1,X_2)$ are measurable functions with at least 2 continuous partial derivatives all of which are integrable. Are the following equations valid ways of manipulating each equation? If not why not and if you have a pertinent reference I would appreciate it.  
$1.) \;\;E\bigr[\; f_1(X_1, X_2) \; E[g(X_1,X_2) Z \; |X_1 ] \; \big|X_1 \bigr] = E\big[ E[f_1(X_1,X_2)g(X_1,X_2)Z|X_1] \big|X_1 \big] $
$2.) \;\;E\bigr[\; f_1(X_1, X_2)f_2(X_1,X_2) \; E[g(X_1,X_2) Z \; |X_1 ] \; \big|X_1 \bigr] = E\big[f_2(X_1,X_2) E[f_1(X_1,X_2)g(X_1,X_2)Z|X_1] \big|X_1 \big] $
Your help will be much appreciated.
 A: 1) Note that $E[g(X_1,X_2)Z \mid X_1]$ is only a function of $X_1$ and thus conditional on $X_1$ is a constant.  Similarly, $E[f_1(X_1,X_2)g(X_1,X_2)Z \mid X_1]$ is only a function of $X_1$ and thus conditioned on $X_1$ is a constant.
\begin{align*}
E\left[f_1(X_1,X_2) E[g(X_1,X_2)Z \mid X_1] \mid X_1\right] & = E[g(X_1,X_2)Z \mid X_1] \,E\left[f_1(X_1,X_2) \mid X_1\right]\\
& \ne E\left[ f_1(X_1,X_2)g(X_1,X_2)Z \mid X_1\right]\\
& =  E \left[ E\left[ f_1(X_1,X_2)g(X_1,X_2)Z \mid X_1\right] \mid X_1\right]
\end{align*}
The last equality is due to the inside term being constant (as mentioned before) and the $\ne$ is because it is unknown because it is not certain than $f_1(X_1, X_2)$ and $g(x_1, X_2) Z$ are conditionally independent (when conditioned on $X_1$). The $\ne$ will be a $=$ is they were conditionally independent.
2) Similarly, you can show that the second statement is also untrue in general.
A: Let $f_1(X_1, X_2) = \frac {X_1}{X_2},\; g(X_1,X_2) = \frac {X_2}{X_1}$. Then looking at the proposed equation $1).$, do you think that the right-hand side
$$ E\left(\;  \frac {X_1}{X_2} \; E\left [\frac {X_2}{X_1} Z \; \mid X_1 \right] \; \big|X_1 \right) = E\left(\;  \frac {1}{X_2} \; E\left [X_2 Z \; |X_1 \right] \; \big|X_1 \right)\\=E\left(\;  \frac {1}{X_2} \; \; \big|X_1 \right)\cdot E\left [X_2 Z \; |X_1 \right]  $$
is equal to the left hand side ?
$$ \;E\left( E\left [\frac {X_1}{X_2}\frac {X_2}{X_1}Z|X_1\right] \big|X_1 \right) = E\big[ Z \mid X_1 \big] $$
