Combining random variables

From CS2800 wiki

Random variables are neither "random" nor "variable". However, by defining arithmetic operations on them, we can put them into equations, where they can act like variables.

If [math]X [/math] and [math]Y [/math] are random variables on a probability space [math](\href{/cs2800/wiki/index.php/S}{S},\href{/cs2800/wiki/index.php/Pr}{Pr}) [/math], then [math]X \href{/cs2800/wiki/index.php?title=%2B&action=edit&redlink=1}{+} Y [/math] is the random variable on [math](\href{/cs2800/wiki/index.php/S}{S},\href{/cs2800/wiki/index.php/Pr}{Pr}) [/math] given by [math](X \href{/cs2800/wiki/index.php?title=%2B&action=edit&redlink=1}{+} Y)(s) := X(s) + Y(s) [/math].

Note: You cannot add random variables on different sample spaces.

Similarly, we can define other operations:

If [math]X [/math] and [math]Y [/math] are random variables on a probability space [math](\href{/cs2800/wiki/index.php/S}{S},\href{/cs2800/wiki/index.php/Pr}{Pr}) [/math], then [math]X \href{/cs2800/wiki/index.php?title=%C2%B7&action=edit&redlink=1}{·} Y [/math] is the random variable on [math](\href{/cs2800/wiki/index.php/S}{S},\href{/cs2800/wiki/index.php/Pr}{Pr}) [/math] given by [math](X \href{/cs2800/wiki/index.php?title=%C2%B7&action=edit&redlink=1}{·} Y)(s) \href{/cs2800/wiki/index.php/Definition}{:=} X(s)·Y(s) [/math].

Note: You cannot multiply random variables on different sample spaces.

If [math]X [/math] is a random variable on a probability space [math](\href{/cs2800/wiki/index.php/S}{S},\href{/cs2800/wiki/index.php/Pr}{Pr}) [/math], then [math]\href{/cs2800/wiki/index.php?title=-&action=edit&redlink=1}{-} X [/math] is the random variable on [math](\href{/cs2800/wiki/index.php/S}{S},\href{/cs2800/wiki/index.php/Pr}{Pr}) [/math] given by [math](\href{/cs2800/wiki/index.php?title=-&action=edit&redlink=1}{-} X)(s) := -X(s) [/math].


As usual, [math]X \href{/cs2800/wiki/index.php?title=-&action=edit&redlink=1}{-} Y [/math] is shorthand for [math]X \href{/cs2800/wiki/index.php?title=%2B&action=edit&redlink=1}{+} (\href{/cs2800/wiki/index.php?title=-&action=edit&redlink=1}{-}Y) [/math].

For example, suppose we modeled an experiment where we randomly selected a rectangle from a given set. We might have random variables [math]W [/math] and [math]H [/math] that give the width and height of the selected rectangle. We could then define a new "area" random variable by multiplying [math]W [/math] and [math]H [/math]; this would work as expected: to find the area of a given outcome, you would measure the width and the height and then multiply them (since by definition, [math]A(s) = (W·H)(s) = W(s)H(s) [/math]).

Because we define operations on random variables pointwise, random variables behave the same way as real numbers do. For example,


If [math]X [/math], [math]Y [/math], and [math]Z [/math] are random variables on a probability measure [math](\href{/cs2800/wiki/index.php/S}{S},\href{/cs2800/wiki/index.php/Pr}{Pr}) [/math], then [math]X(Y + Z) = XY + XZ [/math].
Proof:
Choose an arbitrary [math]s \href{/cs2800/wiki/index.php/%E2%88%88}{∈} \href{/cs2800/wiki/index.php/S}{S} [/math]. We have

[math]\begin{align*} \left(X(Y + Z)\right)(s) &= X(s)\left(Y+Z\right)(s) && \href{/cs2800/wiki/index.php/%C2%B7_(random_variables)}{\text{by definition of ·}} \\ &= X(s)\left(Y(s) + Z(s)\right) && \href{/cs2800/wiki/index.php/%2B_(random_variables)}{\text{by definition of +}} \\ &= X(s)Y(s) + X(s)Z(s) && \href{/cs2800/wiki/index.php/Arithmetic}{arithmetic} \\ &= (XY)(s) + (XZ)(s) && \href{/cs2800/wiki/index.php/%C2%B7_(random_variables)}{\text{by definition of ·}} \\ &= (XY + XZ)(s) && \href{/cs2800/wiki/index.php/%2B_(random_variables)}{\text{by definition of +}} \\ \end{align*} [/math]

Thus [math]X(Y+Z) \href{/cs2800/wiki/index.php/Equality_(functions)}{=} XY + XZ [/math].