Examples based on Chinese Remainder Theorem


Steps to solve the system of congruences :


Step 1: Take the congruence with the largest modulus  an (mod mnthen rearrange it as,

x=mnk+an    

where k is an integer.

Step 2: Substitute x into the 2nd largest modulus mnk+a an-1 (mod mn-1) then solve the  congruence

 h (mod mn-1).

Step 3: Rewrite the congruence as k= mn-1d+h and substitute it in x.

Step 4: Substitute the solve equation of x in the next largest modulus then solve the congruence.

Step 5: Repeat the above steps until the solution arrives.                   


Chinese Remainder Theorem


Examples:


  1. If you have a bowl of chocolates but the exact number is unknown and you distribute it among 3 children you have 2 leftovers, you distribute it among 5 children and have 3 leftovers, you distribute it among 7 children and have 2 leftovers. How many chocolates are there??

Soln:

 According to question,

x  2 (mod 3)

x  3 (mod 5)

x  2 (mod 7)

First, take the congruence with the largest modulus,

x  2 (mod 7)

Rewrite it as an equivalence equation,   

x=7k+2 ,for some integer k ……(1)

Substitute x into second largest modulus,

x  3 (mod 5)

      7k+2  3 (mod 5)

    7k  1 (mod 5)

By solving the linear congruence,

We get,                

k  3 (mod 5)

Rewrite it as an equivalence equation,   

k=5a+3,for some integer a

Substituting this in equation (1),

x=7(5a+3)+2

    x=35a+21+2

     x=35a+2 ...(2)

Substitute x into third largest modulus,

35a+23  2 (mod 3)

35a+21  0 (mod 3)

By solving the linear congruence,

We get,                  

a  0 (mod 3)

Rewrite it as an equivalence equation,

a=3n,for some integer n

Substituting this in equation (2),

x=35a+23

=35(3n)+23

=105n+23

Rewriting this,

x  23 (mod 105)

 Note that, M=3x5x7=105

x=23

Therefore, the number of chocolates in the bowl is 23.





 

  1. x 2 (mod 3)

     x  1 (mod 4)

     x  5 (mod 7)

Soln:


Begin with the largest modulus,

x  5 (mod 7)

Rewriting it,   

x=7k+5 ,for some integer k ……(1)

Substitute x into second largest modulus,

x  1 (mod 4)

  7k+5  1 (mod 4)

   7k+4  0 (mod 4)

Solving the congruence,

We get,                

k  0 (mod 4)

Rewriting it,   

k=4a,for some integer a

Substituting this in equation (1),

x=7(4a)+5

  x=28a+5

    x=28a+5 ...…(2)

Substitute x into third largest modulus,

28a+5 2 (mod 3)

28a+3 0 (mod 3)

Solving the congruence,

We get,                  

a  0 (mod 3)

Rewriting it,

a=3n,for some integer n

Substituting this in equation (2),

x=28a+5

=28(3n)+5

=84n+5

Rewriting this,

x  5 (mod 84)

 Here, M = 3x4x7= 84

Therefore, x=5                    



                  

 

 

 

 

 

3. There is a ship where pirates have a stolen treasure, a box full of unknown numbers of gold coins. Somehow, they figured out that the gold coins are between 70 and 90. If they plan to distribute it among 8 pirates they’ll have 6 gold coins left,  they distribute it among 7 pirates, they'll have 1 gold coin left, they distribute it among 5 pirates and they'll have 3 gold coins left. How many gold coins are there ???

Soln:

According to question,

x  3 (mod 5)

x  1 (mod 7)

x  6(mod 8)

Begin with the largest modulus,

x  6(mod 8)

Rewriting it, 

x=8k+6 ,for some integer k ……(1)

Substitute x into second largest modulus,

x  1 (mod 7)

  8k+6  1 (mod 7)

     8k+5  0 (mod 7)

Solving the congruence,

We get,                

k  2 (mod 7)

Rewriting it,   

k=7a+2,for some integer a

Substituting this in equation (1),

x=8(7a+2)+6

  x=56a+16+6

  x=56a+22 ...…(2)

Substitute x into third largest modulus,

56a+22  3 (mod 5)

56a+19  0 (mod 5)

Solving the congruence,

We get,                  

a  1 (mod 5)

Rewriting it, 

                    a=5n+1,for some integer n

Substituting this in equation (2),

x=56a+22

=56(5n+1)+22

=280n+56+22

=280n+78

Rewriting this,

x  78 (mod 280)

Note that, M = 8x5x7 = 280

x=78

Therefore, there are 78 gold coins.

 

 


Comments

Post a Comment

Please do not enter spam link in the comment box

Recent blogs

Topology

Integration = Area under the curve?

Types of Topology

Chinese Remainder Theorem

Riemann Sums and Integral

Complete proof of Chinese Remainder Theorem