# 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. – lzstat Jun 1 '16 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. – Slowpoke Jun 1 '16 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 '16 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$.
• @Izstat Thank you! So, the second integral over $x$ and $y$ is not a probability as I thought before. – Slowpoke Jun 1 '16 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. – grand_chat Jun 1 '16 at 18:22