# Does a random variable needs to be numeric?

Everywhere I have seen, random variable is a numeric quantity. Is it a rule? Can random variable be a non-numeric quantity?

Suppose I toss a coin. Can I declare my random variable X to be the outcome of the toss, i.e. X will take values from {'heads', 'tail'} rather than some numeric values like {0, 1}?

If say random variable cannot take numeric values then how should I describe something like P(X='heads') = 1/2. What is X in this case?

• Sometimes the term "random element" is used for quantities that are not necessarily real numbers. – Glen_b Sep 25 '16 at 4:14
• What's exactly what I'm confused about! Thanks so much! – Gqqnbig Mar 7 at 5:53
• This is the Wikipedia article explaining random element. I bet it's what you were looking for. en.wikipedia.org/wiki/Random_element – Gqqnbig Mar 7 at 6:52

## 2 Answers

The nomenclature I'm familiar with is that the term "random variable" is reserved for a random quantity that is real-valued. "Random quantity" is the more general term for a measurable function on a probability space. Such a function's codomain need not be a subset of the real numbers, or have anything to do with numbers at all.

• What would you call X in case you want to express P(X='heads') = 1/2. Would you call X an event, outcome or random variable? – Lokesh Sep 25 '16 at 3:34
• @Lokesh Precisely what mathematical object do you mean by "heads"? – Kodiologist Sep 25 '16 at 6:00
• I am not sure. I want to do is to express the idea probability of X that will take value "heads" is 1/2. What should be X be and "heads" in this case, I do not know. – Lokesh Sep 25 '16 at 6:41
• @Lokesh The usual approach is to use 1 for heads and 0 for tails, as you mentioned in the original question. – Kodiologist Sep 25 '16 at 14:19

Random variable is simply a mapping from outcome to real number (from outcome space to real space).

Probability is a mapping from event space to [0, 1]. Here event can be "getting a head".

Probability in itself was sufficient to describe expectation of events. But sometimes we want expectation of f(event). For example, probability of sum(heads) in three tosses. So now you see, sum(heads) is a real quantity, but is derived from the outcomes. That's how notion of Random Variable came into usage.

Take away is :

For events, use probability. But for f(event), use random variable.