Sei sulla pagina 1di 7

CS 261 Homework 1 Solutions:

1a. Let A be the set of people who speak English and B be the set of people who speak English
with an Australian accent. B is a subset of A.
1b. Let A be the set of fruits and B be the set of citrus fruits. B is a subset of A.
1c. Let A be the set of students studying discrete math and B be the set of students studying
data structures. A is not a subset of B nor is B a subset of A. There could be students studying
discrete math but not data structures (e.g. math majors) or there could be computer science
students studying data structures who havent yet taken a formal class in discrete mathematics.
2a. true
2b. false
2c. true
2d. true
3. Suppose A, B and C are sets such that Show that .
Proof: implies that if then . similarly implies that if y is an element
of B then it must be an element of C. Thus it follows that if x belongs A, then it must belong to B
which in turn belongs to C giving the result .
4. Can you include that A = B if A and B are two sets with the same power set? Yes.
Proof #1 (Proof by Contradiction): Suppose not. Suppose that there exist sets A and B that have
the same power set but are not equal as sets. This implies that either A has an element that is
not in B or B has an element that is not in A. Assume the former case (can argue symmetrically
in the latter case). Let x be an element of A that is not in B. implies that {} .
Since it follows that {} . However, this contradicts the assumption that P(A) = P(B).
Thus it must be the case that A = B.
Proof #2 (Direct Proof):
Case 1: A and B are finite: Since A is finite its power set P(A) must be finite. We can express
P(A) in the form {A
1
, A
2
,., A
n
} where each A
i
represents a subset of the set A. P(B) can similarly
be expressed as {B
1
, B
2
,., B
n}
where each B
j
represents a subset of B. Note that both P(B) and
P(A) have the same cardinality since they are equal. Since P(A) = P(B) it is the case that each A
i
corresponds to exactly one B
j
in P(B). It follows that

. The leftmost union is


equal to the set A while the right equals the set B, implying that A = B.
Case 2: A and B are both infinite: The argument follows the same as in case 1. The only
difference is that the unions will be taken over infinite numbers of subsets.
5. Show that if and then .
Proof: implies that for each element a in A there exists an element c in C such that a = c.
Similarly implies that for each element b in B there exists an element d in D such that b =
d. It follows that if (a,b) is an element of then there is a corresponding element (c,d) in
. This implies that .
6. Are and the same? Explain why. No the two sets are not the same.
The former is the set of all triples (a,b,c) where a is an element of A, b an element of B and c an
element of C. in contrast is the set of all ((a,b),c) where the former element in the
pair is itself a pair of elements (a,b).
7. Let A = {a,b,c,d,e} and B = {a,b,c,d,e,f,g}. Find:
a) = {a,b,c,d,e,f,g} = B
b) = {a,b,c,d,e} = A
c) = {} (i.e. the empty set)
d) = {f,g,h}
8. Show that if A and B are sets then .
Proof: , it follows that .
9. Find the sets A and B if = {1,5,7,8}, = {2,10} and = {3,6,9}.
Answer: A = {1,5,7,8,3,6,9} and B = {2,10,3,6,9}. The key here is remembering that

10. Let A and B be sets. Show that = and {} (i.e. the empty
set).
Proof: The former follows since making the left hand side
. This is exactly . {} follows by the definition as is
the set of elements of B that do not belong to A.
11. Show that if A, B and C are sets, then is equal to
Proof: We know from De Morgans Law that for two sets A and B . Let D =
. This makes = . Applying De Morgans Law we get which is equal
to . Applying De Morgans Law a second time to gives us our result for 3 sets.
12. Show that if A and B are sets then:
a) . Proof: By definition consists of all elements of A that dont belong to
B. This implies that if x is an element of then it must belong to A while at the same time
not being in B (i.e. x is in A and the complement of B). This implies the above equivalence.
b) . Proof: Part a allows us to rewrite the left hand side of the equation
as . This is exactly the set A.
13. Let A, B and C be sets. Does ? Explain why.
Answer: Both sets are equal. Its probably simplest to see through the following Venn Diagram
which represents both sides of the above equation.

14. Draw the Venn diagrams for each of these combinations of the sets A, B and C.
a)

b)

c)

15. Can you conclude that A = B if A, B and C are sets such that:
a) . No. For instance you could have A = {1,2,3}, B = {1,2,3,4}, and C = {4,5}. The
unions of A and B with C are both equal to the set {1,2,3,4,5}, but A is not equal to B.
b) . No. For instance you could have A = {1,2,3}, B = {1,2,4} and C = {1,2}. The
equation holds but clearly A and B are not equal as sets.
c) . Yes.
16. Show that . Answer: This follows after rewriting as
. Taking the difference of this set and gives the union of
and which is precisely the symmetric difference of A and B (i.e. it is the set of
all elements that belong to A or B but not both).
17. Determine whether the symmetric difference is associative; that is, if A, B and C are sets,
does it follow that . Explain why. Solution: The simplest way to see
that this equation is in fact true (i.e. that symmetric difference is associative), is through the
following Venn diagram which represents both sides of the equation:

18. Find the domain and range of these functions. Note that in each case, to find the domain,
determine the set of elements assigned values by the function.
a) the function that assigns to each nonnegative integer its last digit. Domain: set of all
nonnegative integers {0,1,2,.}. Range: {0,1,2,3,4,5,6,7,8,9}
b) the function that assigns the next largest integer to a positive integer. Domain: set of all
positive integers {1,2,3,}. Range: {2,3,4,5,.}
c) the function that assigns to a bit string the number of one bits in the string. Domain: set of all
bit strings = {a
1
, a
2
,,a
n
| a
i
{0,1} and n 1}. Range: the set of all nonnegative integers =
{0,1,2,3,}
d) the function that assigns to a bit string the number of bits in the string. Domain: set of all bit
strings = {a
1
, a
2
,,a
n
| a
i
{0,1} and n 1}. Range: the set of all positive integers = {1,2,3,}.
19. Find the domain and range of these functions:
a) the function that assigns to each pair of positive integers the first integer of the pair. Domain:
the Cartesian product of the set of positive integers with itself =
+

+
. Range: the set of all
positive integers
+
.
b) the function that assigns to each positive integer its largest decimal digit. Domain: the set of
all positive integers {1,2,3,..}. Range: {1,2,3,4,5,6,7,8,9}
c) the function that assigns to a bit string the number of ones minus the number of zeros in the
string. Domain: set of all bit strings = {a
1
, a
2
,,a
n
| a
i
{0,1} and n 1}. Range: the set of all
integers (both positive and nonnegative).
d) the function that assigns to each positive integer the largest integer not exceeding the
square root of the integer. Domain: set of all positive integers = {1,2,3,.}. Range: the set of all
positive integers {1,2,3,}.
e) the function that assigns to a bit string the longest string of ones in the string. Domain: set of
all bit strings = {a
1
, a
2
,,a
n
| a
i
{0,1} and n 1}. Range: set of all nonnegative integers =
{0,1,2,.}.
20. Determine whether each of these functions is a bijection from R to R.
a) f(x) -3x+4. Yes
b) f(x) = -3x
2
+7. No
c) f(x) = (x+1)/(x+2). Yes
d) f(x) = x
5
+1. Yes
21. Show that the function f(x) = |x| from the set of real numbers to the set of nonnegative
real numbers is not invertible, but if the domain is restricted to the set of non-negative real
numbers then the resulting function is invertible.
Solution: The function f(x) = |x| without any restrictions is not one to one because f(x) = f(-x) =
|x| for all x, including nonzero x. If one was to restrict the domain to the set of all non-negative
real numbers though, then |x| = x which would imply that f(x) = x. This function is one-to-one.
22. Find and where f(x) = x
2
+1 and g(x) = x+2 are functions from R to R.
1) = (x+2)
2
+1
2) = (x
2
+1) + 2 = x
2
+3
23. If f and are one-to-one, does it follow that g is one-to-one? Justify your answer. Yes,
it must be the case that g is also one-to-one. To show this one can do a proof by contradiction:
Suppose not. Suppose that g is not one-to-one but the above assumptions are true. Saying that
g is not one-to-one means that there exists a pair of inputs x
1
and x
2
where x
1
x
2
but g(x
1
) =
g(x
2
). This would imply that (x
1
) = (x
2
), but this contradicts the assumption that
is one-to-one. Thus it must be the case that g is one-to-one as well.
24. Show that if x is a real number then = 1 if x is not an integer and = 0 if x
is an integer. Solution: If x is an integer then implying that = 0. To see the
other equality, remember that is the smallest integer greater than or equal to x and is
the largest integer less than or equal to x. If x is not an integer then these quantities simply
define the integers preceding and succeeding x on the real number line which implies their
difference of 1.
25a. Show that if a set S has cardinality m, where m is a positive integer, then there is a one-
to-one correspondence between S and the set {1,2,,m}. Solution: one can construct a one-to-
one correspondence f between S and the set T = {1,2,,m} algorithmically in the following way:
for i = 1 to m
arbitrarily select an element x from S
assign i to S.
S = and T = .
end for loop
Note that the one-to-one correspondence outputted by this procedure is not unique. There are
in fact m! different ways of setting up such a correspondence between the sets S and T.
25b. Show that if S and T are two sets each with m elements where m is a positive integer,
then there is a one-to-one correspondence between S and T. Solution: By part a we know that
there exists one-to-one correspondences f and g from the sets S and T to {1,2,,m}
respectively. Because they are one-to-one correspondences both f
-1
and g
-1
exist. Thus one can
compose the functions f and g
-1
(i.e. create
-1
to obtain a one-to-one correspondence from
S to T.

Potrebbero piacerti anche