# How to find condtional expectation given 2 random variables with joint density

Given two random variables, X and Y with joint density $$f(x,y)= c*cosx$$for $0<y<x<\pi/2$ (and zero otherwise),

how do you find the conditional expectation $E(Y|X=x)$?

A general method is welcome. I'm just not sure where to begin.

-

Draw the (nonzero density) range of $X,Y$, now it is a triangle (without its boundary) on the plane with vertices $(0,0)$, $(\pi/2,0)$ and $(\pi/2,\pi/2)$. (In integrals $x$ can go from $0$ to $\pi/2$ and $y$ from $0$ to $x$, or if you exchange them, $y=0..\pi/2$ and $x=y..\pi/2$.)

Now for any set $U$ within the triangle, by the definition of (joint) density function, we have that $$P((X,Y)\in U)=\int_U f(x,y)dxdy$$ and so, if $U$ is the whole triangle, we have to get $1$. This will determine $c$.

Now the conditional probability, specially in the case $X=x$ simply restricts the possible ranges, to the vertical segment of the triangle at $X=x$. So, now this $x$ is considered as fixed.

Let $C:=\int_0^x f(x,y)dy$, now it is $x\cdot c\cdot \cos x$, we are going to divide with it and use $y\mapsto \displaystyle\frac{f(x,y)}C$ as the density function of the conditional random variable $Y|X=x$. Its expectational value is $$E(Y|X=x)=\frac1C\int_0^x y\cdot f(x,y)dy.$$

-
This was very helpful! following through, I ended up with E(Y|X=x)=x/2, which is the correct answer from the book. –  user62596 Feb 17 '13 at 1:11

Since the event $X=x$ has probability zero, conditioning upon it happening is a tricky business: see Borel-Kolmogorov paradox.

But we can close our eyes, cross our fingers, integrate $yf(x,y)$ over the line with fixed value of $x$, and divide by the integral of $f$ over the same line. This works when $0<x<\pi/2$ and gives a reasonably-looking number.

(And the computation makes rigorous sense, if we think of conditional expectation as a map on a Lebesgue space, so that we focus not on pointwise values but on the density).

-