0

I found an interesting question in Donald Knuth's The Art of Computer Programming. This is question number 14 under section 1.2.4. It asks "if $x \space \textrm{mod} \space 3 = 2$ and $x \space \textrm{mod} \space 5 = 3$, what is $x \space \textrm{mod} \space 15?$"

I am basically asking for the solution to the generalized form of this question because I found the answer to Donald Knuth's question empirically. To solve Knuth's question, I found a number that is of the form $3k+2$ and of the form $5k+3$ at the same time: 8.

We find out that $8 \space \textrm{mod} \space 15 = 8$.

Then I used a law of the congruence of numbers which Donald Knuth calls "Law D", that states "if $r \perp s$, then $a \equiv b \space (\textrm{modulo} \space rs)$ if and only if $a \equiv b \space (\textrm{modulo} \space r)$ and $a \equiv b \space (\textrm{modulo}\space s)$. From the law, it results that if $a \equiv b \space (\textrm{modulo} \space r)$ and $a \equiv b \space (\textrm{modulo}\space s)$, then $a \equiv b \space (\textrm{modulo} \space rs)$, given that $r \perp s$.

We know that $3 \perp 5$. By definition, we also know that $8 \equiv x \space (\textrm{modulo}\space 3)$, and that $8 \equiv x \space (\textrm{modulo}\space 5)$. Thus, $8 \equiv x \space (\textrm{modulo}\space 3 \cdot 5)$. That is to say that $x \space \textrm{mod} \space 15 = 8 \space \textrm{mod} \space 15 = 8$.

I can't use the same empirical method for the generalized case. What is the more rigorous algebraic answer that can also solve the general case too?

0 Answers0