230 likes | 396 Views
CSCI 115. Chapter 3 Counting. CSCI 115. §3 .1 Permutations. §3 .1 – Permutations. Theorem 3.1.1 – Multiplication Principle of Counting
E N D
CSCI 115 Chapter 3 Counting
CSCI 115 §3.1 Permutations
§3.1 – Permutations • Theorem 3.1.1 – Multiplication Principle of Counting • Suppose 2 tasks t1 and t2 are to be performed in sequence. If t1 can be performed in n1 ways, and t2 can be performed in n2 ways, then the sequence of tasks t1t2 can be performed in n1n2 ways.
§3.1 – Permutations • Theorem 3.1.2 • Suppose tasks t1, t2, …, tk are to be performed in sequence. If t1 can be performed in n1 ways, t2 can be performed in n2 ways and so on, then the sequence of tasks t1t2…tk can be performed in n1n2…nk ways.
§3.1 – Permutations • Consider the following problem: • How many different sequences, each of length r, can be formed from the elements of a set A if: • Elements can be repeated • Elements in the sequence must be distinct • Number of permutations of n objects taken r at a time
§3.1 – Permutations • Theorem 3.1.3 • Let A be a set with n elements, r Z+, with 1 r n. The number of sequences of length r that can be formed from elements of A, allowing repetitions, is nr.
§3.1 – Permutations • Theorem 3.1.4 • Let A be a set with n elements, r Z+, with 1 r n. The number of permutations of n objects taken r at a time is:n.(n – 1).(n – 2)...(n – (r – 1)) and is denoted nPr. • Equivalently: n! . (n – r)! • Factorials
CSCI 115 §3.2 Combinations
§3.2 – Combinations • Consider the following problem: • Let A be any set with n elements, 1 r n, r Z+. How many different subsets of r elements are there? • Number of combinations of n objects taken r at a time
§3.2 – Combinations • Theorem 3.2.1 • Let A be a set with |A| = n. Let r Z+ with 1 r n. The number of combinations of n objects taken r at a time is n! . r!(n – r)!and is denoted nCr.
CSCI 115 §3.4 Elements of Probability
§3.4 – Elements of Probability • Deterministic Experiment • Outcome should not change • Finding acceleration due to gravity • Probabilistic Experiment • Outcome can change • Rolling a die and recording the outcome • We will be discussing probabilistic experiments
§3.4 – Elements of Probability • Sample space • Event • Subset of sample space • Certain event • Impossible Event • Mutually exclusive events
§3.4 – Elements of Probability • Notation - Assigning probabilities to events • P(E) • Frequency • If you have n experiments and E occurs nE times, then: • fE = nE/n is the Frequency of occurrence of E in n trials • fE P(E) as n
§3.4 – Elements of Probability • Probability Spaces • Axioms for a probability space A: • P1: 0 P(E) 1 E A • P2: P(A) = 1 and P() = 0 • P3: If E1, E2, …, Ek are all mutually exclusive, then:P(E1 E2 … Ek) = P(E1) + P(E2) + … + P(Ek)
§3.4 – Elements of Probability • Probability Spaces • Elementary Events (xi) • Elementary Probability (Pi = P({xi})) • All the xi are mutually exclusive, and we have: • EP1: 0 Pi 1 • EP2: P1 + P2 + … + Pn = 1
§3.4 – Elements of Probability • Equally likely outcomes • |A| = n, and all elementary events are equally likely, then:If E = {x1, x2, …, xk} then P(E) = k/nor P(E) = |E|/|A|
§3.4 – Elements of Probability • Expected value • Sum of the value of each outcome times its probability • A way to calculate the ‘average’ value
CSCI 115 §3.5 Recurrence Relations
§3.5 – Recurrence Relations • Recall sequences • Recursive • Explicit • Recurrence relation • When an equivalent explicit formula is needed, the recursive formula is called a recurrence relation
§3.5 – Recurrence Relations • Backtracking • ‘Track’ the equation ‘back’ to an explicit formula • Does not always work
§3.5 – Recurrence Relations • Linear Homogeneity • A recurrence relation is linearly homogenous of degree k if: • an = r1an-1 + r2an-2 + … + rkan-k • ri is constant i • A recurrence relation that is linearly homogenous of degree k has the following characteristic equation: • xk = r1xk-1 + r2xk-2 + … + rk • The characteristic equation plays a role in determining the explicit formula
§3.5 – Recurrence Relations • Theorem 3.5.1 • If the characteristic equation x2 – r1x – r2 = 0 of the recurrence relation an = r1an-1 + r2an-2 has 2 distinct roots s1 and s2, then an = us1n + vs2n (where u and v depend on initial conditions) is the explicit formula for the sequence. • If the characteristic equation x2 – r1x – r2 = 0 of the recurrence relation an = r1an-1 + r2an-2 has a single root s, then an = usn + vnsn (where u and v depend on initial conditions) is the explicit formula for the sequence.