IT235 Discrete Structure

Discrete StructureUnit 37 min read

Functions, Induction: Definitions, Proofs & Real-World Uses

Unit 3 of Discrete Structure covers functions (types, properties, and representations) and mathematical induction (weak vs. strong, proofs, and recursive algorithms), with visual proofs, real-world examples from Nepali apps (e.g., eSewa’s one-to-one user mapping), and exam-focused problem-solving strategies.

TAKEAWAYS:

  • Functions map inputs to outputs uniquely, and their properties (injective, surjective, bijective) determine reversibility and uniqueness.
  • Mathematical induction proves statements for all natural numbers by verifying a base case and an inductive step (weak) or assuming all prior cases hold (strong).
  • Recursive functions (e.g., power(a, n)) rely on induction to prove correctness, breaking problems into smaller subproblems.
  • Real-world ties: eSewa’s user-ID mapping (bijective), Daraz’s order-processing queue (injective), and Ncell’s billing cycles (recurrence relations).
  • Exam traps: Confusing onto (surjective) with one-to-one (injective), misapplying induction hypotheses, or ignoring domain restrictions.
  • Visual proofs: Truth tables for logical statements, step-by-step induction trees, and function property diagrams.

1. Functions: Definitions and Properties

Functions are the backbone of discrete mathematics, modeling relationships where each input has exactly one output. They appear in algorithms, databases, and real-world systems like user authentication (e.g., eSewa’s login system).

1.1 Core Definitions

A function assigns each element (domain) to one and only one element (codomain).

  • Notation: or .
  • Example: maps integers to non-negative integers.
-3-2-11232468xyf(x) = x²(-2, 4)(0, 0)(2, 4)
Example: f(x) = x² mapping integers to non-negative integers (domain: -2, 0, 2 → codomain: 4, 0, 4)

1.2 Types of Functions

Type Definition Example Real-World Analogy
Injective (One-to-One) (no two inputs share an output). eSewa’s user-ID mapping (unique IDs).
Surjective (Onto) Every has a pre-image in (outputs cover ). via . Daraz’s order system (all orders processed).
Bijective Both injective and surjective (perfect pairing). via . Ncell’s subscriber-to-tariff assignment.

1.3 Worked Example: Proving Function Properties

Question: Determine if defined by is injective, surjective, or bijective. Solution:

  1. Injective?
    • Test and . Since , is not injective.
  2. Surjective?
    • Codomain includes negative numbers, but . Thus, not surjective.
  3. Bijective? No (requires both injective and surjective).

Real-World Tie: Daraz’s order queue is injective (each order ID maps to one unique order), but not surjective (not all possible IDs are used).


2. Mathematical Induction

Induction proves statements for all natural numbers by leveraging a "domino effect": if the first piece stands (base case) and each piece topples the next (inductive step), the whole sequence falls.

2.1 Weak vs. Strong Induction

Aspect Weak Induction Strong Induction
Hypothesis Assume is true. Assume are true.
Use Case Simple recursive relations (e.g., ). Complex dependencies (e.g., Fibonacci).
Example Prove . Prove is prime for .

2.2 Proof Structure

  1. Base Case: Verify (or ).
  2. Inductive Step: Assume holds, then prove .
  3. Conclusion: By induction, holds for all .

Visual Proof Trace:

2.3 Worked Example: Recursive Algorithm Proof

Question: Prove the correctness of power(a, n) using induction.

int power(int a, int n) {
    if (n == 0) return 1;
    else return a * power(a, n - 1);
}

Solution:

  1. Base Case (): . ✅
  2. Inductive Step:
    • Assume holds.
    • Then, . ✅
  3. Conclusion: By induction, for all .

Real-World Tie: Ncell’s billing cycles use recurrence relations (e.g., "this month’s charge = last month’s charge + new usage"). Induction proves the total cost formula works for any number of months.


3. Applications in Nepali Contexts

System Function Concept Induction Use
eSewa Bijective user-ID to account mapping. Proving no duplicate IDs exist.
Khalti Injective transaction-ID assignment. Ensuring each payment is unique.
Daraz Orders Surjective order-processing queue. Proving all orders are eventually fulfilled.
NEPSE Stock price functions (time → value). Predicting trends via recursive models.

4. Common Pitfalls and Exam Tips

4.1 Function Misconceptions

  • Not injective ≠ not a function: A function can fail to be injective (e.g., ) but still be valid.
  • Surjective ≠ onto in all contexts: In computer science, "onto" often implies the codomain equals the range (e.g., hashing functions).

4.2 Induction Mistakes

  • Forgetting the base case: Always verify or .
  • Weak vs. strong confusion: Use strong induction for statements like "every number ≥ 8 is a sum of 3’s and 5’s."
  • Inductive hypothesis misuse: Only use to prove ; never assume holds.

4.3 Exam Strategy

  1. For function questions:
    • Draw a mapping diagram (like the Mermaid example above).
    • Test specific values (e.g., , ) to check injectivity/surjectivity.
  2. For induction proofs:
    • Write the base case first.
    • Clearly state the inductive hypothesis before using it.
    • Use bullet points for each step (examiners love clarity).

5. Practice Problems (Exam-Style)

  1. Functions:

    • Let be . Is bijective? Justify.
    • Define a function that is injective but not surjective.
  2. Induction:

    • Prove for all .
    • Show that is divisible by 3 for all .
  3. Real-World:

    • Pathao’s ride-matching system uses injective functions (each ride ID maps to one driver-passenger pair). Explain why surjectivity isn’t required here.

Exam Tip

  • Functions: Always pair definitions with visual mappings (even in text exams, describe them clearly).
  • Induction: If stuck, start with small values (e.g., ) to spot patterns.
  • Recursive proofs: Trace the algorithm step-by-step (like the power example) to see the induction in action.
  • Nepali context: Relate proofs to local systems (e.g., "This is like how eSewa verifies your ID before login"). Examiners appreciate relevance!

Based on the TU BITM syllabus for Discrete Structure (IT235), unit 3.

Discussion

Loading…