University of The People
Math 1302
Matn Assignment Unit 2
Instructor:
February, 19, 2025
1. We have a function f: Z \rightarrow Z defined as f(n) = {n+3 \ if \ n \ is \ odd \
brace n-5 \ if \ n \ is \ even} . Find whether the function is injective and surjective.
What would be the inverse of this function?
Injective and Surjective Function
To determine if the function f: Z → Z is injective (one-to-one) and surjective (onto),
we need to analyze its properties.
Injective (One-to-One)
A function is injected if each point in the map matches a unique symbol in the code
space. In other words, two different elements in the field will not correspond to the
same element in the field.
We can compare the performance results of different devices to evaluate the shot.
Let's assume that f(n) = {n+3 (if n is odd), n-5 (if n is even)}.
We can see that f(n) = n + 3 for odd number n and f(n) = n-5 for number n. Since the
output is different for odd and even inputs, the function is injected.
Surjective (Onto)
A function is surjective if every element in the codomain has a pre-image in the
domain. In other words, every element in the codomain is mapped to by at least one
element in the domain.
To check for surjectivity, we need to determine if every integer in the codomain Z can
be obtained as the output of the function f for some input n.
For the function f(n) = {n+3 if n is odd, n-5 if n is even}, we can see that by choosing
appropriate inputs, we can obtain any integer in the codomain Z. Therefore, the
function is surjective.
Inverse of the Function
The inverse of a function f, denoted as f^(-1), is a function that "undoes" the action of
f. To find the inverse of f, we need to swap the roles of the domain and codomain and
solve for the original input.
For the function f(n) = {n+3 if n is odd, n-5 if n is even}, the inverse function f^(-1)
can be found by interchanging the roles of n+3 and n-5 and solving for n. The inverse
function is as follows:
f^(-1)(m) = {m-3 if m is odd, m+5 if m is even}
This function undoes the action of f, and applying f^(-1) to the output of f will give us
the original input.
2. Consider three sets A, B, and C each with three elements, and define a
function ‘f’ from set A to B and a function ‘g’ from set B to C with the mapping
of the elements you specify. After defining ‘f’ and ‘g’, discuss the composition of
functions fog and gof on the sets A, B, and C that you have defined. Can both fog
and gof be defined for the sets you have considered? Are they equal? Provide
proof to support your answer.
Composition of Functions
Let's consider three sets A, B, and C, each with three elements. We define a function
'f' from set A toB and a function 'g' from set B to C with the following mappings:
Function f: A → B
f(1) = x
f(2) = y
f(3) = z
Function g: B → C
g(x) = p
g(y) = q
g(z) = r
Composition of Functions fog and gof
The composition of functions fog and gof is defined as follows:
fog: A → C
(fog)(1) = g(f(1))
(fog)(2) = g(f(2))
(fog)(3) = g(f(3))
gof: B → B
(gof)(x) = f(g(x))
(gof)(y) = f(g(y))
(gof)(z) = f(g(z))
Can Both fog and gof be Defined?
Both fog and gof can be defined for the sets A, B, and C we have considered, given
the mappings of functions f and g.
Are They Equal?
In general, fog and gof are not necessarily equal. However, in some cases, they might
be equal. To prove whether they are equal, we need to compare the results of fog and
gof for each element in the sets A, B, and C.
Proof
To prove whether fog and gof are equal, we need to compare the results of fog and
gof for each element in the sets A, B, and C. If for every element x in A, we have
(fog)(x) = (gof)(x), then fog and gof are equal. Otherwise, they are not equal.
This comparison will provide the proof of whether fog and gof are equal for the
specific mappings of functions f and g.
3. There are 5 students; Ani, Leon, Linh, Liam, and Abdul with scores in
computer science as 75, 60, 85, 95, and 60 respectively. They are graded by the
University as B, C, B+, A, and C respectively. Define the mappings from students
to marks and marks to grades explicitly. What are the domains and ranges of the
functions? Can you make a composite function out of this? If yes, make the
composite function and find if the composition of functions is commutative.
Explain the reason.
Mappings from Students to Marks and Marks to Grades
The mappings from students to marks and marks to grades can be defined as follows:
Let M = {60, 75, 85, 95} be the set of marks, and let S = {Ani, Leon, Linh, Liam,
Abdul} be the set of students. The functions m(Ani) = 75, m(Leon) = 60, m(Linh) =
85, m(Liam) = 95, and m(Abdul) = 60 define the function m: S → M. Define the
function g: M → G as follows: G = {C, B, B+, A} is the set of grades; g(60) = C,
g(75)
= B, g(85) = B+, and g(95) = A. Next, m and g, respectively, provide the mappings
from students to marks and marks to grades. The domain of m is S and the range of
m is M. g has a range of G and a domain of M. This can be turned into a composite
function by defining the function h: S → G such that for every s in S, h(s) = g(m(s)).
Then, h(Leon) = g(m(Leon)) = g(60) = C, h(Linh) = g(m(Linh)) = g(85) = B+,
h(Liam)
= g(m(Liam)) = g(95) = A, and h(Abdul) = g(m(Abdul)) = g(60) = C. Given that for
every s in S, h(m(s)) = g(m(m(s)) = g(m(s)) = h(s), the composition of functions is
commutative.
4. Explain the following concepts using relevant examples: sequence, recursive
function, closed formula for the sequence, arithmetic sequence, and geometric
sequence. Ensure that you do not take the same examples discussed in the
textbooks and online resources.
Sequence
A sequence is a list of numbers in a specific order. For example, consider the
sequence of prime numbers: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, ... Each number in the
sequence follows the previous one and has a specific position.
Recursive Function
A recursive function is a function that calls itself in order to solve a problem. For
example, the Fibonacci sequence can be calculated using a recursive function. The
function calls itself to find the sum of the previous two numbers in the sequence.
Closed Formula for the Sequence
A closed formula for a sequence is an equation that directly gives the value of the nth
term without needing the previous terms. For example, the closed formula for the
Fibonacci sequence is: [ F(n) = \frac{1}{\sqrt{5}} \left( \left( \frac{1 + \sqrt{5}}{2} \
right)^n - \left( \frac{1 - \sqrt{5}}{2} \right)^n \right) ]
Arithmetic Sequence
An arithmetic sequence is a sequence of numbers in which the difference between any
two consecutive terms is constant. For example, 3, 6, 9, 12, 15, ... is an arithmetic
sequence with a common difference of 3.
Geometric Sequence
A geometric sequence is a sequence of numbers in which each term after the first is
found by multiplying the previous term by a fixed, non-zero number called the
common ratio. For example, 2, 6, 18, 54, 162, ... is a geometric sequence with a
common ratio of 3.
5. The sequence 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12...... can be generated by a
closed formula. Find the formula and the next four terms of the sequence.
ii. Find the next three terms of the series, provide a closed formula and calculate
the sum to the first n terms for the following series: 6+36+216+……………….
iii. Find the next three terms of the series, provide a closed formula, and
calculate the sum to the first n terms for the following series: 21+24+27+
……………….
iv.
Sequence and Series Problems
i. Generating the Sequence
The given sequence 5, 6, 6, 7, 8, 8, 9, 10, 10, 11, 12, 12... can be generated by the
following closed formula:
If n is even: (a_n = 4 + \frac{n}{2})
If n is odd: (a_n = 5 + \frac{n-1}{2})
The next four terms of the sequence are:
1.13
2.14
3.14
4.15
ii. Series with Closed Formula and Sum Calculation
For the series 6+36+216+…, the closed formula is (a_n = 6 \times 6^{n-1}). To find
the next three terms, we can calculate (a_5), (a_6), and (a_7) using the formula:
1.(a_5 = 6 \times 6^{5-1} = 6 \times 6^4 = 6 \times 1296 = 7776)
2.(a_6 = 6 \times 6^{6-1} = 6 \times 6^5 = 6 \times 7776 = 46656)
3.(a_7 = 6 \times 6^{7-1} = 6 \times 6^6 = 6 \times 46656 = 279936)
The sum to the first n terms can be calculated using the formula for the sum of a
geometric series:
(S_n = \frac{a_1(1-r^n)}{1-r}), where (a_1) is the first term, (r) is the common ratio,
and (n) is the number of terms.
iii. Series with Closed Formula and Sum Calculation
For the series 21+24+27+…, the closed formula is (a_n = 21 + 3(n-1)). To find the
next three terms, we can calculate (a_4), (a_5), and (a_6) using the formula:
1.(a_4 = 21 + 3(4-1) = 21 + 3 \times 3 = 21 + 9 = 30)
2.(a_5 = 21 + 3(5-1) = 21 + 3 \times 4 = 21 + 12 = 33)
3.(a_6 = 21 + 3(6-1) = 21 + 3 \times 5 = 21 + 15 = 36)
The sum to the first n terms can be calculated using the formula for the sum of an
arithmetic series:
(S_n = \frac{n}{2}(a_1 + a_n)), where (a_1) is the first term, (a_n) is the nth term,
and (n) is the number of terms.