Answers to Midterm Exam Mon 13 Oct 2003

notice: five out of eight correct answers make a perfect score

  1. Suppose we measure the quality of watches as the deviation from the time at noon after one month without adjustments. Watches which show a deviation of more than 3 minutes have to be discarded at a cost of $10.

    We have to choose between two ways to produces watches. Watches produced by process A give after one month an average time of 12:01 with a standard deviation of 1 minute, while watches produced by process B show 12:00 on average, but with a standard deviation of 2 minutes. Which process is best?

    1. Set up the quality loss function.
            QLF: L(X,theta) = k*(X-theta)^2
            as the loss is $10 when the deviation >= 3 minutes,
            we can determine k: 10 = k*3^2 => k = 10/9
      
                           10               2
             L(X,theta) = ---- ( X - theta )
                            9
      
    2. Use the expected loss to choose which process is best.
            E[L(X,theta)] = k*sigma^2 + k*(mu-theta)^2,
            where mu and sigma are mean and standard deviation
      
         Process A: mu = 1201, sigma = 1
      
                              10   2    10   2    20
            E[L(X,theta)] =  ---- 1  + ---- 1  = ----
                               9         9         9 
      
         Process B: mu = 1200, sigma = 2 
      
                              10   2    10   2    40
            E[L(X,theta)] =  ---- 2  + ---- 0  = ----
                               9         9         9 
      
         The process A is best because it gives 
         a lower expected loss than process B.
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  2. Suppose we are interested in organizing a marathon. The performance of the top runners (their average time and standard deviation to complete the marathon) is known.

    1. As marathon organizers, how would we estimate the probability of breaking the world record at our event? Assume our budget allows to pay five top athletes.
         Athlete a runs a marathon on average in time mu(a) and
         with standard deviation sigma(a), a = 1,2,..,5.
      
         Let t = sample(mu(a),sigma(a)) samples running time
         for athlete a.
      
         We simulate the marathon N times and record each time
         the minimum time, which is the time of the winner.
      
    2. Describe the computational procedures we would apply, using pseudo code.
           run_min := 24 hours x 60 minutes x 60 seconds;
           for i from 1 to N do
              for a from 1 to 5 do
      	   t(a) := sample(mu(a),sigma(a));
              end for;
      	m = minimum(t(1),t(2),t(3),t(4),t(5));
              if m < run_min
               then run_min := m;
              end if;
           end for;
           report run_min.
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  3. Consider a credit card with a balance of $1,000, at an annual interest rate of 20%. Suppose we can afford a monthly payment of $50, how long will it take to clear the balance on the credit card?

    1. Set up the recursion relation for the balance B(n) at month n.
            B(0) = 1000
                          (      0.2  )
            B(n) = B(n-1)*( 1 + ----- ) - 50
                          (       12  )
      
                          ( 61 )
            B(n) = B(n-1)*(----) - 50
                          ( 60 )
      
    2. Solve the recursion for B(n).
                        ( 61 )
            B(1) = 1000*(----) - 50
                        ( 60 )
      
                        ( 61 )
            B(2) = B(1)*(----) - 50
                        ( 60 )
      
                   (      ( 61 )      ) ( 61 )
                 = ( 1000*(----) - 50 )*(----) - 50
                   (      ( 60 )      ) ( 60 )
      
                        ( 61 )2      ( 61 )
                 = 1000*(----)  - 50*(----) - 50
                        ( 60 )       ( 60 )
      
                        ( 61 )3      ( 61 )2     ( 61 )
            B(3) = 1000*(----)  - 50*(----) - 50*(----) - 50
                        ( 60 )       ( 60 )      ( 60 )
      
                                     n-1
                        ( 61 )n      --- ( 61 )k 
            B(n) = 1000*(----)  - 50 >   (----)
                        ( 60 )       --- ( 60 )
                                     k=0
      
                                        ( 61 )n
                                        (----)  - 1
                        ( 61 )n         ( 60 )
                 = 1000*(----)  - 50 * --------------
                        ( 60 )            61   
                                         ----   - 1
                                          60
                                 ( 61 )n
            B(n) = 3000 - 2000 * (----)
                                 ( 60 )
           
      
    3. Determine for which n, B(n) = 0.
            Evaluate B(n) using a calculator:
              n = 24 : B(24) = 26.17
              n = 25 : B(25) = -23.39
      
            So the last payment at n=25 is 50-23.39.
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  4. Show that the Discrete Fourier Transform (DFT) turns convolutions into coordinate-wise products.

    1. Using * for convolution and xx for the DFT of x, write the property
         x * y  -> xx . yy
      
      down for frames of four elements.
             x = (x(0) x(1) x(2) x(3)) (x(0) x(1) x(2) x(3)) ...
             y = (y(0) y(1) y(2) y(3)) (y(0) y(1) y(2) y(3)) ...
      
             z = x*y = (z(0) z(1) z(2) z(3)) (z(0) z(1) z(2) z(3)) ...
             zz = xx . yy, zz(k) = xx(k).yy(k), for k = 1,2,3,4.
      
    2. Show the property holds for frames of four elements.
         w^(-9)*( z(3) = y(3)x(0) + y(2)x(1) + y(1)x(2) + y(0)x(3) )
         w^(-0)*( z(0) = y(3)x(1) + y(2)x(2) + y(1)x(3) + y(0)x(0) )
         w^(-3)*( z(1) = y(3)x(2) + y(2)x(3) + y(1)x(0) + y(0)x(1) )
       + w^(-6)*( z(2) = y(3)x(3) + y(2)x(0) + y(1)x(1) + y(0)x(2) )
      ----------------------------------------------------------------
         z(0)*w^(-0) + z(1)*w^(-3) + z(2)*w^(-6) + z(3)*w^(-9) = zz(3)
      
      Collecting the terms at the right of the sum:
      
        x(0)*( y(0)w^(-0) + y(1)w^(-3) + y(2)w^(-6) + y(3)w^(-9) = yy(3)       )
      + x(1)*( y(0)w^(-3) + y(1)w^(-6) + y(2)w^(-9) + y(3)w^(-0) = yy(3)w^(-3) )
      + x(2)*( y(0)w^(-6) + y(1)w^(-9) + y(2)w^(-0) + y(3)w^(-3) = yy(3)w^(-6) )
      + x(3)*( y(0)w^(-9) + y(1)w^(-0) + y(2)w^(-3) + y(3)w^(-6) = yy(3)w^(-9) )
      
      which equals
      
        zz(3) = x(0)yy(3)w^(-0) + x(1)yy(3)w^(-3) 
              + x(2)yy(3)w^(-6) + x(3)yy(3)w^(-9) = xx(3).yy(3)
      
      The same holds for zz(0), zz(1), and zz(2).
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  5. A manufacturer produces two types of products, say A and B. A sells at $5 per unit, while B sells at $7 per unit. We have to decide how many units of each product to produce, with the aim of maximizing the profit, subject to the following constraints.

    We are obliged to produce at least 20 units of A and to offer at least 10 units of B. Our storage capacity is limited to 250 units. We have only 600 man hours available, one unit of A requires two man hours, while one unit of B takes three man hours.

    1. Set up the linear programming model for this problem.
              max 5 x1 + 7 x2
      
      	subject to  -x1       <= -20
                              -  x2 <= -10
                           x1 +  x2 <= 250
                          2x1 + 3x2 <= 600
      
    2. Graph the feasibility region.

    3. From the graph, compute the optimal solution.
          value at ( 20,186): 5  20 + 7 186 = 1402
                at (150,100): 5 150 + 7 100 = 1450
                at (240, 10): 5 240 + 7  10 = 1270
      
          The optimum occurs when 150 units of A,
          and 100 units of B are produced.
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  6. The evolution of the population (size in millions) in the U.S. is listed in the table:
         year || 1950 | 1960 | 1970 | 1980 | 1990 
        ------++------+------+------+------+------
         size ||  151 |  179 |  203 |  226 |  249 
    
    We use P(t) = exp(a t + b) to model the size of the population (in millions) at year t.

    1. Set up the system of linear equations we need to solve in order to find a and b.
               ln(P(t)) = a t + b
      
           [ 1950 1 ]         [ ln(151) ]
           [ 1960 1 ] [ a ]   [ ln(179) ]
           [ 1970 1 ] [   ] = [ ln(203) ]
           [ 1980 1 ] [ b ]   [ ln(226) ]
           [ 1990 1 ]         [ ln(249) ]
      
                X [a b]^T = P
      
    2. Explain how to solve this overconstrained linear system, but do not solve it.
            We can either reduce the system to a 2-by-2 linear
            system, as
      
                 X^T X [a b]^T = X^T P
      
            or apply QR to X, X = QR, Q^T Q = I, R upper triangular
            and solve a triangular system in a and b:
      
                 R [a b]^T = Q^T P.
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  7. company considers investing one million dollars for equipment with an expected life span of 12 years. Use 5% in continuous interest compounding.

    1. Suppose the equipment will save the company each year one hundred thousand dollars. Is this investment worth doing?
          The present value of the savings at r = 0.05 are
      
            100,000*(exp(-r) + exp(-2r) + .. + exp(-12r))
      
                     1 - exp(-13r)
          = 100,000 ---------------
                     1 -  exp(-r)
      
          = 980,005.30 < 1,000,000
      
          So the investment is not worth doing.
      
    2. Compute the break even annual savings, i.e.: how large should the annual savings be in order to gain from this investment?
                        1,000,000
          savings = -----------------
                    ( 1 - exp(-13r) )
                    (---------------)
                    ( 1 -  exp(-r)  )
      
                  = 102,040.26
      
          At this savings, the investment breaks even,
          no profit and no loss.
      
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+
    
  8. Consider the demand function D(p) = 8 + 20/p^2.
    1. Compute the elasticity of this demand function.
                 D'(p)            D(p) = 8 + 20*p^(-2)
         e = - p ------ 
                  D(p)           D'(p) = -40*p^(-3)
      
                   -40/p^3
           = - p ------------
                  8 + 20/p^2
      
                     40
           = -----------------
               2 (      20  )
              p  ( 8 + ---- )
                 (      p^2 )
      
                  40
           = ------------
              8 p^2 + 20
      
    2. Explain what this means for the price the producer will charge for the product.
        The price where the revenue does not change occurs at e=1.
      
        Thus the price the producer will charge for the product
        satisfies the equation
      
                   40
          1 = ------------  <=>  8 p^2 + 20 = 40
               8 p^2 + 20
                            <=>  8 p^2 = 20
      
                            <=>  4 p^2 = 10              
      
                            <=>  p^2 = 10/4
      
         => p = 10/sqrt(2) is the price the producer will charge
      
                                                            +--------+
                                                            |    /20 |
                                                            +--------+