# Integral of conditional probability density function

As far as I understand, when we fix the condition for the conditional density, we get probability distribution and the integral over all the space is $1$ $P(X|Y=y_0)$:

$$\int_{\mathbb{R}}f_{X \mid Y}(x \mid y=y_0)dx=P(X|Y=y_0)<1$$

However, suppose we want to take integral:

$$\int_{\mathbb{R}}\bigg(\int_{\mathbb{R}}f_{X \mid Y}(x \mid y)dx\bigg)dy$$

I thought it is equal to $1$, but approximate numerical computation through summation for continuous conditional density $$\sum_{i=1}^N \sum_{j=1}^N f_{X\mid Y}(a+\frac{b-a}{N}i \ \ \big| \ \ a+\frac{b-a}{N}j)\cdot(\frac{b-a}{N})^2$$ gives very big values, e.g. $3000$ or even $1e+25$.

• see answer by grand_chat. Your value maybe correct but you have misunderstanding of integration with respect to marginal distribution. What you really mean is to integration of joint distribution of x and y equals 1. Jun 1, 2016 at 18:19
• @lzstat Thank you very much! So the integral over $f(x,y)$ is $1$ while $f(x \mid y)$ can be arbitrary number that doesn't mean anything. Jun 1, 2016 at 18:22
• Just to mention that $$\int_{\mathbb{R}}f_{X \mid Y}(x \mid y)dx=1$$ and that $P(X|Y=y_0)$ is either undefined or bad notation.
– Did
Jun 1, 2016 at 18:28

When you integrate the conditional density of $X$ given $Y=y$ over all $x$, you should get $1$: $$\int_{\mathbb{R}}f_{X \mid Y}(x \mid Y=y)dx = 1\tag1$$ because you've just computed $P(X\in\mathbb{R}\mid Y=y)$. This is true for every value of $y$. So when you attempt to integrate (1) over all values of $y$, you'll be integrating the constant $1$. The result doesn't need to equal $1$. If $Y$ is discrete, you'll be essentially counting the number of possible values for $Y$.

• This answer makes sense. integration of marginal distribution of x given y should be 1 indeed. Jun 1, 2016 at 18:16
• @Izstat Thank you! So, the second integral over $x$ and $y$ is not a probability as I thought before. Jun 1, 2016 at 18:19
• @Slowpoke Correct. Since (1) is not a probability density as a function of $y$, you should not expect the integral over $y$ of (1) to equal anything in particular. It is typically not an interesting quantity. Jun 1, 2016 at 18:22
• @Slowpoke, yes, it is not probability in second integration. You really need the joint distribution of the two in order to get probability 1. Jun 1, 2016 at 18:24

There is a solid proof:

Given a joint distribution function $$f(x,y)$$, one can write it also as $$f(x,y)=f_{X|Y}(x|y)f_Y(y)$$. Hence, notice that:

$$f_Y(y)=\int_{x \in \mathbb{R}}^{} f(x,y) \, dx$$

and expand the joint distribution function as above:

$$f_Y(y)= \int_{x \in \mathbb{R}}^{} f_{X|Y}(x|y)f_Y(y) \, dx \Rightarrow f_Y(y)= f_Y(y)\int_{x \in \mathbb{R}}^{} f_{X|Y}(x|y) \, dx$$

given that $$f_Y(y)\neq0$$:

$$\int_{x \in \mathbb{R}}^{} f_{X|Y}(x|y) \, dx =1$$, Q.E.D