Notes/UNB/Year 4/Semester 2/CS2333/2024-01-19.md

61 lines
2.5 KiB
Markdown
Raw Normal View History

2024-01-22 10:12:48 -04:00
Lecture Topic: Functions & Relations
When a function is onto, it means that the entire co-domain of a function is the range of the function
Proving a function is not onto:
Just prove for any element b in the co-domain B and show that b cannot be equal to f(a) for any a in the domain.
Example: $g: \mathbb{R} \rightarrow \mathbb{R}, g(x) = x^2 + 10$ is not onto
Proof:
For example, choose the element $-1$ from the co-domain $\mathbb{R}$
Consider any domain element $a$
The function will square $a$, and $a^2 \geq 0$ (because no squares are negative reals)
Then $a^2 + 10 \geq 10$, so this means that $-1$ is not in the co-domain
$\therefore$ The function is not onto
You can also use a proof by contradiction by saying that:
$g(a) = -1$
$\therefore a^2 + 10 = -1$
$\therefore a^2 = -11$
Squares of a real number cannot be negative, so the function is not onto
A function is not always numbers:
Example: Favourite UNB Course : S -> C
Where S is all students and C is all courses
What would have to be true for this to be one to one or onto?:
- One to one:
- Onto:
# Relations:
A binary relation R on two sets A and B is a subset of $A \times B$
- e.g. S = all students, C = all students, s is any given student, c is any given course
- Relation: HasTaken: for (s, c) s has taken c
- Relation Aplus: for (s,c) s got A+ in c
A relation can be between the same set, for example the set of A = {John, Jane, Bill, Sue, Mary, Betty}, we can define a relation that is the relationship between who loves who $A \times A$
- e.g. (John, Jane)
A binary relation $R \subseteq A \times A$ is also called an equivalence relation if the following conditions hold:
- reflexive: $\forall a \in A, (a,a) \in R$
- symmetric: $\forall a,b \in A, (a,b) \in R \rightarrow (b,a) \in R$
- transitive: $\forall a,b,c \in A, [(a,b) \in R \wedge (b,c) \in R] \rightarrow (a,c) \in R$
Example:
$G = \{(x,y) | x \in \mathbb{R}, y \in \mathbb{R}, x > y\}$
Is G reflexive? (Is is true that every real number is relation to itself)
No, because we can show that $(5,5) \notin \mathbb{R}$ because $5 \ngtr 5$
Is G symmetric? (Is it the case that whenever $(a,b) \in G, (b,a)$ will also be in G)
No, for example $(10,3) \in G$ because $10 > 3$ but $(3, 10) \notin G$ because $3 \ngtr 10$
Is G transitive? (Is it true that whenever (a,b) and (b,c) are in G, (a,c) will also be in G)
Yes, let a,b,c be any real numbers where $(a,b) \in G$ and $(b,c) \in G$
Since $(a,b) \in G$, we know that $a > b$
Since $(b,c) \in G$, we know that $b > c$
Then $a > b > c$, so that means that $a > c$, so also $(a,c) \in G$