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?
 A: 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)$)
A: Yes it does hold and your proof looks correct. You are simply using the definition of conditional probability, $f(x|x\in A)=\frac{f(x,x\in A)}{Pr(X\in A)}$.
A: 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 \in A) = E[\mathbf{1}_{X \in A}]$, so we can correct the result for the excess zeros in the calculation by dividing it by the probability.
As noticed by @all feedback welcome (+1), it directly follows from applying the definition, and @user18214 (+1) also gives a more formal explanation.
