# Summation of a Random Variable

I'm having trouble grokking Cormen's Algorithms book on pg. 120. The context is the hiring problem (as it is called in the book). Here is the part that is tripping me up:

"Let X be the random variable whose value equals the number of times we hire a new office assistant."

and later on:

"...we let $X_i$ be the indicator random variable associated with the event in which the $i$th candidate is hired ... [so that] $X = X_1 + X_2 + \ldots + X_n$"

In particular, Cormen defines $X_i$ as follows:

$$X_i = \begin{cases} 1 & \text{if candidate i is hired} \\ 0 & \text{otherwise} \end{cases}$$

Question: Why does $X = X_1 + X_2 + \ldots + X_n$?

First, this equation only makes sense if $X$ and each of the $X_i$ have the same domain. Here I'm assuming the domain of $X$ is $\{1,2, \ldots , n\}$ (i.e., each number representing the number of assistants hired).

That implies that the domain of each $X_i$ must be $\{1,2, \ldots , n\}$. Then it seems that, i.e., $X_2$ will satisfy $X_2(2) = 1$ and be $0$ everywhere else.

But if that's the case, then $X_1 + \ldots + X_n$ will satisfy $X(i) = 1$ for all $i \in \{1, \ldots , 6\}$, which means that $X \ne X_1 + \ldots + X_n$ (since, for example, $X(2) = 2$). What am I missing?

EDIT: The more I think about it, the more I'm convinced that my misunderstanding lies with the way $X$ itself is defined. Is it true that i.e. $X(2) = 2$?

• I don't understand what you mean by "$X(2)$". $X$ is defined as an integer-valued random variable, not a function. Apr 8, 2016 at 22:30
• A random variable is a function. Apr 8, 2016 at 22:59

Your outcomes are not the number of candidates but rather which candidates were hired: $\Omega = \{0,1\}^n$. Then you have $X_i(a_1, \dots, a_n) = a_i$ and $X(a_1, \dots, a_n) = \sum\limits_{i=1}^n X_i(a_1, \dots, a_n) = \sum\limits_{i=1}^n a_i$.
• What is $\Omega$ in this context: is it the domain, or the range of the random variable $X$ (or of $X_i$)? Apr 8, 2016 at 23:01
• Do you mean by $\{0,1\}^n$ the set $\{(0,1) \times \ldots \times (0,1) \}$ (with cardinality $2^n$)? Apr 9, 2016 at 0:11