2. Random Variables

1 Random Variables

Random variable, informally, is a variable that takes on numerical values and has an outcome that is determined by an experiment.

Random Variable: Let S be a sample space with a probability measure. A random variable (or stochastic variable) X is a real-valued function defined over the elements of S. X:SRsX(s)

Important convention: Random variables are always expressed in capital letters. On the other hand, particular values assumed by the random variables are always expressed by lowercase letters.

Remark: Although a random variable is a function of s; usually we drop the argument, that is we write X; rather than X(s).

Remark:

  • Once the random variable is defined, R is the space in which we work with;

  • The fact that the definition of a random variable is limited to real-valued functions does not impose any restrictions;

  • If the outcomes of an experiment are of the categorical type, we can arbitrarily make the descriptions real-valued by coding the categories, perhaps by representing them with the numbers.

Example 1.1 One flips a coin and observes if a head or tail is obtained.

Sample Space: S={H,T}

Random Variable: X:S{0,1} with X(H)=0 and X(T)=1.

The definition of random variable does not rely explicitly on the concept of probability, it is introduced to make easier the computation of probabilities. Indeed, if BR, then P(XB)=P(A),whereA={sS:X(s)B}

Is now clear that: P(XB)=1P(XB). In particular, P(Xx)=1P(X>x);P(X<x)=1P(Xx)

2 Cumulative Distribution Function

2.1 Cumulative distribution function

Let X be a random variable. The cumulative distribution function FX is a real function of real variable given by: FX(x)=P(Xx)=P(X(,x])

Properties of CDFs:

  • 0FX(x)1;

  • FX(x) is non-decreasing: Δx>0:

  • limxFX(x)=0 and

  • P(a<Xb)=FX(b)FX(a), for b>a

  • limxa+FX(x)=FX(a); therefore is right continuous

  • P(X=a)=FX(a)limxaFX(x) for any real finite number.

Example 2.1 One flips a coin and observes if a head or tail is obtained.

Sample Space: S={H,T}

Random Variable: X:S{0,1} with X(H)=0 and X(T)=1.

X counts the number of tails obtained.

It is easy to see that: P(X=0)=1/2, P(X=1)=1/2. Since we have FX(x)=P(Xx), then

FX(x)=P(Xx)={0,x<012,0x<11,x1

Example 2.2 One flips a coin twice and counts the number of tails obtained.

Sample Space: S={(H,T),(H,H),(T,H),(T,T)}

Random Variable:

X:S{0,1,2} X((H,T))=1,X((H,H))=0, X((T,H))=1,X((T,T))=2.

It is easy to see that: P(X=s)=1/4, for s=0,2 and P(X=1)=1/2. Since we have FX(x)=P(Xx), then

FX(x)={0,x<014,0x<13/4,1x<21,x2

Further properties:

  • P(X<b)=FX(b)P(X=b)

  • P(X>a)=1FX(a)

  • P(Xa)=1FX(a)+P(X=a)

  • P(a<X<b)=FX(b)FX(a)P(X=b)

  • P(aX<b)=FX(b)FX(a)P(X=b)+P(X=a)

  • P(aXb)=FX(b)FX(a)+P(X=a)

Prove the previous properties!

Proof: To prove that P(Xa)=1FX(a)+P(X=a), one notes that: P(Xa)=1P(X<a)=1P(Xa)+P(X=a)=1FX(a)+P(X=a)

The set of discontinuities of the cumulative distribution function DX is given by DX={xR:P(X=x)>0}. Note that by property 6 this the same as

DX={aR:FX(a)limxaFX(x)>0}.

2.2 Types of random variables

Discrete Random Variable: X is a discrete random variable if DXandxDxP(X=x)=1.

Continuous Random Variable: X is a continuous random variable if DX= and there is a non-negative function f such that FX(x)=0xf(s)ds.

Mixed Random Variable: X is a mixed random variable if

DX,xDxP(X=x)<1andλ(0,1) such that FX(x)=λFX1(x)+(1λ)FX2(x)

where X1 is a discrete random variable and X2 is a continuous random variable.

3 Discrete Random Variables

X is a discrete random variable if

DXandxDxP(X=x)=1. Additionally, the function fX:R[0,1] defined by

fX(x)={P(X=x),xDX0,xDX. is called the probability mass function (pmf).

Theorem: A function can serve as the probability function of a discrete random variable X if and only if its values, fX(x), satisfy the conditions

  • 0fX(xj)1, j=1,2,3,...

  • j=1fX(xj)=1.

For discrete random variables, the cumulative distribution function (cdf) is given by :

FX(x)=P(Xx)=xjxfX(xj).

Generally,

P(XB)=xjBDXfX(xj).

Theorem: If the range of a random variable X consists of the values x1<x2<<xn, then fX(x1)=FX(x1),andfX(xi)=FX(xi)FX(xi1), i=2,3,n.

Example 3.1 Check whether the function given by f(x)=x+225, for x=1,2,3,4,5 can serve as the probability function of a discrete random variable X. Compute the cumulative distribution function of X.

4 Continuous Random Variables

4.1 Continuous Random Variables

X is a continuous random variable if DX= and there is a function fX:RR0+ such that

FX(x)=xfX(s)ds.

Additionally, fX is called the probability density function.

Remark:

  • Continuity of FX is necessary, but not sufficient to guarantee that X is a continuous random variable;

  • Note that P(XDX)=P(X)=0;

  • The function fX provides information on how likely the outcomes of the random variable are.

4.2 Probability Density Function

Theorem. A function can serve as a probability density function of a continuous random variable X if its values, fX(x), satisfy the conditions:

  • fX(x)0 for <x<+;

  • +fX(x)dx=1.

Example 4.1 Let X be a continuous random variable with a probability density function fX given by

fX(x)={1/5,x[3,a]0,xR[3,a]

Find the value of the parameter a.

According to the previous theorem, we know that fX(x)0, for <x<++fX(x)dx=1

From the second condition, we get that

a535=1a=8.

Theorem. If fX(x) and FX(x) are the values of the probability density and the distribution function of X at x, then P(aXb)=FX(b)FX(a)=abfX(t)dt

for any real constants a and with ab, and

fX(x)=dFX(x)dx,almost everywhere.

Remarks:

  • At the points x where there is no derivative of the CDF, FX, it is agreed that fX(x)=0. In fact, it does not matter the value that we give to fX(x) as it does not affect the computation of FX.

  • The probability density function is not a probability and therefore it can assume values bigger than one.

  • If X is a continuous random variable P(X=a)=aafX(t)dt=0.

Example 4.2 Consider the continuous random variable X with a probability density function fX and cumulative distribution function given by fX(x)={0,x<04x,0x1244x,12x10,x>1

Cumulative density function:

FX(x)={0,x<02x2,0x<121+4x2x2,12x<11,x1

Is this function FX differentiable?

Theorem: If X is a continuous random variable and a and b are real constants with ab, then P(aXb)=P(aX<b)=P(a<Xb)=P(a<X<b)

Proof: To prove the previous theorem one needs notice that: P(aXb)=P(a<X<b)+P(X=a)+P(X=b)=P(a<Xb)+P(X=a)=P(aX<b)+P(X=b)

Additionally, for c=a or c=b we have

P(X=c)=P(cXc)=ccfX(t)dt=0

Remark: The previous inequalities are not necessarily true for discrete random variables.

5 Mixed random variables

Mixed Random Variable: X is a mixed random variable if

DX,xDxP(X=x)<1andλ(0,1) tal que FX(x)=λFX1(x)+(1λ)FX2(x)

where X1 is a discrete r.v. and X2 is a continuous r.v..

Example 5.1 A company has received 1 million €  to invest in a new business. With probability 12, the firm does nothing but with probability 12 the money is invested. If it does not invest the money, 1 million €  is kept. Otherwise, the firm gets back a random amount uniformly distributed between 0 and 3 million €.

Let X be the following random variable: X=Amount received by the company in millions" What type of random variable is X?

S=[0,3]andX={1,with probability 12 (Scenario 1)[0,3],with probability 12 (Scenario 2)

  • X is not a discrete r.v. because it takes values in a continuous set;

  • X is not a continuous random variable because P(X=1)=1/2 (For continuous random variables the probability to take one single point is equal to 0).

  • X is a mixed random variable?

We can define two random variables:

X1=Amount received by thecompany in millions in S1"

X2=Amount received by thecompany in millions in S2"

Since P(X1=1)=1, then FX1(x)={0,x<11,x1

On the other hand, in scenario 2, the firm gets back a random amount uniformly distributed between 0 and 3 million €. Therefore,

fX2(x)={13,x[0,3]0,otherwise,andFX2(x)={0,x<0x3,0x<31,x3,

Since S1 holds with probability 12 and S2 holds with probability 12, we have that

FX(x)=12FX1(x)+12FX2(x)={0,x<0x6,0x<112+x6,1x<31,x3,

DX={1}, because

FX(1)FX(1)=2312=12=P(X=1)<1

Exercise: Let

FX(x)={0x<0112+34(1ex)0x<114+34(1ex)x1,

Compute P(X=0), P(X=1), P(0.5<X<1) and P(0.5<X<2).

Answer: P(X=0)=112,P(X=1)=212P(0.5<X<1)=FX(1)FX(0.5)P(X=1)=34(e0.5e1)P(0.5<X<2)=FX(2)FX(0.5)=212+34(e0.5e2)

6 The Distribution of Functions of Random Variables

Motivation: Assume that the random variable D represents the demand of a given product in a store. The profit of this store is represented by the random variable L=4D5. If the probability function of D is given by

P(D=d)={0.3,d=00.2,d=10.3,d=20.2,d=3, what is the probability of having L>2?

P(L>2)=P(D>74)=P(D=2)+P(D=3)=0.5 Since L is a random variable, it should be possible to find its distribution. How to do it?

  • Let X be a known random variable with known cumulative distribution function .

  • Consider a new random variable Y=g(X), where g:RR is a known function. Let be the cumulative distribution function of Y. How can we derive FY(y) from FX(x)?.

  • The derivation of FY(y) is based on the equality

FY(y)=P(Yy)=P(g(X)y)=P(XAy) where Ay={x:g(x)y}

Example 6.1 Derive the cumulative distribution functions of Y=aX+b, where a>0 and Z=X2.

  • Y=aX+b

FY(y)=P(Yy)=P(aX+by)=P(Xyba)=FX(yba)

  • Z=X2

For z0,

FZ(z)=P(Zz)=P(X2z)=P(zXz)=FX(z)FX(z)+P(X=z)

6.1 Functions of Continuous Random Variables

Assume that in the previous example X is a continuous random variable such that

FX(x)={0,x<0x,0x<11,x1,

then the following holds:

  • Y=aX+b

FY(y)=FX(yba)={0,yba<0yba,0yba<11,yba1={0,y<byba,by<a+b1,ya+b

Example 6.2 Assume that in the previous example X is a continuous random variable such that

FX(x)={0,x<0x,0x<11,x1, then the following holds:

  • Z=X2

    If z<0 then FZ(z)=P(Zz)=0. When z0

FZ(z)=FX(z)FX(z)+P(X=z)=0, because X is continuous=FX(z)FX(z)=0 because z is negative={0,z<0z,0z<11,z1

6.2 Functions of Discrete Random Variables

  • When X is a discrete random variable, it is easier to find the distribution of Y=g(X). In this case, we will derive the probability function.

  • Let DX={x1,x2,x3...} be the set of discontinuities of FX(x), then DY={g(x1),g(x2),g(x3)...} is the set of discontinuities of FY(y).

  • The probability function of Y is given by

fY(y)=P(Y=y)=P(g(X)=y)=P(X{xDX:g(x)=y})=xi{xDX:g(x)=y}f(xi)

Example 6.3 Consider the discrete random variable X with probability function

x -2 -1 0 1 2
fX(x) 12/60 15/60 10/60 6/60 17/60

Let Y=X2, what is fY(y)?

Firstly: The set of discontinuities DY is DY={0,1,4}

x -2 -1 0 1 2
y=x2 4 1 0 1 4

Consequently

  • fY(0)=P(Y=0)=P(X2=0)=P(X=0)=1060.

  • fY(1)=P(Y=1)=P(X2=1)=P(X=1)+P(X=1)=6/60+15/60=21/60.

  • fY(4)=P(Y=4)=P(X2=4)=P(X=2)+P(X=2)=17/60+12/60=29/60.

Previous
Next