Math 210 Fall 2008  
Reminder: You can work together in groups of at most three people. In this case, the group submits one copy of each Homework Set with the names of all the people in the group. Essentially the same groupings should work together all semester.

Problem Set 2, Due Tues. Sept. 23 in Class
(late papers OK until 1:00 Wednesday)

  1. The next three players in a game win 30%, 20% and 25% of the time, respectively. What is the likelihood that none of them will win this time?
    [Equivalent wording: It is the fifth inning of a baseball game. The batting averages of the next three batters are .300, .200, and .250. Say they face an average pitcher. What is the likelihood that none of them will get a hit this inning?]

  2. Say you are interviewing 6 candidates for a job. As you proceed, you can determine the relative ranks of the candidates, but not the true rank. Thus, if there are 6 candidates with true rank 6, 1, 4, 2, 3, 5, then after interviewing the first three candidates you would rank them 3, 1, 2. After you interview a candidate, you either hire that person or the candidate leaves and can no longer be considered.
    You want a strategy when to stop and accept a candidate, maximizing the likelihood of getting the best candidate. Assume there are 6 candidates, and they arrive in a random order.
    a) What is the probability that you get the best candidate if you interview all of the candidates? What if you immediately choose the first candidate?
    b) Say you adopt the strategy of interviewing the first half of the candidates and then accept the first of the following candidates who is better than any seen so far (if you have seen all the candidates so are at the last candidate then you must accept that person). Show (by a crude estimate) that you have a chance of less than 50% of getting the the best candidate -- but better than a 25% chance of getting the the best candidate.
    Computer Simulation with 10 candidates: Pick the Largest Number

  3. a) In a certain town there are 2 bus companies whose buses stop at the Main Street station. One company's busses run every 10 minutes, the other runs every 8 minutes -- but the times of arrival of the previous busses are unknown. The question is, what is the average length of time that you will wait for a bus after arriving at the station?
    b). Same as the above, but 3 bus companies -- whose busses each stop every 10 minutes.

  4. a). Say you roll a die once (this is your "event"). To each eventyou assign the number showing on the die. Compute the expected value and standard deviation.
    b). Say you roll 100 dice once (this is your "event"). To each event you assign the sum of the numbers showing on the dice. Compute the expected value and standard deviation.
    Remark: To do this problem easily, one needs that for 100 random variables X1, ..., X100, the expected value of the sum is the sum of the expected values:
    E(X1 + ...+ X100) = E(X1) + ...+ E(X100).

    Here Xj is the expected value fot the jth die, which you computed in part a).
    There is a related formula for the variance, but here one also needs to assume that the variables X1, ..., X100 are independent (the result one gets tossing one die is independent of the value obtained when tossing another die). Then
    Var(X + Y) = Var(X) + Var(Y)
    with the obvious generalization to Var(X1 + ...+ X100) (see Theorem 6.2 (p. 231), Theorems 6.7, 6.8, and 6.9 (p. 259-260) of Probability by Grinstead and Snell
    c). Say you roll 100 dice once (this is your "event"). To each event you assign the average of the numbers showing on the dice. Compute the expected value and standard deviation.
    Similarly to part b), for any constant c, E(cX) = cE(X) so
    E([X1 + ...+ X100]/100]) = [E(X1 + ...+ X100)]/100
    and similarily, Var(cX)=c2Var(X).

  5. target fig A big dart board consists of three concentric disks of radius 1, 2, and 3 feet. If a dart lands in the center disk you get 50 points. If it lands in the middle ring you get 25 points, while if it lands in the outer ring you get 10 points.
    Compute both the expected value and standard deviation of the number of points you'll get by throwing darts at random at this board.


Computer Problems

  1. Toss a (fair) coin 10,000 times. How many times do you get "heads"? Since this can be tedious unless you get an army of helpers, you may prefer to do a computer simulation.

  2. Write a perl script that computes (x + y)/w, where x, y, and w are given numbers (with w not zero, of course). You may wish to just modify the similar example in:
    http://www.math.upenn.edu/~kazdan/210/computer/perl/perl_example0.pl After writing this, make sure the first line is the correct location of perl on the computer you are using. Also, remember to make this program executable:
    chmod 755 [filename]

  3. [If you are working in a group, then each person should do this problem separately.]
    The point of this problem is to learn how to write web forms where you input data on a web page and the data is processed. As an example, first try http://johnny.sas.upenn.edu/~kazdan/210/perl_example1.html

    a) Next, copy my
    http://johnny.sas.upenn.edu/~kazdan/210/perl_example1.html
    to your html directory on johnny.sas. So login to johnny.sas and:

    cp ~kazdan/html/210/perl_example1.html   ~/html
    and change the permissions so anyone can execute it:
    chmod 755 ~/html/perl_example1.html

    b).Copy my file (on johnny.sas)
    /home/kazdan/html/cgi-bin/210/perl_example1.pl
    to your directory   html/cgi-bin/210 as follows (all on one line):

    cp ~kazdan/html/cgi-bin/210/perl_example1.pl   ~/html/cgi-bin/210
    [Of course you'll *first* need to make the directory html/cgi-bin/210/ and also make it world readable:
    chmod 755 {directory name}]
    Then modify the <form ...> line on the file of part a) to refer to this perl script. Test if the perl script in part a) now works. (It should.)

    c). Modify both parts a) and b) to change addition to multiplication.

  4. Using your work last week, write a computer program (perhaps using perl) that does the following:
    Given a date, such as April 17, 2501, determine the day of the week (Monday, Tuesday, etc.).
    Perl note. You may find the following items useful, an array named "MonthLength" giving the length of each month -- with three lines of code to correct the length of February for leap years:
    @MonthLength = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
    
    # Step 1: If Year is a leap year, set $MonthLength[1]=29; if ( (($Year % 4) == 0) and ( (($Year % 100) != 0) or ( ($Year % 400) == 0) ) ) { $MonthLength[1]=29; }