4

$\text{X and Y are a pair of jointly continuous random variables:}$

the shaded region is the domain of the function

$f_{X,Y}(x, y) = \begin{cases} \text{c,} &\text{the shaded region}\\ \text{0,} &\text{elsewhere}\\ \end{cases}$

$\text{a- find the value of c.}$

$\text{b- find the marginal pdf of X and Y.}$

$\text{c- find E[X|Y=1/4] and Var[X|Y=1/4]}.$

$\text{d- find the conditional PDF of X knowing that Y=3/4.}$

$\text{what I did:}$

for the first question, we know that the function is constant thus we can simply multiply the shaded surface and c and this value will equal 1. $$c\times S = \frac{c}{2} = 1$$ $$c = 2$$

for the marginal pdf of each variable: the definition domain is: $$\Delta(x,y)=\text{{0⩽x⩽1 and 0⩽y⩽1, and [0.5-x⩽y⩽1-x, or 3/2-x⩽y]}}$$ $$f_X(x) = \int^{1/2-x}_{1-x}cdy + \int^{3/2-x}_{1}cdy$$ $$f_X(x) = 2x$$ $$f_Y(y) = \int^{1-y}_{1/2-y}cdx + \int^{1}_{3/2-y}cdx$$ $$f_Y(y) = 2y$$ however when I tried to compute the expectation I got a negative value: $$E[X|Y] = \int^{1-y}_{1/2-y}x \times \frac{f(x,y)}{f(y)}dx + \int^{1}_{3/2-y}x \times \frac{f(x,y)}{f(y)}dx$$ $$E[X|Y] = \int^{1-y}_{1/2-y}\frac{x}{y}dx + \int^{1}_{3/2-y}\frac{x}{y}dx$$ $$E[X|Y] = \frac{8y - 2 - 4y}{8y}$$ $$E[X|Y=1/4] = -0.5$$

I also computed in the same way the variance and found that it was negative [obviously wrong], thus I would be sincerely grateful to know where I made my mistake.

Roger V.
  • 3,903
  • 3
    Your computation of the marginal pdfs of $X$ and $Y$ is incorrect; both $X$ and $Y$ are uniformly distributed on $[0,1]$. – Dilip Sarwate Jan 15 '23 at 17:28

2 Answers2

11

These questions can all be answered just by looking at the picture.

The only numerical result you need to know is that the variance of a Uniform distribution of length $1/2$ is $1/48.$ This can be computed by noting the variance does not depend on the location of the distribution and therefore is the variance of a Uniform distribution on the zero-centered interval $[-1/4,1/4],$ where it equals

$$\int_{-1/4}^{1/4}x^2\,\mathrm dx = \frac{x^3}{3}\bigg|_{-1/4}^{1/4} = \frac{1}{48}.$$

Computation isn't really needed: if you have committed to memory the variance of a unit Uniform distribution, which is $1/12,$ simply observe this distribution has been scaled by a factor of $1/2,$ whence its variance is $(1/2)^2$ = one-quarter of $1/12.$

a. The shaded region along with its rotation by 180 degrees (shown in orange) partition the unit square, showing the original area is half the area of the square, or $1/2.$ Therefore $c = 1/(1/2) = 2$ to make the total probability equal to $1.$

enter image description here

("Partition" isn't quite correct, because there may be some overlap along the boundaries of the two pieces: but because the boundaries have no area, they have no probability and this overlap doesn't matter.)

b. Consider the marginal of $y.$ This is the total probability of $x$ for each $y$ (within an infinitesimal neighborhood of $y$: this form of reasoning is explained more generally in my post at https://stats.stackexchange.com/a/584907/919). We may shift some of the probability horizontally without changing either $y$ or the total probability conditional on $y.$ The result upon shifting two triangular pieces, as shown, is a rectangle. Its horizontal cross-sections are all the same length, showing the total probability does not change with $y.$ Therefore the marginal is uniform. The marginal of $x$ must be uniform, too, because the original picture with $x$ and $y$ interchanged is the same.

enter image description here

c. The conditional expectation is the average position of $x$ for any given $y.$ For $y=1/4,$ $x$ is uniformly distributed between $1/4$ and $3/4,$ as shown in the yellow region. Therefore its average position is $1/2$ and its variance is that of that uniform distribution, equal to $1/48.$

enter image description here

d. Finally, the conditional distribution of $x$ when $y=3/4$ is found in the same way as in (c). The picture clearly shows it is uniform on the union of the intervals $[0,1/4]\cup[3/4,1].$

enter image description here

whuber
  • 322,774
  • I can see very well that inferring all results from the graph proves to be a faster method, but is this only possible for a constant random variable, and in the case of X and Y we can deduce that they are uniform but how do we find there values. Is it by integrating over the interval [0,1] (and by knowing that the value is 1) we can find the value constant. – youssef hafidi Jan 15 '23 at 18:02
  • 1
    I'm unsure what you mean by a "constant random variable," because none of the variables in this question are constant. The approach shown here works because the original joint PDF is directly proportional to area. In general you have to weight areas by the density function and that requires you to compute the integrals. However, this same visual reasoning enables you easily to write down the correct integrals and to be confident they will give you the information you are looking for. That's why it's worth learning. – whuber Jan 15 '23 at 19:15
  • 1
    Excuse my lack of clarity, I meant that as you said the marginal PDF of both X and Y are uniform, and thus I wanted to ask whether we can compute the numerical value by integration or determine it from the graph. your responses are very helpful and I am very thankful. – youssef hafidi Jan 15 '23 at 19:30
7

There is a support mistake when deriving the marginal densities (and again in constructing the conditional expectations) \begin{align} f_Y(y) &\propto\mathbb I_{0\le y\le 1/2}\int^{1-y}_{1/2-y}\text dx + \mathbb I_{1\ge y\ge 1/2}\int^{1-y}_{0}\text dx + \mathbb I_{1\ge y\ge 1/2}\int^{1}_{3/2-y}\\ &= \begin{cases}{\left[(1-y)-0+1-(3/2-y) \right] \text{ if }1\ge y\ge 1/2\\ \left[(1-y)-(1/2-y)\right] \text{ otherwise} }\end{cases}\\ &= \begin{cases}{\dfrac{1}{2}\text{ if }1\ge y\ge 1/2\\ \dfrac{1}{2}\text{ otherwise} }\end{cases}\\ &\propto \mathbb I_{(0,1)}(y) \end{align} meaning that both $f_X$ and $f_Y$ are densities for the Uniform $\mathcal U(0,1)$ distribution.

Xi'an
  • 105,342
  • 2
    Sometimes elementary posts can be quite enlightening. +1. – User1865345 Jan 15 '23 at 15:45
  • First I would like to sincerely thank you for the time you have invested into my post. but somehow I still feel a bit confused, so what I understood from your response is that the formula of the conditional expectation E[X|Y] should be computed piece wise, and in that case shouldn't we do the same for fX(x), and fY(y). Moreover, if we are computing E shouldn't we multiply x with the value of f(X|Y). I am very sorry for my inaptitude to understand your answer, I am still new to this field and I am not even sure about the values of fX(x) and fY(y). – youssef hafidi Jan 15 '23 at 17:26
  • 1
    Is there a chance you're missing a multiplicative factor of $2$ everywhere? – statmerkur Jan 16 '23 at 10:43
  • @youssefhafidi: Thank you for validating my answer, but I feel that whuber's answer should get the validation as it is more informative and pedagogical, mine being simply a mathematical derivation. – Xi'an Jan 16 '23 at 13:41
  • 2
    I am sorry for the misunderstanding, both answers where interesting. I am new to this platform and I didn't know that only one response could be validated (I clicked both). I am very thankful for all the kind responses I got, once again thank you very much. – youssef hafidi Jan 16 '23 at 14:05