Linear congruence Created 2026-09-29 Updated 2026-10-14
A linear congruence asks for the integers satisfying , where are integers and . Let be their greatest common divisor. There are solutions exactly when divides . When solutions exist, there are exactly solution classes modulo , obtained from one solution byThe divisibility condition follows immediately from : every common divisor of must divide . Conversely, Bézout's identity constructs a solution when . Differences between any two solutions obey , equivalently , since and are coprime. This explains both the spacing and the number of solution classes.
For a complete example, solve . Here divides nine. Dividing the corresponding divisibility statement by three changes the integer modulus too:Because , multiplying by the modular inverse three gives . Lifting this class back to modulus fifteen yields . Direct substitution gives , and , each with remainder nine after division with remainder by fifteen. By contrast, has no solutions, because three does not divide ten.
This is why ordinary-looking division cannot be performed blindly in modular arithmetic. Reducing the equation and its integer modulus together keeps all solutions; retaining modulus fifteen after dividing by three would lose valid classes. When , the modular inverse of exists and gives a unique class . The Euclidean algorithm computes the Bézout coefficients needed for this construction. [ref]
https://ocw.mit.edu/courses/18-200-principles-of-discrete-applied-mathematics-spring-2024/mit18_200_s24_lec15.pdf. Moitra, MIT 18.200, Lecture 15, modular inverses and the extended Euclidean algorithm
