# [Prob&Stats] 1. Random Variable

# 1. Random Variable

‘Random variable’ is ways(or a function) to map the outcome of random processes to numbers.In other words, it plays the role of quantifying the outcomes. The concept of random variable might be confusing since it is not like an algebra variable. In algebra, a variable like ‘𝑥’ is an unknown value but solving an equation will always lead to the same answer of the variable ‘𝑥’. For example, from the equation: 𝑥 + 10 = -5, the value of ‘𝑥’ is clearly 5 and it will not change regardless of how many times or whenever we perform the calculation of this equation.A random variable, however, unlike an algebra variable, has a set of possible values and it can randomly take on any of those values.

*outcome: a possible result of experiments**Random variable tends to be noted as a capital letter like ‘𝑿’*

*Given the example in figure 1, we are going to toss a coin. The number of total possible outcomes is 2 which are the **‘Head’ **and **‘Tail’**, and we have the random variable 𝑿 whose value is 1 when the outcome is Head and is 0 otherwise. In other words, 𝑿 maps outcomes(‘Head’ and ‘Tail’) from the sample space to numbers(1 and 0, in the above case), and the probability that 𝑿 takes on the value 1 is 1/2 since, only the outcome ‘Head’ results in the value 1 for 𝑿 out of total possible outcomes when the coin is tossed(‘Head’ and ‘Tail). Therefore, the probability of (𝑿=1) is 1/2. In that sense, P(𝑿=0) is also 1/2 and figure 2 illustrates the distribution of 𝑿.*

*Let’s take a look at another example below. This time we toss 3 coins and define the random variable 𝑿 as a ‘total number of heads’.*

*From each toss, 2 outcomes which are the ‘Head’ and the ‘Tail’ can happen, and we toss three coins. It will result in 8(2³=8) possible outcomes as is shown in the sample space of figure 3. Since the tossed number of coins is 3, the ‘Head’ can appear 3 times at the most or 0 times at the worst. So 𝑿 can have value among 0, 1, 2, and 3. Calculating probabilities for each case are the same as we did in figure 1.*

*There is another interpretation of 𝑿. we can define another 3 random variables 𝑿₁, 𝑿₂, 𝑿₃ which takes an outcome from the respective toss time step 1, 2, 3 and maps the ‘Head’ to 1. More specifically, 𝑿₁ represents the first toss, and 𝑿₂, 𝑿₃ represent the second and third toss, respectively. Then we can see that the random variable 𝑿 which is defined as the total number of heads can be interpreted as the sum of 𝑿₁, 𝑿₂, and 𝑿₃.*

# 2. Types of random variables

*Random variables have 2 types: (1) Discrete and (2) Continuous*

## 2.1 Discrete random variables

*A discrete variable is a variable whose value is obtained by counting(finite). It can take only distinct, separate values.*

*The random variable in figure 1 and 3 is an example of a discrete random variable. It has two values which are 1 and 0, those are apparently distinctive and countable values. In other words, if a random variable 𝑿 has a finite and countable number of values that it can take on, then 𝑿 is a discrete random variable.*

## 2.2 Continuous random variables

*In contrast to discrete random variables, a continuous random variable is a variable whose value is obtained by measuring. It can take on any value in some interval(low, high).*

*For instance, let the random variable **𝐘** denotes the exact mass of a random human selected on the earth. **𝐘 **might take on any value somewhere between 0 and 200kg. However, we can not list all of the possible masses in this interval since there is an infinite number of values between consecutive two numbers. For example, between 70.01 and 70.02 there are 70.001, 70.0001, 70.00001, 70.00…0001 and so on. Namely, since it is impossible to make a list of all possible values that 𝐘 can take on, 𝐘 is a continuous random variable.*

# 3. Reference

[1]https://en.wikipedia.org/wiki/Random_variable#Definition

[2]https://www.mathsisfun.com/data/random-variables.html

[3]https://www.quora.com/A-coin-is-tossed-3-times-What-is-the-probability-that-the-tosses-are-the-same

[4]http://www.henry.k12.ga.us/ugh/apstat/chapternotes/7supplement.html

**Any corrections, suggestions, and comments are welcome**