1 / 12

The Chinese Remainder Theorem

The Chinese Remainder Theorem. Setting the Scene (the problem). Imagine that you are a commander in the army. You have lost a major battle and are attempting to regroup. Before you can do this, you must count the survivors. Originally you have 500 soldiers.

jeremy-good
Download Presentation

The Chinese Remainder Theorem

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Chinese Remainder Theorem

  2. Setting the Scene(the problem) • Imagine that you are a commander in the army. • You have lost a major battle and are attempting to regroup. • Before you can do this, you must count the survivors. Originally you have 500 soldiers. • You are a busy commander though and this process would be too strenuous to attempt by hand.

  3. An Attempted Solution • Being a wise leader, you realize that you could group the remaining infantry into a nxm matrix. Then, the total solders would just equal n * m. • But, annoyingly enough, a large number of solders remain outside your matrix with no place to stand.

  4. An Observation • No matter what size matrix you have, there seems to be people left over. • Although there might be a square solution, finding the correct n and m is difficult.

  5. Guessing Not being one to admit defeat, you decide to try different sized groupings anyways: • At first, you decide to group the survivors into groups of 3. After dividing the whole of the army, 1 person had no place in a group. • Then, you decide that groups of 7. Once this was done, 3 people had been left out. • In desperation, you decide to group the army into groups of 11. This left 2 people over.

  6. Another Observation • After thinking for awhile, you realize that the total number of solders is going to be some x such that: x = 1 (mod 3) x = 3 (mod 7) x = 2 (mod 11) • Invigorated by these equations, but frustrated with no solution, you seek advice.

  7. Advice • Your advisors remind you of the Chinese Remainder Theorem: If m1, m2, ...mk are positive integers with a greatest common divisor of one, then this system: x = a1  (mod m1) x = a2  (mod m2) … x =ak (modmk) Is solved by the modulo m= m1 * m2 * ... *mk

  8. Proof • Unconvinced you demand an example of this theorem. It is presented as follows: with our numbers: x = 1 (mod 3) x = 3 (mod 7) x = 2 (mod 11) Now take Mk , with m divided by mk for each k = 1, 2, ... N • What? The top aid explains slowly… Simply multiply all m except for mkto find Mk . Using our numbers: M1 = 7 * 11 = 77 M2 = 3 * 11 = 33 M3 = 3 * 7 = 21

  9. Furthermore • Next, we have to find the solutions xk for each of the equationsMk * xk = 1  (modmk). M1 = 7 * 11 = 77 M2 = 3 * 11 = 33 M3 = 3 * 7 = 21 x = 1 (mod 3) x = 3 (mod 7) x = 2 (mod 11) • For our problem, this is: • 77 * x1 = 2 * x1 = 1 (mod 3) -> 77 mod 3 = 2 • 33 * x2 = 5 * x2 =1 (mod 7) -> 33 mod 7 = 5 • 21 * x3 =10 * x3 =1 (mod 11) -> 21 mod 11 = 10 So, we have x1 = 2 x2 = 3 x3 = 10

  10. Almost there… • s = a1 * M1 * x1 + a2 * M2 * x2 + ...+ ar * Mr * xr • s = a1 * M1 * x1 + a2 * M2 * x2 + ...+ ar * Mr * xr • s = 1 * 77 * 2 + 1 * 33 * 3 + 1 * 21 * 10 • s = 463 = x (mod 231)

  11. Solution • Taking s = 463 = x (mod 231) • Originally have 500 soldiers Solving for x: x = 463 mod 231 = 1 so: s = 1 (mod 231) s = 231*k + 1 k = 0 -> 1 soldier left k = 1 -> 232 soldiers left k = 2 -> 694 soldiers left (too large) • We know now that we either have 1 or 232 soldiers left. • Close enough to easily guess. • Good news is that we have 232 soldiers.

  12. Homework • I mailed 200 invitations to this rave. I danced in every song… • We did a dance where we paired off into groups of 5, but one group only had 4… • Then, we had a line dance with 9 to a line, but three lines ended up with 10… • At the end of the evening, everyone left in pairs, except for me… • How many people (including me) attended the event (assuming no uninvited guests showed up)?

More Related