# What is the difference between a random variable and an event?

In layman terms, what is the difference between a random variable and an event? To my understanding a random variable is a function outputting a real number. And an event is an outcome or a set of outcomes.

• Tossing a coin two times is an event with the outcome space $\{TT,TH,HT,HH\}$. A random variable maps each element of outcome space to some value. For example you could have the random variable $X$ mapping each element to the number of heads. Then $X(TT)=0,X(TH)=X(HT)=1,X(HH)=2$. Nov 2, 2020 at 6:21

This may be an instance where the most possible general definition gives more insight. Consider a pair $$(\Omega, \Sigma)$$ where $$\Omega$$ is the sample space and $$\Sigma \subseteq 2^\Omega$$ is a $$\sigma$$-algebra. The measurable sets (i.e., elements of $$\Sigma$$) are called events. A random variable is a measurable function $$X\colon \Omega \to \Bbb R$$. By measurable function we mean that for every open interval $$]a,b[\subseteq \Bbb R$$, we have that $$X^{-1}\big(]a,b[\big) \in \Sigma$$ is measurable. To put it simply:

A random variable is a nice function from the sample space to the real line (and a random vector takes values in some $$\Bbb R^k$$, etc.). An event is a certain subset of the sample space, to which a probability may be assigned.

This does not depend on any choice of probability. More precisely, a probability space is a triple $$(\Omega, \Sigma, \Bbb P)$$ where $$(\Omega, \Sigma)$$ is as above and $$\Bbb P\colon \Sigma \to \Bbb R_{\geq 0}$$ is a measure with $$\Bbb P(\Omega) = 1$$. Then finding $$\Bbb P(X = x)$$ means finding the "measure" of the event $$\{\omega \in \Omega \mid X(\omega) = x\}\in \Sigma$$, inside of the sample space $$\Omega$$.

Example: consider the experiment of tossing a fair coin $$n$$ times. The sample space is $$\Omega = \{{\rm heads}, {\rm tails}\}^n$$. The $$\sigma$$-algebra of events will be all possible subsets of $$\Omega$$. Say that we write $$0$$ for heads and $$1$$ for tails, and the random variable $$X \colon \Omega \to \Bbb R$$ gives the result of the second toss. That is: $$X\colon \Omega \to \Bbb R$$ is given by $$X(\omega_1,\ldots, \omega_n)= \omega_2$$. The event "getting heads on the second toss" is $$X^{-1}(0) = \{ (\omega_1,\ldots, \omega_n) \in \Omega \mid \omega_2 = 0 \}$$, and the probability of this happening is $$\Bbb P(X = 0) = 1/2$$.

• Good answer but I think it is a little too advanced seeing the level of the question asked and may not be comprehensible. Nov 2, 2020 at 6:31
• I totally agree. If OP gets the take-away "A random variable is a nice function from the sample space to the real line (and a random vector takes values in some $\Bbb R^k$, etc.). An event is a certain subset of the sample space, to which a probability may be assigned." then it's already good enough for me. Nov 2, 2020 at 6:47
• @ShubhamJohri subtle flex :^) Sep 26, 2021 at 6:28

We have a large (and maybe not well describable) space $$\Omega$$ of possible outcomes. For example, $$\Omega$$ might be the set of possible weathers tomorrow at the village where I live.

An event is a decent subset of $$\Omega$$, say the set $$R\subset\Omega$$ of all weathers where it rains at time 10:00 tomorrow. When a probability measure $${\tt P}$$ has been defined on $$\Omega$$ it makes sense to talk of the probability $${\tt P}(R)$$ of the event $$R$$, and the well known rules about the probabilities of unions, etc., of events hold.

A random variable is a given real-valued function defined on $$\Omega$$, say, the temperature at the graveyard at time 12:00. This is a nice function, and there is nothing random about it. When fate has chosen a weather $$\omega\in\Omega$$ the function value $$f(\omega)$$ is determined. This value is considered "random", before one has really observed it.

Usually the probability that $$f$$ has a particular value, say $$21.35^\circ$$ Celsius, is zero. This particular event is just too special. But one can easily define events using $$f$$ that have an interesting probability, say the event $$Z$$, consisting all weathers $$\omega$$ with $$f(\omega)<0^\circ$$ Celsius. We see here that a random variable can be used to create lots of events that are of interest in the momentary discussion.

On the other hand an arbitrary event, say the $$R$$ from above, can be redesigned as a random variable, when we want to argue in the language of random variables: The characteristic function of $$R$$, being $$\equiv1$$ on $$R$$ and $$\equiv0$$ outside of $$R$$ is a perfect random variable, albeit one with just two values.