WIX1001 Computing Mathematics 1
Tutorial 5: Functions - Complete Solutions
Question 1
Given: Function f with Domain P = {−2, −1, 0, 1, 2}, Codomain Q = {1, 2, 3, 4, 5}, and rule f(x)
= 5 − x²
(i) Mapping diagram and range
First, let's calculate f(x) for each element in P:
f(−2) = 5 − (−2)² = 5 − 4 = 1
f(−1) = 5 − (−1)² = 5 − 1 = 4
f(0) = 5 − (0)² = 5 − 0 = 5
f(1) = 5 − (1)² = 5 − 1 = 4
f(2) = 5 − (2)² = 5 − 4 = 1
Mapping diagram:
P = {−2, −1, 0, 1, 2} → Q = {1, 2, 3, 4, 5}
−2 → 1
−1 → 4
0 → 5
1 → 4
2 → 1
Range of f = {1, 4, 5}
(ii) Properties of f : P → Q
Injective (One-to-one): NO
f(−2) = f(2) = 1 and f(−1) = f(1) = 4
Since different inputs map to the same output, f is not injective
Surjective (Onto): NO
Range = {1, 4, 5} ≠ Codomain = {1, 2, 3, 4, 5}
Elements 2 and 3 in the codomain are not mapped to by any element in the domain
Bijective: NO
Since f is neither injective nor surjective, it cannot be bijective
Therefore: f is non-injective and non-surjective
(iii) Invertibility
f is NOT invertible because it is not bijective. A function must be bijective to have an inverse.
(iv) New range for f(x) = ⌊x/5⌋ + 1
Calculating for each element in P:
f(−2) = ⌊−2/5⌋ + 1 = ⌊−0.4⌋ + 1 = −1 + 1 = 0
f(−1) = ⌊−1/5⌋ + 1 = ⌊−0.2⌋ + 1 = −1 + 1 = 0
f(0) = ⌊0/5⌋ + 1 = 0 + 1 = 1
f(1) = ⌊1/5⌋ + 1 = ⌊0.2⌋ + 1 = 0 + 1 = 1
f(2) = ⌊2/5⌋ + 1 = ⌊0.4⌋ + 1 = 0 + 1 = 1
New range = {0, 1}
Question 2
Given: P = {1, 2} and Q = {a, b}
Since |P| = 2 and |Q| = 2, there are 2² = 4 possible functions from P to Q.
All possible functions:
1. f₁: f₁(1) = a, f₁(2) = a
o Mapping: {(1,a), (2,a)}
o Not injective (both elements map to a), Not surjective (b not in range)
2. f₂: f₂(1) = a, f₂(2) = b
o Mapping: {(1,a), (2,b)}
o Injective ✓, Surjective ✓, Bijective ✓
3. f₃: f₃(1) = b, f₃(2) = a
o Mapping: {(1,b), (2,a)}
o Injective ✓, Surjective ✓, Bijective ✓
4. f₄: f₄(1) = b, f₄(2) = b
o Mapping: {(1,b), (2,b)}
o Not injective (both elements map to b), Not surjective (a not in range)
Question 3
Given: f = {(a,b), (b,a), (c,b)} from X = {a,b,c} to X
(i) Find f∘f and f∘f∘f
f∘f (f composed with f):
(f∘f)(a) = f(f(a)) = f(b) = a
(f∘f)(b) = f(f(b)) = f(a) = b
(f∘f)(c) = f(f(c)) = f(b) = a
f∘f = {(a,a), (b,b), (c,a)}
f∘f∘f = f∘(f∘f):
(f∘f∘f)(a) = f((f∘f)(a)) = f(a) = b
(f∘f∘f)(b) = f((f∘f)(b)) = f(b) = a
(f∘f∘f)(c) = f((f∘f)(c)) = f(a) = b
f∘f∘f = {(a,b), (b,a), (c,b)} = f
(ii) Find f⁹ and f⁶²³
Notice that f³ = f, which means f has period 3.
For f⁹: Since 9 = 3×3, f⁹ = f³ˣ³ = f f⁹ = {(a,b), (b,a), (c,b)}
For f⁶²³: 623 = 3×207 + 2, so f⁶²³ = f² We need f²:
f²(a) = f(f(a)) = f(b) = a
f²(b) = f(f(b)) = f(a) = b
f²(c) = f(f(c)) = f(b) = a
f⁶²³ = f² = {(a,a), (b,b), (c,a)}
Question 4
Find these values:
(i) ⌈1.2⌉ = 2
(Ceiling function: smallest integer ≥ 1.2)
(ii) ⌊−9.7⌋ = −10
(Floor function: largest integer ≤ −9.7)
(iii) ⌈−3.3⌉ = −3
(Ceiling function: smallest integer ≥ −3.3)
(iv) ⌊1/2 + ⌈5/3⌉ − ⌊−1/10⌋⌋
Step by step:
⌈5/3⌉ = ⌈1.667⌉ = 2
⌊−1/10⌋ = ⌊−0.1⌋ = −1
⌊3.5⌋ = 3
1/2 + 2 − (−1) = 0.5 + 2 + 1 = 3.5
Answer: 3
Question 5
Given: X = {x | x ∈ Z and x² < 9}, Y = {y | y ∈ W and y² < 9}
(i) List elements of X and Y
For X: x² < 9 means −3 < x < 3, and x ∈ Z X = {−2, −1, 0, 1, 2}
For Y: y² < 9 means 0 ≤ y < 3, and y ∈ W (whole numbers) Y = {0, 1, 2}
(ii) Cardinalities
|X| = 5, |Y| = 3
(iii) Number of functions from X to Y
Each element in X can map to any element in Y. Number of functions = |Y|^|X| = 3⁵ = 243
(iv) Number of bijective functions from X to Y
Since |X| = 5 ≠ 3 = |Y|, no bijective functions exist. Number of bijective functions = 0
Question 6
Find inverse functions:
(i) f(x) = (x−3)², x ≥ 3
Let y = (x−3)² √y = x−3 (taking positive root since x ≥ 3) x = √y + 3
f⁻¹(x) = √x + 3, x ≥ 0
(ii) f(x) = (x+1)/(x+2)
Let y = (x+1)/(x+2) y(x+2) = x+1 yx + 2y = x + 1 yx − x = 1 − 2y x(y−1) = 1 − 2y x =
(1−2y)/(y−1) = (2y−1)/(1−y)
f⁻¹(x) = (2x−1)/(1−x), x ≠ 1
(iii) f(x) = (x+1)², x ≥ −1
Let y = (x+1)² √y = x+1 (taking positive root since x ≥ −1) x = √y − 1
f⁻¹(x) = √x − 1, x ≥ 0
Question 7
Given: f(x) = 2x + 3, g(x) = −x² + 1
Composite functions:
(f∘g)(x) = f(g(x)) = f(−x² + 1) = 2(−x² + 1) + 3 = −2x² + 2 + 3 = −2x² + 5
(g∘f)(x) = g(f(x)) = g(2x + 3) = −(2x + 3)² + 1 = −(4x² + 12x + 9) + 1 = −4x² − 12x − 8
(f∘f)(x) = f(f(x)) = f(2x + 3) = 2(2x + 3) + 3 = 4x + 6 + 3 = 4x + 9
(g∘g)(x) = g(g(x)) = g(−x² + 1) = −(−x² + 1)² + 1 = −(x⁴ − 2x² + 1) + 1 = −x⁴ + 2x² − 1 + 1 = −x⁴
+ 2x²
Question 8
State the function for the graph below (Figure 1).
Solution:
Looking at the graph, I can identify the following key features:
Analysis of the graph:
1. There are two distinct points plotted:
o A filled (solid) circle at (0, 0.5)
o An open (hollow) circle at (0, 1.0)
2. There are horizontal line segments:
o A horizontal line from x = -2 to x = 0 at y = 0
o A horizontal line from x = 0 to x = 2 at y = 1
3. The graph shows a discontinuous function with a jump at x = 0
Function definition:
This is a piecewise function that can be written as:
f(x) = { 0, if -2 ≤ x < 0 { 0.5, if x = 0
{ 1, if 0 < x ≤ 2
Alternative notation: f(x) = { 0, if -2 ≤ x < 0 { 0.5, if x = 0 { 1, if 0 < x ≤ 2
Explanation:
For all x values from -2 to 0 (not including 0), f(x) = 0
At exactly x = 0, f(x) = 0.5 (shown by the filled circle)
For all x values from 0 to 2 (not including 0), f(x) = 1
The open circle at (0, 1) indicates that f(0) ≠ 1
The filled circle at (0, 0.5) indicates that f(0) = 0.5
Domain: [-2, 2] Range: {0, 0.5, 1}
This function has a jump discontinuity at x = 0, where the left-hand limit is 0, the right-hand
limit is 1, but the actual function value is 0.5.
Question 9
Given: f: X → X where X = {0,1,2,3,4} and f(x) = 4x mod 5
Calculate f(x) for each x ∈ X:
f(0) = (4×0) mod 5 = 0
f(1) = (4×1) mod 5 = 4
f(2) = (4×2) mod 5 = 8 mod 5 = 3
f(3) = (4×3) mod 5 = 12 mod 5 = 2
f(4) = (4×4) mod 5 = 16 mod 5 = 1
f = {(0,0), (1,4), (2,3), (3,2), (4,1)}
Arrow diagram:
0 → 0
1 → 4
2 → 3
3 → 2
4 → 1
Properties:
Is f injective? YES - Each element in the domain maps to a different element in the codomain.
Is f surjective? YES - Every element in the codomain {0,1,2,3,4} is mapped to by some element
in the domain.
Therefore, f is bijective.