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›Finding Solutions to Congruence
    Discrete StructuresTopic 38 of 67

    Finding Solutions to Congruence

    12 minread
    2,079words
    Intermediatelevel

    Finding Solutions to Congruences

    A congruence is a mathematical statement that expresses a relationship between two numbers with respect to a modulus. The general form of a congruence is:

    a≡b(modm)a \equiv b \pmod{m}a≡b(modm)

    which reads as "a is congruent to b modulo m", meaning that when aaa and bbb are divided by mmm, they leave the same remainder. In other words, mmm divides a−ba - ba−b. Solving congruences involves finding values of aaa that satisfy the given congruence.

    1. Linear Congruences

    A linear congruence is an equation of the form:

    ax≡b(modm)ax \equiv b \pmod{m}ax≡b(modm)

    where aaa, bbb, and mmm are given integers, and xxx is the unknown we need to solve for. To solve a linear congruence, we want to find all values of xxx that satisfy this equation modulo mmm.

    Steps to Solve a Linear Congruence ax≡b(modm)ax \equiv b \pmod{m}ax≡b(modm):

    1. Check if a solution exists: A solution to the linear congruence ax≡b(modm)ax \equiv b \pmod{m}ax≡b(modm) exists if and only if the greatest common divisor gcd⁡(a,m)\gcd(a, m)gcd(a,m) divides bbb. That is, the equation has a solution if and only if:

      gcd⁡(a,m)∣b\gcd(a, m) \mid bgcd(a,m)∣b

      If this condition is not satisfied, then the congruence has no solution.

    2. Simplify the equation (if possible): If gcd⁡(a,m)=d\gcd(a, m) = dgcd(a,m)=d, then we can divide the entire equation by ddd to simplify it. After dividing, the modulus will be reduced by dividing by ddd, and the new congruence will be:

      adx≡bd(modmd)\frac{a}{d} x \equiv \frac{b}{d} \pmod{\frac{m}{d}}da​x≡db​(moddm​)
    3. Use the Extended Euclidean Algorithm: If gcd⁡(a,m)=1\gcd(a, m) = 1gcd(a,m)=1, the linear congruence ax≡b(modm)ax \equiv b \pmod{m}ax≡b(modm) can be solved using the Extended Euclidean Algorithm. This method will help find the multiplicative inverse of aaa modulo mmm, denoted by a−1a^{-1}a−1, such that:

      a⋅a−1≡1(modm)a \cdot a^{-1} \equiv 1 \pmod{m}a⋅a−1≡1(modm)

      Once the inverse is found, multiply both sides of the congruence ax≡b(modm)ax \equiv b \pmod{m}ax≡b(modm) by a−1a^{-1}a−1 to solve for xxx:

      x≡a−1⋅b(modm)x \equiv a^{-1} \cdot b \pmod{m}x≡a−1⋅b(modm)
    4. General Solution: If gcd⁡(a,m)=d>1\gcd(a, m) = d > 1gcd(a,m)=d>1, after dividing by ddd, we find the solution to the reduced congruence. The general solution will be given by:

      x=x0+k⋅mdx = x_0 + k \cdot \frac{m}{d}x=x0​+k⋅dm​

      where x0x_0x0​ is a particular solution, and kkk is any integer.

    2. Example 1: Solving a Linear Congruence

    Solve the congruence 3x≡12(mod15)3x \equiv 12 \pmod{15}3x≡12(mod15).

    1. Check if a solution exists: First, compute gcd⁡(3,15)\gcd(3, 15)gcd(3,15):

      gcd⁡(3,15)=3\gcd(3, 15) = 3gcd(3,15)=3

      Since 3∣123 \mid 123∣12, a solution exists.

    2. Simplify the equation: Divide the entire congruence by gcd⁡(3,15)=3\gcd(3, 15) = 3gcd(3,15)=3:

      33x≡123(mod153)\frac{3}{3} x \equiv \frac{12}{3} \pmod{\frac{15}{3}}33​x≡312​(mod315​)

      This simplifies to:

      x≡4(mod5)x \equiv 4 \pmod{5}x≡4(mod5)
    3. Solve the simplified congruence: The simplified congruence is x≡4(mod5)x \equiv 4 \pmod{5}x≡4(mod5), which has the solution x=4+5kx = 4 + 5kx=4+5k for any integer kkk.

    4. General solution: The general solution to the original congruence is:

      x=4+5kfor any integer kx = 4 + 5k \quad \text{for any integer} \, kx=4+5kfor any integerk

      This means x=4,9,14,19,…x = 4, 9, 14, 19, \dotsx=4,9,14,19,….


    3. Solving Systems of Congruences: Chinese Remainder Theorem (CRT)

    The Chinese Remainder Theorem (CRT) is a method used to solve a system of simultaneous linear congruences, where each congruence has the same modulus or different moduli. The CRT guarantees that if the moduli are pairwise coprime (i.e., their pairwise GCDs are 1), then there is a unique solution modulo the product of the moduli.

    General Form:

    Solve the system of congruences:

    x≡a1(modm1)x \equiv a_1 \pmod{m_1}x≡a1​(modm1​) x≡a2(modm2)x \equiv a_2 \pmod{m_2}x≡a2​(modm2​) ⋮\vdots⋮ x≡an(modmn)x \equiv a_n \pmod{m_n}x≡an​(modmn​)

    where m1,m2,…,mnm_1, m_2, \dots, m_nm1​,m2​,…,mn​ are pairwise coprime.

    Steps to Solve Using the Chinese Remainder Theorem:

    1. Find the product of all moduli: Let M=m1×m2×⋯×mnM = m_1 \times m_2 \times \dots \times m_nM=m1​×m2​×⋯×mn​.

    2. Compute partial products: For each iii, calculate Mi=MmiM_i = \frac{M}{m_i}Mi​=mi​M​, which is the product of all moduli except mim_imi​.

    3. Find the modular inverses: For each iii, find the inverse of MiM_iMi​ modulo mim_imi​, denoted by yiy_iyi​, such that:

      Mi⋅yi≡1(modmi)M_i \cdot y_i \equiv 1 \pmod{m_i}Mi​⋅yi​≡1(modmi​)
    4. Form the solution: The solution to the system of congruences is:

      x=∑i=1nai⋅Mi⋅yi(modM)x = \sum_{i=1}^{n} a_i \cdot M_i \cdot y_i \pmod{M}x=i=1∑n​ai​⋅Mi​⋅yi​(modM)

      where MMM is the product of all the moduli.


    4. Example 2: Solving a System Using the Chinese Remainder Theorem

    Solve the system of congruences:

    x≡2(mod3)x \equiv 2 \pmod{3}x≡2(mod3) x≡3(mod5)x \equiv 3 \pmod{5}x≡3(mod5)
    1. Find the product of the moduli:

      M=3×5=15M = 3 \times 5 = 15M=3×5=15
    2. Compute the partial products:

      • M1=153=5M_1 = \frac{15}{3} = 5M1​=315​=5
      • M2=155=3M_2 = \frac{15}{5} = 3M2​=515​=3
    3. Find the modular inverses:

      • Find y1y_1y1​ such that 5⋅y1≡1(mod3)5 \cdot y_1 \equiv 1 \pmod{3}5⋅y1​≡1(mod3):

        5≡2(mod3)so2⋅y1≡1(mod3)5 \equiv 2 \pmod{3} \quad \text{so} \quad 2 \cdot y_1 \equiv 1 \pmod{3}5≡2(mod3)so2⋅y1​≡1(mod3)

        The inverse of 2 modulo 3 is 2, so y1=2y_1 = 2y1​=2.

      • Find y2y_2y2​ such that 3⋅y2≡1(mod5)3 \cdot y_2 \equiv 1 \pmod{5}3⋅y2​≡1(mod5):

        3⋅2=6≡1(mod5)soy2=23 \cdot 2 = 6 \equiv 1 \pmod{5} \quad \text{so} \quad y_2 = 23⋅2=6≡1(mod5)soy2​=2
    4. Form the solution: The solution is:

      x=(2⋅5⋅2)+(3⋅3⋅2)(mod15)x = (2 \cdot 5 \cdot 2) + (3 \cdot 3 \cdot 2) \pmod{15}x=(2⋅5⋅2)+(3⋅3⋅2)(mod15) x=(20)+(18)=38(mod15)x = (20) + (18) = 38 \pmod{15}x=(20)+(18)=38(mod15) x≡8(mod15)x \equiv 8 \pmod{15}x≡8(mod15)

    Thus, the solution to the system is x≡8(mod15)x \equiv 8 \pmod{15}x≡8(mod15).


    5. Conclusion

    • To solve a linear congruence ax≡b(modm)ax \equiv b \pmod{m}ax≡b(modm), check if gcd⁡(a,m)\gcd(a, m)gcd(a,m) divides bbb. If it does, simplify the equation and use the Extended Euclidean Algorithm to solve for xxx.
    • The Chinese Remainder Theorem provides a method for solving systems of simultaneous congruences when the moduli are pairwise coprime.
    • Solving congruences is important in number theory and has applications in cryptography, computer science, and coding theory.
    Previous topic 37
    Euclidean and Extended Euclidean Method
    Next topic 39
    Primes: Fundamental Theorem of Arithmetic

    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 count2,079
      Code examples0
      DifficultyIntermediate