# What is a random variable

Content
»Preliminary remark
»Discrete Random Variables and Their Probability Functions
»Continuous random variables
" Remarks
“Examples

##### Preliminary remark

We have already covered very simple, discrete random variables. With a little more formalism, building on the previous questions, we can consider even more complicated models.

##### Discrete random variables and their probability functions

Discrete random variables are perhaps the simpler of the two. They assign the values ​​of a finite set \ (\ Omega \), for example \ (\ {0, 1, 2, 3 \} \), or a countably infinite set, for example \ (\ mathbb {N} \) With the help of a probability function \ (f \) a probability An example for \ (\ {0, 1, 2, 3 \} \) would be the number of coats of arms when a coin is tossed three times. On the other hand, the "waiting time" in days until a purchased device becomes defective can assume all natural numbers \ (\ mathbb {N} \).

We often construct probability functions by hand and write down the probabilities explicitly, as in our previous examples. This is of course very time-consuming with \ (\ {0, 1, 2, \ dots, 30 \} \) or is not even possible with natural numbers. However, probability functions can often be specified explicitly. We now want to lay the foundation for more complicated probability functions, especially as far as the notation is concerned. Let us consider the two coin toss and our random variable \ (X \) observes the number of coats of arms \ (W \). Then we can define a probability function, or probability distribution, \ (f \) or \ (P \) on \ (\ Omega = \ {0,1,2 \} \). Depending on the context, book or preferences, the following formulas all describe the probability of having exactly two coats of arms:
\ begin {align *}
P (X = 2) = P ({2}) = f (2) = \ frac {1} {4}.
\ end {align *}
Here \ (P (X = 2) \) is the most telling, "the probability \ (P \) that my random variable \ (X \) takes the value \ (x = 2 \)". On the other hand, \ (f (2) \) is already the notation from function theory, but as we see in the following, this has a great right to exist.

We can also plot this probability distribution. To do this, we create a histogram whose classes have width 1 and represent our event space \ (\ Omega \). We now choose \ (P \) as the height, so the area of ​​the bars (height times width \ (= 1 \)) also represents the probability.

The histogram is a popular illustration in school, "in reality" one often considers the section-by-section defined probability function \ (f \)

##### Continuous random variables

There are not only discrete random variables, values ​​other than natural numbers can of course also occur in processes. Popular examples are the lifespan (burning time) of a lightbulb, the size of a randomly selected person or the (waiting) time (not in days) until a certain atom decays. The value ranges of our random variable are elements of the real numbers \ (\ mathbb {R} \), then there is a continuous random variable.

A continuous random variable now assigns probabilities to these infinitely many values, this is done using a continuous probability function \ (f \), often also called density function \ (f \).

A big difference to the discrete random variable is the following: Since our range of values ​​\ (\ Omega \) consists of an infinite number of elements, because it is an uncountable subset of \ (\ mathbb {R} \), the probability is that a certain The value is equal to 0. This property, which appears strange at first glance, also makes mathematical sense in brief. But how do we define our random variable and our distribution function if \ (P (X = x) = 0 \) holds for all \ (x \ in \ mathbb {R} \)? In the case of a continuous random variable, starting from the density function \ (f \), we examine probabilities with the help of its cumulative distribution function \ (F \) (the antiderivative). Similar to the discrete case above, this distribution function measures the area under the graph that corresponds to the probability. The following are three graphs of important continuous density functions.

The blue area calculates the area, the probability, under the graph for \ (P (X \ leq 3) \) (in general \ (P (X \ leq x) \)). Depending on the context, we use other probability distributions to best describe reality. So we define that \ (X \) is a continuous random variable on \ (\ Omega \). The cumulative distribution function \ (F \) is then defined as
\ begin {align *}
P (X \ leq x): = F (x) = \ int _ {- \ infty} ^ x f (x) dx.
\ end {align *}

##### Remarks

Roughly said once again, the discrete random variable usually has an explicit distribution function to calculate \ (P (X = x) \), whereas the continuous random variable has an explicit, cumulative distribution function, which \ (P (X \ leq x) \) calculated.

Often one also defines cumulative distribution functions for the discrete case. Due to the existing, explicit formulas about the discrete probability functions and the associated, very manual, possibility of \ (P (X \ leq 3) = P (X = 0) + \ dots P (X = 3) \), \ ( P (2 \ leq X \ leq 5) = P (X = 2) + \ dots + P (X = 5) \) and many more explicitly and the disadvantage that, unlike in the continuous case, there is usually no explicit formula for the distribution function, these are only introduced to bring the concept closer, but often have no added value or necessity in terms of computation.

So we hereby define a cumulative distribution function. Let \ (X \) be a discrete random variable on \ (\ Omega \). The cumulative distribution function \ (F \) for the discrete probability distribution \ (f \) (or \ (P \)) is then defined as
\ begin {align *}
P (X \ leq x): = F (x) = & \ sum _ {x_i \ leq x} P (X = x_i) = \
& = P (X = 0) + \ dots + P (X = x) \
\ end {align *}

Let's look again at the different spellings. With a discrete random variable \ (X \) we usually have an explicit probability distribution which we \ (P (X = x) \) calculates. This is also often based on the continuous case, called the density function \ (f \) with \ (f (x) = P (X = x) \). \ (P (X = k) \) and \ (f (k) \), based on \ (k \) hits, are also popular. With this we can "build" a cumulative distribution function \ (P (X \ leq x) = F (x) \) by adding up the individual terms \ (P (X = 0) + \ dots + P (X = x) = f (0) + \ dots + f (x) \). In a continuous random variable \ (X \) \ (P (X = x) = 0 \) applies to all \ (x \), we start here with a continuous density function \ (f \), "which fits to reality" , and calculate the area under \ (f \) for the probability using the cumulative distribution function \ (F \) (called the antiderivative in analysis). In the following a continuous and a discrete probability function, both of which compute in different contexts \ (P (X \ leq 2) \)

We can often derive probability distributions from an explicit random variable, and from a continuous random variable we often know the expected value \ (E (X) \) and the standard deviation \ (\ sigma \). More about that here.

##### Examples

Continuous random variables: You can find examples of continuous random variables here.

Discrete random variables, the sum of the pips: Give a probability distribution for the sum of the pips when rolling the dice twice and calculate to roll a sum less than 5.

### solution

For the combination of the two cubes there are 36 possible tuples arranged as follows:

 \((1;1)\) \((1;2)\) \((1;3)\) \((1;4)\) \((1;5)\) \((1;6)\) \((2;1)\) \((2;2)\) \((2;3)\) \ (\ dots \) \ (\ dots \) \ (\ dots \) \((3;1)\) \((3;2)\) \ (\ dots \) \ (\ dots \) \ (\ dots \) \ (\ dots \) \((4;1)\) \ (\ dots \) \ (\ dots \) \ (\ dots \) \ (\ dots \) \ (\ dots \) \((5;1)\) \ (\ dots \) \ (\ dots \) \ (\ dots \) \ (\ dots \) \ (\ dots \) \((6;1)\) \ (\ dots \) \ (\ dots \) \ (\ dots \) \ (\ dots \) \ (\ dots \)

We notice two things. According to Laplace, every combination is equally probable and has the probability \ (\ frac {1} {36} \). Furthermore, we recognize a pattern, in the diagonal there is always the same total of the eyes. We thus inductively conclude for our random variable \ (X \), the sum of the eyes,

 \ (X = x \) \ (X = 0 \) \ (X = 1 \) \ (X = 2 \) \ (X = 3 \) \ (X = 4 \) \ (X = 5 \) \ (X = 6 \) \ (P (X = x) \) \(0\) \(0\) \ (\ frac {1} {36} \) \ (\ frac {2} {36} \) \ (\ frac {3} {36} \) \ (\ frac {4} {36} \) \ (\ frac {5} {36} \) \ (X = 7 \) \ (X = 8 \) \ (X = 9 \) \ (X = 10 \) \ (X = 11 \) \ (X = 12 \) \ (X = 13 \) \ (\ frac {6} {36} \) \ (\ frac {5} {36} \) \ (\ frac {4} {36} \) \ (\ frac {3} {36} \) \ (\ frac {2} {36} \) \ (\ frac {1} {36} \) \(0\)

So we have our distribution and for \ (P (X <5) \) we have
\ begin {align *}
P (X <5) & = P (X \ leq 4) \
& = F (4) \
& = P (X = 2) + P (X = 3) + P (X = 4) \
& = \ frac {1} {36} + \ frac {2} {36} + \ frac {3} {36} = \ frac {1} {6}.
\ end {align *}

Note: In the table above we also wrote \ (X = 0,1,13 \). This is a possibility to continue every finite discrete random variable on \ (\ mathbb {N} \), sometimes it can be helpful.