When integrating with [[indicator variables]], often the range of the indicator variable for the variable with respect to which you are integrating become the limits of integration. With two or more indicator variables, the other indicator variable(s) are considered constants and can be pulled out of the integral. Given the [[joint probability density function]] $f(x,y) = 16xy$ for $0<x<y<1$, calculate the [[marginal probability]] functions $f_x(x)$ and $f_y(y)$. The marginal probability functions for $X$ and $Y$ can be found by integrating the joint pdf with respect to $y$ and $x$, respectively. ## integration without indicator variables Let's start with the marginal probability without indicator variables, beginning with $x$. The marginal pdf is $f_x(x) = \int_x^116xy \ dy$ Notice the limits of integration. We are given that $x < y < 1$ and so $x$ becomes the lower limit of integration. Because we are integrating with respect to $y$ the $16x$ is a constant term which we can pull out of the integral. $f_x(x) = 16x\int_x^1 y \ dy$ Now we solve using the [[Fundamental Theorem of Calculus]]. $f_x(x) = 16x \Big [ \frac12 y^2 \Big|_x^1 \Big] = 16x \Big [ \frac12 - \frac12 x^2 \Big ] = 4x(1-x^2)$ for $0 < x < 1$. We can repeat this process for the marginal pdf of $y$, given by $f_y(y) = \int_0^y 16xy \ dx$ Again note the limits of integration are determined by the range for $x$ provided $0 < x < y$. Solving the integral we get $f_y(y) = 16y \Big [ \frac12 x^2 \Big|_0^y \Big] = 16y \Big [ \frac12 y^2 - 0 \Big ] = 8y^3$ for $0 < y < 1$. ## integration with indicator variables Now let's rewrite the function with indicator variables. There are two ways to express this function with indicator variables, and we'll use the appropriate one when integrating. $\displaylines{ f(x,y) = 16xy \ I_{(0,y)}(x) \ I_{(0,1)}(y) \\ f(x,y) = 16xy \ I_{(0,1)}(x) \ I_{(0,x)}(y)}$ Notice that the indicator variables in each case limit the range from $0$ to $1$ or $0$ to the opposite variable. This reflects the restriction on the range of $x,y$ given for the problem. When integrating with respect to $y$ to find the marginal pdf for $x$, we'll use the equation above that allows $y$ from $0$ to $1$ (excluding the variable for which we are trying to find the pdf, and vice versa). Beginning with the marginal pdf $f_x(x)$, we can write the marginal pdf as $f_x(x) = \int_{-\infty}^{\infty} 16xy \ I_{(0,1)}(x) \ I_{(x,1)}(y) \ dy$ Notice here that the limits of integration are all possible values. This is because the indicator variables handle the range for us. Also notice that we've selected the joint pdf for which the indicator variable for $x$ ranges from $0$ to $1$. Because we are integrating with respect to $y$, the $x$ terms are constant and can be pulled out of the integral, including the indicator portion. $f_x(x) = 16x \ I_{(0,1)}(x) \int_{-\infty}^{\infty} y \ I_{(x,1)}(y) \ dy$ The indicator variable for $y$ states that $y$ can only take the values from $x$ to $1$, so we can replace this indicator with a $1$ and set $x$ and $1$ as the limits of integration. $f_x(x) = 16x \ I_{(0,1)}(x) \int_{x}^{1} y * 1 \ dy$ Integrating with respect to $y$ we will find we get the same thing as integration without indicator variables, but with the indicator variable for $x$ preserved. $f_x(x) = 16x \ I_{(0,1)}(x) \Big [ \frac12 y^2 \Big|_x^1 \Big] = 16x \ I_{(0,1)}(x) \Big [ \frac12 - \frac12 x^2 \Big ] = 4x(1-x^2) \ I_{(0,1)}(x)$ We can repeat this process for the marginal pdf of $y$, this time using the formula for the joint pdf which allows $y$ to run from $0$ to $1$, which is given by $f_y(y) = \int_{-\infty}^{\infty} 16xy \ I_{(0,y)}(x) \ I_{(0,1)}(y) \ dx$ Pulling out the constants we have $f_y(y) = 16y \ I_{(0,1)}(y) \int_{-\infty}^{\infty} x \ I_{(0,y)}(x) \ dx$ Replacing the indicator variable with $1$ and setting the limits of integration, we can solve the integral. $f_y(y) = 16y \ I_{(0,1)}(y) \Big [ \frac12 x^2 \Big|_0^y \Big] = 16y \ I_{(0,1)}(y) \Big [ \frac12 y^2 - 0 \Big ] = 8y^3 \ I_{(0,1)}(y)$ ## testing for independence Now that we have factored the marginal pdfs for $X$ and $Y$, we can determine whether the variables $X$ and $Y$ are [[independent]]. We know that $X$ and $Y$ are independent if $f_x(x,y) = f_x(x) * f_y(y)$. We can see that in this case $X$ and $Y$ are not independent because $4x(1-x^2) * 8y^3 \neq 16xy$.