Discrete StructureUnit 98 min read
Number Theory: Divisibility, Primes, Congruences & Cryptography
Unit 9 of Discrete Structure covers divisibility rules, prime numbers, greatest common divisors (GCD), modular arithmetic, and applications in cryptography—essential for secure transactions, error detection, and algorithm design.
Key Concepts and Definitions
Divisibility and Divisors
Definition: An integer is divisible by an integer (where ) if there exists an integer such that . We write this as .
Example: is divisible by because . Here, .
Divisors of a Number: The integers such that are called divisors of . For example, the divisors of are .
Prime Numbers
Definition: A prime number is a natural number greater than that has no positive divisors other than and itself.
Example: is prime because its only divisors are and . is not prime because it is divisible by .
Fundamental Theorem of Arithmetic: Every integer greater than can be represented uniquely as a product of prime numbers, up to the order of the factors.
Example: .
Greatest Common Divisor (GCD) and Least Common Multiple (LCM)
GCD: The greatest common divisor of two integers and is the largest integer that divides both and . It is denoted by .
Example: .
LCM: The least common multiple of two integers and is the smallest positive integer that is divisible by both and . It is denoted by .
Example: .
Relationship Between GCD and LCM:
Modular Arithmetic
Definition: For integers and (with ), modulo is the remainder when is divided by . It is denoted by .
Example: because .
Congruence: Two integers and are congruent modulo if . We write this as .
Example: because .
Euclidean Algorithm
The Euclidean algorithm is an efficient method to compute the GCD of two numbers. It is based on the principle that .
Example: Compute :
- Thus, .
Applications in Cryptography
Number theory is foundational in cryptography, particularly in public-key cryptosystems like RSA. RSA relies on the difficulty of factoring large integers into primes and properties of modular arithmetic.
In the Real World
1. eSewa and Khalti: Secure Transactions
Both eSewa and Khalti use cryptographic algorithms based on number theory to secure transactions. When you transfer money or pay bills, the system uses modular arithmetic to encrypt your data, ensuring that only the intended recipient can decode it. For example, when you send money to a friend, the transaction ID and amount are hashed using a one-way function (often involving modular arithmetic) to create a unique fingerprint. This ensures that the transaction cannot be altered or forged.
2. Ncell and NTC: Error Detection in Data Transmission
Ncell and NTC use checksums and cyclic redundancy checks (CRC) to detect errors in data transmission. These techniques rely on modular arithmetic to verify the integrity of transmitted data. For instance, when you send an SMS or make a call, the data is divided into packets, and each packet is checked using a polynomial division in modular arithmetic. If the checksum does not match, the data is retransmitted, ensuring error-free communication.
3. NEPSE: Stock Market Index Calculations
The Nepal Stock Exchange (NEPSE) uses divisibility and GCD concepts to adjust stock indices. For example, when a company splits its shares (e.g., a 1:2 split), the total number of shares doubles, but the total market capitalization remains the same. To adjust the index, NEPSE uses divisibility rules to ensure the index reflects the actual value of the market accurately.
Visualizing Key Concepts
Divisibility and Prime Factorization
This diagram shows the prime factorization of 12, where the final box represents the unique product of primes.
Euclidean Algorithm Steps
flowchart TD
A["Start with 48 and 18"] --> B["48 = 2 × 18 + 12"]
B --> C["Now find gcd(18, 12)"]
C --> D["18 = 1 × 12 + 6"]
D --> E["Now find gcd(12, 6)"]
E --> F["12 = 2 × 6 + 0"]
F --> G["gcd is 6"]This flowchart traces the steps of the Euclidean algorithm to find .
Modular Arithmetic Example
Consider :
- Divide 23 by 5: quotient = 4, remainder = 3.
- Thus, .
Worked Examples
Example 1: Divisibility and GCD
Problem: Find using the Euclidean algorithm.
Solution:
- Thus, .
Real-world tie-in: Imagine a bank like Nabil Bank processing loan repayments. If two loan amounts are 56,000 and 98,000, the GCD helps determine the largest possible equal installment that can be used for both loans without leaving a remainder.
Example 2: Congruence and Cryptography
Problem: Solve for in the congruence .
Solution:
- Rewrite the congruence: is divisible by 9.
- Simplify: .
- Divide by the GCD of 3 and 9, which is 3: .
- Thus, .
- The solutions are .
Real-world tie-in: In RSA encryption, solving such congruences helps decrypt messages. For example, if Pathao uses a public key to encrypt a delivery confirmation code, the recipient (the delivery person) uses their private key (derived from modular arithmetic) to decode it.
Comparison Table: GCD vs. LCM
| Feature | GCD (Greatest Common Divisor) | LCM (Least Common Multiple) |
|---|---|---|
| Definition | Largest number dividing both inputs | Smallest number divisible by both inputs |
| Example | ||
| Use Case | Simplifying fractions | Finding common denominators |
| Algorithm | Euclidean algorithm | Using prime factorization |
Advantages and Disadvantages
Divisibility Rules
Advantages:
- Quickly determine if a number is divisible by another without performing full division.
- Useful in simplifying fractions and solving equations.
Disadvantages:
- Rules are limited to specific divisors (e.g., 2, 3, 5, 9).
- Not applicable to all numbers or operations.
Prime Numbers
Advantages:
- Fundamental in cryptography (e.g., RSA encryption).
- Used in generating unique identifiers (e.g., serial numbers).
Disadvantages:
- Testing primality for very large numbers is computationally intensive.
- No known simple formula to generate primes.
Modular Arithmetic
Advantages:
- Efficient in computer science (e.g., hashing, error detection).
- Forms the basis of many cryptographic protocols.
Disadvantages:
- Can be abstract and difficult to visualize for beginners.
- Misapplication can lead to incorrect results in algorithms.
Exam Tip
For exams, focus on:
- Definitions: Know the precise definitions of divisibility, primes, GCD, LCM, and congruence.
- Algorithms: Be able to apply the Euclidean algorithm to find GCDs and solve congruences.
- Proofs: Practice proving properties using mathematical induction or contradiction.
- Applications: Understand how these concepts apply to real-world scenarios like cryptography, error detection, and financial calculations.
- Visualization: Draw diagrams for prime factorization, Euclidean steps, and modular arithmetic to aid understanding.
Common Pitfalls:
- Misapplying divisibility rules (e.g., confusing divisibility by 2 and 3).
- Forgetting to consider negative divisors when listing all divisors of a number.
- Incorrectly solving congruences by not simplifying properly.
Based on the TU BIM syllabus for Discrete Structure (IT235), unit 9.
Discussion
Loading…