# Random Variable

$X$ is a random variable (r.v.) if it is a function that maps each outcome of a random experiment (sample space $S$) to an element in $R$. $X:S→R$

Ex: You roll a dice twice. We define $X$ as the sum of the faces, so it maps $(2,3)$ to $5$

- Domain: Set of outcomes in in the experiment $(x_{1},x_{2},…,x_{n})$
- Range: Real value

The random variable can follow various Distributions (see this page for more), such as

There are two types of random variables:

- Discrete Random Variable: Takes on Integer values
- Continuous Random Variable: Takes on real values. Ex: Measuring heights of people

### Other Notes

- The experiment is random, the function, $X$, is not.
- This is confusing. The function is deterministic, input is random, but output behaviour is known. It would be stupid if the function is not deterministic.
- Ex: Roll a die 3 times. Define $X=∣# heads - # tails∣$
- In this case, the actual coin flip (input) is random. However, calculating the function to determine $X$ is not, we know how to compute it and it is the same every time based on the input.

- Geometric Interpretation of an r.v.