for example you toss a coin three times then let $X$ be the number of times you get heads.
so since the coin is tossed three times it means the sample space is $ \Omega = \{HHH,HHT,HTH,HTT,TTT,TTH,THT,THH\}$
with each sample point from the sample space above we can associate a number for X (either 3 or 2 or 1 or 0).
this means X is a function from $\Omega$ to the real numbers so It follows that X is a random variable.
but how can we prove that formally, I mean is there a more formal proof of it.