ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Discrete Structures
    GE-167
    Progress0 / 67 topics
    Topics
    1. Mathematical Reasoning: Propositional and Predicate Logic2. Propositional Logic: Logical Operators3. Translations Between Symbolic Expressions and Formal English Expression4. Logical Equivalences5. Predicate Logic: Quantifiers6. Nested Quantification7. Equivalences in Predicate Logic8. Translations Between Symbolic Forms and Formal English9. Rules of Inference: Proof Methods and Strategies10. Direct Proof11. Proof by Contraposition12. Proof by Induction13. Proof by Implication14. Existence Proof15. Uniqueness Proofs16. Trivial Proofs17. Vacuous Proofs18. Sets: Notations and Set Operations19. Venn Diagrams20. Countable and Uncountable Sets21. Relations: Equivalence Relations and Partitions22. Partial Orderings23. Recurrence Relations24. Functions: Injective, Surjective, Bijective25. Special Types of Functions26. Function Composition27. Inverse Functions28. Recursive Functions29. Compositions30. Number Theory: Sequences and Series31. Counting: Inclusion and Exclusion Principle32. Pigeonhole Principle33. Permutations and Combinations34. Integers and Divisibility: Division Theorem35. Modular Arithmetic36. LCM and GCD37. Euclidean and Extended Euclidean Method38. Finding Solutions to Congruence39. Primes: Fundamental Theorem of Arithmetic40. Characterizations of Primes41. Mersenne Primes42. Induction: Weak Induction43. Strong Induction44. Recursion and Recurrences: Formulation of Recurrences45. Closed Formulas46. Counting: Product Rule and Sum Rule47. Principle of Inclusion-Exclusion48. Binomial Coefficients49. Pascal's Identity and Pascal’s Triangle50. Binomial Theorem51. Relations: Reflexive, Symmetric, Transitive, and Antisymmetric52. Equivalence Relations and Equivalence Classes53. Partial Orders54. Graph Theory: Terminologies55. Elements of Graph Theory56. Planar Graphs57. Graph Coloring58. Euler Graph59. Hamiltonian Path60. Rooted Trees61. Graph Traversals62. Handshaking Lemma and Corollary63. Special Families of Graphs64. Graph Isomorphism65. Planarity in Graphs66. Eulerian and Hamiltonian Graphs67. Trees in Graph Theory
    GE-167›LCM and GCD
    Discrete StructuresTopic 36 of 67

    LCM and GCD

    12 minread
    1,967words
    Intermediatelevel

    LCM and GCD

    The Least Common Multiple (LCM) and Greatest Common Divisor (GCD) are two fundamental concepts in number theory. They are used to find common multiples and divisors of integers, and they have important applications in solving problems related to divisibility, fractions, and many other areas of mathematics.


    1. Greatest Common Divisor (GCD)

    The GCD of two integers aaa and bbb is the largest positive integer that divides both aaa and bbb without leaving a remainder. The GCD is also known as the Greatest Common Factor (GCF).

    Formal Definition:

    The GCD of two integers aaa and bbb, denoted by gcd⁡(a,b)\gcd(a, b)gcd(a,b), is the largest integer ddd such that:

    d∣aandd∣bd \mid a \quad \text{and} \quad d \mid bd∣aandd∣b

    This means that ddd divides both aaa and bbb exactly.

    Example:

    Find gcd⁡(12,18)\gcd(12, 18)gcd(12,18):

    • The divisors of 12: 1,2,3,4,6,121, 2, 3, 4, 6, 121,2,3,4,6,12
    • The divisors of 18: 1,2,3,6,9,181, 2, 3, 6, 9, 181,2,3,6,9,18

    The common divisors of 12 and 18 are 1,2,3,61, 2, 3, 61,2,3,6, and the greatest of these is 6. Therefore:

    gcd⁡(12,18)=6\gcd(12, 18) = 6gcd(12,18)=6

    Properties of GCD:

    • Commutative: gcd⁡(a,b)=gcd⁡(b,a)\gcd(a, b) = \gcd(b, a)gcd(a,b)=gcd(b,a)
    • Associative: gcd⁡(a,gcd⁡(b,c))=gcd⁡(gcd⁡(a,b),c)\gcd(a, \gcd(b, c)) = \gcd(\gcd(a, b), c)gcd(a,gcd(b,c))=gcd(gcd(a,b),c)
    • Distributive over LCM: gcd⁡(a,b)×lcm(a,b)=∣a×b∣\gcd(a, b) \times \text{lcm}(a, b) = |a \times b|gcd(a,b)×lcm(a,b)=∣a×b∣

    2. Least Common Multiple (LCM)

    The LCM of two integers aaa and bbb is the smallest positive integer that is divisible by both aaa and bbb. In other words, it is the smallest number that both aaa and bbb divide into exactly.

    Formal Definition:

    The LCM of two integers aaa and bbb, denoted by lcm(a,b)\text{lcm}(a, b)lcm(a,b), is the smallest integer mmm such that:

    a∣mandb∣ma \mid m \quad \text{and} \quad b \mid ma∣mandb∣m

    This means that mmm is divisible by both aaa and bbb.

    Example:

    Find lcm(12,18)\text{lcm}(12, 18)lcm(12,18):

    • The multiples of 12 are 12,24,36,48,60,…12, 24, 36, 48, 60, \dots12,24,36,48,60,…
    • The multiples of 18 are 18,36,54,72,…18, 36, 54, 72, \dots18,36,54,72,…

    The smallest common multiple of 12 and 18 is 36. Therefore:

    lcm(12,18)=36\text{lcm}(12, 18) = 36lcm(12,18)=36

    Properties of LCM:

    • Commutative: lcm(a,b)=lcm(b,a)\text{lcm}(a, b) = \text{lcm}(b, a)lcm(a,b)=lcm(b,a)
    • Associative: lcm(a,lcm(b,c))=lcm(lcm(a,b),c)\text{lcm}(a, \text{lcm}(b, c)) = \text{lcm}(\text{lcm}(a, b), c)lcm(a,lcm(b,c))=lcm(lcm(a,b),c)
    • Distributive over GCD: gcd⁡(a,b)×lcm(a,b)=∣a×b∣\gcd(a, b) \times \text{lcm}(a, b) = |a \times b|gcd(a,b)×lcm(a,b)=∣a×b∣

    3. Relationship Between LCM and GCD

    There is a key relationship between the LCM and GCD of two numbers. It is given by:

    gcd⁡(a,b)×lcm(a,b)=∣a×b∣\gcd(a, b) \times \text{lcm}(a, b) = |a \times b|gcd(a,b)×lcm(a,b)=∣a×b∣

    This means that the product of the GCD and the LCM of two numbers is equal to the product of the numbers themselves.

    Example:

    Let’s verify this relationship for a=12a = 12a=12 and b=18b = 18b=18:

    We know:

    • gcd⁡(12,18)=6\gcd(12, 18) = 6gcd(12,18)=6
    • lcm(12,18)=36\text{lcm}(12, 18) = 36lcm(12,18)=36

    Now, check the relationship:

    gcd⁡(12,18)×lcm(12,18)=6×36=216\gcd(12, 18) \times \text{lcm}(12, 18) = 6 \times 36 = 216gcd(12,18)×lcm(12,18)=6×36=216

    and

    ∣12×18∣=∣216∣=216|12 \times 18| = |216| = 216∣12×18∣=∣216∣=216

    Thus, the equation holds true:

    6×36=12×186 \times 36 = 12 \times 186×36=12×18

    4. Methods to Calculate GCD and LCM

    Euclidean Algorithm (for GCD)

    The Euclidean Algorithm is an efficient method for computing the GCD of two numbers. It works by repeatedly applying the division algorithm and replacing the larger number by the remainder until the remainder is zero. The last non-zero remainder is the GCD.

    Steps:

    1. Divide the larger number by the smaller number.
    2. Replace the larger number with the remainder from the division.
    3. Repeat until the remainder is zero. The GCD is the last non-zero remainder.
    Example: Find gcd⁡(48,18)\gcd(48, 18)gcd(48,18)
    1. Divide 48 by 18:

      48÷18=2(quotient),48−2×18=12(remainder)48 \div 18 = 2 \quad \text{(quotient)}, \quad 48 - 2 \times 18 = 12 \quad \text{(remainder)}48÷18=2(quotient),48−2×18=12(remainder)

      So, gcd⁡(48,18)=gcd⁡(18,12)\gcd(48, 18) = \gcd(18, 12)gcd(48,18)=gcd(18,12).

    2. Divide 18 by 12:

      18÷12=1(quotient),18−1×12=6(remainder)18 \div 12 = 1 \quad \text{(quotient)}, \quad 18 - 1 \times 12 = 6 \quad \text{(remainder)}18÷12=1(quotient),18−1×12=6(remainder)

      So, gcd⁡(18,12)=gcd⁡(12,6)\gcd(18, 12) = \gcd(12, 6)gcd(18,12)=gcd(12,6).

    3. Divide 12 by 6:

      12÷6=2(quotient),12−2×6=0(remainder)12 \div 6 = 2 \quad \text{(quotient)}, \quad 12 - 2 \times 6 = 0 \quad \text{(remainder)}12÷6=2(quotient),12−2×6=0(remainder)

      The remainder is zero, so the GCD is 6.

    Thus, gcd⁡(48,18)=6\gcd(48, 18) = 6gcd(48,18)=6.

    Finding LCM Using GCD:

    The LCM can be calculated using the formula:

    lcm(a,b)=∣a×b∣gcd⁡(a,b)\text{lcm}(a, b) = \frac{|a \times b|}{\gcd(a, b)}lcm(a,b)=gcd(a,b)∣a×b∣​
    Example:

    Find lcm(12,18)\text{lcm}(12, 18)lcm(12,18):

    We already know that:

    • gcd⁡(12,18)=6\gcd(12, 18) = 6gcd(12,18)=6
    • ∣12×18∣=216|12 \times 18| = 216∣12×18∣=216

    Now, using the formula for LCM:

    lcm(12,18)=2166=36\text{lcm}(12, 18) = \frac{216}{6} = 36lcm(12,18)=6216​=36

    Thus, lcm(12,18)=36\text{lcm}(12, 18) = 36lcm(12,18)=36.


    5. Applications of LCM and GCD

    1. Simplifying Fractions:

      • The GCD is used to simplify fractions. For example, to simplify 1218\frac{12}{18}1812​, divide both the numerator and the denominator by gcd⁡(12,18)=6\gcd(12, 18) = 6gcd(12,18)=6:
      1218=12÷618÷6=23\frac{12}{18} = \frac{12 \div 6}{18 \div 6} = \frac{2}{3}1812​=18÷612÷6​=32​
    2. Finding Common Denominators:

      • When adding or subtracting fractions, the LCM of the denominators is used to find a common denominator.
    3. Solving Diophantine Equations:

      • Diophantine equations, which are equations that seek integer solutions, often involve the GCD and LCM.
    4. Cryptography:

      • In encryption algorithms like RSA, the GCD plays a crucial role in finding keys and ensuring security.
    5. Scheduling Problems:

      • The LCM is used in problems where you need to find common intervals of recurring events (e.g., two events repeating every 12 days and 18 days will both coincide every lcm(12,18)=36\text{lcm}(12, 18) = 36lcm(12,18)=36 days).

    6. Conclusion

    The GCD is the largest divisor shared by two numbers, while the LCM is the smallest multiple shared by the two numbers. The relationship between the GCD and LCM is important, as it helps simplify many number-theoretic problems. The Euclidean algorithm provides an efficient way to compute the GCD, and once the GCD is known, the LCM can be easily calculated. These concepts have wide applications in number theory, cryptography, scheduling, and many other areas.

    Previous topic 35
    Modular Arithmetic
    Next topic 37
    Euclidean and Extended Euclidean Method

    Past Papers

    Open this section to load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time12 min
      Word count1,967
      Code examples0
      DifficultyIntermediate