You are on page 1of 4

UC Berkeley, CS 174: Combinatorics and Discrete Probability (Fall 2010)

Solutions to Problem Set 6

1. (MU 8.1) Let X and Y be independent, uniform random variables on [0, 1]. Find the density
function and distribution function for X + Y .
We will use a convolution equations to find the density and distribution of Z:
Z ∞
fZ (z) = fX (x)fY (z − x)dx
x=−∞
Z z
FZ (z) = fZ (u)du.
u=−∞

Now, we use the fact that X and Y are independent U nif (0, 1) random variables. We will
consider two cases. First, for z ≤ 1,
Z z
fZ (z) = 1 · 1dx = z
0
Z z
FZ (z) = udu = z 2 /2.
0

Second, for 1 < z ≤ 2, we need to be careful about the range of X, Y


Z 1
fZ (z) = 1 · 1dx = 2 − z
z−1
1 z
z2
Z Z
FZ (z) = udu + (2 − u)du = 2z − − 1.
0 1 2

2. (MU 8.2) Let X and Y be independent, exponentially distributed random varaibales with
parameter 1. Find the density function and distribution function for X + Y .
Again, we use a convolution. For z ≥ 0, we have
Z z
fZ (z) = e−x e−z+x dx = ze−z
0
Z z
FZ (z) = ue−u du = 1 − e−z (z + 1),
0

where the last equation is computed using integration by parts.

3. (MU 8.4) We agree to try to meet between 12 and 1 for lunch at our favorite sandwich shop.
Because of our busy schedules, neither of us is sure when we’ll arrive; we assume that for each of
us our arrival time is uniformly distributed over the hour. So that neither of us has to wait too
long, we agree that we will each wait exactly 15 minutes for the other to arrive, and then leave.
What is the probability we actually meet each other for lunch?
Let random variables X and Y be independent and uniformly distributed the interval [0, 60].
These variables denote the arrival times of the two people during that hour. So, the two people

1
will meet if |X − Y | ≤ 15. Therefore, we compute
Z ∞ Z y+15
P[|X − Y | ≤ 15] = fX,Y (x, y)dxdy
−∞ y−15
Z ∞ Z y+15
= fX (x)fY (y)dxdy
−∞ y−15
Z 60 Z y+15
= fX (x)dxdy
0 y−15

We also have that 


Z y+15  y + 1/4 0 ≤ y < 15
fX (x)dx = 1/2 15 ≤ y < 45
y−15 
5/4 − y 45 < y ≤ 60
So, finally we get
Z 15 Z 45 Z 60
P[|X − Y | ≤ 15] = (y + 1/4)dy + 1/2dy + (5/4 − y)dy
0 15 45

= (1/2(1/4)2 + (1/4)(1/4)) + 1/4 + (1/2(1/4)2 + (1/4)(1/4))

= 7/16

4. (MU 8.9)
You would like to write a simulation that uses exponentially distributed random variables. Your
system has a random number generator that produces independent, uniformly distributed num-
bers from the real interval (0, 1). Give a procedure that transforms a uniform random number as
given to and exponentially distributed random variable with parameter λ.
We will simulate a random variable Y ∼ exp(λ) by Y = −ln(X)/λ, where X ∼ unif orm(0, 1).
To see that Y is indeed exponential, we calculate its distribution function

FY (y) = P[Y ≤ y]
 
ln(X)
= P − ≤y
λ

= P[e−λy ≤ X]

= 1 − P[X ≤ e−λy ]

= 1 − FX (e−λy )
1 − e−λy if x ≥ 0

=
0 if x < 0

Therefore, Y is an exponentially distributed random variable with parameter λ.

5. (MU 8.19) You are waiting at a bus stop to catch a bus across town. There are actually n
different bus lines you can take, each following a different route. Which bus you decide to take
will depend on which bus gets to the bus stop first. As long as you are waiting, the time you

2
have to wait for a bus on the ith line is exponentially distributed with mean µi minutes. Once
you get on a bus on the ith line, it will take you ti minutes to get across town.
Design an algorithm for deciding–when a bus arrives–whether or not you should get on the bus,
assuming your goal is to minimize the expected time to cross town. (Hint: You want to determine
the set of buses that you want to take as soon as they arrive. There are 2n possible sets, which
is far too large for an efficient algorithm. Argue that you need only consider a small number of
these sets.)
Denote a strategy by S, the set of buses from which we will board the first bus that appears. An
optimal strategy is one where the total expected time (wait time plus travel time) is minimal.
Let Xi ∼ exp(1/µi ) as the problem states. Let the time of the first P bus arrival be at time
X = min{Xi |i ∈ S}. We know from Lemma 8.5 that X ∼ exp( i∈S 1/µi ). After we have
selected an arrival time for the first bus, then we can select bus i with probability P 1/µ1/µ
i
i
. Let
i∈S
T be the random variable for the travel time of that bus. For a given set S, the expected time is
P
1 ti /µi
ES := E[X + T ] = E[X] + E[T ] = P + Pi∈S .
i∈S 1/µi i∈S 1/µi

We want to choose the set S with the least expected time ES . Order the entire set of buses by
their travel times in increasing order. We need only consider sets S that are a prefix of this list
of buses. if bus i is not considered in set S, then all buses j with tj ≥ ti would also not be
considered. Conversly, if bus i is considered in set S, then any bus j with less travel time tj ≤ ti
would also be considered.
Therefore, we want to find the set S ∈ {{1}, {1, 2}, ..., {1, 2, ..., n}} results in the lowest expected
wait time ES . Simply compute these values and pick the set S with the smallest ES .
6. (MU 8.21)
The Ehrenfest model is a basic model used in physics. There are n particles moving randomly
in a container. We consider the number of particles in the left and right halves of the container.
A particle in one half of the container moves to the other half after an amount of time that is
exponentially distributed with parameter 1, independently of all other particles. See Figure 8.6.

(a) Find the stationry distribution of this process.


We define the Markov chain so that the states, ranging from 0 to n, are the number of
particles in the left half of the container. This chain is finite and ergodic, since all states
communicate. Therefore there is a stationary distribution.
The stationary distribution can be obtained by noticing that the rate at which particles
move from the left to the right must be the same as the rate at which they move from the
right to the left. Therefore πk (n − k) = πk+1 (k + 1). So, we have
n−k
πk+1 = πk
k+1
π1 = nπ0
n−1
π2 = n π0
2
...
 
n−1 n−k+1 n! n
πk = n ··· π0 = π0 = π0
2 k (n − k)!k! k

3
P
Since we also have that i πi = 1, we get
X n 
π0 = π0 2n = 1,
i
i

n
and we obtain π0 = 2−n . Therefore πk = 2−n .

k
(b) What state has the highest probability in the stationary distribution? Can you suggest an
explanation for this?
When k = b n2 c or k = d n2 e, then nk and thus πk is maximized. This means that the


probability is maximized when there are equal particles in both chambers. This is due to it
being the state with the higest entropy, i.e. the second law of Thermodynamics.

You might also like