I'm reviewing the proof of the law of iterated expectations from Hansen's book of econometrics. I'd like to know why in the first line of the proof it integrates with respect to the conditional density $x_2$ given $x_1$. Should it not be integrated with respect to the marginal function of $x_1$ since this conditional value is only a function of this variable?
\begin{split} E_{X_3|X_1}[X_3|X_1] =& E_{X_2|X_1}[E_{X_3|X_2 X_1}[X_3|X_2,X_1]|X_1]\\ =& \int^\infty_{-\infty} \left( \int^\infty_{-\infty} x_3 f_{X_3|X_2 X_1} (x_3|x_2,x_1) dx_3 \right) f_{X2|X1} (x_2|x_1) dx_2\\ =& \int^\infty_{-\infty} \int^\infty_{-\infty} x_3 f_{X_3|X_2 X_1} (x_3|x_2,x_1) f_{X2|X1} (x_2|x_1) dx_3 dx_2\\ =& \int^\infty_{-\infty} \int^\infty_{-\infty} x_3 f_{X_3 X_2|X_1} (x_3,x_2|x_1) dx_3 dx_2\\ =& \int^\infty_{-\infty} \int^\infty_{-\infty} x_3 f_{X_3|X_1} (x_3|x_1) f_{X_2|X_3 X_1} (x_2|x_3,x_1) dx_3 dx_2\\ =& \int^\infty_{-\infty} x_3 \left( \int^\infty_{-\infty} f_{X_2|X_3 X_1} (x_2|x_3,x_1) dx_2 \right) f_{X_3|X_1} (x_3|x_1) dx_3 \\ =& \int^\infty_{-\infty} x_3 \left( 1 \right) f_{X_3|X_1} (x_3|x_1) dx_3 \\ =& E_{X_3|X_1}[X_3|X_1] \end{split}