Discussion 3B

Bijections

Consider two sets AA and BB, and a function f:ABf : A \mapsto B that maps elements from AA to the elements of BB.
  • ff is injective if each element in BB has at most one element in AA that maps to it
  • ff is surjective if each element in BB has at least one element in AA that maps to it
  • ff is bijective if it is both injective and surjective
  • ff is bijective if and only if it has an inverse f1f^{-1}

Chinese Remainder Theorem

Goal

Given a list of congruences xa1modm1x \equiv a_1 \mod m_1, xa2modm2x \equiv a_2 \mod m_2, \cdots, xanmodmnx \equiv a_n \mod m_n, find an xx that satisfies all congruences.

Theorem

Let N=m1m2mnN = m_1 m_2 \cdots m_n. If all the mim_i are relatively prime (gcd(mi,mj)=1\gcd(m_i, m_j) = 1) then there is exactly one value of xx in the set {0,1,,N1}\{ 0, 1, \cdots, N-1 \} that satisfies all the congruences.

Finding xx

For xa1modm1x \equiv a_1 \mod m_1 and xa2modm2x \equiv a_2 \mod m_2, we want to find a number k1k_1 that is a multiple of m2m_2 and k11modm1k_1 \equiv 1 \mod m_1, and similarly a number k2k_2 that is a multiple of m1m_1 and k21modm2k_2 \equiv 1 \mod m_2. Then x=a1k1+a2k2x = a_1 k_1 + a_2 k_2 is a solution because xa1k1+0a1modm1x \equiv a_1 k_1 + 0 \equiv a_1 \mod m_1 and x0+a2k2a2modm2x \equiv 0 + a_2 k_2 \equiv a_2 \mod m_2.