# How a random variable takes a value?

Why do mathematicians say a random variable takes on a value? Is it just for convenience? My understanding is that a random variable is a function mapping the sample space of an experiment to a codomain of interest. When I read "$X$ takes on the value ... ", I take it to mean we apply $X$ to the outcome $s$ of some experiment, and use the value of this for some purpose (e.g. assign a probability to it). That is, we use $a$ when $a=X(s)$.

I don't understand when people say formally or informally things like $X=4$ or even $X=X(s)$. Isn't this wrong?

-
What's the rest of that sentence? ("$X$ takes on the value...") –  Qiaochu Yuan Sep 16 '12 at 22:25
Functions take on (have) values. For example, let $f(x)=x^2$. The sentence "Where does $f$ take on the value $9$?" is quite idiomatic –  André Nicolas Sep 16 '12 at 22:30
Right André, but doesn't that mean: for what value of $x$ is $f(x)=9$? In probability I see statements where a closer analogy would be something like $f=9$ –  zenna Sep 16 '12 at 22:36
@zenna: There are some differences of usage. Part of the reason is that random variables were not always functions, that interpretation only came about in the $20$th century, when the subject was made rigorous. There are similar mild problems with calculus notation. –  André Nicolas Sep 16 '12 at 22:45

People make lots of confusion with "random variables". Given a probability space $(\Omega, \mathcal{B}, P)$, a random variable is simply a function $$X: \Omega \to \mathbb{R}$$ that is Borel measurable (you can ignore this if you don't understand).
The naming seems to suggest that those "random variables" take "random" values for each $\omega \in \Omega$. That is, people seem to talk about the random variable as if $X(\omega)$ was not always the same. Informally, what is "random" here is the choice of $\omega$.
Suppose that the set $\Omega = \{1,\dotsc, 6\}$ represents the possible outcomes of a dice. Suppose that you are gambling (why else study probability?). For each outcome $\omega$, you get $X(\omega)$ Brazilian Reals (BRL). In a sense, the amount of money you will get on each roll of the dice is a "random" value. That is, it is a "random variable". The randomness comes from the dice itself, not from $X$. Now, I can ask you what is the probability that you will loose money. I can ask you what is the probability that you will get more then 5BRL. For example, the probability that you will get exactly 10BRL is the probability of getting any of the outcomes $X^{-1}(10)$. That is, $P\left(X^{-1}(10)\right)$.
Now, instead of writing $P\left(X^{-1}(10)\right)$, probabilists prefer to write $P(X = 10)$. Instead of writing $P\left(X^{-1}([a, b))\right)$, probabilists prefer to write $P(a \leq X < b)$. Or, if you just want to talk about the event, you can use the notation $$[X \in A] = X^{-1}(A),$$ or its variants $[X < a]$, etc.
A random variable transports the probability (randomness) in $\Omega$ to a probability in $\mathbb{R}$. Namely, it transforms the probability $P$ over $\Omega$ into the probability $P \circ X^{-1}$, that takes a (Borel) set $A$ and attributes the probability $P(X^{-1}(A))$ to it.