Here are the slides. Reading assignment: BT, Sections 3.1-3.3.
Homework #6
Posted by James on February 16, 2012
Due, in class: February 22nd
For this homework, you will need to turn in your solutions in two parts. This is for ease of grading by the TAs. Problems 1-3 and 5-6 (+ the extra credit) should be turned in on different sheets of paper (there will be two different piles).
In solving the problem sets, you are allowed to collaborate with fellow students taking the class, but remember that you are required to write up the solutions by yourself or with a single partner. If you do collaborate in any way, you must acknowledge, for each problem, the people you worked with on that problem.
The problems have been carefully chosen for their pedagogical value, and hence might be similar to those given in past offerings of this course at UW, or similar to other courses at other schools. Using any pre-existing solutions from these sources, for from the web, constitutes a violation of the academic integrity you are expected to exemplify, and is strictly prohibited.
Most of the problems only require one or two key ideas for their solution. It will help you a lot to spell out these main ideas so that you can get most of the credit for a problem even if you err on the finer details.
A final piece of advice: Start working on the problem sets early! Don’t wait until the day (or few days) before they’re due.
Problems
Part one
- Sandwiches. Suppose you work for a sandwich shop. It costs $10 to buy a vegan sandwich, and you can sell them for $15. Unfortunately, the sandwiches go bad by the end of the day, and you cannot return unsold sandwiches. If your daily demand is a binomial random variable with n=10 and p=1/3, approximately how many vegan sandwiches should you purchase so as to maximize your expected profit?
- NFLX. Suppose now that you work for Netflix. In a typical hour, there are 50,000 viable users, and each one streams a movie independently with probability p=0.1. You need 10Mb/s of bandwidth to stream a single movie. If your bandwidth is exceeded, you have to drop a stream. Let X = number of movies requested in an hour.
- Compute E[X]. Using Markov’s inequality, compute the approximate bandwidth you will need so that you drop a stream with probability at most 1/100.
- Compute Var[X]. Using Chebyshev’s inequality, compute the approximate bandwidth you will need so that you drop a stream with probability at most 1/100.
- Finally, compute your bandwidth requirement for the same setting using a Chernoff bound.
- Entropy. A coin with probability p=2/3 of coming up heads is flipped 6 times. Let X = the total number of heads. Compute the entropy of X. Your answer should be in term of bits.
[Hint: Look in the BT book, or the definition on the wikipedia page.]
Part two
-
You have an array holding 6 numbers, and you run the following algorithm to find the max of those numbers:
max = a[0];
for(i = 1; i < 6; i++) {
if (max < a[i]) // (*)
max = a[i]; // (**)
}
To do a detailed analysis of the running time of this algorithm, you need to know how many times statement (**) is executed vs skipped. A related, perhaps simpler, question is this: assuming that the six numbers are all distinct and equally likely to be in any order (e.g., they might as well be a random permutation of 1, 2, …, 6), let the random variable X be the number of times the "if" test in (*) is false before the first time statement (**) is executed (if ever). I.e., X=2 means that the 0-th array element was larger than elements 1 and 2, but smaller than element 3.
Find the probability mass function for X.
Find E[X].
Find Var[X].
- Poisson approximation. The expected number of typos in on a page of The Hunger Games is 0.2. What is the probability that the next page you read contains (a) 0 errors? (b) 2 or more errors? Explain your reasoning.
- Let N be an arbitrary random variable that takes only non-negative integer values. Prove that
Extra credit
You will show that the randomized min-cut algorithm can be made to run in time.
First, show that if you run the algorithm for only t steps, then the probability of contracting some edge of the minimum cut is .
Now consider the following algorithm: Run the basic algorithm to four times. Then recurse on each of these 4 copies. Use the recursion tree method (or some other method you know about) to argue why the running time for this will be
Finally, the probability of success is the probability that not all the recursions fail to find the min-cut. Argue that the probability of success is at least . Conclude that we need to run the algorithm only times to get a 90% probability of success.
Thus the total running time is .
Posted in Homework | 24 Comments »
Homework #5
Posted by James on February 5, 2012
Due, in class: February 15th
For this homework, you will need to turn in your solutions in two parts. This is for ease of grading by the TAs. Problems 1-4 and 5-7 should be turned in on different sheets of paper (there will be two different piles).
In solving the problem sets, you are allowed to collaborate with fellow students taking the class, but remember that you are required to write up the solutions by yourself or with a single partner. If you do collaborate in any way, you must acknowledge, for each problem, the people you worked with on that problem.
The problems have been carefully chosen for their pedagogical value, and hence might be similar to those given in past offerings of this course at UW, or similar to other courses at other schools. Using any pre-existing solutions from these sources, for from the web, constitutes a violation of the academic integrity you are expected to exemplify, and is strictly prohibited.
Most of the problems only require one or two key ideas for their solution. It will help you a lot to spell out these main ideas so that you can get most of the credit for a problem even if you err on the finer details.
A final piece of advice: Start working on the problem sets early! Don’t wait until the day (or few days) before they’re due.
Problems
Part one
- [Probability mass functions]
Let X be a random variable that takes values {1,2,3,4,5,6,7,8,9,10} each with probability 1/10.
Find the PMF of the random variable Y = X mod 4.
Find the PMF of the random variable Y = 5 mod (X+1).
- [Binomial PMF]
Let X be a binomial random variable with distribution Bin(n,p). Write for its probability mass function (PMF). What is the value of ?
Prove that for every k=0, 1, 2, …, the following recursive formula computes the PMF correctly.
- [Facebook IPO]
Since Facebook is about to be worth 100,000,000,000 dollars (yes, that’s the right number of zeros), Mark Zuckerberg chooses 6 interns and plays the following game. The interns are labeled 1,2,3,4,5,6. Then 6 distinct numbers are randomly distributed to the interns. Whenever two interns compare their numbers, the one with the highest number has to take a shot, and keep going. Initially, interns 1 and 2 compare their numbers; the “winner” then compares her number with that of intern 3, and so on. Let Y be the number of times intern 1 has to take a shot. What is the probability mass function of Y?
- [The coin lottery]
Suppose you toss independently a fair coin and you count the number of tosses until the first head appears.
If this number is n, you receive dollars.
What is the expected amount you will get?
What’s the variance?
How much would you pay to play this game?
Part two
- [Mission impossible?]
Tom Cruise and Katie Holmes claim they have ESP. To test their claim, we flip a fair coin 11 times and ask them to predict the outcome in advance. They get 8 out of 11 correct. Oprah throws a party and gives everyone a car. Now, what is the probability that they would have done at least this well without ESP?
- [Advertising budgets]
Extensive sampling has shown that when a person Google searches for “Gatorade” and a Vitamin Water ad appears, they click on it 15% of the time. Suppose that the Vitamin Water comes up with every “Gatorade” search and they are charged $1 whenever anyone clicks on their ad. Vitamin Water, unfortunately, has only $6000 to use for its daily advertising budget (come on, they sell water).
Now, suppose you know that, since it’s Superbowl Sunday, there are going to be about 10,000 searches for Gatorade the next day. Prove to the Vitamin Water CEO that the probability of exceeding the advertising budget is at most 0.25.
[Hint: First calculate E[X], where X = amount spent on advertising that day. Then show that if the probability of exceeding the budget is too big, then E[X] would be too big.]
- [Guessing games]
One of the 15 numbers 1, 2, …, 15 is chosen at random. You try to guess which number it is by only asking yes or no questions.
You are charged $1 for each of the first ten questions you ask, and then $2 for each additional question.
Let X be the amount of money you have to pay before determining the number. Compute E[X] for each of the two strategies:- Your ith question is “Is it i?” for i=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15.
- With each question, you try to eliminate one half of the remaining numbers, as nearly as possible.
- Your ith question is “Is it i?” for i=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15.
Posted in Homework | 33 Comments »