Congruences are equations that involve modular arithmetic, which is basically math speak for “dividing by a certain number and getting a remainder.” For example, if you divide 20 by 14 (which we’ll call ‘modulo 14’), the result would be a remainder of 6. So, in congruence terms, this would look like:
x is congruent to 6 modulo 14 or written as x 6 (mod 14)
Now that we’ve got that out of the way, Time to get going with solving these bad boys. The first step is to reduce both sides of the equation by the same number until you get a remainder of zero when dividing by your modulus number. For example:
x 23 (mod 14)
Let’s say we want to solve for x, so let’s try reducing this congruence. First, divide both sides by 2 and see what happens:
(x/2) 11.5 (mod 14)
Uh oh! We can’t have a decimal in our modulus equation because it doesn’t make sense to talk about remainders with decimals. So, let’s try reducing again by dividing both sides by 2:
(x/4) 5.75 (mod 14)
Nope, still not working! Let’s keep going and divide both sides by 2 one more time:
(x/8) 2.375 (mod 14)
Okay, we can see that this is getting ridiculous pretty quickly. We need to find a way to reduce without having decimals or negative numbers in our equation. The key here is to remember that when you divide by an even number, the remainder will always be zero because any even number divided by 2 equals zero with a remainder of zero. So let’s try reducing again but this time we’ll multiply both sides by 2:
x/8 * 2 = (x/4)
Now that we have an integer on the left-hand side, let’s reduce it:
(x/4) * 2 10.5 (mod 14)
Okay, so now we can see that reducing by a factor of two is not going to work because we still have a decimal in our equation. Let’s try something else! Instead of dividing both sides by an even number, let’s add or subtract the same value from both sides until we get a remainder of zero when divided by our modulus number:
x 23 (mod 14)
Let’s say we want to solve for x and we know that x is less than 50. So, let’s try subtracting 14 from both sides:
x 14 19 (mod 14)
Now let’s reduce this congruence by dividing both sides by 1:
(x-14)/1 19/1 (mod 14)
Okay, so we have a fraction on the left-hand side. Let’s try multiplying both sides by 1 to get rid of that ***** fraction:
(x 14)*1 = x 14
Now let’s reduce this congruence:
(x 14) * 1 13 (mod 14)
Awesome! We have a remainder of zero when divided by our modulus number. So, the solution to x is any integer that leaves us with a remainder of 13 when we divide it by 14:
x = 13 + 14k for some integer k (where ‘+’ means addition)
Solving congruences can be tricky, but if you remember to reduce both sides and keep an eye out for decimals or negative numbers, you’ll be solving them like a pro in no time.