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$?

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

1 Answer 1


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$.

  • $\begingroup$ What is $\Omega$ in this context: is it the domain, or the range of the random variable $X$ (or of $X_i$)? $\endgroup$
    – George
    Commented Apr 8, 2016 at 23:01
  • $\begingroup$ Omega is usually used as the symbol for the possible outcomes, i.e. the variable domain. $\endgroup$
    – Andreas T
    Commented Apr 8, 2016 at 23:21
  • $\begingroup$ Do you mean by $\{0,1\}^n$ the set $\{(0,1) \times \ldots \times (0,1) \}$ (with cardinality $2^n$)? $\endgroup$
    – George
    Commented Apr 9, 2016 at 0:11
  • $\begingroup$ Yes, that is what I meant. You can also see it as an n-dimensional vector. $\endgroup$
    – Andreas T
    Commented Apr 9, 2016 at 0:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.