Question regarding conditional and marginal distributions I’ve stumbled upon this figure. You can see that the shaded area represents the conditional density function:
$$f_{X_1|X_2}(x_1|x_2) = \frac{f(x_1,x_2)}{f_{X_2}(x_2)}$$
At the same time, this shaded area is the marginal distribution $f_{X_2}(x_2)$, at least as far as I can tell:
$$f_{X_2}(x_2)=\displaystyle \int_{-\infty}^\infty f(x_1,x_2)\, dx_1$$
If variables are independent, the following is true:
$${f_{X_2|X_1}\left(x_2\middle| x_1\right)=f}_{X_2}\left(x_2\right)$$
That is when it gets confusing, because based on my - obviously incorrect -  interpretation of the figure I can conclude that $f_{X_1|X_2}\left(x_1\middle| x_2\right)=f_{X_2}\left(x_2\right)$. Something has gone wrong ...
Could you please point me in the right direction? I just want to understand these concepts in a more visual way.
 A: For any $b$ you get a conditional distribution/density $f_{X_1 | X_2}(x_1|b)=\frac{f_{X_1 ,X_2}(x_1,b)}{f_{X_2}(b)}$ for $X_1$ given $b$. You can see this, because this distribution lives on the $x_1$-Axis given $b$ on the $x_2$ axis.
$f_{X_1 ,X_2}(x_1,b)$ is the shaded slice in the figure. This is up to the $x_1$-constant $f_{X_2}(b)$ a probability distribution (to be more precise the conditional probability distribution of $X_1$ given $X_2=b$).
For the marginal distribution in general, if you vary $b$, you get a different conditional distribution for $X_1$, i.e. the shape of the distribution always looks different. But if the shape looks same for each value $b$, i.e. if $f_{X_1 ,X_2}(x_1,b)$ scales proportional in $f(b)$, which is equivalent to $\frac{f_{X_1 ,X_2}(x_1,b)}{f_{X_2}(b)}$ is always the same function in $x_1$, which is then equal to $f_{X_1}(x_1)$, then $X_1$ and $X_2$ are independent.
In general, $$f_{X_1}(x_1)=\displaystyle \int_{-\infty}^\infty f(x_1,x_2)\, dx_2=\int_{-\infty}^\infty f_{X_1|X_2}(x_1|x_2)f_{X_2}(x_2)\, dx_2$$ which means (loosely / heuristically), that you sum up all $X_1$ distributions $f_{X_1|X_2}$ over $x_2$ given $x_2$ weighted by the probability of $x_2$. Then you arrive at the marginal distribution in the background.
