Question

In: Computer Science

Consider f,g:ℤ→ℤ given by: f(n) = 2n g(n) = n div 2 Which of the following...

Consider f,g:ℤ→ℤ given by:

  • f(n) = 2n
  • g(n) = n div 2

Which of the following statements are true? Select all that apply

(a)

f is an injection

(b)

g is an injection

(c)

f∘g is an injection

(d)

g∘f is an injection

(e)

f is a surjection

(f)

g is a surjection

(g)

f∘g is a surjection

(h)

g∘f is a surjection

Solutions

Expert Solution

So we have f(n)=2n and f:Z -> Z

but for 1 as output n must be 1/2 (not an integer) which is outside the domain, so it is not surjective but injective.

for g(n)= n div 2 and f: Z -> Z

and g is not even a function: g(1)=1/2 out of the range. (so neither surjective nor injective)

fog = 2 (n/2)= n hence is surjective.

gof = 2n / 2 = n again surjective.

so the right options are (a), (g) and (h).


Related Solutions

1.)Prove that f(n) = O(g(n)), given: F(n) = 2n + 10; g(n) = n 2.)Show that...
1.)Prove that f(n) = O(g(n)), given: F(n) = 2n + 10; g(n) = n 2.)Show that 5n2 – 15n + 100 is Θ(n2 ) 3.)Is 5n2 O(n)?
Consider the following functions from ℤ × ℤ → ℤ. Which functions are onto? Justify your...
Consider the following functions from ℤ × ℤ → ℤ. Which functions are onto? Justify your answer by proving the function is onto or providing a counterexample and explaining why it is a counterexample. (a) f(x,y) = xy + 3 (b) f(x,y) = | xy | + 10 (c) f(x,y) = ⌊( x+y ) / 3⌋
Consider the following functions from ℤ × ℤ → ℤ. Which functions are onto? Justify your...
Consider the following functions from ℤ × ℤ → ℤ. Which functions are onto? Justify your answer by proving the function is onto or providing a counterexample and explaining why it is a counterexample. (a) f(x,y) = xy + 3 (b) f(x,y) = | xy | + 10 (c) f(x,y) = ⌊( x+y ) / 3⌋
Given the relation R = {(n, m) | n, m ∈ ℤ, n ≥ m}. Which...
Given the relation R = {(n, m) | n, m ∈ ℤ, n ≥ m}. Which of the following statements about R is correct? R is not a partial order because it is not antisymmetric R is not a partial order because it is not reflexive R is a partial order R is not a partial order because it is not transitive
If f(n) = 3n+2 and g(n) = n, then Prove that f(n) = O (g(n))
If f(n) = 3n+2 and g(n) = n, then Prove that f(n) = O (g(n))
For f: N x N -> N defined by f(m,n) = 2m-1(2n-1) a) Prove: f is...
For f: N x N -> N defined by f(m,n) = 2m-1(2n-1) a) Prove: f is 1-to-1 b) Prove: f is onto c) Prove {1, 2} x N is countable
Which of the following integer examples provides a proof of the existential statement "∃n ∈ ℤ,...
Which of the following integer examples provides a proof of the existential statement "∃n ∈ ℤ, n² ≤ 0 ∧ n ≥ 0"? a n = -1 b n = 1 c n = 0 d n = 10
Given a 2n × 2 n checkerboard with one square missing, construct a tiling of this...
Given a 2n × 2 n checkerboard with one square missing, construct a tiling of this checkerboard using right triominoes. Write a C or C++ program to solve this problem. The input is an integer n ≥ 3 and the position of the missing square. The output is a tiling of the 2n × 2 n checkerboard with one square missing (the position of the missing square is part of the input).
Prove the following by induction: 2 + 4 + 6 + …+ 2n = n(n+1) for...
Prove the following by induction: 2 + 4 + 6 + …+ 2n = n(n+1) for all integers n Show all work
Which of these statements are true and which are false? (a) If f(n) = Θ(g(n)) and...
Which of these statements are true and which are false? (a) If f(n) = Θ(g(n)) and g(n) = Θ(h(n)), then h(n) = Θ(f(n))   (b) If f(n) = O(g(n)) and g(n) = O(h(n)), then h(n) = Ω(f(n)) (c) If f(n) = O(g(n)) and g(n) = O(f(n)) then f(n) = g(n)                                                      (d) 100n = Ω(n2)     (e) In the merge-sort execution tree, roughly the same amount of work is done at each level of the tree.   (f) An algorithm is randomized if...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT