JDEP 183H
Homework
Assignment 1A – Solution
Sets,
Relations, and Functions
Assigned: September 5, 2006
Due: September 19, 2006
(12:30 PM)
(Homework 5
minutes late will not be accepted)
Set Basics
1. (10 points) List all members of the following sets.
(a) ![]()
(b) ![]()
(c)
where
is the set of all
positive numbers
(d)
where
is the set of all
positive numbers
(e)
where
is the set of all
positive numbers
Solution
(a) { 1, ½, 1/3, ¼}
(b)
When n = 0,
;
n = 1,
;
n = 2,
;
n = 3,
;
n = 4,
.
{ 0, 0, 2, 6, 12 }
(c)
When n is even,
is 1, and thus
. When n is
odd,
is -1, and thus
. Thus,
= {1, 3}.
(d) The valid n values are 2, 4, 6, 8, and 10. So, we have {1/4, 1/16, 1/36. 1/64, 1/100 }.
(e) The valid n values are 2, 3, 5, 7, 11, and 13. So we have { 2, 3, 5, 7, 11, 13 }.
![]()
2. (10 points)
Consider the following six subsets of Z. (Definition:
Z = the set of all integers = ( …, -3, -2, -1, 0, 1, 2, 3, …}.)
A = { 2m + 1 | m Î Z }
B = { 2n + 3 | n Î Z }
C = { 2p -3 | p Î Z }
D = { 3r + 1 | r Î Z }
E = { 3s + 2 | s Î Z }
F
= { 3t - 2 | t Î Z }
Which
of the following statements are true and which are false? Show your reasons.
(a) A = B
(b) A = C
(c) B = C
(d) D = E
(e) D = F
(f) E = F
Solution
First, let us enumerate the members of each
set.
A = { 2m + 1 | m Î Z } = { …, -5, -3, -1, 1, 3, 5, 7, …}
B = { 2n + 3 | n Î Z } = { …, -3, -1, 1, 3, 5, 7, 9, …}
C = { 2p - 3 | p Î Z } = { …, -9, -7, -5, -3, -1, 1, 3,
…}
D = { 3r + 1 | r Î Z } = { …, -8, -5, -2, 1, 4, 7, 10, … }
E = { 3s + 2 | s Î Z } = { …, -7, -4, -1, 2, 5, 8, 11, … }
F
= { 3t - 2 | t
Î Z } = { …, -11, -8, -5, -2, 1, 4, 7, … }
(a) A
= B. This is true.
(b)
A = C. This is true.
(c)
B = C.
This is true.
(d)
D = E.
This is false.
(e) D = F. This is true.
(f) E = F. This is false.
Note that there are several ways to approach this question. The above is basically enumerating the members of each set and then just comparing the sets. Another way is as follows:
(a) Consider
x in A. Then x = 2m
+ 1. Or, x = 2m - 2 + 2 +
1 = 2(m – 1) + 2 + 1 = 2(m – 1) + 3. Since m Î Z, m-1 Î Z too.
And thus, we can rewrite the equation as x = 2n + 1 for n Î Z, or A = { 2n + 3 | n Î Z
}.
And now, A = B.
The proofs for (b)-(f) are similar to the
above.
![]()
Set Operations
3. Application of
Knowledge (14 points)
Consider an alphabet Σ = { a, b }. It has only two letters. A word (or w) is any finite
string of letters that you can form out of the alphabet. For example, abba is a word formed
using only the letters from the alphabet Σ. The collection of all words is called a language,
and is denoted as
. For example,
= { ε, a, aa, ab,
ba, bb, aaa, aab, abb, bbb, bba, baa, …}.
And
is an infinite
set! The symbol ε denotes the empty
word or null word.
Now, suppose Σ = { a, b }; A
= {a, b, aa, bb, aaa, bbb }; B = {
: length(w) ≥ 2}; and C = {
: length(w) ≤ 2}. (Hint: Don’t forget the empty word ε,
which has a length of zero!) List all
members of the following:
(a) ![]()
(b) ![]()
(c) ![]()
(d) ![]()
(e) ![]()
(f) ![]()
(g) power set of Σ
Solution
First, we list B = { ab, aa, ba, bb, aaa, aab, abb, bbb, bba, baa, …}.
Then, we list C = { ε, a, b, aa, ab, ba, bb }.
(a)
= { a, b, bb, aa }
(b)
= { aaa, bbb }
(c)
= { ε, ab, ba }
(d)
= { ε, ab, ba, aaa, bbb }
(e)
= { aa, bb, aaa, bbb
}
(f)
= { aa, ab, ba, bb }
(h) The set Σ = { a , b }. So the power set of Σ is { {}, {a}, {b}, {a, b} }.
![]()
Binary Relations
4. (18 points)
Determine whether or not each of the binary relations
defined on the given
sets A are reflexive, symmetric, or transitive. If a relation has a certain property, prove
this is so; otherwise, provide a counterexample to show that it does not. Determine also whether a relation is equivalence.
(a)
A = { 3, 4 };
= { (3, 3), (4, 4)}
(b)
A is the set of all humans;
if and only if
where
means “a is the
parent of b.”
(c)
A is the set of integers;
if and only if
is odd.
(d)
A is the set of cross products of integers, Z×Z;
if and only if
.
(e)
A is the set of all humans;
if and only if
where
means “a and b
are both fans of the same musician.”
Assume that a human may be a fan of more than one musician.
(f)
A is the set of natural numbers, N;
if and only if
is an integer.
Solution
(a) Reflexive, since both (3,3) and (4,4) are part of the relation.
Symmetric, since we cannot find a counter example such as “(3, 4) and no (4, 3).”
Transitive, since we cannot find a counter example such as “(3, 4) & (4, 3) and no (4, 4).”
The relation is reflexive, symmetric, and transitive. It is an equivalence.
(b)
Not Reflexive, since a person cannot be a parent
of himself or herself.
does not exist.
Not Symmetric,
since if
, then
does not exist. If a person a is a parent of another
person b, then that person b cannot be a parent of the person a.
Not
Transitive, since if
, and
,
does not exist. If a person a is a parent of another
person b, and that person b is a parent of yet another person c,
then a is the grandparent of c. a cannot be the parent of c.
Not Equivalence, since the relation does not satisfy all the above three properties.
(c) Not Reflexive, since, for example, 1 + 1 is even. So, (1,1) is not part of the relation.
Symmetric. If
, then that means
is odd. By the commutative law of mathematics,
=
. So, if
, then
is also odd. So, if
, then we are guaranteed to have
.
Not
Transitive. For example, suppose a =
10, b = 7, c = 4. Both (a,b)
and (b,c) are members since
which is odd, and
, which is odd. However,
(a, c) is not a member of the relation. Why?
This is because
which is even. Thus,
the relation is not transitive.
Not Equivalence, since the relation does not satisfy all the above three properties.
(d)
Reflexive, since
. This is because
is always true.
Symmetric,
since
is always true. This is because
always yields the same
result as
.
Transitive. Suppose we have
such that we know
and
. If we add c – m
to
, we have
. Since
, we can transform the equation to
. Then we can reduce
the equation to
. Thus, we have an
element
. Since for every pair
,
is also in
. The relation
is transitive.
Equivalence. The relation satisfies all three of the above properties.
(e) A is the set of all humans;
if and only if
where
means “a and b
are both fans of the same musician.”
Assume that a human may be a fan of more than one musician.
Reflexive,
since
is always part of the
relation. If I am a fan of Eric Clapton,
then I am also a fan of Eric Clapton.
Symmetric,
since if
, then
too.
Not transitive. For example, suppose there are three
fans: Adam, Belle, and Charlie. Adam is a fan of Britney Spears; Belle is a
fan of Britney Spears and YoYo Ma.
Charlie is a fan of YoYo Ma. So,
we have
, and
; but we do not have
! Adam and Charlie do
not have a common musician that they are fans of.
Not Equivalence, since the relation does not satisfy all the above three properties.
(f) Reflexive, as
since
is always equal to 1,
an integer
Not symmetric. For example, let
and a = 2 and b
= 1. Then
is 2, an integer. But
because
is ½, or 0.5, not an
integer.
Transitive. We want to show that if
then
. If
, then we have
= j, and
= k, where j
and k are integers. So, a =
bj, and b = ck.
Substituting for b, we have a = ckj. Then, we have
= kj. Since j
and k are both integers, then the product kj is also an
integer. Thus,
. Therefore, if
, then
.
Not Equivalence, since the relation does not satisfy all the above three properties.
![]()
5. (8 points) Given the following relations:
.
.
.
.
Solution
First, let us look at the four relations.
. Since a sum of two
numbers is odd only when one of the number is odd and the other is even, we know
that
consists of (1, 2),
(1,4), (3,6), and so on.
. Similarly, a sum of
two numbers is even only when (a) both numbers are even or (b) both numbers are
odd. So, we know that
consists of (1,1),
(2,2), (3,1), (5,9), and so on.
. Since a product of
two numbers is odd only when both numbers are odd, we know that
consists of (1,1),
(3,5), (9,17), and so on.
. For a product of
two numbers to be even, one of the numbers must be even. So, we know that
consists of (1,4),
(2,3), (10,2), and so on.
List 5 members for each of the following sets; if not possible, explain.
(a)
This is an empty
set.
requires one of the
numbers to be even;
requires both to be
even. So, the intersection is empty.
(b)
5 members: (1,4), (2,3), (10,2), (3,6), (2,2)
(c)
5 members: (2,2),
(2,4), (4,6), (4,4), (4,8)
(d)
5 members: (1,4),
(2,3), (10,2), (9,17), (1,1)
(e)
Since
and
do not intersect,
=
. So, 5 members:
(1,2), (1,4), (3,6), (5, 6), (6, 5)
(f)
As we see from the
answer to part (c), we know that
and
intersect. So, out of
the members for
, we need to filter out members that also satisfy
. To satisfy
, basically the two numbers have to be even or both have to
be odd. The latter case cannot exist within
. So, we only have to
make sure that we filter out all members that have both numbers even. So, 5 members: (1,4), (2,3), (3,2), (5,6),
(2,9).
(g)
This is exclusive
or.
requires one even
number and one odd number.
requires at least one
even number. And since
is a subset of
. So, to be exclusive,
we consider for
only the members that
have two even numbers. 5 members: (2,2),
(4,2), (10,2), (2,6), (4,4).
(h)
This is exclusive
or.
requires either both
even numbers or both odd numbers.
requires both numbers
to be odd. So, once again, we have a
scenario where
is a subset of
. To be exclusive, we
only consider the members that have two even numbers. 5 members: (2,2), (4,2), (10,2), (2,6),
(4,4).
![]()
Functions
6. (15 points) Determine whether each of these functions is
onto and one-to-one (where Z is the set of integers, and R is the set of real numbers).
Explain or show an example to support your answers. (Hint:
For (e)-(g), think carefully about the domain, target, and range
involved.)
(a)
f: Z → Z , ![]()
(b)
f: Z → Z , ![]()
(c)
f: R → R , ![]()
(d)
f: R → R , ![]()
(e)
f: Z → Z , ![]()
(f)
f: R → R , ![]()
(g)
f: R → Z , ![]()
Solution:
First,
remember that a function from a set A to a set B is a binary relation f
from A to B with the property that for every
, there is
exactly one
such that
. That means that every single element in the
domain must have a link to one of the elements in the target. Also, for a function to be onto, then all the
elements in the target, B, must have a link from the domain.
|
Problems |
One-to-one? |
Onto? |
|
(a) f: Z → Z , |
Yes. Since this function maps from an integer to
another integer (smaller by 1), all elements in the domain set will have a
unique corresponding element in the target.
For example, { …, (-2,-1), (-1, 0), (0, -1), (1,0), (2,1), (3,2), … } |
Yes. All elements in the target will have a
corresponding element in the domain. |
|
(b) f: Z → Z , |
No. For example, |
No. The target set is the set of integers. However, the function only maps to positive
integers since |
|
(c) f: R → R , |
No. For example, |
No. The target set is the set of real
numbers. However, the function only
maps to real numbers smaller than 7 since |
|
(d) f: R → R , |
Yes. Each real number will be mapped to a unique real number. In fact, the function resembles a graph like this:
|
Yes. The graph shows that |
|
(e) f: Z → Z , |
Yes. Each integer will be mapped to itself. (Note that the ‘ceiling’ function actually
does not do anything when the domain is the set of integers.) |
Yes. Each integer will be mapped to itself and
all integers in the target set will have corresponding elements in the
domain. (Note that the ‘ceiling’
function actually does not do anything when the domain is the set of
integers.) |
|
(f) f: R → R , |
No. Now we consider the set of real numbers. So, it is possible to have two elements
from the domain set to map to the same element in the target set. For example, |
No. Now we consider the set of real numbers
in the target set. Since we know that
the ceiling function always return an integer, that means many real numbers
in the target set will not have corresponding elements in the domain. For example, an element such as 6.7 in the
target set does not have a corresponding element in the domain. Thus this function is no longer onto. |
|
(g) f: R → Z , |
No. Now we consider the set of real numbers. So, it is possible to have two elements
from the domain set to map to the same element in the target set. For example, |
Yes. See, here, the target is the set of
integers!!!! So, all the elements of
the target set will have corresponding elements in the domain! |
7. (15 points)
We define functions mapping R to R (where R is the
set of real numbers) as follows:
,
,
. Find
(a) ![]()
(b) ![]()
(c) ![]()
(d) ![]()
(e) ![]()
Solution:
(a)
=
.
(b)
=
.
(c)
=
.
(d)
=
.
(e)
=
.
8. (15 points) Find the inverses of the following functions mapping R to R (where R is the set of real numbers):
(a) ![]()
(b) ![]()
(c) ![]()
(d) ![]()
(e)
where
is a constant.
Solution:
(a)
We have
. Let
, and
. Solving for
, we have
![]()
![]()
![]()
Thus,
is the inverse of
.
(b)
We have
. Let
, and
. Solving for
, we have
![]()
![]()
![]()
Thus,
is the inverse of
.
(c)
We have
. This function is not
one-to-one. For example, when x =
2,
; when x = 0,
. Thus it is possible
for two different values of x to map to the same value in the
target. Thus, there is no inverse for
this function.
(d)
We have
. Since k(1) =
-1/6 or 1/6. This is not a
function. Thus there is no inverse.
(e)
We have
where
is a constant. Let
, and
. Solving for
, we have
![]()
![]()
![]()
Thus,
is the inverse of
.