# Conditional expectation with indicator function

I’m trying to get familiar with indicator functions.

Let YY and XX be two independent dices and Ω={1,2,3,4,5,6}\Omega=\{1,2,3,4,5,6\} and X∼Y∼Uni(Ω)X\sim Y \sim Uni(\Omega) and ZZ is the sum Z=Y+XZ=Y+X. Now I want to compute the conditional expectation E(Z∣X)E(Z\mid X) using indicator functions.

So my attempt:

We have E(Z∣X)(ω):=6∑i=1E(Z∣X=xi)1X=xiE(Z\mid X)(\omega):=\sum\limits_{i=1}^6 \operatorname{E}(Z\mid X=x_i)\mathrm1_{X=x_i}

So it follows
E(Z∣X=x)=E(Z1X=x)P(X=x)=∑Ω′∩{X=x}zP(Z=z)P(X=x)\operatorname{E}(Z\mid X=x)=\frac{\operatorname{E}(Z\mathrm1_{X=x})}{P(X=x)}=\frac{\sum\limits_{\Omega’ \cap \{X=x\}}zP(Z=z)}{P(X=x)}

P(X=x)=1/6P(X=x)=1/6 and if I set Ω′0:=Ω′∩{X=x}\Omega’_0:={\Omega’ \cap \{X=x\}} then it becomes

E(Z∣X=x)=6∑Ω′0zP(Z=z)\operatorname{E}(Z\mid X=x)=6\sum\limits_{\Omega’_0}zP(Z=z)

Now I know that the RHS makes a new conditional measure. But how can I compute further?

=================

Are X,YX,Y functions Ω→R\Omega\to\mathbb R here? If so then how are they defined? As (the outcomes of) dice they will take values in Ω\Omega, so it seems that you are confusing domain and codomain.
– drhab
2 days ago

@drhab Yes I see there is a problem. No X,YX,Y should be discrete random variables Ω′→Ω\Omega’ \to \Omega
– MarcE
2 days ago

=================

2

=================

The probability of Z = z is as follows:

0, z = 2 .. x

16\frac{1}{6}, z = x+1 .. x+6

0, z = x+7 .. 12

∑z⋅P(z|x)=(x+1+x+2+..x+6)⋅16=(6x+21)⋅16=x+3.5\sum{z \cdot P(z|x)}=(x+1+x+2+..x+6)\cdot\frac{1}{6}=(6x+21)\cdot\frac{1}{6}=x+3.5

This should stand to reason as E(y) = 3.5

of course this assumes that X and Y are independent

Hi, thanks for your answer. But how can I come to this using my attempt: ∑Ω′∩{X=x}zP(Z=z)P(X=x)\frac{\sum\limits_{\Omega’ \cap \{X=x\}}zP(Z=z)}{P(X=x)}
– MarcE
2 days ago

1

To calculate P(z) you have to use P(z given x) and sum over x. I don’t think there’s any other way, since z is not independent of x.
– MikeP
2 days ago

There is a smooth solution for this that leaves out indicator functions. So it is not really an answer to your question, but it might interest you anyway:

E(Z|X)=E(Y+X∣X)=E(Y|X)+E(X∣X)=E(Y|X)+X\mathbb E(Z|X)=\mathbb E(Y+X\mid X)=\mathbb E(Y|X)+\mathbb E(X\mid X)=\mathbb E(Y|X)+X

If moreover XX and YY are independent then E(Y|X)=EY\mathbb E(Y|X)=\mathbb EY so we end up with:E(Z|X)=EY+X=3.5+X\mathbb E(Z|X)=\mathbb EY+X=3.5+X