# Does $E(X|X\in A)=\frac{E(X\mathbf{1}(X\in A))}{Pr(X\in A)}$ hold?

Does $$E(X|X\in A)=\frac{E(X\mathbf{1}(X\in A))}{Pr(X\in A)}$$ hold? (Here $$\mathbf{1}(\cdot)$$ is the indicator function). To me it seems that it holds. Here is the proof: $$E(X|X\in A)=\int_{-\infty}^{\infty}xf(x|x\in A)dx=\int_{-\infty}^{\infty}x\frac{f(x,x\in A)}{Pr(X\in A)}dx=\int_{-\infty}^{\infty}x\frac{f(x)\mathbf{1}(x\in A)}{Pr(X\in A)}dx=\frac{E(X\mathbf{1}(X\in A))}{Pr(X\in A)}$$ .

Does this proof look correct?

For an intuition,

$$E[X|X\in A] = \frac{ E[X \mathbf{1}_{X \in A}] }{P(X \in A)}$$

you want the expected value of $$X$$'s, but only such that belong to set $$A$$. For that, you multiply the $$X \in A$$ values by $$1$$ and all the other values by $$0$$, and calculate the expected value of it, i.e. the $$E[X \mathbf{1}_{X \in A}]$$ part. The problem with this expected value is that it is influenced by the excess zeroes produced by the procedure described above. The fraction of excess zeros is exactly equal to $$P(X \notin A) = E[1 - \mathbf{1}_{X \in A}]$$, so we can correct the result for the excess zeros in the calculation by dividing it by the probability of non-zeros.

As noticed in the answers by @all feedback welcome (+1), it directly follows from applying the definition, and @user18214 (+1) also gives a more formal explanation.

For a proof without using integrals but using the Law of Iterated Expectations :

Let $$\mathbf{1}_{A}$$ denote $$\mathbf{1}_{X \in A}$$. Then $$E[X \mathbf{1}_{A}]=E[E(X \mathbf{1}_{A} | \mathbf{1}_{A} )]=E[\mathbf{1}_{A}E(X|\mathbf{1}_{A})]=Pr(\mathbf{1}_{A}=1)E[X|X \in A]+Pr(\mathbf{1}_{A}=0)(0\times E[X | X \notin A])=Pr(\mathbf{1}_{A}=1)E[X|X \in A]$$

The result follows (divide both sides by $$Pr(\mathbf{1}_{A}=1)$$)

• Thanks a lot! I think your proof is the most rigorious and general. Jun 30, 2022 at 7:58

Yes it does hold and your proof looks correct. You are simply using the definition of conditional probability, $$f(x\mid x\in A)=\frac{f(x,x\in A)}{\Pr(X\in A)}.$$

• Thank you very much! This is very helpful. Jun 30, 2022 at 7:55