Download Test 3 review answers

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Georg Cantor's first set theory article wikipedia , lookup

Ethnomathematics wikipedia , lookup

Mathematics of radio engineering wikipedia , lookup

Location arithmetic wikipedia , lookup

Positional notation wikipedia , lookup

Elementary arithmetic wikipedia , lookup

Real number wikipedia , lookup

Collatz conjecture wikipedia , lookup

Large numbers wikipedia , lookup

Addition wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Order theory wikipedia , lookup

Elementary mathematics wikipedia , lookup

Transcript
Test 3 review answers
Fall 2014
1. Prove or disprove that if R is a transitive relation on set A, then R' is also transitive.
Not true, here’s a counterexample:
Let A = {a, b, c} and let R = {(a, b)}. Clearly R is transitive since it contains only one
element. Then ordered pairs (a, c) and (c, b) are in R'. If R' were transitive then
(a, b) would have to be in R' which is not possible since it’s in R.
2. Find the smallest partial order on {a, b, c} that contains {(b, b), (b, a), (a, c)}.
Since a partial order must be reflexive, the ordered pairs (a, a) and (c, c) must be
added to the relation. Since the antisymmetric property wont’ require the inclusion
of any extra ordered pairs, we must make sure the transitive property holds, and
this is done by including the ordered pair (b, c). Thus the partial order is the
following:
{(a, a), (b, b), (c, c), (b, a), (a, c), (b, c)}
3. Let R be the relation { (m, n) m and are integers and m + n is even}.
Prove that R is an equivalence relation.
reflexive: Let a  Z+. Since a + a = 2a, an even number, (a, a)  R so R is reflexive.
symmetric: Suppose (a, b)  R. Then a + b =2k. But, this means that b + a = 2k as
well, so (b, a)  R and thus R is symmetric.
transitive: Suppose (a, b)  R and (b, c)  R. Then, a + b = 2k and b + c = 2j for
some integers k and j. Then adding the two equations we get a + c + 2b
= 2k + 2j or a + c = 2(k + j – b). Since the right hand side of the equation
is even, (a, c)  R and thus R is transitive.
Therefore R is an equivalence relation since it is reflexive, symmetric, and transitive.
4. Consider the following three relations. For each relation, place its number in the blank to
the left of each property it satisfies.
Relation 1: R = {(a, b) N  N | a + b is even}
Relation 2: R = {(a, b) | a, b  Z and |a - b|  1}
Relation 3: R = 
____1, 2_____ Reflexive ___1, 2, 3_____ Symmetric __1, 3_______ Transitive
______3_____ Irreflexive ______3_____ Antisymmetric ____3_______ Asymmetric
5. If possible, give an example of a relation R on S = {a, b, c} with exactly 3 elements that is
both symmetric and transitive but not reflexive. If it’s not possible, explain why not.
This is not possible. Since it can’t be reflexive and must have three pairs then there
must be a pair in which the two elements are not the same. Suppose that (a, b) R.
Then symmetry means (b, a)  R and transitivity means that both (a, a) and (b, b)
must be in R also. Thus, the smallest relation satisfying those conditions has four
ordered pairs.
6. An ice cream parlor offers 6 toppings for its sundaes. A customer can choose as many or
as few of the toppings as desired. If you eat one sundae each Sunday, how many
Sundays will it take to try each topping combination. (At least one topping must be used.)
The order in which the toppings are put on the sundae doesn’t matter.
26 – 1 (Number of nonempty subsets of the set of toppings)
7. Using the standard alphabet and allowing repetition of letters, find the number of words of
length 8 that are palindromes. 264
8. If C(n, 8) = C(n, 5) then n = ____13_________
9. Consider the set of bit strings of length 10. How many
a. contain exactly three 0's? C(10, 3)
b. begin or end with 0 29 + 29 – 28 or 210 - 28
c. contain at least two 0's?
210  11 (Total number  no 0's  exactly one 0)
10. How many three-digit numbers are there in which the sum of the digits is even?
450—first note there are 900 three digit numbers. Let’s look at them in blocks of
10. For example, 100 – 109, 110 – 119, etc. Notice that no matter what the first two
digits are, the last digit will determine whether the sum is odd or even. Since five
of the digits from 0 – 9 will make the sum even and half will make it odd, then ½ of
the three-digit numbers or 450 numbers have even sums.
11. A group of n men and n women are arranged in a row. The number of arrangements with
a. the men and women in any order is __(2n)!_____
b. the men and women in alternate places is
2·n!·n! (The 2 is to determine if first chair contains a man or a woman.)
c. The men occupying n consecutive seats (n+1)•n!•n!
n+1 chairs the first man could sit in, n! arrangements for men, n! arrangements for women
12. Consider the set {1, 2, …, 12}.
a. How many subsets contain only even numbers? 26 - 1
b. How many subsets contain 3 and 5 but not 7? 29
c. How many subsets of size 6 contain at least two odd numbers?
Total number – no odd numbers –exactly 1 odd number
C(12, 6) - 1 - 6C(6, 5)
d. In how many 6-element subsets of S is 3 the smallest element? C(9, 5)
13. A coin is tossed eight times. An outcome is string of length 8 made up of T and H.
a. How many outcomes have a head on the fifth toss?
27
b. How many outcomes have equal numbers of heads and tails? C(8, 4)—since there
must be equal numbers of each, you just have to choose the positions for the
heads.
Since the heads are indistinguishable combinations rather than
permutations are needed.
14. A class contains 30 students--10 freshmen, 12 sophomores and 8 juniors.
a. How many 3-member committees contain exactly one person from each class? 10•12•8
b. How many 4-member committees contain at least one person from each class?
2 freshmen + 2 sophomores + 2 juniors
C(10, 2)•12•8 + C(12, 2)•10•8 + C(8, 2)•10•12
c. How many ways to arrange the students in a line so that all the freshmen are together at
the front of the line? 10! x 20!
d. How many ways are there to arrange the students if all students from the same class
stand together? 3!•10!•12!•8!
15. Consider 5-card hands selected from a deck of 52 cards. How many hands
a. contain no face cards (Aces are not face cards)? C(40, 5)
b. contain only face cards? C(12, 5)
c. contain three cards of one suit and one each of two other suits?
4•C(13, 3)•C(3, 2)•C(13, 1)•C(13,1)
d. contain exactly two queens and exactly three spades?
We need to consider whether the queen of spades is one of the queens
with queen of spades + without queen of spades
C(3,1)•C(12,2)•36
+ C(3, 2)•C(12, 3)
16. Matching exactly three white balls in the powerball lottery wins a prize. How many
powerball tickets are there for which exactly three white balls (and not the powerball) are
matched?
On any ticket 5 numbers corresponding to white balls and one corresponding to
the powerball must be chosen. This means that for a ticket to win in this way
exactly three correct and two incorrect white numbers must be chosen as well as
an incorrect powerball number. So, the number of ways to correctly choose 3 of
the 5 winning numbers is C(5, 3). Of the 54 nonwinning numbers, two losing
numbers must be picked. This can be done in C(54, 2) ways. Finally, there are 35
ways to choose an incorrect powerball so the total number of tickets satisfying
these conditions is the product of those values: C(5, 3)•C(54, 2)•35.
17. Write a pseudocode algorithm that returns the index of the first item that is greater than its
predecessor in the array[a1, a2, ..an]. Output 0 if the numbers are in nonincreasing order.
Give the number of comparisons made in the best and worst cases. Note: other
answers are possible. Just be careful to check all the exceptional cases.
int i  1
int bigger  0
while (i < n and ai  ai+1)
ii+1
if i < n then bigger  i+1
return(bigger)
First, a couple of comments. In the while loop, the i < n test is necessary to ensure
there are list items remaining. If we drop out of the while loop on the first condition it
means that the list is in nonincreasing order. If a number greater than its predecessor
is found, we drop out of the while loop and at that point ai < ai+1 so we want to return
i+1, the index of the first item greater than its predecessor.
Best case: a2 > a1 so the number of comparisons is 3—two in the while
loop and one in the if statement.
Worst case: the list is in nonincreasing order. The number of comparisons
is then 2(n-1) + 1 + 1 = 2n because there are two comparisons each time
through the while loop plus one more (when i = n) to drop out of the loop
and one in the if statement.
18. Always, Sometimes or Never: If f(x)  O(g(x)) then f(x)  (g(x)).
Sometimes. Big-O is an upper bound, not an exact bound. So, for example, if f(x) =
2x + 5 then f(x)  O(x2)) but it is (x)
19. Using the definition of big-O prove or disprove that f(x)  O(g(x)) where f(x) = 3x2 + 5x and
g(x) = 7x
Assume that f(x)  O(g(x). Then there are constants C and N0 such that
3x2 + 5x  C(7x)  x  N0. This means that 3x2  C(7x) or x2  (C/3)(7x).
Then, x2/(7x)  C or x/7  C Let M = max{C, N0} and consider what happens when
x = 7M + 1. Then, x/7 = (7M + 1)/7 = M + 1/7 < C. Since M  C this is a contradiction
so the assumption that f(x)  O(g(x)) is false so f(x)  O(g(x)).