# OpenStax-CNX

You are here: Home » Content » Applied Probability » Problems on Random Variables and Probabilities

• Preface to Pfeiffer Applied Probability

### Lenses

What is a lens?

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

#### Affiliated with (What does "Affiliated with" mean?)

This content is either by members of the organizations listed or about topics related to the organizations listed. Click each link to see a list of all content affiliated with the organization.
• Rice Digital Scholarship

This collection is included in aLens by: Digital Scholarship at Rice University

Click the "Rice Digital Scholarship" link to see all content affiliated with them.

#### Also in these lenses

• UniqU content

This collection is included inLens: UniqU's lens
By: UniqU, LLC

Click the "UniqU content" link to see all content selected in this lens.

### Recently Viewed

This feature requires Javascript to be enabled.

Inside Collection:

Collection by: Paul E Pfeiffer. E-mail the author

# Problems on Random Variables and Probabilities

Module by: Paul E Pfeiffer. E-mail the author

## Exercise 1

The following simple random variable is in canonical form:

X=-3.75IA-1.13IB+0IC+2.6IDX=-3.75IA-1.13IB+0IC+2.6ID.

Express the events {X(-4,2]},{X(0,3]},{X(-,1]}{X(-4,2]},{X(0,3]},{X(-,1]}, {|X-1|1}{|X-1|1}, and {X0}{X0} in terms of A,B,CA,B,C, and D.

• ABCABC
• D
• ABCABC
• C
• CDCD

## Exercise 2

Random variable X, in canonical form, is given by X=-2IA-IB+IC+2ID+5IEX=-2IA-IB+IC+2ID+5IE.

Express the events {X[2,3)},{X0},{X<0}{X[2,3)},{X0},{X<0}, {|X-2|3}{|X-2|3}, and {X24}{X24}, in terms of A,B,C,DA,B,C,D, and E.

• D
• ABAB
• ABAB
• BCDEBCDE

## Exercise 3

The class {Cj:1j10}{Cj:1j10} is a partition. Random variable X has values {1,3,2,3,4,2,1,3,5,2}{1,3,2,3,4,2,1,3,5,2} on C1 through C10, respectively. Express X in canonical form.

### Solution

T = [1 3 2 3 4 2 1 3 5 2];
[X,I] = sort(T)
X =   1   1   2   2   2   3   3   3   4   5
I =   1   7   3   6  10   2   4   8   5   9
X = I A + 2 I B + 3 I C + 4 I D + 5 I E X = I A + 2 I B + 3 I C + 4 I D + 5 I E
(1)
A = C 1 C 7 , B = C 3 C 6 C 10 , C = C 2 C 4 C 8 , D = C 5 , E = C 9 A = C 1 C 7 , B = C 3 C 6 C 10 , C = C 2 C 4 C 8 , D = C 5 , E = C 9
(2)

## Exercise 4

The class {Cj:1j10}{Cj:1j10} in Exercise 3 has respective probabilities 0.08, 0.13, 0.06, 0.09, 0.14, 0.11, 0.12, 0.07, 0.11, 0.09. Determine the distribution for X.

### Solution

T = [1 3 2 3 4 2 1 3 5 2];
pc = 0.01*[8 13 6 9 14 11 12 7 11 9];
[X,PX] = csort(T,pc);
disp([X;PX]')
1.0000    0.2000
2.0000    0.2600
3.0000    0.2900
4.0000    0.1400
5.0000    0.1100

## Exercise 5

A wheel is spun yielding on an equally likely basis the integers 1 through 10. Let Ci be the event the wheel stops at i, 1i101i10. Each P(Ci)=0.1P(Ci)=0.1. If the numbers 1, 4, or 7 turn up, the player loses ten dollars; if the numbers 2, 5, or 8 turn up, the player gains nothing; if the numbers 3, 6, or 9 turn up, the player gains ten dollars; if the number 10 turns up, the player loses one dollar. The random variable expressing the results may be expressed in primitive form as

X = - 10 I C 1 + 0 I C 2 + 10 I C 3 - 10 I C 4 + 0 I C 5 + 10 I C 6 - 10 I C 7 + 0 I C 8 + 10 I C 9 - I C 10 X = - 10 I C 1 + 0 I C 2 + 10 I C 3 - 10 I C 4 + 0 I C 5 + 10 I C 6 - 10 I C 7 + 0 I C 8 + 10 I C 9 - I C 10
(3)
• Determine the distribution for X, (a) by hand, (b) using MATLAB.
• Determine P(X<0)P(X<0), P(X>0)P(X>0).

### Solution

p = 0.1*ones(1,10);
c = [-10 0 10 -10 0 10 -10 0 10 -1];
[X,PX] = csort(c,p);
disp([X;PX]')
-10.0000    0.3000
-1.0000    0.1000
0    0.3000
10.0000    0.3000
Pneg = (X<0)*PX'
Pneg =  0.4000
Ppos = (X>0)*PX'
Ppos =  0.300

## Exercise 6

A store has eight items for sale. The prices are $3.50,$5.00, $3.50,$7.50, $5.00,$5.00, $3.50, and$7.50, respectively. A customer comes in. She purchases one of the items with probabilities 0.10, 0.15, 0.15, 0.20, 0.10 0.05, 0.10 0.15. The random variable expressing the amount of her purchase may be written

X = 3 . 5 I C 1 + 5 . 0 I C 2 + 3 . 5 I C 3 + 7 . 5 I C 4 + 5 . 0 I C 5 + 5 . 0 I C 6 + 3 . 5 I C 7 + 7 . 5 I C 8 X = 3 . 5 I C 1 + 5 . 0 I C 2 + 3 . 5 I C 3 + 7 . 5 I C 4 + 5 . 0 I C 5 + 5 . 0 I C 6 + 3 . 5 I C 7 + 7 . 5 I C 8
(4)

Determine the distribution for X (a) by hand, (b) using MATLAB.

### Solution

p = 0.01*[10 15 15 20 10  5 10 15];
c = [3.5 5 3.5 7.5 5 5 3.5 7.5];
[X,PX] = csort(c,p);
disp([X;PX]')
3.5000    0.3500
5.0000    0.3000
7.5000    0.3500

## Exercise 7

Suppose X,YX,Y in canonical form are

X = 2 I A 1 + 3 I A 2 + 5 I A 3 Y = I B 1 + 2 I B 2 + 3 I B 3 X = 2 I A 1 + 3 I A 2 + 5 I A 3 Y = I B 1 + 2 I B 2 + 3 I B 3
(5)

The P(Ai)P(Ai) are 0.3, 0.6, 0.1, respectively, and the P(Bj)P(Bj) are 0.2 0.6 0.2. Each pair {Ai,Bj}{Ai,Bj} is independent. Consider the random variable Z=X+YZ=X+Y. Then Z=2+1Z=2+1 on A1B1A1B1, Z=3+3Z=3+3 on A2B3A2B3, etc. Determine the value of Z on each AiBjAiBj and determine the corresponding P(AiBj)P(AiBj). From this, determine the distribution for Z.

### Solution

A = [2 3 5];
B = [1 2 3];
a = rowcopy(A,3);
b = colcopy(B,3);
Z =a + b               % Possible values of sum Z = X + Y
Z = 3     4     6
4     5     7
5     6     8
PA = [0.3 0.6 0.1];
PB = [0.2 0.6 0.2];
pa= rowcopy(PA,3);
pb = colcopy(PB,3);
P = pa.*pb            % Probabilities for various values
P =  0.0600    0.1200    0.0200
0.1800    0.3600    0.0600
0.0600    0.1200    0.0200
[Z,PZ] = csort(Z,P);
disp([Z;PZ]')         % Distribution for Z = X + Y
3.0000    0.0600
4.0000    0.3000
5.0000    0.4200
6.0000    0.1400
7.0000    0.0600
8.0000    0.0200

## Exercise 8

For the random variables in Exercise 7, let W=XYW=XY. Determine the value of W on each AiBjAiBj and determine the distribution of W.

### Solution

XY = a.*b
XY = 2     3     5               % XY values
4     6    10
6     9    15

W        PW               % Distribution for W = XY
2.0000    0.0600
3.0000    0.1200
4.0000    0.1800
5.0000    0.0200
6.0000    0.4200
9.0000    0.1200
10.0000    0.0600
15.0000    0.0200

## Exercise 9

A pair of dice is rolled.

1. Let X be the minimum of the two numbers which turn up. Determine the distribution for X
2. Let Y be the maximum of the two numbers. Determine the distribution for Y.
3. Let Z be the sum of the two numbers. Determine the distribution for Z.
4. Let W be the absolute value of the difference. Determine its distribution.

### Solution

t = 1:6;
c = ones(6,6);
[x,y] = meshgrid(t,t)
x =  1     2     3     4     5     6     % x-values in each position
1     2     3     4     5     6
1     2     3     4     5     6
1     2     3     4     5     6
1     2     3     4     5     6
1     2     3     4     5     6
y =  1     1     1     1     1     1     % y-values in each position
2     2     2     2     2     2
3     3     3     3     3     3
4     4     4     4     4     4
5     5     5     5     5     5
6     6     6     6     6     6
m = min(x,y);                         % min in each position
M = max(x,y);                         % max in each position
s = x + y;                            % sum x+y in each position
d = abs(x - y);                       % |x - y| in each position
[X,fX] = csort(m,c)                   % sorts values and counts occurrences
X =   1     2     3     4     5     6
fX = 11     9     7     5     3     1    % PX = fX/36
[Y,fY] = csort(M,c)
Y =   1     2     3     4     5     6
fY =  1     3     5     7     9    11    % PY = fY/36
[Z,fZ] = csort(s,c)
Z =   2     3     4     5     6     7     8     9    10    11    12
fZ =  1     2     3     4     5     6     5     4     3     2     1  %PZ = fZ/36
[W,fW] = csort(d,c)
W =   0     1     2     3     4     5
fW =  6    10     8     6     4     2    % PW = fW/36

## Exercise 10

Minterm probabilities p(0)p(0) through p(15)p(15) for the class {A,B,C,D}{A,B,C,D} are, in order,

0 . 072 0 . 048 0 . 018 0 . 012 0 . 168 0 . 112 0 . 042 0 . 028 0 . 062 0 . 048 0 . 028 0 . 010 0 . 170 0 . 110 0 . 040 0 . 032 0 . 072 0 . 048 0 . 018 0 . 012 0 . 168 0 . 112 0 . 042 0 . 028 0 . 062 0 . 048 0 . 028 0 . 010 0 . 170 0 . 110 0 . 040 0 . 032
(6)

Determine the distribution for random variable

X = - 5 . 3 I A - 2 . 5 I B + 2 . 3 I C + 4 . 2 I D - 3 . 7 X = - 5 . 3 I A - 2 . 5 I B + 2 . 3 I C + 4 . 2 I D - 3 . 7
(7)

### Solution

% file npr06_10.m
% Data for Exercise 10
pm = [ 0.072 0.048 0.018 0.012 0.168 0.112 0.042 0.028 ...
0.062 0.048 0.028 0.010 0.170 0.110 0.040 0.032];
c  = [-5.3 -2.5 2.3 4.2 -3.7];
disp('Minterm probabilities are in pm, coefficients in c')
npr06_10
Minterm probabilities are in pm, coefficients in c
canonic
Enter row vector of coefficients  c
Enter row vector of minterm probabilities  pm
Use row matrices X and PX for calculations
Call for XDBN to view the distribution
XDBN
XDBN =
-11.5000    0.1700
-9.2000    0.0400
-9.0000    0.0620
-7.3000    0.1100
-6.7000    0.0280
-6.2000    0.1680
-5.0000    0.0320
-4.8000    0.0480
-3.9000    0.0420
-3.7000    0.0720
-2.5000    0.0100
-2.0000    0.1120
-1.4000    0.0180
0.3000    0.0280
0.5000    0.0480
2.8000    0.0120

## Exercise 11

On a Tuesday evening, the Houston Rockets, the Orlando Magic, and the Chicago Bulls all have games (but not with one another). Let A be the event the Rockets win, B be the event the Magic win, and C be the event the Bulls win. Suppose the class {A,B,C}{A,B,C} is independent, with respective probabilities 0.75, 0.70 0.8. Ellen's boyfriend is a rabid Rockets fan, who does not like the Magic. He wants to bet on the games. She decides to take him up on his bets as follows:

• $10 to 5 on the Rockets --- i.e. She loses five if the Rockets win and gains ten if they lose •$10 to 5 against the Magic
• even $5 to 5 on the Bulls. Ellen's winning may be expressed as the random variable X = - 5 I A + 10 I A c + 10 I B - 5 I B c - 5 I C + 5 I C c = - 15 I A + 15 I B - 10 I C + 10 X = - 5 I A + 10 I A c + 10 I B - 5 I B c - 5 I C + 5 I C c = - 15 I A + 15 I B - 10 I C + 10 (8) Determine the distribution for X. What are the probabilities Ellen loses money, breaks even, or comes out ahead? ### Solution P = 0.01*[75 70 80]; c = [-15 15 -10 10]; canonic Enter row vector of coefficients c Enter row vector of minterm probabilities minprob(P) Use row matrices X and PX for calculations Call for XDBN to view the distribution disp(XDBN) -15.0000 0.1800 -5.0000 0.0450 0 0.4800 10.0000 0.1200 15.0000 0.1400 25.0000 0.0350 PXneg = (X<0)*PX' PXneg = 0.2250 PX0 = (X==0)*PX' PX0 = 0.4800 PXpos = (X>0)*PX' PXpos = 0.2950 ## Exercise 12 The class {A,B,C,D}{A,B,C,D} has minterm probabilities p m = 0 . 001 * [ 5 7 6 8 9 14 22 33 21 32 50 75 86 129 201 302 ] p m = 0 . 001 * [ 5 7 6 8 9 14 22 33 21 32 50 75 86 129 201 302 ] (9) • Determine whether or not the class is independent. • The random variable X=IA+IB+IC+IDX=IA+IB+IC+ID counts the number of the events which occur on a trial. Find the distribution for X and determine the probability that two or more occur on a trial. Find the probability that one or three of these occur on a trial. ### Solution npr06_12 Minterm probabilities in pm, coefficients in c a = imintest(pm) The class is NOT independent Minterms for which the product rule fails a = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 canonic Enter row vector of coefficients c Enter row vector of minterm probabilities pm Use row matrices X and PX for calculations Call for XDBN to view the distribution XDBN = 0 0.0050 1.0000 0.0430 2.0000 0.2120 3.0000 0.4380 4.0000 0.3020 P2 = (X>=2)*PX' P2 = 0.9520 P13 = ((X==1)|(X==3))*PX' P13 = 0.4810 ## Exercise 13 James is expecting three checks in the mail, for$20, $26, and$33 dollars. Their arrivals are the events A,B,CA,B,C. Assume the class is independent, with respective probabilities 0.90, 0.75, 0.80. Then

X = 20 I A + 26 I B + 33 I C X = 20 I A + 26 I B + 33 I C
(10)

represents the total amount received. Determine the distribution for X. What is the probability he receives at least $50? Less than$30?

### Solution

c = [20 26 33 0];
P = 0.01*[90 75 80];
canonic
Enter row vector of coefficients  c
Enter row vector of minterm probabilities  minprob(P)
Use row matrices X and PX for calculations
Call for XDBN to view the distribution
disp(XDBN)
0    0.0050
20.0000    0.0450
26.0000    0.0150
33.0000    0.0200
46.0000    0.1350
53.0000    0.1800
59.0000    0.0600
79.0000    0.5400
P50 = (X>=50)*PX'
P50 =  0.7800
P30 = (X <30)*PX'
P30 =  0.0650

## Exercise 14

A gambler places three bets. He puts down two dollars for each bet. He picks up three dollars (his original bet plus one dollar) if he wins the first bet, four dollars if he wins the second bet, and six dollars if he wins the third. His net winning can be represented by the random variable

X = 3 I A + 4 I B + 6 I C - 6 , with P ( A ) = 0 . 5 , P ( B ) = 0 . 4 , P ( C ) = 0 . 3 X = 3 I A + 4 I B + 6 I C - 6 , with P ( A ) = 0 . 5 , P ( B ) = 0 . 4 , P ( C ) = 0 . 3
(11)

Assume the results of the games are independent. Determine the distribution for X.

### Solution

c = [3 4 6 -6];
P = 0.1*[5 4 3];
canonic
Enter row vector of coefficients  c
Enter row vector of minterm probabilities  minprob(P)
Use row matrices X and PX for calculations
Call for XDBN to view the distribution
dsp(XDBN)
-6.0000    0.2100
-3.0000    0.2100
-2.0000    0.1400
0    0.0900
1.0000    0.1400
3.0000    0.0900
4.0000    0.0600
7.0000    0.0600

## Exercise 15

Henry goes to a hardware store. He considers a power drill at $35, a socket wrench set at$56, a set of screwdrivers at $18, a vise at$24, and hammer at \$8. He decides independently on the purchases of the individual items, with respective probabilities 0.5, 0.6, 0.7, 0.4, 0.9. Let X be the amount of his total purchases. Determine the distribution for X.

### Solution

c = [35 56 18 24 8 0];
P = 0.1*[5 6 7 4 9];
canonic
Enter row vector of coefficients  c
Enter row vector of minterm probabilities  minprob(P)
Use row matrices X and PX for calculations
Call for XDBN to view the distribution
disp(XDBN)
0    0.0036
8.0000    0.0324
18.0000    0.0084
24.0000    0.0024
26.0000    0.0756
32.0000    0.0216
35.0000    0.0036
42.0000    0.0056
43.0000    0.0324
50.0000    0.0504
53.0000    0.0084
56.0000    0.0054
59.0000    0.0024
61.0000    0.0756
64.0000    0.0486
67.0000    0.0216
74.0000    0.0126
77.0000    0.0056
80.0000    0.0036
82.0000    0.1134
85.0000    0.0504
88.0000    0.0324
91.0000    0.0054
98.0000    0.0084
99.0000    0.0486
106.0000    0.0756
109.0000    0.0126
115.0000    0.0036
117.0000    0.1134
123.0000    0.0324
133.0000    0.0084
141.0000    0.0756

## Exercise 16

A sequence of trials (not necessarily independent) is performed. Let Ei be the event of success on the ith component trial. We associate with each trial a “payoff function” Xi=aIEi+bIEicXi=aIEi+bIEic. Thus, an amount a is earned if there is a success on the trial and an amount b (usually negative) if there is a failure. Let Sn be the number of successes in the n trials and W be the net payoff. Show that W=(a-b)Sn+bnW=(a-b)Sn+bn.

### Solution

X i = a I E i + b ( 1 - I E i ) = ( a - b ) I E i + b X i = a I E i + b ( 1 - I E i ) = ( a - b ) I E i + b
(12)
W = i = 1 n X i = ( a - b ) i = 1 n I E i + b n = ( a - b ) S n + b n W = i = 1 n X i = ( a - b ) i = 1 n I E i + b n = ( a - b ) S n + b n
(13)

## Exercise 17

A marker is placed at a reference position on a line (taken to be the origin); a coin is tossed repeatedly. If a head turns up, the marker is moved one unit to the right; if a tail turns up, the marker is moved one unit to the left.

1. Show that the position at the end of ten tosses is given by the random variable
X=i=110IEi-i=110IEic=2i=110IEi-10=2S10-10X=i=110IEi-i=110IEic=2i=110IEi-10=2S10-10
(14)
where Ei is the event of a head on the ith toss and S10 is the number of heads in ten trials.
2. After ten tosses, what are the possible positions and the probabilities of being in each?

### Solution

X i = I E i - I E i c = I E i - ( 1 - I E i ) = 2 I E i - 1 X i = I E i - I E i c = I E i - ( 1 - I E i ) = 2 I E i - 1
(15)
X = i = 1 10 X i = 2 e = 1 n I E i - 10 X = i = 1 10 X i = 2 e = 1 n I E i -10
(16)
S = 0:10;
PS = ibinom(10,0.5,0:10);
X = 2*S - 10;
disp([X;PS]')
-10.0000    0.0010
-8.0000    0.0098
-6.0000    0.0439
-4.0000    0.1172
-2.0000    0.2051
0    0.2461
2.0000    0.2051
4.0000    0.1172
6.0000    0.0439
8.0000    0.0098
10.0000    0.0010

## Exercise 18

Margaret considers five purchases in the amounts 5, 17, 21, 8, 15 dollars with respective probabilities 0.37, 0.22, 0.38, 0.81, 0.63. Anne contemplates six purchases in the amounts 8, 15, 12, 18, 15, 12 dollars, with respective probabilities 0.77, 0.52, 0.23, 0.41, 0.83, 0.58. Assume that all eleven possible purchases form an independent class.

1. Determine the distribution for X, the amount purchased by Margaret.
2. Determine the distribution for Y, the amount purchased by Anne.
3. Determine the distribution for Z=X+YZ=X+Y, the total amount the two purchase.

Suggestion for part (c). Let MATLAB perform the calculations.

[r,s] = ndgrid(X,Y);
[t,u] = ndgrid(PX,PY);
z = r + s;
pz = t.*u;
[Z,PZ] = csort(z,pz);

### Solution

% file npr06_18.m
cx = [5 17 21 8 15 0];
cy = [8 15 12 18 15 12 0];
pmx = minprob(0.01*[37 22 38 81 63]);
pmy = minprob(0.01*[77 52 23 41 83 58]);
npr06_18
[X,PX] = canonicf(cx,pmx);  [Y,PY] = canonicf(cy,pmy);
[r,s] = ndgrid(X,Y);   [t,u] = ndgrid(PX,PY);
z = r + s;   pz = t.*u;
[Z,PZ] = csort(z,pz);
a = length(Z)
a  =  125              % 125 different values
plot(Z,cumsum(PZ))  % See figure     Plotting details omitted

## Content actions

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

For detailed instructions on how to download this content's EPUB to your specific device, click the "(?)" link.

#### Collection to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks

#### Module to:

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks