Understanding random variables as functions First of all, I have read What is a function and I have understood it basically and it is clear to me that in order to caluclate statistics "things" have to be transformed or mapped to numbers.
I have read that a random variable $X$ is (or can be thought) as a function. $X:\Omega\rightarrow\mathbb{R}$ and then $X(\omega) = ...$
Say we have a coin with $\Omega = \{H,T\}$ then we could do $X:\{H,T\} = \{0,1\}$.
My question is here about the meaning of $X$ or how to "pronouce" it. I would say $X$ is just a placeholder or short for "map (or transform) the character "H" into 0 and "T" into 1.
Or if we wean to count the numbers of getting tails then X:{H,T} = if tails is facing upwards increase the counter by 1. And $X$ is just short for the if sentene. Is this right?
Second, say I have a data set like this
\begin{array}{|c|c|c|}
\hline
id& coin & value \\ \hline
 1& H & 0\\ \hline
 2& H & 0\\ \hline
 3& T & 1\\ \hline
\end{array}
then "coin" is no random variable because it isn't a number and only "value" is. Is this true?
 A: In statistics, we want some way to go from the space of random events to the space of real numbers that we can deal with. Random variables are exactly how we go from "random event", defined as a particular set of elements of $\Omega$ to "real number."
Your example with the coin is very instructive. We want to find some "statistics" that can tell us, with some level of specificity, what happened.
For example, the random variable that we use depends on the use we have for it. If we want to figure out what the probability of getting a heads is out of the sample space of $n$ tosses of the coin, then we would reasonably pick our random variable as $X(\omega) = \text{# of heads in }\omega$.
If we let $n = 2$ then $\Omega = \{HH, HT, TH, TT\}$ and $X$ is the mapping
\begin{array}{|c|c|}
\hline
\omega & X \\ \hline
 HH & 2\\ \hline
 HT & 1\\ \hline
 TH & 1\\ \hline
 TT & 0\\ \hline
\end{array}
So $X$ tells us important information about which $\omega$ actually happened over the course of our two tosses!
$X$ is a mapping from random events and we can make statements about the properties of $X$ based on how frequently each of the "events" $\omega$ occur.
A: By definition, a random variable is just a measurble function over the whole space $\Omega$.
It's possible that a random variable is just to use numbers to encode different random outcomes. For example, in information theory, we can define the entropy of a random variable, where the value of the random variable doesn't matter and all we need is whether two outcomes are the same or not. In that sense, the expectation or average value of the random variable is not a meaningful quantity, just like the average of head and tail doesn't make much sense.
But the value of the random variable often made some sense. Like if you win a coin flip, you get 1 million dollars otherwise you get 0. Here $0$ and $1$ million are clearly specific numbers related to the problem you are studying that should not be replaced by two other distinct numbers. In this case, $X(H)=10^6, X(T)=0$ is not just a place holder.
When we say "a random variable", the second point of view is often implicitly assumed, as we often want to know its expectations and variance, etc. As there is no harm to use them as place holders, there is no need to have a "coin" instead of "values" in your case. One could argue, there is difference between how random variables are treated in information theory and statistics/data science, but it's not worth the effort to emphasize the difference.
