# Week 2 Lecture 2 ## Random Variable For a given sample space &Omega; of some experiment, a **random variable** is any rule that associates a real number with each outcome in &Omega;. A random variable is a **real-valued** function (its range is within the set of real numbers) whose domain is the sample space. ![](https://i.imgur.com/qlGO9dH.png) ## Discrete and Continuous RV A random variable is called **discrete** if X can take only a finite number *k* of different values x~1~,...,x~k~, or, at most, an infinite sequence of different values x~1~,x~2~,x~3~,... A random variable X is called continuous if the following conditions hold: * The set of all possible values for X is either a single interval on the real line, or a union of disjoint intervals on the real line. * No possible value has positive probability: $Pr(X=x) = 0$ for any possible $x$ :::info P(X=x) means probability of random variable X to take the value x. ::: ### Examples #### Discrete RV ![](https://i.imgur.com/dD13TlX.png) #### Continuous RV ![](https://i.imgur.com/Xi8EAzD.png) ![](https://i.imgur.com/nGwNH37.png) #### Question ![](https://i.imgur.com/vvxbhFX.png) There is a discrete component, which is the element 2, and a continuous component, which is [0,1] ## Probability Distribution Let X be a random variable defined on the sample space &Omega;. Thus, X(&omega;) is a real number for every outcome &omega; &isin; &Omega;. Let C be a subset of the real line. We write {X &isin; C} to mean the set {&omega; &isin; &Omega;: X(&omega;) &isin; C} of all outcomes whose X-value is in C. ![](https://i.imgur.com/8jacEkP.png) :::info An event is a subset of outcomes contained in &Omega;. Hence, {X &isin; C} is an event. ::: Every event is assigned a probability, so it makes sense to consider the probability of {X &isin; C}: $Pr(X \in C ) = Pr(\{\omega\in\Omega:X(\omega)\in C\})$ The probability distribution of X is the collection of all probabilities of the form Pr(X&isin;C), for all sets C of real numbers. In other word, for any set C of real numbers, the probability distribution of X gives the probability Pr(X&isin;C) of how likely the random variable X takes on values in C. ## Probability Mass Distribution (pmf) Let X be a discrete RV defined on the sample space &Omega;. The pmf of X is a function p(x) defined on every real number, such that $$ \begin{eqnarray*} p(x) &=& Pr(X=x) \\ &=& Pr({\omega\in\Omega:X(\omega)=x}) \end{eqnarray*} $$ The pmf of X completely describes the distribution of X, since $$ Pr(X\in C)=\sum_{x\in C}p(x). $$ ### Example ![](https://i.imgur.com/pr1eBpM.png) ### Bernoulli Distribution An RV X is called a Bernoulli RV if it takes only 2 values: 0 and 1. The pmf of X is given by $Pr(X=1)=p$, $Pr(X=0)=1-p$, for some 0 &le; p &le; 1. We say that X is the Bernoulli R.V. with parameter p. ![](https://i.imgur.com/2DhjLC5.png) ### Bernoulli Process and Binomial RV Consider an experiment (a Bernoulli process) with n repeated trials, such that: * The trials are independent * Each trial has only 2 outcomes: 1(success) and 0 (failure) * The success rate of the trials is the same (denoted by some probability p). The pmf of binomial RV is given by: ![](https://i.imgur.com/T2KLpSh.png) where n is the number of trials, and p is the success rate of each trial. ![](https://i.imgur.com/pWUfdhY.png) ### Examples ![](https://i.imgur.com/dYDoABn.png) ![](https://i.imgur.com/c1dlhbo.png) ![](https://i.imgur.com/4dA85PX.png) ## Probability Density Distribution (pdf) The pdf of a continuous RV X is a function f(x) such that for any two numbers a and b with a &le; b, $$ P(a\le X \le b)= \int_a^b f(x) dx $$ The pdf completely describes the distribution of X. ![](https://i.imgur.com/KD6XvFF.png) This graph is also known as the density curve. For a function f(x) to be a valid pdf of some continuous RV, it must satisfy the following conditions: 1. $f(x) \ge 0$ for al x. (Density cannot be negative) 2. $\int_{-\infty}^{\infty}f(x) dx= 1$ (Area under the curve of f(x) is 1) ![](https://i.imgur.com/SmSlxRi.png) ### Uniform Distribution ![](https://i.imgur.com/yrpRVH9.png) ### Exponential Distribution ![](https://i.imgur.com/szQfgTs.png) ### Examples ![](https://i.imgur.com/o5yxxC7.png) ![](https://i.imgur.com/2o6pYoC.png) ![](https://i.imgur.com/DmjYiGK.png) <hr/> ![](https://i.imgur.com/rsGhuzR.png) <hr/> ![](https://i.imgur.com/v838Ki5.png)