In a book on probability I'm reading they begin by defining random experiment, outcome, sample space & event, then using these notions they define & a probability space in terms of the sample space, a sigma field & a probability function.
After about 80 pages of working with this theory, i.e. Bayes theorem, conditional probability etc... they introduce the notion of a random variable & the distribution function of a random variable.
They give the impression that a random variable is a function of the outcomes, & that it is defined independently of the notion of a probability function, which this stack answer seems to imply:
Probability measures assign values (probabilities) to sets in the $\sigma$-algebra $\mathcal{A}$. On the other hand, random variables are functions $f\colon \Omega\to E$ that are measurable in this sense: If $B \in \mathcal{E}$, then $f^{-1}(B) \in \mathcal{A}$. https://math.stackexchange.com/a/124504
yet other sources I've seen seem to conflate the two notions or even imply they mean the same thing :(
What is a random variable a) intuitively, b) mathematically & c) in a way that distinguishes it from a probability function, i.e. a nice intuitive example of a situation where you can't just use a probability function you need a random variable. I can't believe I got through a course on probability without understanding this :(
Thanks!