Discrete StructureUnit 18 min read
Functions & Relations: Definitions, Types, and Applications
Unit 1 of Discrete Structure covers functions (types, operations, and properties), relations (types, closures, and Hasse diagrams), and their real-world applications in computer science, with emphasis on injective/surjective/bijective functions, relation matrices, and set representations.
1. Introduction to Functions
1.1 Definition and Notation
A function maps each element of set (domain) to exactly one element in set (codomain).
- Notation: means is the image of under .
- Example: maps integers to integers.
1.2 Types of Functions
| Type | Definition | Example | Injective? | Surjective? | Bijective? |
|---|---|---|---|---|---|
| Injective | (one-to-one) | Yes | No | No | |
| Surjective | Every has a pre-image in (onto) | Yes (if domain is ) | Yes | Yes (if domain is ) | |
| Bijective | Both injective and surjective (one-to-one and onto) | Yes | Yes | Yes | |
| Constant | Always returns the same output | No | No | No | |
| Identity | Yes | Yes | Yes |
Worked Example: Determine if is injective/surjective/bijective.
- Injective? Yes, because .
- Surjective? Yes, because for any , .
- Bijective? Yes (both injective and surjective).
1.3 Function Operations
- Sum: Example:
- Product:
- Composition: Example:
1.4 Special Functions
| Function | Definition | Example |
|---|---|---|
| Floor | = greatest integer | |
| Ceiling | = smallest integer | |
| Boolean | Maps to |
Worked Example: Find and .
- (greatest integer )
- (smallest integer )
2. Relations and Their Properties
2.1 Definition of a Relation
A relation from set to is a subset of .
- Example: on .
2.2 Types of Relations
| Property | Definition | Example |
|---|---|---|
| Reflexive | for all | |
| Symmetric | ||
| Transitive | and | |
| Antisymmetric | and | (no ) |
2.3 Relation Closures
| Closure | Definition | Example |
|---|---|---|
| Reflexive | Add for all | |
| Symmetric | Add if | |
| Transitive | Add if and |
Worked Example: Find the symmetric closure of .
- Add missing symmetric pairs: and .
- Symmetric closure: .
2.4 Matrix Representation of Relations
A relation on can be represented as a zero-one matrix:
a b c
a 1 1 0
b 0 0 1
c 1 0 0
- Example: .
2.5 Hasse Diagrams
A Hasse diagram visually represents a partially ordered set (poset) by omitting reflexive and transitive edges. Worked Example: Draw the Hasse diagram for the divisible relation on .
32
/ \
16 8
/ /
2 1
\ /
5
- Maximal element: 32 (no element above it).
- Minimal element: 5 (no element below it).
- Greatest element: 32 (divisible by all others).
- Least element: 1 (divides all others).
3. Applications in Computer Science
3.1 Functions in Algorithms
- Injective functions ensure unique keys in databases.
- Bijective functions enable encryption/decryption (e.g., Caesar cipher).
- Recursive functions define self-similar structures (e.g., fractals).
3.2 Relations in Databases
- Foreign keys model relations between tables.
- Equivalence relations define partitioning in clustering.
3.3 Graph Theory
- Adjacency matrices represent relations between nodes.
- Hasse diagrams model hierarchical data (e.g., file systems).
Exam Tip
Common Pitfalls & Strategies
✅ For functions:
- Always check domain and codomain before classifying (injective/surjective).
- Composition is not commutative: .
- Floor/ceiling questions often test integer arithmetic.
✅ For relations:
- Closures require systematic addition of missing pairs.
- Hasse diagrams must omit reflexive/transitive edges to avoid clutter.
- Matrix representation is useful for automata theory (next unit).
❌ Avoid:
- Assuming a function is bijective without proof.
- Forgetting to include all required pairs in closures.
- Misidentifying maximal vs. greatest elements in posets.
High-Scoring Techniques
For function proofs:
- Use definition-based reasoning (e.g., "Assume , then...").
- Draw mapping diagrams for clarity.
For relations:
- List all possible pairs before computing closures.
- Label Hasse diagrams clearly (e.g., "divisible by").
For past exam questions:
- Set representation: (multiples of 3 not exceeding 6 in ).
- Recurrence relations (Unit 4) often appear in function-related problems.
End of Note
Based on the TU BSc CSIT syllabus for Discrete Structure (CSC165), unit 1.
Discussion
Loading…