.. title: Engineering Probability Class 5 Mon 2021-02-08
.. slug: class05
.. date: 2021-02-08
.. tags: class
.. link: 
.. description: 
.. type: text
.. has_math: true

.. sectnum::
.. contents:: Table of contents::
..

TAs
---

We have two 10-hour TAs:

#. Heshan Fernando, fernah, office hour: Wednesday 2pm.
#. Meng Zhang, zhangm19, office hour: Friday 3-4pm.

Their office hours will be on webex, at https://rensselaer.webex.com/meet/RCSID.   If no one appears after 15 minutes, they'll leave.  OTOH, if you'd like help at other times, contact them.  They'll try to be available.


Leon Garcia, chapter 2, ctd
----------------------------

#. Leon-Garcia 2.3: Counting methods, pp 41-46.
   
   a. finite sample space
   #. each outcome equally probable
   #. get some useful formulae
   #. warmup: consider a multiple choice exam where 1st answer has 3 choices,
      2nd answer has 5 choices and 3rd answer has 6 choices.
      
      i. Q: How many    ways can a student answer the exam?  
      #. A: 3x5x6
	 
   #. If there are k questions, and the i-th question has :math:`n_i` answers
      then the number of possible combinations of answers is :math:`n_1n_2 .. n_k`

#. 2.3.1 Sampling WITH replacement and WITH ordering
   
   a. Consider an urn with n different colored balls.
   #. Repeat k times:
      
      i. Draw a ball.
      #. Write down its color.
      #. Put it back.
	 
   #. Number of distinct ordered k-tuples = :math:`n^k`

#. Example 2.1.5.  How many distinct ordered pairs for 2 balls from 5?   5*5.

#. *Review*.  Suppose I want to eat one of the following 4 places, for
   tonight and again tomorrow, and don't care if I eat at the same place
   both times: Commons, Sage, Union, Knotty Pine.  How many choices to I
   have where to eat?
   
   a. 16
   #. 12
   #. 8
   #. 4
   #. something else

#. 2.3.2 Sampling WITHOUT replacement and WITH ordering
   
   a. Consider an urn with n different colored balls.
   #. Repeat k times:
      
      i. Draw a ball.
      #. Write down its color.
      #. Don't put it back.
	 
   #. Number of  distinct ordered k-tuples = n(n-1)(n-2)...(n-k+1)

#. *Review*.  Suppose I want to visit two of the following four
   cities: Buffalo, Miami, Boston, New York.  I don't want to visit one
   city twice, and the order matters.  How many choices to I have how to
   visit?
   
   a. 16
   #. 12
   #. 8
   #. 4
   #. something else

#. Example 2.1.6: Draw 2 balls from 5 w/o replacement.
   
   a. 5 choices for 1st ball, 4 for 2nd. 20 outcomes.
   #. Probability that 1st ball is larger?
   #. List the 20 outcomes.  10 have 1st ball larger.  P=1/2.

#. Example 2.1.7: Draw 3 balls from 5 with replacement.  What's the
   probability they're all different?
   
   a. P = :math:`\small \frac{\text{# cases where they're different}}{\text{# cases where I don't care}}`
   #. P = :math:`\small \frac{\text{# case w/o replacement}}{\text{# cases w replacement}}`
   #. P = :math:`\frac{5*4*3}{5*5*5}`

#. 2.3.3 Permutations of n distinct objects
   
   a. *Distinct* means that you can tell the objects apart.
   #. This is sampling w/o replacement for k=n
   #. 1.2.3.4...n = n!
   #. It grows fast.  1!=1, 2!=2, 3!=6, 4!=24, 5!=120, 6!=720, 7!=5040
   #. Stirling approx:

      .. math::

         n! \approx \sqrt{2\pi n} \left(\frac{n}{e}\right)^n\left(1+\frac{1}{12n}+...\right)

   #. Therefore if you ignore the last term, the relative error is about
      1/(12n).

#. Example 2.1.8.  # permutations of 3 objects.   6!

#. Example 2.1.9.  12 airplane crashes last year.  Assume independent,
   uniform, etc, etc.  What's probability of exactly one in each month?

   a. For each crash, let the outcome be its month.
   #. Number of events for all 12 crashes = :math:`12^{12}`
   #. Number of events for 12 crashes in 12 different months = 12!
   #. Probability = :math:`12!/(12^{12})  = 0.000054`
   #. **Random does not mean evenly spaced.**

#. 2.3.4 Sampling w/o replacement and w/o ordering
   
   a. We care what objects we pick but not the order
   #. E.g., drawing a hand of cards.
   #. term: **Combinations** of k objects selected from n.  Binomial coefficient.

      .. math::
	 
         C^n_k = {n \choose k} = \frac{n!}{k! (n-k)!}
	 
   #. **Permutations** is when order matters.

#. Example 2.20.  Select 2 from 5 w/o order.  :math:`5\choose 2`

#. Example 2.21 # permutations of k black and n-k white balls.  This is
   choosing k from n.

#. Example 2.22.  10 of 50 items are bad.  What's probability 5 of 10
   selected randomly are bad?
   
   a. # ways to have 10 bad items in 50 is :math:`50\choose 10`
   #. # ways to have exactly 5 bad is 3 ways to select 5 good from 40 times #
      ways to select 5 bad from 10 = :math:`{40\choose5} {10\choose5}`
   #. Probability is ratio.

#. Multinomial coefficient: Partition n items into sets of size :math:`k_1, k_2, ... k_j,  \sum k_i=n`

   .. math::
      
      \frac{n!}{k_1! k_2! ... k_j!}

#. 2.3.5.  skip

**Reading:** 2.4 Conditional probability, page 47-



#. New stuff, pp. 47-66:
   
   a. **Conditional probability** - If you know that event A has occurred,
      does that change the probability that event B has occurred?
   #. **Independence of events** - If *no*, then A and B are independent.
   #. **Sequential experiments** - Find the probability of a sequence of
      experiments from the probabilities of the separate steps.
   #. **Binomial probabilities** - tossing a sequence of *unfair* coins.
   #. **Multinomial probabilities** - tossing a sequence of *unfair* dice.
   #. **Geometric probabilities** - toss a coin until you see the 1st head.
   #. **Sequences of dependent experiments** - What you see in step 1
      influences what you do in step 2.


To watch
--------

Rich Radke's Probability Bites:

12. The Monty Hall Problem
13. Independent Events
14. Bernoulli Trials

https://www.youtube.com/playlist?list=PLuh62Q4Sv7BXkeKW4J_2WQBlYhKs_k-pj


Occasional no-work classes
--------------------------

Since there is no spring break, or even many long weekends, occasionally the probability class will be something easy, with no homework and no exam questions, like watching a video.

Probability in the real world - enrichment
------------------------------------------

See examples in the random section below.


Homework 3
----------

is online `here <../posts/homework03.html>`_ , due in a week.


   

Xkcd comic
----------

`Linear Regression <https://xkcd.com/1725/>`_
