# Algebra of Random Variables

Random variables have been introduced as functions defined on sample spaces. The simplest ones are the identity function, f(x) = x, and the indicator functions of events: 1A(x) = 1 if x is favorable to event A, and 1A(x) = 0, if it is not. The probability itself is a random variable, albeit a variable with very specific properties. RV is a universal abbreviation for "random variable".

It is customary to use capital (and often bold capital) letters to denote random variables. For example, on the sample space of 2 tosses of a coin the number of heads is an rv. Let it be H:

 H(HH) = 2, H(HT) = H(TH) = 1, H(TT) = 0.

The sum total S of two die is a random variable with the range {2, 3, ..., 12}.

Associated with every random variable is a probability distribution (function) defined on the range of the rv:

 fX(t) = P(X = t).

So, for example, fH is a function defined on the set {0, 1, 2} with values

 fH(0) = 1/4, fH(1) = 1/2, fH(2) = 1/4.

Also, fS(3) = 1/18 and fS(5) = 1/9. For the identity function X(x) = x, the probability distribution is simply the probability defined on the sample space:

 fX(x) = P(X = x) = P(x).

All that can be done with two functions defined on the same domain, can be done with two random variables defined on the same sample space. For example, if two random variables S and T are numeric and defined on the same sample space {x} then S + T is another random variable defined as

 (S + T)(x) = S(x) + T(x).

A constant RV can be added to any other. (An RV is constant if it takes on only one value and that - naturally enough - with the probability of 1. It may be considered as defined on any finite sample space and assigned arbitrary probabilities at every elementary outcome, subject to the sole restriction that those proabilities add up to 1.)

Also, for a function f defined on all possible values of a RV X we can define a RV Y = f(X) for a value x of X takes on the value y = f(x) with the same probability:

 P(Y = f(x)) = P(X = x).  