Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I was wondering if I correctly understand what a random variable is. Is a random variable's domain the set of numbers that are reasonable, when considering how the random variable is defined. For instance, $X =$ number of broken eggs in a dozen-egg cartoon. Would the domain be $\{0,1,2,3,4,....12\}$? And when you apply a function to the random variable, it will associate a number from the domain, to an element in the sample same, thereby giving some output? Taking our example, $(X=12)$ would take the domain value 12, and associate to it the element, from the sample space, $(B,~B,~B,~B,~B,~B,~B,~B,~B,~B,~B,~B)$? If I am using any notation incorrectly, please be prompt to remonstrate.

share|improve this question
The wiki page gives a good definition of RV and some examples. I deleted my answer because I feel wikipedia explains RV's really well. Sorry if you don't find the wikipedia article helpful. –  Rustyn Feb 9 '13 at 22:01
@RustynYazdanpour Well, I give it a gander. Thank you for the link. –  Mack Feb 9 '13 at 22:04
I think the mentioned wiki page is not so good actually. It makes one think that a random variable is some magical function, that is not really a function, that takes values, but not really, since you don't know what they are blah blah blah. Nonsense. A random variable is nothing but a measurable function (very ordinary function) from a given probability space to $\mathbb R$. –  Ittay Weiss Feb 9 '13 at 22:08
add comment

2 Answers

up vote 3 down vote accepted

Technically you're using the term "domain" wrong -- what you're thinking of here is the range (or "codomain") of the random variable.

Formally a random variable is a (measurable) function from a sample space $\Omega$ to some other set that is the range of the random variable. Exactly what $\Omega$ is is usually left implicit in computation, and it is almost universal to write just $X$ in computations rather than "$X(\omega)$ where $\omega\in\Omega$ is a point in the sample space that represents one outcome of the experiment". This is because when there are several random variables involved, we always talk about their values at the same $\omega\in\Omega$, so possibly $X(\omega)+Y(\omega)$, but never $X(\omega_1)+Y(\omega_2)$.

In particular is $X$ and $Y$ are number-valued random variables, the notation $X+Y$ stands for the function $\omega \mapsto X(\omega)+Y(\omega)$, which is itself a random variable.

Similarly, when $X$ is a random variable whose range is in the set A (that is, $X:\Omega\to A$) and $f$ is a function $A\to B$, we write "$ f(X) $" to denote the random variable that is the composition of $f$ with $X$, that is, the function $\omega \mapsto f(X(\omega)) $.

In your example, $X$ is a random value with range $\{0,1,2,\ldots,12\}$. "Broken" and "unbroken" are not elements of either the sample space or the range of $X$, but there could be another random variable $Y$ with range $\{B,U\}$ that encodes whether the top right egg in the container is broken or not. In that case the two variables would be related by $Y=B \Rightarrow X\ne 0$ and $Y=U\Rightarrow X\ne 12$.

We don't usually describe explicitly what the sample space is. Here it presumably contains at least one point for each of the $2^{12}$ possible combinations of broken and unbroken eggs, but there could be many different elements in the sample space for each such combination. Being deliberately vague about the sample space has the advantage that we can almost always decide halfway through the analysis to assume that there are dimensions to it that we haven't mentioned before, so that for example it has room to define a random variable $Z$ giving the number of red lights the driver of the egg transport needs to stop at on the way to the supermarket.

share|improve this answer
add comment

A random variable is a function. It's values are fixed and well-defined and there is nothing random about them. The precise definition is that a random variable $X$ is a function $X:P\to \mathbb R$ where $P$ is a probability space, and then to be a random variable $X$ must be Borel measurable.

This this latter notion is technically a bit involved but in some cases it is greatly simplified. Consider for instance a fair coin. The probability space associated to it is $\{H,T\}$ and $p(H)=P(T)=0.5$. Now, you can't speak of the average of $H$ and $T$, a mean or anything like that. But, if you now define a function $X:\{H,T\}\to \mathbb R$ by $X(H)=4$ and $X(T)=17$ then $X$ is a random variable and now you can speak of its mean, variance, or any other useful things. Of course there are infinitely many different random variables just in this particular case.

Often the most natural way to model a statistical situation mathematically is with a probability space that is not $\mathbb R$. But often it is natural to translate the situation to $\mathbb R$. That is basically what a random variable does.

share|improve this answer
where P is a probability space... Ouch! That hurted. Don't you want to keep P for something else? (Something else, just for the record: I do not understand your last paragraph and I think I disagree with what I understand from it... To begin with, which natural probability measure on $(\mathbb R,\mathcal B(\mathbb R))$ should one consider?) –  Did Feb 10 '13 at 20:59
I'm not sure I follow you objection. Do you mean keep the letter 'P' for "probability of..."? And I didn't say there is a natural probability on $\mathbb R$ but only that it is natural to translate to $\mathbb R$. There are many possible translations. –  Ittay Weiss Feb 10 '13 at 21:06
Yes I meant keep P for probability measures. // Natural to translate the situation to R: I know almost no such situations, in fact it is almost always better to keep the probability space $(\Omega,\mathcal F,\mathbb P)$ unspecified, contrary to what bad (but seemingly frequent in the US) pedagogical choices suggest. –  Did Feb 10 '13 at 21:14
I think we are agreeing here @Did. Usually it is not needed to make the domain space explicit. I agree. Still, a random variable is just a measurable function. –  Ittay Weiss Feb 10 '13 at 21:33
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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