21
Random Variables By Rohan Bhatkar

Qt random variables notes

Embed Size (px)

DESCRIPTION

Qt chapter 7 random variables

Citation preview

Page 1: Qt random variables notes

Random Variables

By Rohan Bhatkar

Page 2: Qt random variables notes

Murtuza IndorewalaAyushi JainApeksha MehtaRohan BhatkarYash RawaniMohammed DriverMayur SanchetiNandan Shah

GROUP 1

01

05

08

11

21

24

32

33

Page 3: Qt random variables notes

Content-

Random VariablesProbability Mass FunctionDiscrete Random VariablesProbability DistributionDistribution FunctionVarianceExpectationContinuous Random Variables

Page 4: Qt random variables notes

Random Variables

Consider an experiment of throwing two dice. We know that this experiments has 36 outcomes .Let x be the sum of numbers on the uppermost faces.

For Example-The value of x is 2 if outcome of the experiment is (1,1) & probability of this outcome is 1/36.

In this case we can associate real number with each outcome of random experiment or group of outcomes of random experiment.Here X is called Random Variables.

Page 5: Qt random variables notes

Probability Mass FunctionIf x is discrete random variables values x1, x2, x3, …., xn then probability of each value is described by a function called the Probability Mass Function. The probability that random variable X takes values xi is denoted by p(xi).

Illustration -Suppose fair coin is marked 1 & 2, dice numbered 1, 2, 3, 4, 5 & 6 are thrown simultaneously then probability mass function of random variables X which is sum of numbers on coin & dice is obtained as under.

Solution-The sample space is:

S={(1,1), (1,2), (1,3), (1,4), (1,5), (1,6), (2,1), (2,2), (2,3), (2,4), (2,5), (2,6)}Note that n(s) = 12X: sum of numbers on coin & dice.

X = 2, 3, 4, 5, 6, 7, 8P[x=2] = {(1,1)} = 1/12P[x=3] = {(1,2)(2,1)} = 2/12P[x=4] = {(1,3)(2,2)} = 2/12P[x=5] = {(1,4)(2,3)} = 2/12P[x=6] = {(1,5)(2,4)} = 2/12P[x=7] = {(1,6)(2,5)} = 2/12P[x=8] = {(2,6)} = 1/12

Thus probability distribution of random variable X is as under:

X=x 2 3 4 5 6 7 8

P[X=x] 1/12 2/12 2/12 2/12 2/12 2/12 1/12

Note that P[xi] ≥ 0 & ∑ (xi) = 1

Page 6: Qt random variables notes

Discrete Random Variable

A random variable which can assume only a countable number of real values & the values taken by variables depends on outcome of random experiment is called Discrete Random Variables.

For Example-1. Number of misprints per page of book.2. Number of heads in n tosses of fair coin.3. Number of throws of dice to get first 6.

Illustration 1-A bag contains 20 currency notes. 10 of Rs. 5, 5 of Rs. 10, 3 of Rs. 20 & 2 of Rs. 50. a note is selected at random from the bag. Find the expected value of the domination of the note drawn.

Solution-

Define the discrete random variableX = Denomination on the note drawn in Rs.

X Rs. 5 Rs. 10 Rs. 20 Rs. 50

P[X = x] 1/2 1/4 3/20 1/10

xi. pi 5/2 5/2 3 5

E(X) = ∑xipi = 26/2 = 13 Rs.

Expected value of the denomination of the note drawn is Rs. 13.

Page 7: Qt random variables notes

Illustration 2-The probability distribution of discrete random variable X is given below:

X 8 12 16 20 24

P[X=x] 1/8 1/6 3/8 1/4 1/12

Calculate mean & variance of X.

Solution-

X 8 12 16 20 24

P[X=x] 1/8 1/6 3/8 1/4 1/12

xipi 1 2 6 5 2

xip2i 8 24 96 100 8

Mean = E(X) = ∑xipi = 16

Var (X) = E (X2) – [E (X)]2

E (X2) = ∑xipi 2

Var (X) = 276 – 256

= 20

Page 8: Qt random variables notes

Continuous Random Variables

Consider the small interval (X, X + dx) of length dx round the point x.Let f(x) be any continuous function of x so that f(x) represent the probability that falls in very small interval (X, x + dx)Symbolically P[x ≤ X ≤ x + dx] = f(x) dx.

X – dx/2

f(x) dx

X + dx/2

Y = f(x)

x

y

In the figure f(x) dx represents the area bounded by the curve y = f(x); X-axis a& the ordinates x and x + dx.The function f(x) so defined is known as probability density function of random variable X & usually abbreviated as p.d.f. The expression f(x) dx usually written as F (x), is known as probability differential & f(x) is known as probability density curve. The probability that X lie in the interval dx is f(x) dx. Thus the p.d.f. of random variable x is defined as

f(x) = lim P [x ≤ X ≤ x + δx] δx → 0 δx

Page 9: Qt random variables notes

Illustration 1-

A random variable X has following p.d.f.f(x) = K - ∞ < x < ∞ 1 + x2 = 0 OtherwiseFind k:

Solution-

Since X is continuous random variable with density function f(x), ∞ ⌠ f(x) dx = 1 - ∞

∞ ⌠ K dx = 1 - ∞ 1 + x2

∞k[tan-1 x] = 1 - ∞

k[tan-1 ∞ - tan-1 ∞ (- ∞)] = 1

k[π/2 + (π/2)] = 1

k × π = 1

k = 1/ π

Page 10: Qt random variables notes

Illustration 2-

State, with reason following are probability distribution or not.

Solution-

All pi’s are > 0 and 0.3 + 0.5 + 0.2 = 1 ..It is Probability distribution

X 0 1 2

P 0.3 0.5 0.2

Illustration 3-

State, with reason following are probability distribution or not.

Solution-

Not All pi’s are > 0 but 0.1 + 0.1 + 0.1 + 0.1 – 0.4 ≠ 1 ..It is not Probability distribution

X 0 1 2 3

P 0.1 0.1 0.1 0.1

Page 11: Qt random variables notes

Illustration 1-

Obtain the probability distribution of the number of sixes in two losses of a die.

Solution-

When we tosses a two die possible outcomes are

(1,1), (1,2), (1,3), (1,4), (1,5), (1,6),(2,1), (2,2), (2,3), (2,4), (2,5), (2,6),(3,1), (3,2), (3,3), (3,4), (3,5), (3,6),(4,1), (4,2), (4,3), (4,4), (4,5), (4,6),(5,1), (5,2), (5,3), (5,4), (5,5), (5,6),(6,1), (6,2), (6,3), (6,4), (6,5), (6,6)

Total 36. out of this 10 containing one ‘6’. One containing two ‘6’ and ‘25’ does not containing ‘6’.Suppose ‘x’ is random variable that represent number of ‘6’.

{ }x 0 1 2

P 25/36 10/36 1/36

Probability Distribution

Page 12: Qt random variables notes

Illustration 2-

Obtain the probability distribution of the number of heads in two losses of a coin.

Solution-

When we tosses a two die possible outcomes are

(H,H), (H,T), (T,H), (T,T) Total 4.

Suppose ‘x’ is random variable that represent number of head H.

X 0 1 2

P 1/4 2/4 1/4

(T,T) (HT,TH) (H,H)

Page 13: Qt random variables notes

Distribution Function

Let X be a random variable. The function F defined for all real values x by F(x) = P [X = x], For all real x is called Distribution Function.A distribution function is also called as Cumulative Probability Distribution Function.

Properties OF Distribution Function:

If F is the D.F. of random variable X & if a <b thenP[a < X ≤ b] = F(b) – F(a).

Values of all distribution functions lie between 0 & 1i.e. 0 ≤ F(x) ≤ 1 for all x.

All distribution functions are monotonically non-decreasingi.e. 0 < y then F(x) < F(y).

F(- ∞) = lim F(x) = 0x - ∞

F(+ ∞) = lim F(x) = 1x → ∞

If X is discrete random variable then F(x) = ∑ P(xi) xi ≤ x

If values of discrete random variable X are like x1 < x2 < x3 < x4 … then P(Xn+1) = F(Xn+1) – F(Xn)

If x is discrete random variable then D.E. is step function.

Page 14: Qt random variables notes

Illustration 1-Consider probability distribution of random variable x

If F(x) is distribution function of random variable x thenF(1) = P[x ≤ 1] = P(1) = 0.1F(2) = P[x ≤ 1] = P(1) + P(2) = 0.1 + 0.2 = 0.3F(3) = 0.1 + 0.2 + 0.3 = 0.6F(4) = 0.1 + 0.2 + 0.3 + 0.2 = 0.8F(5) = 0.1 + 0.2 + 0.3 + 0.2 + 0.1 = 0.9F(6) = 1

Thus values of x & corresponding cumulative probability distribution function is as under:

X=x 1 2 3 4 5 6

P[X=x] 0.1 0.2 0.3 0.2 0.1 0.1

X=x 1 2 3 4 5 6

P[X=x] 0.1 0.3 0.6 0.8 0.9 1.0

We will have graphical representation of random variable X, & the Graph of D.E.

1 2 3 4 5 6

1

2

3

X →

P(x)

Probability Distribution

1 2 3 4 5 6

0.2

0.4

0.6f(x)

CumulativeProbability Distribution

0.8

1.0

X →

Page 15: Qt random variables notes

Variance

If X is discrete random variable then variance of x is given by

Var (X) = E[X – X (X)]2

Note that Var (X) = µ2Var (X) = µ2

` - µ1`2

Var (X) = E (X2) – [E(X)] 2

The positive square root of the variance is known as standard deviationS D (X) = + √Var (X)

Illustration-For a random variable X, E (X) = 10 and Var (X) = 5. Find Var (3X + 5), Var(X – 2), Var (4X).

Also find E(5X – 4), E(4X + 3).

Solution-Var (3X + 5) = Var (3X)= 9 Var (X) = 9 x 5 = 45Var (x - 2) = Var (X) = 5Var (4X) = 16 Var (X) = 16 x 5 = 80Var (5X - 4) = 5 E(X) – 4Var (5X - 4) = 5 x 10 – 4 = 46Var (4X + 3) = 4 E(X) + 3Var (4X + 3) = 4 x 10 + 3 = 43

Page 16: Qt random variables notes

Properties OF Variance:

1. Variance is independent of change of origin. It means that if X is random variable & ‘a’ is constant then variances of X and new variable X + a are same i.e.

Var (X) + Var (X + a)consider

Var (X + a) = E [X + a – (E (X) + a)]2 Var (X + a) = E [X + a – E (X) + a]2 Var (X + a) = E [X –E (X)]2 Var (X + a) = Var (X).

2. Variance of random variable depends upon change of scale.i.e. Var (a X) = a2 Var (X)consider

Var (a X) = E [aX – E (aX)]2

= E [aX – a E (X)]2 = E a2 [X –E (X)]2

= a2 E [X –E (X)]2

= a2 Var (X).

3. From property 1 and 2 we can find Var (a X + b),Var (a X + b) = Var (a X) by property 1 = a2 Var (X) by property 2

4. Variance of constant is 0. put a=0 in a x + b thenVar (a X + b)= Var (b)

but Var (a x + b) = a2 × Var (X)Var (a x + b) = 0 × Var (X) = 0Var (b) = 0

Page 17: Qt random variables notes

Expectation

Mathematical Expectation of Discrete Random Variable:Once we have determined probability distribution function P(x) &

distribution function of discrete random variable X, we want to compute the mean or variance of random variable X, the mean or expected value of X is nothing but weighted average of value X where corresponding probabilities are taken as weights, thus if X takes values x1, x2,.. With corresponding probabilities p(x1), p(x2),… then

mathematical expectation of X denoted by E(X) is given by E(X) = ∑ xi P(xi).E(X) is also mean of random variable X.E(X) exists if series on right hand side is absolutely convergent.

Page 18: Qt random variables notes

Illustration 1-

The p.m.f. of a random variable X is given below. Find E(X).Hence E(2X + 5) & E(X - 5).

X=x 1 2 3 4 5 6

P[X=x] 0.1 0.15 0.2 0.3 0.15 0.1

Solution-

Expected value of random variable is given by:E(X) = ∑xi P[X = xi] = 1(0.1) + 2(0.15) + 3(0.2) + 4(0.3) + 5(0.15) + 6(0.1) = 0.1 + 0.3 + 0.6 + 1.2 + 0.75 + 0.6

E(X) = 3.55

E(2X + 5) = 2 E(X) + 5 = 2 E(3.55) + 5

= 12.1

E(X - 5) = E(X) - 5 = (3.55) - 5

= -1.45

Page 19: Qt random variables notes

Illustration 2-

Mr. A & Mr. B plays a game. The winner is paid Rs. 99. The winner is decided by throwing a dice & the one who gets ‘6’ first time is winner. Find expected gain of A & B if first A throws dice.

Note that if A does not win then B throws & if B does not win then A again throws this way they continue.

Solution-Suppose getting ‘6’ is denoted by S and not getting ‘6’ is denoted by ‘F’ then the

probability of A winning the game is= P(S) + P(FES) + P(FFFFS) + P(FFFFFFS) + …..= 1/6 + (5/6) 1/6 + (5/6) 1/6 + (5/6) 1/6 + …..= 1/6 [ 1 + (5/6) + (5/6) + …..]= 1/6 x 1/ 1- 25/36= 1/6 x 36/11 = 6/11

Thus expected gain of A = 99 x 6/11 = 54

Expected gain of = 99 -54 = 45

Page 20: Qt random variables notes

Properties OF Expectation:

If X1 & X2 are two random variables then E(X1 + X2) = E(X1 ) + E(X2). This result can be generalized for X1, X2, …, Xn i.e. n random variables

E(X1 + X2 + …. + Xn ) = E(X1) + E(X2) + …. + E(Xn)

If X & Y are independent random variable, E(XY) = E(X) E(Y) If X is a random variable & a is constant then

E(a X) = a E(X) andE(X + a) = E(X) + a

If X is a random variable and a & b are constantsE[a (X) + b] = a E(X) + b

If X is a random variable and a & b are constants & g (X) a function X is random variable thenE[a g (X) + b] = a E[g (X)] + b

If X1, X2, X3 ….,Xn are any n random variable and if a1, a2, ….,an are any n constants thena1 X1 + a2 X2 + …. An Xn is called linear combination of n variables & expectation of linear combination is given by E(a1 X1 + a2 X2 + ….. + an Xn)

===

If X ≥ 0 then E(X) ≥ 0. If X and Y are two random variables & if X ≤ Y then E(X) ≥ E(Y). If X & Y are independent random variable then

E[a g (X) + h (Y)] = E[g (X)] E[h (Y)]then g (X) is a function of X & its random variable. Also h (Y) is a function of Y & random variable.

Page 21: Qt random variables notes

Thank You …