# Confused between random variable as function, coming from CS background

This is from wikipedia

The term ‘random variable’ can be misleading as it is not actually random nor a variable,[2] but rather it is a function from possible outcomes

I know that in programming functions can be variables also, like following

``````relu = lambda x: max(0, x)
``````

but mathematically, functions are different from variables. Please help me understand why its called variable.

Hi @tbhaxor!

This question is very interesting. You are correct that random variables are actually functions. However, due to their complex input, it is just virtually impossible to predict an exact outcome.

Let’s use a dice as an example. You know that if we throw a faird 6-sided dice, there are 6 equally possible outcomes, and it is virtually impossible to predict which number the dice will land once you throw it. However, if you know exactly the movement you will throw the dice, the exact geometry of the dice, the air resistance the dice will face untill landing etc., then you would be able to properly predict the exact value it would give. Note that this is impossible in daily life, also this is very hard to do, so it is easier to just consider the outcomes as random, where we know the possible values.

One interesting assumption that the probabilistic theory makes when defining random variable is: if we know completely how the sample space works, then any random event ir predictable. However, as discussed above, this is just impossible due to the complexity of some examples.

Lucas

2 Likes

The output is indeterministic and is fixed between range \{ 0, 1\}, therefore we can say it is random. Now variable means it can have multiple values.

Random variable is function because the experiment is itself inderterministic.

This is the way how I learnt about it.

Also I learnt that PDF/PMF are the functions that take random variable range as input and return their associated probability. Because the output can be plotted as histogram or the kernel density function, they have Distribution/Mass in the name.

1 Like