I'm having trouble understanding exactly why when you have a two-dimensional random variable $(X,Y)$ and you want to find the marginal probability distribution of $X$, for example, you integrate the joint probability density function with respect to y. That is,

$f_x=\int_{-\infty}^{\infty}f(x,y) \ dy$

I understand its analogous form in the discrete case:

$p(X=x_i)=\sum_j p(x_i,y_j)$

because here you're just adding up the different ways $X$ can be $x_i$ (i.e., it can be $x_i$ when $Y$ is $y_1$ or $y_2$ etc.) but I don't get exactly what is being done by integrating with respect to $y$. What is being summed up? And how does it work when there are no distinct probabilities but only a probability density, in terms of adding up possibilities to "marginalize out" a variable?


The joint density $f_{XY}(x,y)$ is defined in terms of probability as $$\mathbb{P}((X,Y)\in A)=\int_A f_{XY}(x,y)\,\text{d}x\text{d}y$$ for all measurable sets $A$. When $A$ is of the special form $A=[a,b]\times[c,d]$, this translates as $$\mathbb{P}((X,Y)\in A)=\int_c^d\int_a^b f_{XY}(x,y)\,\text{d}x\text{d}y=\int_c^d\left\{\int_a^b f_{XY}(x,y)\,\text{d}x\right\}\text{d}y$$that is, as the integral in $y$ of a function of $y$ defined as$$g(y)=\int_a^b f_{XY}(x,y)\,\text{d}x$$In particular, when $a=-\infty$ and $b=+\infty$ you get that$$\mathbb{P}((X,Y)\in \mathbb{R}\times[c,d])=\int_c^d\int_{-\infty}^{+\infty} f_{XY}(x,y)\,\text{d}x\text{d}y$$which shows that$$\int_{-\infty}^{+\infty} f_{XY}(x,y)\,\text{d}x$$operates like a density for $Y$.

  • $\begingroup$ I'm trying to understand the integral in terms of Riemann sums...could you help me out with that $\endgroup$ – Gabriel Mar 18 '16 at 20:26
  • 1
    $\begingroup$ @Gabriel, probability integrals do not always work with riemannian definition of an integral. If you still want to cast them as Riemannian, then imagine that x and y are cut into bins. In this case the integrals become sums. $\endgroup$ – Aksakal Mar 18 '16 at 20:32
  • 1
    $\begingroup$ There is not much difference with Riemann sums when $f$ is continuous or continuous by parts and when $A$ is a union or intersection of a collection of cubes $[a,b]\times[c,d]$, which is why I wrote this explanation for a single cube. $\endgroup$ – Xi'an Mar 18 '16 at 20:33
  • $\begingroup$ So then how would I interpret $\sum f(x,y) \Delta y $ $\endgroup$ – Gabriel Mar 18 '16 at 20:35
  • $\begingroup$ I do not understand what this sum means in terms of the original problem. $\endgroup$ – Xi'an Mar 18 '16 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.