EECS 203: Homework 4 Solutions
Section 2.3
1. (E) 6acd
a.) The domain is Z+ x Z+ and the range is Z+
c.) The domain is the set of all bit strings. The difference between the number of 1’s and 0’s can be any integer and
so the range is Z.
d.)The domain is Z+ and the range is Z+.
2. (E) 12bcd
b.) f(n) = n
2
+ 1
A function is one-to-one if f(x) = f(y)
↔ x = y.
Let f(x) = f(y), then
x
2
+ 1 = y
2
+ 1
↔
x
2
=
y
2
for all real numbers.
However in this case, it does not necessarily mean that x = y. For example, when x = 1 and y = -1, the above
equation is satisfied. So, the function is not one-to-one.
c.) f(n) = n
3
A function is one-to-one if f(x) = f(y)
↔ x = y.
Let f(x) = f(y), then
x
3
= y
3
↔
x
=
y for all real numbers (Since cube root is unique).
Hence the function is one-to-one.
A function is one-to-one if f(x) = f(y)
↔ x = y.
Let f(x) = f(y), then
.
However in this case, it does not necessarily mean that x = y. For example, when x = 3 and y = 4, the above equation
is true. So, the function is not one-to-one.
3. (E) 14bcd
b.) f(m, n) = m
2
– n
2
No, the range does not include the value 2. To see this, let us assume there is are m and n such that f(m, n) = 2 and
seek a contradiction. Then m
2
− n
2
= (m + n)(m − n) = 2. Note that because m
2
− n
2
is even, m
2
and n
2
must either
be both even or both odd. As a result, m and n are either both even or both odd (by exercise 3 in section 1.6).
Therefore (m+ n) and (m− n) are both even. That is, there are integers
s
and
t
such that (m + n)(m − n) = 2
s
・
2
t
=
4
st
. If 4
st
= 2, then
st
= 1/2 . But
st
is an integer, so this is a contradiction and f is not onto.
c.) f(m, n) = m + n + 1
Generally, A function is onto if and only if for every element y in the co-domain, there exists an element x in the
domain such that f(x) = y. (In short, Range = Co-domain)
Here, Let f(m, n) = y, then y = m + n + 1.
The function f is onto because for every integer y, there exist integers m and n such that m+ n = y-1.
d.) f(m, n) = |m| - |n|
Here, we can achieve negative values when we set m to 0 and positive values when n is 0. Therefore range is equal
to Co-domain and the function is onto.