Show that two random variables are equal a.s. and say if they are equal surely as well

Let X,Y be two r.v.'s living on the probability space $$(\Omega,\mathcal{F},R)$$ such that $$E[X1_{A}]=E[Y1_A] \forall A\in\mathcal{F}$$. Show that X=Y a.s.. What is more, is X=Y surely? Why? Why not?

I have tried this way: consider $$(X1_A - Y1_A)$$, which is equal to $$(X - Y)$$ for $$\omega \in A$$ and equal to 0 otherwise. Take $$E(X1_A - Y1_A)$$: $$E(X1_A - Y1_A) = (X - Y)Pr(A) + 0Pr(A^C) = (X - Y)Pr(A)$$ Since we know that $$E[X1_{A}]=E[Y1_A] \forall A\in\mathcal{F}$$, we have, by linearity of expectation on l.h.s: $$0=(X - Y)Pr(A)$$ $$0=XPr(A)-YPr(A)$$ $$XPr(A)=YPr(A)$$ $$X=Y$$ If the above is correct, I think that $$X$$ and $$Y$$ are equal both a.s. (that is, with probability 1, since I have considered the whole $$\Omega = A \cup A^C$$ and surely as well. Is this correct?

Your reasoning is not correct. You're saying that an expected value equals a random variable.

Juste take $$A=\{X. Then $$(Y-X)1_A$$ is a nonnegative random variable with null expected value, so $$(Y-X)1_A=0$$ almost surely, which means $$X\ge Y$$ almost surely. With $$A=\{X>Y\}$$ you get $$X\le Y$$ almost surely, hence $$X=Y$$ almost surely.

• Thank You a lot @Will Jan 23, 2020 at 17:41
• And could I state as well that they are equal surely, that is not just a.s. but also surely? Jan 23, 2020 at 17:44
• What are you definitions of "a.s." and "surely"? For me they mean the same, and besides "a.s." stands for "almost surely"
– Will
Jan 23, 2020 at 18:03
• Yeah, of course a.s. stands for "almost surely"..I mean, since in the question I am requested to say if they are equal ALSO surely, and not just a.s. I was asking you. Surely is a synonym for "absolutely certain" while almost surely stands for something with a probability equal to 1 associated to it. I think that the question on "surely" is due to the fact that whenever sample space is discrete, a.s. and surely are the same thing, while this may not be true for infinite sample space Jan 23, 2020 at 18:06
• Okay I see. I think what you call "surely" and "asbolutely certain" is what I call "everywhere", that is for all $\omega\in\Omega$ and not only for a set with probability $1$. Then of course we do not have $X=Y$ everywhere, but only almost surely.
– Will
Jan 23, 2020 at 18:13