I'm reading about statistical decision theory and started to wonder how would you write conditional probability in terms of density function?

For example, if we have random variables $X$ and $Y$ then we know that:

$$P(Y, X) = P(Y \;|\; X)P(X)$$

Now lets say $X$ and $Y$ have continuous range so if I would like to calculate the joint probability that $X$ is in range $[x_1, x_2]$ and $Y$ is in range $[y_1, y_2]$ I would do:


where $f(x,y)$ is the joint probability density function of the two variables. Now my first question is: Is is this notation correct?:

$$P(Y\; \text{in range}\; [y_1, y_2], X\; \text{in range}\; [x_1, x_2]) = \int_{x_1}^{x_2}\int_{y_1}^{y_2}f(x,y)\:dy\:dx$$

If yes then my next question is: IF:

$$P(Y, X) = P(Y \;|\; X)P(X)$$ $$=>$$

$$P(Y\; \text{in range}\; [y_1, y_2], X\; \text{in range}\; [x_1, x_2]) $$$$= P(Y\; \text{in range}\; [y_1, y_2] \;|\; X\; \text{in range}\; [x_1, x_2])P(X\; \text{in range}\; [x_1, x_2])$$ $$= \int_{x_1}^{x_2}\int_{y_1}^{y_2}f(x,y)\:dy\:dx$$

Then how do you write $P(Y\; \text{in range}\; [y_1, y_2] \;|\; X\; \text{in range}\; [x_1, x_2])$ and $P(X\; \text{in range}\; [x_1, x_2])$ in terms of the density function? (So that the expressions include integral signs, dx, dy and f(x,y), etc.)?

Hope my questions is clear and understandable. If not please let me know :)

Thank you for any help :)


1 Answer 1


$$ P(Y \in [y_1, y_2] \mid X \in [x_1,x_2]) = \dfrac{P(X \in [x_1,x_2], Y \in [y_1,y_2)}{P(X \in [x_1,x_2])} = \dfrac{\int_{x_1}^{x_2} \int_{y_1}^{y_2} f(x,y)\; dy\; dx}{\int_{x_1}^{x_2} \int_{-\infty}^\infty f(x,y)\; dy\; dx}$$

  • $\begingroup$ Hi, professor. Is that possible for this form question to rewrite in terms of conditional density form, something similar to this $P(X|Y=y)=\int f_{X|Y}(x)dx$, compactly $\endgroup$
    – LJNG
    Jun 23, 2022 at 15:31
  • $\begingroup$ If $f_{X|Y}(x|y)$ is the conditional density of $X$ given $Y=y$ and $f_Y(y)$ is the marginal density of $Y$, then $f(x,y) = f_{X|Y}(x|y) f_Y(y)$, so just substitute that for $f(x,y)$. $\endgroup$ Jun 24, 2022 at 17:24
  • $\begingroup$ Thank you for your reply. I just found my question does not reflect what I was trying to ask, not about switching the conditioning. Sorry about that. Just back to your answer, that formula with double integral on numerator and denominator. Is that possible to rewrite your answer( conditional on continuous r.v) in form of an integral of a conditional density of $Y$ given $X\in $ some set, (as an analogy to conditional on the discrete case). what is that conditional density supposed to look like? $\endgroup$
    – LJNG
    Jun 24, 2022 at 19:40
  • $\begingroup$ The conditional density of $Y$ given $X \in [x_1, x_2]$ is $$\frac{\int_{x_1}^{x_2} f(x,y)\; dx}{\int_{x_1}^{x_2} \int_{-\infty}^\infty f(x,y)\; dy \; dx}$$ Is that what you were looking for? $\endgroup$ Jun 26, 2022 at 7:47
  • $\begingroup$ Yes. Thank you for your help. The reason I am looking for such conditional density is that I am trying to figure out every component of the form $$E(Y|X\in A)=\frac{E(Y\mathbf{1_[x_1,x_2]})}{P(A)},\quad A=[x_1,x_2]$$. Based on your answer, I am not sure if I can rewrite the numerator as $$\int_{x_1}^{x_2}f(x,y)dx=f(y)\mathbf{1_[x_1,x_2]}$$ $\endgroup$
    – LJNG
    Jun 26, 2022 at 8:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .