HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Problems
  2. /Prove the cancellation rule: if ac ≡ bc pmod m and d = gcd(c, m), then a ≡ b pmodm/d…
AdvancedMathematicsHigh School (11–12)Number TheoryproofNumericalOlympiad

Prove the cancellation rule: if ac ≡ bc pmod m and d = gcd(c, m), then a ≡ b pmodm/d…

StemPy LabContributed by StemPy Lab

Try it on paper first. A hint, the key idea and the worked solution are here when you need them.

Prove the cancellation rule: if ac≡bc(modm)ac \equiv bc \pmod mac≡bc(modm) and d=gcd⁡(c,m)d = \gcd(c, m)d=gcd(c,m), then a≡b(modm/d)a \equiv b \pmod{m/d}a≡b(modm/d). Then use it on 12x≡18(mod30)12x \equiv 18 \pmod{30}12x≡18(mod30). Find how many solutions xxx lie from 000 to 292929, the smallest solution and the sum of all the solutions in that range. Explain why the solutions are equally spaced.

Check your answer

Work it out on paper, then type your number. The answer itself stays hidden.

Need a reminder? The key ideaShowHide

ax≡b(modm)ax \equiv b \pmod max≡b(modm) is solvable exactly when d=gcd⁡(a,m)d = \gcd(a, m)d=gcd(a,m) divides bbb, and then it has ddd solutions modulo mmm:

ax≡b(modm)  ⟺  adx≡bd(modmd).\displaystyle ax \equiv b \pmod m \iff \tfrac{a}{d}x \equiv \tfrac{b}{d} \pmod{\tfrac{m}{d}}.ax≡b(modm)⟺da​x≡db​(moddm​).

The worked solution

Check an answer or open a hint to unlock the worked solution.

Have you tried it?

Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, go through the solution one step at a time, and check each step against your own.

Given. ac≡bc(modm)ac \equiv bc \pmod mac≡bc(modm), d=gcd⁡(c,m)d = \gcd(c, m)d=gcd(c,m).

Step 1. The proof. We have m∣(a−b)cm \mid (a - b)cm∣(a−b)c. Write m=dm′m = dm'm=dm′ and c=dc′c = dc'c=dc′. Then dm′∣(a−b)dc′dm' \mid (a - b)dc'dm′∣(a−b)dc′, so m′∣(a−b)c′m' \mid (a - b)c'm′∣(a−b)c′. Since gcd⁡(m′,c′)=1\gcd(m', c') = 1gcd(m′,c′)=1, the number m′m'm′ shares no factor with c′c'c′, so m′∣a−bm' \mid a - bm′∣a−b. That is a≡b(modm/d)a \equiv b \pmod{m/d}a≡b(modm/d). Proof complete.

Step 2. The gcd. gcd⁡(12,30)=6\gcd(12, 30) = 6gcd(12,30)=6, and 6∣186 \mid 186∣18. So there are 666 solutions modulo 303030.

Step 3. Divide by 6. 2x≡3(mod5)2x \equiv 3 \pmod 52x≡3(mod5). The inverse of 222 modulo 555 is 333, so x≡9≡4(mod5)x \equiv 9 \equiv 4 \pmod 5x≡9≡4(mod5).

Step 4. The list. x=4,9,14,19,24,29x = 4, 9, 14, 19, 24, 29x=4,9,14,19,24,29, one every 555, because a solution modulo 555 repeats every 555.

Step 5. The sum. 4+9+14+19+24+29=994 + 9 + 14 + 19 + 24 + 29 = 994+9+14+19+24+29=99, or 6×4+292=996 \times \dfrac{4 + 29}{2} = 996×24+29​=99.

Check. 12×4=48=30+1812 \times 4 = 48 = 30 + 1812×4=48=30+18, and 12×29=348=11×30+1812 \times 29 = 348 = 11 \times 30 + 1812×29=348=11×30+18.

Answer: 666 solutions, the smallest 444, with sum 999999.

Log in to save this for later
← All Problems
← A ring has 89 cells, numbered 0 to 88 clockwise…A farmer counts the eggs in a basket. Taken two, three, four, five or six at a time, one egg is… →
More onNumber Theory

Discussion (0)

Log in to join the discussion.

Loading…

More on this topic

  1. The triangular numbers are 1, 3, 6, 10, …, where the nth one is (n(n + 1))/2…Advanced
  2. Prove that the equation x³ + y³ + z³ = n has no solution in integers when n leaves remainder 4 or 5…Advanced
  3. Find every triple of positive integers a ≤ b ≤ c with 1/a + 1/b + 1/c = 1, and prove that there are…Advanced
  4. Find all pairs of positive integers (x, y) with x² - y² = 945…Hard
  5. A teacher wants a list of every primitive Pythagorean triple whose hypotenuse is less than 100…Advanced
All problems on this topic →