Chapter 5 - Introduction to counting

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Count the number of different functions with the given domain, target and additional properties. f: {0,1}⁵ → {0,1}⁷. The function f is one-to-one.

A function is defined in terms of its output for every possible element in the domain. Start with 00000 and select the value for f(00000). There are 2⁷ possible choices because f(00000) can be any element from the target set {0,1}⁷. After f(00000) has been chosen, select the value for f(00001). There are 2⁷ - 1 possible choices for f(00001) because the output can be any element from the target set except the element that was chosen to be f(00000). Select the value of f(x) for each x ∈ {0,1}⁵ in such a way that there are no repetitions. Since there are 2⁵ elements selected from a set of size 2⁷ with no repetitions, the total number of ways to select the output values for f is P(2⁷, 2⁵). The number of one-to-one functions whose domain is {0,1}⁵ and whose target set is {0,1}⁷ is P(2⁷, 2⁵).

What are the two rules of counting?

Sum and Product rule

What is a permutation without the parameter r?

a sequence that contains each element of a finite set exactly once. For example, the set {a, b, c} has six permutations:

License plate numbers in a certain state consists of seven characters. The first character is a digit (0 through 9). The next four characters are capital letters (A through Z) and the last two characters are digits. Therefore, a license plate number in this state can be any string of the form: (a) How many different license plate numbers are possible? (b) How many license plate numbers are possible if no digit appears more than once? (c) How many license plate numbers are possible if no digit or letter appears more than once?

(a) 10³⋅26⁴. There are 10 ways to fill in each of the digit locations and 26 ways to fill in each of the letter locations. Using the product rule, there are 10³⋅26⁴ ways to fill in all seven locations. (b) 10⋅9⋅8⋅26⁴. There are 10⋅9⋅8 ways to fill in the digit locations with no repetitions. There are 26 ways to fill in each of the letter locations. Using the product rule, there are 10⋅9⋅8⋅26⁴ ways to fill in all seven locations with no repeated digits. (c) 10⋅9⋅8⋅26⋅25⋅24⋅23 There are 10⋅9⋅8 ways to fill in the digit locations with no repetitions. There are 26⋅25⋅24⋅23ways to fill in the letter locations with no repetitions. Using the product rule, there are 10⋅9⋅8⋅26⋅25⋅24⋅23 ways to fill in all seven locations with no repeated digits or letters.

Ten members of a club are lining up in a row for a photograph. The club has one president, one VP, one secretary, and one treasurer. (a) How many ways are there to line up the ten people? (b) How many ways are there to line up the ten people if the VP must be beside the president in the photo? (c) How many ways are there to line up the ten people if the president must be next to the secretary and the VP must be next to the treasurer?

(a) A line-up of the ten people is just a permutation of ten distinct items/people. There are 10! ways to order ten people. (b) Decide whether the VP is to the left or the right of the president (two choices). Now, for each choice, find an ordering of the 9 items, where the 9 items consist of the 8 people in the club besides the president and VP and the unit consisting of the president and VP stuck together. There are 9! ways to permute 9 distinct items. Therefore the number of ways to line up the ten people so that the VP is beside the president is 2·9! (c) Decide whether the president is to the left or the right of the secretary (two choices). Once that decision is made, the president and secretary will be stuck together. Decide whether the VP is to the left or the right of the treasurer (two choices). Once that decision is made, the VP and treasurer will be stuck together. Now find an ordering of the 8 items, where the 8 items consist of the president/secretary unit, the VP/treasurer unit and the other 6 members of the club. There are 8! ways to permute 8 distinct items. Therefore the number of ways to line up the ten people with the president next to the secretary and the VP next to the treasurer is 2·2·8!.

At a certain university in the U.S., all phone numbers are 7-digits long and start with either 824 or 825. (a) How many different phone numbers are possible? (b) How many different phone numbers are there in which the last four digits are all different?

(a) There are two choices for the first three digits (824 or 825). Each of the remaining 4 digits can be any one of the ten digits, so there are 10⁴ ways to pick the last four digits. The total number of 7-digit phone numbers that start with 824 or 825 is 2·10⁴. (b) There are two choices for the first three digits (824 or 825). In selecting the remaining 4 digits, 4 digits are selected from a set of 10 with no repetitions, so there are P(10, 4) choices. The total number of 7-digit phone numbers that start with 824 or 825 and have no repeated digits among the last four digits is 2·P(10, 4).

In the following question, a club with 10 students elects a president, vice president, secretary and treasurer. No student can hold more than one position. How many ways are there to select the class officers?

10 choices for Pres. After Pres chosen, 9 choices for VP. After Pres, VP chosen, 8 choices for Treasurer. After Pres, VP, Treasurer chosen, 7 choices for Sec. 10 × 9 × 8 × 7 = 504

A class has ten students. A teacher will give out three prizes: One student gets a gift card, one gets a book, and one gets a movie ticket. No student can receive more than one prize. How many ways can the teacher distribute the prizes?

10 students to select from for the first prize. Once the first prize has been given, there are 9 students to select from for the second prize, and then 8 students to select from for the third prize. P(10, 3) = 10 · 9 · 8 = 720

A manager must select three coders from her group to write three different software projects. There are 7 junior and 3 senior coders in her group. The first project can be written by any of the coders. The second project must be written by a senior person and the third project must be written by a junior person. How many ways are there for her to assign the three coders to the projects if no person can be assigned to more than one project?

3·7·8 First select the senior person for the second project. There are three choices. Then select the junior person for the third project. There are seven choices. The first project can be written by anyone except for the two people chosen for the second and third projects, so there are eight choices. Since the number of choices for each selection is independent of the selections already made, the number of choices can be combined using the generalized product rule.

Each character in a password is either a digit [0-9] or lowercase letter [a-z]. How many valid passwords are there with length 20. No character repeats.Must contain: g, 2, 4, and 3.

4 already chosen characters with 20 possible positions: P(20, 4)Then, permute 16 from 32 characters: P(32, 16) Finally, combine: P(20, 4) * P(32, 16)

There are 5 computers and 3 students. How many ways are there for the students to sit at the computers if no computer has more than one student and each student is seated at a computer?

5 possible computers for the first student. Once the first student has chosen, there are 4 computers left for the second student to select from, and then 3 possible computer choices for the third student. P(5, 3) = 5 × 4 × 3 = 60

Again suppose that there are five ninth graders and five tenth graders in the club. How many ways are there to elect the officers if the president is a tenth grader and the VP is a ninth grader?

5 tenth graders to choose from for Pres.5 ninth graders to choose from for VP.After Pres, VP chosen, 8 choices for Treas.After Pres, VP, Treas chosen, 7 choices for Sec. 5 × 5 × 8 × 7 = 1400

Now suppose that there are five ninth graders and five tenth graders in the club. How many ways are there to elect the officers if the president is a tenth grader?

5 tenth graders to choose from for Pres.After Pres chosen, 9 choices for VP.After Pres, VP chosen, 8 choices for Treas.After Pres, VP, Treas chosen, 7 choices for Sec. 5 × 9 × 8 × 7 = 2520

A red, blue, and green die are thrown. Each die has six possible outcomes. How many outcomes are possible in which the three dice all show different numbers?

6 possible outcomes for the red die. Since the blue die must be different from the red die, 5 possibilities for the blue die. Since the green die must be different from the red and blue dice, 4 possibilities for the green die. P(6, 3) = 6 × 5 × 4 = 120

Count the number of different functions with the given domain, target and additional properties. f: {0,1}⁵ → {0,1}⁷

A function is defined in terms of its output for every possible element in the domain. For a given x ∈ {0,1}⁵, f(x) can be any element from the target set {0,1}⁷. Therefore there are |{0,1}⁷| = 2⁷ choices for f(x). The output must be chosen for each element x in the domain and the choices are put together by the product rule. There are 2⁵ elements in the domain, so the number of functions whose domain is {0,1}⁵ and whose target set is {0,1}⁷ is

Count the number of different functions with the given domain, target and additional properties. f: {0,1}⁷ → {0,1}⁷

A function is defined in terms of its output for every possible element in the domain. For a given x ∈ {0,1}⁷, f(x) can be any element from the target set {0,1}⁷. Therefore there are |{0,1}⁷| = 2⁷ choices for f(x). The output must be chosen for each element x in the domain and the choices are put together by the product rule. There are 2⁷ elements in the domain, so the number of functions whose domain and target sets are both {0,1}⁷ is: (2⁷)²^⁷

Count the number of different functions with the given domain, target and additional properties. f: {0,1}⁷ → {0,1}⁷. The function is one-to-one

A function is defined in terms of its output for every possible element in the domain. Start with 0000000 and select the value for f(0000000). There are 2⁷ possible choices because f(0000000) can be any element from the target set {0,1}⁷. After f(0000000) has been chosen, select the value for f(0000001). There are 2⁷ - 1 possible choices for f(0000001) because the output can be any element from the target set except the element that was chosen to be f(0000000). Select the value of f(x) for each x ∈ {0,1}⁷ in such a way that there are no repetitions. There are 2⁷ elements selected from a set of size 2⁷ with no repetitions. Therefore the number of one-to-one functions whose domain and target sets are both {0,1}⁷ is (2⁷)!

A wedding party consisting of a bride, a groom, two bridesmaids, and two groomsmen line up for a photo. How many ways are there for the wedding party to line up?

A line-up of the wedding party is a permutation of the six people in the group, so the number of different line-ups is: 6! = 720

How many six bits strings are there that begin and end with a 1, or start with 00?

Begin and end with 1 (1****1): 1 · 2 · 2 · 2 · 2 · 1 = 2⁴ Start with 00 (00****): 1 · 1 · 2 · 2 · 2 · 2 = 2⁴ A string can not start with 0 and 1, so the sets are disjoint. Apply the sum rule: The number of strings that begin and end with 1 OR start with 00 is 2⁴ + 2⁴ = 16 + 16 = 32.

The sum rule

Consider n sets, A₁, A₂,...,An. If the sets are mutually disjoint (which means that Ai ∩ Aj = ∅ for i ≠ j), then |A₁ ∪ A₂ ∪ ... ∪ An| = |A₁| + |A₂| + ... + |An| It is the intuitive idea that if we have A number of ways of doing something and B number of ways of doing another thing and we can not do both at the same time, then there are A + B ways to choose one of the actions.

If x is a string, then xᴿ is the reverse of the string. For example, if x = 1011, then xᴿ = 1101. A string is a palindrome if the string is the same backwards and forwards (i.e., if x = xᴿ). Let B = {0, 1}. The set Bⁿ is the set of all n-bit strings. Let Pn be the set of all strings in Bⁿ that are palindromes. Show a bijection between P₆ and B³ What is |P₆|?

Define the function f: P₆ → B³ such that if x ∈ P₆, then f(x) is obtained by dropping the last three bits of x. For example f(011110) = 011. Notice that if x ∈ P₆, then the first and sixth bits of x are the same, the second and fifth bits of x are the same, and the third and fourth bits of x are the same, so x = b₁b₂b₃b₃b₂b₁, where each bi = 0 or 1. f is onto, because for any y ∈ B³, yyᴿ is a palindrome and f(yyᴿ) = y. f is one-to-one because for x and y ∈ P₆, if f(x) = f(y), then x and y have the same first three bits. Since the last three bits of a palindrome of length 6 are determined by the first three bits, then x and y must be equal. |P₆| = |B³| = 2³

Each character in a password is either a digit [0-9] or lowercase letter [a-z]. How many valid passwords are there when the length is 8 or 14?

Each character has 36 possibilities: A₈ U A₁₄ = 36⁸ + 36¹⁴

Counting One-to-One Functions: How many one-to-one functions are there from a set with m elements to one with n elements?

First note that when m > n there are no one-to-one functions from a set with m elements to a set with n elements. Now let m ≤ n. Suppose the elements in the domain are a₁, a₂,..., am. There are n ways to choose the value of the function at a₁. Because the function is one-to-one, the value of the function at a₂ can be picked in n − 1 ways (because the value used for a₁ cannot be used again). In general, the value of the function at ak can be chosen in n − k + 1 ways. By the product rule, there are n(n − 1)(n − 2)⋯(n − m + 1) one-to-one functions from a set with m elements to one with n elements. For example, there are 5 ⋅ 4 ⋅ 3 = 60 one-to-one functions from a set with three elements to a set with five elements.

Recall that function f: S→T is a bijection only if ______________?

If it has a well-defined inverse

How many strings of length five or six start with a 1?

Length 5 start with a 1 (1****): 1 · 2 · 2 · 2 · 2 = 2⁴ Length 6 start with a 1 (1*****): 1 · 2 · 2 · 2 · 2 · 2 = 2⁵. A string can not have length 5 and length 6. Apply the sum rule: The number of strings that have length 5 or 6 and begin with a 1 is 2⁴ + 2⁵ = 16 + 32 = 48.

Each character in a password is either a digit [0-9] or lowercase letter [a-z]. How many valid passwords are there with length 7. Must contain: n, f, w, l, h, z, and t

Permute 7 from 7 characters: P(7, 7).

product rule

Provides a way to count the total possible number of sequences by taking the cardinality of each individual set and multiplying it to get the total possible number of outcomes. it is the intuitive idea that if there are a ways of doing something and b ways of doing another thing, then there are a · b ways of performing both actions.

Each character in a password is either a digit [0-9] or lowercase letter [a-z]. How many valid passwords are there with length 13. No character repeats. Starts with: t

Since t is first character and there are no repeats, your alphabet shrinks to 35 and your length is now 12. Choose other 12 from 35 characters: P(35, 12)

How many 6 bit binary strings are there that begin w/ "01"?

Since the first two digits are defined, the product rule starts with listing the cardinality of the problems as follows: |{0} • {1} • {0, 1}⁴ | = |{0}| • |{1}| • |{0, 1}⁴| = 1 • 1 • 2 • 2 • 2 • 2 = 16

A wedding party consisting of a bride, a groom, two bridesmaids, and two groomsmen line up for a photo. How many ways are there for the wedding party to line up so that the bride is next to the groom?

Since you have to decide whether the bride is to the left or right of the groom you have 2 choices here. Count the bride and groom as one so you then have five factorial with the other people. Here is a combination of the permutations with the product rule. By the product rule, the number of line-ups with the bride next to the groom is: 2 · 5! = 240

Counting Functions: How many functions are there from a set with m elements to a set with n elements?

Solution: A function corresponds to a choice of one of the n elements in the codomain/target for each of the m elements in the domain. Hence, by the product rule there are n ⋅ n⋅ ⋯ ⋅ n = nᵐ functions from a set with m elements to one with n elements. For example, for a set with three elements to a set with five elements there are 5³ = 125 different functions from the 3-element set to the 5-element set

k-to-1 rule

Take a bijection which has a 1-to-1 correspondence...meaning for every element in the domain, there is one and only one element mapped in the target. K=1 in this instance. Take a pair of shoes. This is a 2-to-1 correspondence since one person has a pair of shoes. The limbs on a human body would have a k=4 correspondence. A six-pack would have k=6 for every one pack. Suppose there is a k-to-1 correspondence from a finite set A to a finite set B. Then |B| = |A|/k.

Each character in a password is either a digit [0-9] or lowercase letter [a-z]. How many valid passwords are there when the length is 18 and cannot start with a digit?

The first character only has 26 possibilities. Therefore the answer equals: 26 * 36¹⁷

∑ can be used to represent a set of characters - called an alphabet. ∑^n would represent what?

The set of all strings of length n whose characters come from set ∑. For example if ∑ = { 0, 1 }, then ∑⁶ is the set of all binary strings w/ 6 bits |∑^n| = | ∑ * ∑ * ... * ∑ | = |∑| * |∑| *** |∑| = |∑|^n

Each character in a password is either a digit [0-9] or lowercase letter [a-z]. How many valid passwords are there for length 9 password?

There are 26 letter characters and 10 digit characters for a total alphabet of 36. For a length 9 password, there are 36·36·36·36·36·36·36·36·36 or 36⁹ possible password combinations.

How many strings are there over the set {a, b, c} that have length 10 in which no two consecutive characters are the same? For example, the string "abcbcbabcb" would count and the strings "abbbcbabcb" and "aacbcbabcb" would not count.

There are three choices for the first character. There are two choices in selecting each of the next 9 characters from left to right because each character can be any element from the set {a, b, c}, except the one that was chosen to be the previous character. Putting together all the choices by the generalized product rule, the number of strings of length 10 that do not have two consecutive characters that are the same is 3·2⁹.

A girl scout troop with 10 girl scouts and 2 leaders goes on a hike. When the path narrows, they must walk in single file with a leader at the front and a leader at the back. How many ways are there for the entire troop (including the scouts and the leaders) to line up?

There are two ways to select which leader will go in the front. There are 10! ways to order the 10 scouts in the middle. Once those decisions are made, the leader who goes last is determined. Therefore there are 2 · 10! ways to line up the entire troop.

How many strings of length 4 are there over the alphabet {a, b, c}?

To make strings of length 4 with this set, you would make it {a, b, c}⁴ which equals 3⁴ which equals 81

Let X = {1, 2, 3, 4}. Define the function f from P(X) to {0, 1}⁴. 1. What is f({1,4})? 2. Which element is not in f⁻¹(1101)? 3. How many elements are in the set f⁻¹(0000)?

To map this you take a 4 bit binary string (0000) to represent set X where the number 0 represents that an element is not present and 1 represents an element that is present. f({1, 4}) = 1001 f⁻¹(1101) = element 3 is missing f⁻¹(0000) = this is the empty set ∅

Each character in a password is either a digit [0-9] or lowercase letter [a-z]. How many valid passwords are there with length 16. No character repeats. Must contain: n

We have to consider that we will not know what position in the password the n is in. Therefore, our first permutation will be length 16 and 1 character from our alphabet - P(16, 1). Then, you're left with length 15 from the 35 remaining characters: P(35,15) Finally, combine: P(16, 1) * P(35, 15)

Each character in a password is either a digit [0-9] or lowercase letter [a-z]. How many valid passwords are there with a length of 11 and no character repeating?

With 10 digits and 26 characters, the alphabet total is 36. A password of length 11 with an alphabet of 36 with no repeats means that after one password entry, you will have 35 choices, then 34 until you get to length 11. This means we want 11-permutations from a set with 36 elements. To permute 11 from 36 characters: P(36, 11)

Recall what is the inverse of a function.

f: S→T is an inverse only if g:T→S where for every s element and for every t element f(s) = t if and only if g(t) = s

bijection rule

if there is a bijection from one set to another then the two sets have the same cardinality

Counting

involves counting the number of elements or the cardinality of a finite set given the description of the set

What is the total number of permutations of a finite set with n elements?

n! P(n, n) = n⋅(n-1)⋅...⋅2⋅1 = n!

The number of r-permutations from a set with n elements where r and n are positive integers with r ≤ n. The number of r-permutations from a set with n elements is denoted by P(n, r) and can be described with the following formula:

n(n-1)...(n-r+1)

When solving word problems with the product and sum rule, what are the keywords to look for for each?

product rule - and sum rule - or

How many 6 bit binary strings are there?

| {0, 1}⁶ | = 2x2x2x2x2x2 = 2⁶ = 64

What is the number of possible breakfast combinations of the below sets: D (drink) = { coffee, oj } M(main course) = { pancakes, eggs } S(side) = { bacon, sausage, hash browns }

|DxMxS| = |D| x |M| x |S| = 2x2x3 = 12

How many strings of length 4 are there over the alphabet {a, b, c} that end with the character c?

|{a, b, c}³ × {c}| = |{a, b, c}|³ · |{c}| = 3³ · 1 = 27


संबंधित स्टडी सेट्स

Chapter 7 beliefs goals and needs

View Set

Unit Test Review - COMBUSTION: PART 1

View Set

Ap Environmental Science: Sustainability

View Set

Western Civilization I CLEP Exam (ANSWERS)

View Set

Graphing Functions and Equations

View Set

Agency, Employment, Employment Discrimination L201 Unit 4 (heavily tested on final exam)

View Set