Now that we have these three properties of congruences defined, we are better prepared for when we need to solve congruence problems! There are three distinct congruence problem types based on which variable in the expression:

ab(modn)a \equiv b\;(mod\;n)

is unknown:

  1. Suppose only a is unknown. Then, from the definition of congruence, we have (a-b) = n*k, or a = n*k + b. This means that the answers we seek are all values of a for which n divides a-b, or equivalently all values of a for which a-b is a multiple of n.
  2. Suppose only b is unknown. In this case, the procedure for solving for b is identical to the procedure for solving for a because we proved the symmetric property of congruences!
  3. Suppose only n is unknown. Then, since (a-b) = n*k by definition of congruence, we are seeking an integer k in which (a-b)/n is an integer. In other words, we must find all positive integers n such that n divides (a-b). This is equivalent to finding every factor of (a-b) since they all divide (a-b) with no remainder.

Thankfully, since we have only three variables present in any given congruence, these three scenarios are the only ones possible (assuming that only one of these three variables is unknown). These next few checkpoints will hopefully boost your confidence in your ability to solve simple congruence problems!



Find by hand the smallest number a such that a > 3 and that

a1(mod3)a \equiv 1 \;(mod\;3)

is true. Print whether or not the resulting congruence is true.


Instead of solving this by hand, use the symmetric property to come up with an answer for:

1b(mod3)1 \equiv b\;(mod\;3)

Print out whether or not the resulting congruence is true.


Find the largest n for which:

159(modn)15 \equiv 9\;(mod\;n)

is true, and print whether or not your congruence is true.

Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.
Already have an account?