Counting - Computational Concepts in Biological Sciences - Lecture Note, Lecture notes of Computer Science

Main points of this lecture are: Counting and Probability, Notation, Experiments, Populations, Samples, Experiment Measures, Set of Possible Outcomes, Kinds of Probability, Uniform Distribution, Theoretical Probability, Simulating Dice

Typology: Lecture notes

2012/2013

Uploaded on 04/23/2013

ashwini
ashwini 🇮🇳

4.5

(18)

167 documents

1 / 28

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
First problem of homework
Monday, October 25 , 201 0
3:03 PM
Counting Page 1
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

Partial preview of the text

Download Counting - Computational Concepts in Biological Sciences - Lecture Note and more Lecture notes Computer Science in PDF only on Docsity!

First problem of homework Monday, October 25, 2010 3:03 PM Docsity.com

"How many" ways are there to do something? "How many" outcomes are there for an experiment? So far, we know about best case (O(f)) and worst case (Ω(f)) behavior. But we might want to know average case behavior. Average case behavior is a function of input. Key idea: what characterizes input? How can we describe it? Where we're going: Counting Friday, October 22, 2010 2:27 PM Docsity.com

Lemma: For a set of n elements, there are 2 n subsets. Sketch of proof: There are 2 options for each element: in or out. Apply the product rule n-1 times to get 2n options. Independence: whether x is in the subset doesn't determine whether y is in the subset. Example: subsets Friday, October 22, 2010 2:29 PM Docsity.com

The permutations of n (distinct) things are the number of ways they can be ordered. Lemma: There are n! = n(n-1)1 permutations of n distinct things.! = factorial Proof: Basis: n=1, 1 order possible(!). Order the first n things. before the first one in the middle after the last one Put the last thing either and there are n+1 options. Inductive step: Assume there are n! ways to order n things. Then for n+1 things, Thus for n+1 things there are (n+1)n! orders = (n+1)! Example: permutations Friday, October 22, 2010 2:30 PM Docsity.com

How many 8-character passwords can be made from both upper- and lower-case letters? A: there are 26+26=52 choices for each letter, and there are 8 slots, so there are 52 8 =53459728531456 options. Q: Why do people guess other peoples' passwords? A: there are a lot less 8-character words. Q: How do you pick a really good password? A: use a sentence, not a word! "to be or not to be" 2b||!2b Example: passwords Friday, October 22, 2010 2:35 PM Docsity.com

If one thing can be done in either n ways or m ways, and there are no overlaps between the two kinds of ways, then the total count of ways is n+m. The sum rule Friday, October 22, 2010 2:34 PM Docsity.com

For two sets of things A and B: |AUB| = |A|+|B|-|A∩B| The number of things in the union is the sum of the numbers of things in each set minus the number of things they have in common. In other words: |A|+|B| double counts the intersection. Inclusion/exclusion principle Friday, October 22, 2010 2:40 PM Docsity.com

How many 6-character passwords (from a-z and A-Z) are there that start with a capital letter or end with a capital letter? The number of passwords that start with a capital letter is 2652^5. The number of passwords that end with a capital letter is 2652^ The number of passwords that start and end with a capital letter is 26^2 52^4. Thus the number of passwords that start or end with a capital letter is 26 5

  • 26* 5
  • 26 2 * 4 = 4942652416

|A| + |B| - |A∩B|

Example: passwords Friday, October 22, 2010 2:44 PM Docsity.com

How many games can there be if two teams play "best two of three"? Tree example: playoffs Friday, October 22, 2010 3:02 PM Docsity.com

The most basic counting lemma: the pidgeonhole principle: Lemma: if there are n pidgeons and n+1 pidgeonholes, then at least one pidgeonhole contains more than one pidgeon. ○ n=1, one hole, two pidgeons, done. Inductive step: if n+1 pidgeons don’t fit into n pidgeonholes, add one hole and one pidgeon, and they still don't fit!)

(Sketch of proof by induction: Use: several common facts are corollaries. Counting proofs Friday, October 22, 2010 3:47 PM Docsity.com

In a group of 367 people, two must have the same birthday. 366 possible birthdays, including Feb 29! In a group of more than 10 people, two must have the same score on one of my assignments (0-10). In a group of 8 people, two were born on the same weekday! Examples: Friday, October 22, 2010 8:36 PM Docsity.com

If N objects are placed into k bins, there is at least one bin with at least N/k objects in it. x is the least integer greater than or equal to x (the ceiling of x) x is the greatest integer less than x (the floor of x) If there are 2n+1 things, and n pidgeonholes, then at least 3 have to share the same hole. The generalized pidgeonhole principle Friday, October 22, 2010 8:38 PM Docsity.com

In a group of 6 people, if each pair are either friends or enemies, there are at least three people who are either mutual friends or mutual enemies. In the first case, if 2 friends of A are themselves friends, then A and those two are mutual friends, else the 3 people who are friends of A are enemies amongst themselves. ○ In the second case, if 2 enemies of A are themselves enemies, then there are three mutual enemies, else the three people who are enemies of A are mutual friends! ○ Proof: Choose one person A. A has either 5/2 = 3 friends or 3 enemies Friends and enemies Friday, October 22, 2010 8:45 PM Docsity.com

An r-permutation of n elements is a sequence of r<=n elements. Lemma: there are P(n,r) = n!/(n-r)! r-permutations of n objects. The first element can be taken from n elements. The second element can be taken from n- 1 elements. …. The rth element can be taken from n-(r-1) elements These choices are independent. Thus the number of permutations is n(n-1)(n- (r-1)) = n(n-r+1) = n1/((n-r)(n-r-1)1 = n!/(n-r)! Sketch of proof: Permutations Friday, October 22, 2010 8:53 PM Docsity.com