CSCE 235

Light Bulb 6

March 3, 2004 

 

1.         Counting.  Every kid learns how to count, and most kids can count.  So, what are we doing with this topic?  Why do we want to learn about the Principles of Counting?  Several goals:  We want to count faster, we want to prove that the results of out counting is correct, we want to count efficiently, we want to implement counting as programs, and so on.  A simple argument is:  If you are asked to count how many days between April 10th and April 15th, you may use your fingers.  But, what if you are asked to count the number of lectures left in CSCE235 for this semester, between April 10th and May 9th?  You probably will have to use paper and pen, or look at a Calendar.  That’s still probably tractable.  But for problems that are too complex or that involve large numbers, things become intractable or difficult to organize.  That is when the Principles of Counting can be of help.

 

2.         One principle is the Principle of Inclusion-Exclusion.  This is extremely useful.  Suppose you are working for an IT company and you have been tasked to find out the following:  the number of customers buying product A, the number of customers buying product B, the number of customers buying both products, and the number of customers buying none.  There are 100 customers registered in the database.  Suppose your co-worker goes out and collects the data and reports to you:  the number of customers buying product A is 40, the number of customers buying product B is 30 and the number of customers buying either A or B is 60.  The co-worker collects only these numbers because the questionnaire for product B has an error in it.  And now, you need to report to your boss … what can you do?  We know that , , and .  Using the Principle of Inclusion-Exclusion, you can rewrite .  Or, .  Thus, .  That is, the number of customers buying both products is 10.  Now, what is the number of customers buying none of the products?  It is 100 - =100-60 = 40.  Now, with the help of a very useful principle, you can recover from the error in your questionnaire.  Not only that, this is also a very strategy:  you ask only a minimal set of questions to your customers.  And thus, they are more likely to participate in your questionnaire!

 

3.         When the sets involved in counting are disjoint or mutually exclusive, we have the addition and multiplication rules.  These are extremely useful when we study combinatorics for permutations.  So, we will see examples of those later in this class.  Basically, if two sets are disjoint, that means the intersection of the sets is an empty set!  That allows us to count even faster!  So, problem solvers (programmers, scientists, engineers, artists, etc.) sometimes look for representing a problem with disjoint sets!  Among many advantages of having disjoint sets (such as orthogonality, etc.), one is the applicability of the addition and multiplication rules.  

 

4.      Another very useful principle is the Pigeon Hole Principle.  This principle is intuitively obvious!  If n objects are put into m boxes and n > m, then some box must contain at least  objects.  It is so obvious that one may question its usefulness.  This name of this principle comes from building a pigeon house with some holes.  If the number of pigeons at the pigeon house is greater than the number of holes available, then some of the pigeons either go somewhere else or have to share a pigeon hole.  How can this principle be useful?  First of all, this principle has been used to prove numerous theorems and propositions.  For example, “Given 3 integers, there must be two of whose sum is even,” “Given 9 nonnegative numbers with sum 90, there must be 3 of the numbers having sum at least 30,” etc. 

 

Now, you may ask, what’s so great about that?  So what if I know “Given 9 nonnegative numbers with sum 90, there must be 3 of the numbers having sum at least 30?”  Well, suppose that you drive a truck, collecting recyclables.  There are nine recycling sites that you have to go and collect recyclables at the end of every month.  And then, you unload the recyclables at your processing center.  Your boss tells you that the monthly amount of recyclables is about 9000 pounds.  Before you set out on your collection trip, your boss gives you a report listing the current amounts of recyclables at the 9 recycling sites.  Your truck can carry only 2800 pounds of load.  Is it possible for you to plan a collection strategy with only three trips?  The answer is no!!  As the above says, there must be 3 of the sites having sum at least 3000 pounds of recyclables.  This is a very trivial example.  But it shows how the Pigeon Hole Principle can help you plan and schedule your solution to a problem.

 

Another application is the Hash Table!  A hash table is a common strategy used in computer programming to distribute items in a table for efficient access/retrieval.  If I know the number of objects, the number of hash table slots (buckets), then I will know whether there will be two objects in one slot, or three objects in one slot, and so on.  I can thus calculate the probability of such occurrences, and may trade-off accuracy for space.  That is, if I know there will be at most one such occurrence, then I may want to use a smaller hash table and ignore such an occurrence.  Then, I can also find out the appropriate size of the hash table slots (buckets).

 

These are optimization problems that one can see in all aspects of real world problems.  How to plan three shifts in a factory with 200 workers of different skills?  How to fit 4 different goods into 2 cargo spaces?  How to schedule 10 meetings among 16 people into a week?  How to manage limited power resources among 10 residential grids and 2 industrial grids?  How to design a communication network to support different types of loading scenarios?  (For example, if I have 6 routers in my network, and each can handle comfortably 500 phone calls in an hour, what if I have 1000 phone calls crowding one router, how should the router re-rout the calls?)