0% found this document useful (0 votes)
64 views5 pages

RMIT Discrete Mathematics Functions Guide

Uploaded by

longhtr023
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
64 views5 pages

RMIT Discrete Mathematics Functions Guide

Uploaded by

longhtr023
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

MATH2448: Discrete Mathematics

1
Lecturer: Dr Nguyen Hieu Thao
Email: [Link]@[Link]

Tutorial Solutions: Functions


(2024C, Week 4)1

1. Determine whether each of the sets is a function from X = {1, 2, 3, 4} to Y = {a, b, c, d}.
If it is a function, find its domain and range, draw its arrow diagram, and determine if it
is one-to-one, onto, or both.

(a) {(1, a), (2, a), (3, c), (4, b)} is a function.

(i) It is not injective since two distin-


guished elements 1 and 2 in X have
the same value a in Y .

(ii) It is not surjective since d does not


belong to its range.

(iii) The diagram of this function is beside.

(b) {(1, c), (2, a), (3, b), (4, c), (2, d)} is not a function since there are two correspondences
for the input 2 (a and d).

2. Draw the graph of the function f (x) = x − bxc, whose domain and codomain are the set
of real numbers.

Solution. Note that the function f (x) = x − bxc is periodic with period 1. Consider, for
example, the interval [0, 1), we have f (x) = x. Duplicating the graph of f on [0, 1) to all
the periodic intervals, we obtain the graph of f as below.

1 Most of the content of this document is taken from the book [1].
2

3. Determine whether each function is one-to-one, onto, or both. The domain and codomain
are the set of integers. Justify your answers.

(a) The function f (n) = dn/2e is surjective, but not injective.


(i) It is surjective because for any integer n, we have f (2n) = d2n/2e = n. That is,
the range of f contains all integers.
(ii) It is not injective because 1 6= 2, but f (1) = d1/2e = 1 = d1e = f (2).
(b) The function f (n) = 2n is injective, but not surjective.
(i) It is injective because whenever n 6= m, we have f (n) = 2n 6= 2m = f (m).
(ii) It is not surjective because odd integers do not belong to the range of f which
contains only even integers (2n, n ∈ Z).

4. The function f (x) = 3 log2 x is one-to-one on its domain X - the set of positive real
numbers. By letting Y = range(f ), we obtain a bijection from X to Y . Find its inverse.

Solution. The inverse function is f −1 (y) = 2y/3 . Justify the result for yourself.

5. Given g = {(1, b), (2, c), (3, a)}, a function from X = {1, 2, 3} to Y = {a, b, c, d}, and
f = {(a, x), (b, x), (c, z), (d, w)}, a function from Y to Z = {w, x, y, z}, write f ◦ g as a set
of ordered pairs and draw the arrow diagram of f ◦ g.

Solution. The composition function f ◦ g as a set of


ordered pairs is

f ◦ g = {(1, x), (2, z), (3, x)} .

The arrow diagram of f ◦ g is beside.

6. Let f (n) = 2n + 1 and g(n) = 3n − 1 be functions from the set of positive integers to itself.
Find the compositions f ◦ f , g ◦ g, f ◦ g, and g ◦ f .
Solution. The composition functions are below.

(i) f ◦ f (n) = 2(2n + 1) + 1 = 4n + 3 (iii) f ◦ g(n) = 2(3n − 1) + 1 = 6n − 1


(ii) g ◦ g(n) = 3(3n − 1) − 1 = 9n − 4 (iv) g ◦ f (n) = 3(2n + 1) − 1 = 6n + 2

7. Decompose the function f (x) = log2 (x2 + 2) into simpler functions.


Solution. It can be decomposed as f = f1 ◦ f2 ◦ f3 , where

f3 (x) = x2 , f2 (y) = y + 2, and f1 (z) = log2 (z).

Justify the result for yourself.


3

8. Consider the function f (x) = 4x( mod 5) from X = {0, 1, 2, 3, 4} to X. Write f as a set
of ordered pairs and draw the arrow diagram of f . Is f one-to-one? Is f onto? Explain
your answers.

Solution.

(i) As a set of ordered pairs:

f = {(0, 0), (1, 4), (2, 3), (3, 2), (4, 1)} .

(ii) The arrow diagram of f is beside.

(iii) f is both one-to-one and onto. Explain the


answers to yourself.

9. For the following hash function, show how the data would be inserted in initially empty
cells in the given order. Use the collision resolution policy mentioned in Notes Week 4.

h(x) = x mod 11; cells indexed 0 to 10; data: 53, 13, 281, 743, 377, 20, 10, 796.

Solution. Recall that the collision resolution policy is to look for the next unoccupied cell.
The hash values are below.

53 13 281 743 377 20 10 796


9 2 6 7 3 10 0 4

10. Let g be a function from X to Y and let f be a function from Y to Z. For each statement,
if the statement is true, prove it; otherwise, give a counterexample.

(a) If f and g are onto, then f ◦ g is onto. The statement is True.

Proof. Take any z ∈ Z. Since f is onto, there is y ∈ Y such that f (y) = z. Since g is
onto and y ∈ Y , there is x ∈ X such that g(x) = y. That is, f ◦ g(x) = z. Thus, for
every z ∈ Z, there is x ∈ X such that f ◦ g(x) = z. That is, f ◦ y is onto.

(b) If f ◦ g is one-to-one, then f is one-to-one. The statement is False.

Counterexample. Consider the function g : {1} → {a, b} given by g(1) = a and the
function f : {a, b} → {α} given by f (a) = f (b) = α. Then the composition function
f ◦ g : {1} → {α} with f ◦ g(1) = α is one-to-one, but f is not one-to-one.
4

11. In asynchronous transfer mode (ATM) (a communication protocol used on backbone net-
works), data are organized into cells of 53 bytes. How many ATM cells can be transmitted
in 1 minute over a connection that transmits data at the rate of 500 kilobits per second?
Solution.

(i) 53 bytes/cell = 53 · 8 = 424 bits/cell.

(ii) In 60 seconds, 60 · 500, 000 = 30, 000, 000 bits can be transmitted.

(iii) Thus, b30, 000, 000/424c = b70, 754.717c = 70, 754 cells can be transmitted.

12. A JPEG file stores image data in blocks of 8 × 8 pixels. How many blocks are needed to
store a JPEG image whose dimensions are 4753 × 3747 pixels?
Solution.

(i) Horizontally, it requires ceiling(4, 753/8) = ceiling(594.125) = 595 blocks.

(ii) Vertically, it requires ceiling(3, 747/8) = ceiling(468.375) = 469 blocks.

(iii) Total number of blocks required is 595 · 469 = 279, 055 blocks.

13. Consider the set X = {1, 2, . . . , 10}. Define the function f from the power set of X to the
set of positive integers. For each subset A of X, the function f returns the cardinality of
A. Justify yours answers.

(a) f is not injective. For example, {A} = {1} 6= {B} = {2}, but f (A) = f (B) = 1.

(b) f is not surjective since 11 ∈


/ range(f ) which ranges from 0 to 10.

(c) X is a proper subset of range(f ) since X ⊂ range(f ) and 0 ∈ range(f ) \ X.

14. Define the function f : R2 → R2 by f (x) = Ax for every x ∈ R2 , where


 
1 2
A= .
2 4

(a) Calculate f (x), where x = (−3, −6)T (column vector).

Solution. f (x) = Ax = (−15, −30)T .

(b) Is f an injective, surjective, bijective function? Explain/prove your answers.

Solution. f is not injective since f ((2, 1)T ) = f ((0, 2)T ) while (2, 1)T 6= (0, 2)T . f is
not surjective since f −1 ((1, 1)T ) = ∅. As a consequence, f is not bijective.
5

15. Define the function f : R3 → R3 by f (a) = Aa (matrix-vector multiplication) for every


a ∈ R3 , where 
1 2 3

A = 0 −1 1 .
0 0 1
(a) Calculate f (a) and f −1 (a), where a = (1, 1, 1)T (column vector).
    
1 2 3 1 6
f (a) = Aa = 0 −1 1 1 = 0 .
0 0 1 1 1
To compute f −1 (a), we solve the equation f (x) = a for the unknown x. Indeed,
    
1 2 3 x1 1
f (x) = Ax = a ⇐⇒ 0 −1 1 x2  = 1
0 0 1 x3 1
 
x1 + 2x2 +3x3 = 1 x1 = −2
⇐⇒ −x2 +x3 = 1 ⇐⇒ x2 = 0 .
x3 = 1 x3 = 1
 

Hence, f −1 (a) = (−2, 0, 1)T .

(b) f is injective. Indeed, suppose that f (x) = f (y) for some x, y ∈ R3 . Then
    
1 2 3 x1 − y1 0
Ax = Ay ⇐⇒ A(x − y) = 0 ⇐⇒ 0 −1 1 x2 − y2  = 0
0 0 1 x3 − y3 0
 
(x1 − y1 ) + 2(x2 − y2 ) +3(x3 − y3 ) = 0 x1 = y1
⇐⇒ −(x2 − y2 ) +(x3 − y3 ) = 0 ⇐⇒ x2 = y2 .
x3 − y3 = 0 x3 = y3
 

Hence x = y and f is injective.

(c) f is surjective. Indeed, consider any a ∈ R3 . We show that the equation f (x) = a has
a solution x. Indeed,
    
1 2 3 x1 a1
f (x) = Ax = a ⇐⇒ 0 −1 1 x2  = a2 
0 0 1 x3 a3
 
x1 + 2x2 +3x3 = a1 x1 = a1 + 2a2 − 5a3
⇐⇒ −x2 +x3 = a2 ⇐⇒ x2 = −a2 + a3 .
x3 = a3 x3 = a3
 

This means that for every given a ∈ R3 , the equation f (x) = a has a solution x, and
hence f is surjective.

References
1. Johnsonbaugh, R.: Discrete Mathematics - Eighth Edition. Pearson Education, New York
(2018).

Common questions

Powered by AI

A set of ordered pairs is a function from set X to set Y if every element in X is assigned exactly one element in Y. This can be established using arrow diagrams, where each element in X is connected by an arrow to one and only one element in Y. In situation (a) from Source 1, the set {(1, a), (2, a), (3, c), (4, b)} is considered a function because each element in X = {1, 2, 3, 4} has a unique arrow pointing to an element in Y = {a, b, c, d}. This can be visualized through an arrow diagram that represents these mappings. In contrast, in situation (b) where the set is {(1, c), (2, a), (3, b), (4, c), (2, d)}, there are two outputs for the input 2 (namely a and d), which violates the definition of a function .

Composition of two functions f and g can lead to different properties regarding injectivity and surjectivity based on the individual characteristics of f and g. For instance, if both f and g are onto functions, then the composition f ◦ g is also onto as each element in the codomain of f ◦ g can be sourced from an element in the domain of g due to both functions covering their codomains. However, if f ◦ g is one-to-one, this does not imply that f is one-to-one, as shown in the counterexample where g : {1} → {a, b} given by g(1) = a and f : {a, b} → {α} given by f(a) = f(b) = α, resulting in f ◦ g as one-to-one but f not being one-to-one .

In telecommunications, the number of ATM cells transmitted over a specified time is determined by dividing the total data that can be transmitted by the size of each cell. For a connection transmitting at 500 kilobits per second and an ATM cell size of 53 bytes (i.e., 424 bits), in a timeframe of 60 seconds, the total bits transmitted would be 30,000,000. The number of cells transmitable in this period is the integer division of total bits by the size of one cell, calculated as 30,000,000/424, resulting in 70,754 cells transmitted per minute, considering the remainder is disregarded as partial cells cannot be transmitted .

In matrix-vector multiplication-based functions like f : R^3 → R^3 defined by f(a) = Aa, injectivity is determined by checking if the null space of the matrix A contains only the zero vector, meaning f(x) = f(y) implies x = y, thus confirming injectivity if this is met. Surjectivity is verified by solving f(x) = a for any vector a in R^3 to check if solutions always exist, indicating that every possible output is accounted for by some input. In the example provided, A = [[1, 2, 3], [0, -1, 1], [0, 0, 1]], confirming that f is both injective and surjective due to solvable equations relating to the rank and determinant properties of the matrix .

To find the inverse of a bijective function such as f(x) = 3 log2 x, we solve the equation y = 3 log2 x for x in terms of y. Rearranging gives y/3 = log2 x, leading to x = 2^(y/3) as the inverse function. This inverse ensures that applying f and then f^−1 returns the original input, confirming the bijection between the set of positive real numbers X and the range Y .

Discrete hash functions can be evaluated for efficiency in data storage based on how they manage collisions, which occur when multiple inputs map to the same hash value. The collision resolution policy is critical in determining efficiency. For instance, given a hash function h(x) = x mod 11 with cells indexed 0 to 10, and a sequence of data, the resolution policy is to occupy the next unoccupied cell when a collision occurs. The efficiency of this process can be seen by the specific placement of inputs such as 53, 13, 281, 743, 377, 20, 10, and 796 into initially empty cells following this policy, thereby maintaining a structured data storage despite collisions .

Decomposing a complex function into simpler component functions aids understanding and computation by isolating sub-processes or transformations. For example, the function f(x) = log2(x^2 + 2) can be decomposed into a series of simple functions: f1(z) = log2(z), f2(y) = y + 2, and f3(x) = x^2. Each component function performs a distinct part of the overall transformation, making analysis more manageable and facilitating easier computation for each step individually, enhancing clarity and reducing computational complexity .

The periodicity of a function like f(x) = x - ⌊x⌋, which is periodic with a period of 1, influences its graphical representation by repeating the same pattern across subsequent intervals. The function f(x) takes on values in the range [0, 1) in the interval [n, n+1) for any integer n, effectively duplicating the linear segment from 0 to just below 1 repeatedly along the x-axis at integer intervals. This periodic nature makes the function appear as a series of steps or spikes in the graph, with each step corresponding to a length of 1 on the x-axis .

The function f(n) = ⌈n/2⌉ is not injective because different inputs can produce the same output, which violates the one-to-one mapping requirement of injective functions. For instance, f(1) = ⌈1/2⌉ = 1 and f(2) = ⌈2/2⌉ = 1, hence 1 and 2 map to the same value. Despite this, the function is surjective since for every integer k, there exists an n such that f(n) = k, specifically by choosing n = 2k for non-negative integers .

The function that computes cardinality of subsets from a set X = {1, 2, ..., 10}, returning the size of each subset, is not injective because different subsets can have the same cardinality (e.g., {1} and {2} both have cardinality 1). It is not surjective because not all possible positive integers are achievable as cardinalities; specifically, numbers greater than 10 cannot be in the range. Thus, it lacks both injectivity and surjectivity despite representing a potentially large total number of subsets, evidenced by cardinalities ranging from 0 to 10, omitting integers outside this range .

You might also like