R.v.'s are functions, therefore it is possible to operate on r.v.'s exactly like one operates on functions. In particular it is possible to consider a function of a function. Specifically, if
X:Ω→R,g:R→R,
then it is possible to consider the composition of the maps g∘X:Ω→R, defined as
Y:Ω→R,ω↦g(X(ω)).
If X is a discrete r.v. then X=X(Ω) is a discrete set and Y=g(X) is certainly discrete, since ∣Y∣=∣g(X)∣≤∣X∣. Moreover
Y−1({yk})=X−1(g−1({yk}))=xk∈g−1(yk)⋃X−1({xk})∈F,
since ∣g−1(yk)∣≤∣X∣ (a countable union of events of F). Conclusion:Y is a discrete r.v.
Examples. If X is a r.v. and g(x)=x2 then Y=g(X)=X2 is a function of the r.v. X. One could consider other functions like X3, X, cos(X), etc.
Problem. Determine the complete probabilistic description of Y=g(X), i.e. the alphabet Y and the discrete density pY(yk), yk∈Y, or alternatively the DF FY(y), in terms of the probabilistic description of X, i.e. X and pX(xk) or FX(x).
Example.Ω={00,01,10,11} with P equiprobable. Let
X:Ω→R,ω=(b1,b2)↦X(ω)=2(b1+b2)−1,g:R→R,x↦x2.
Then X sends 00↦−1, 01,10↦1, 11↦3, and Y=X2 sends −1↦1, 1↦1, 3↦9. So Y={1,9} and
pY(9)=pX(3)=41,pY(1)=pX(1)+pX(−1)=42+41=43.
(Two different values of X are merged into the value 1 of Y, so their probabilities add.)
Lemma. Let Y=g(X) where X∼pX(xk), xk∈X. Then Y∼pY(yℓ), yℓ∈Y, where Y=g(X); moreover
pY(yℓ)=xkg(xk)=yℓ∑pX(xk).Proof.[Y=yℓ]=⋃xk:g(xk)=yℓ[X=xk] (a disjoint union), therefore
pY(yℓ)=P([Y=yℓ])=xk:g(xk)=yℓ∑pX(xk).□
Lemma (LOTUS). Let Y=g(X) where X∼pX(xk), xk∈X. Then
E(Y)=E(g(X))=xk∈X∑g(xk)pX(xk).
Remark. The practical value of the LOTUS is that it allows the computation of E(Y) without the need to first compute pY(yℓ), yℓ∈Y.
Proof. Recall the expression of pY(yℓ) in terms of pX(xk):
E(Y)=yℓ∈Y∑yℓpY(yℓ)=yℓ∈Y∑yℓ[xk:g(xk)=yℓ∑pX(xk)]=yℓ∈Y∑xk:g(xk)=yℓ∑g(xk)pX(xk)=xk∈X∑g(xk)pX(xk)=E(g(X)).
In the third step yℓ is replaced by g(xk) (equal on the inner sum); in the fourth the double sum over yℓ and over the xk in its preimage runs once over every xk∈X. □
Example.X∼U({−1,0,1}), so pX(−1)=pX(0)=pX(1)=31, and Y=X2. By the LOTUS,
E(Y)=E(X2)=xk∈X∑g(xk)pX(xk)=(−1)231+0231+1231=32.
Alternatively one can first compute pY(yℓ). The alphabet of Y is Y={0,1} and
pY(1)=g(xk)=1∑pX(xk)=pX(−1)+pX(1)=32,pY(0)=pX(0)=31.
Therefore Y∼b(32) and E(Y)=32, the same value.
If X is a discrete r.v. and g:R→R, then Y=g(X)=g∘X is a discrete r.v. with alphabet Y=g(X), ∣Y∣≤∣X∣, and Y−1({y})=⋃xk∈g−1(y)X−1({xk})∈F.
Density of Y:pY(yℓ)=∑xk:g(xk)=yℓpX(xk) (since [Y=yℓ]=⋃g(xk)=yℓ[X=xk], disjoint).
Example: X=2(b1+b2)−1 on equiprobable {0,1}2, Y=X2: pY(9)=41, pY(1)=43.
LOTUS:E(g(X))=∑xk∈Xg(xk)pX(xk), with no need to find pY. Proof: E(Y)=∑ℓyℓ∑g(xk)=yℓpX(xk)=∑xkg(xk)pX(xk).
Example: X∼U({−1,0,1}), Y=X2: E(Y)=32; also Y∼b(32).
Typical mistake: E(g(X))=g(E(X)) in general (e.g. E(X2)=32 but E(X)=0 in the example); and forgetting to add the probabilities of the xk that g maps to the same value.