ECE-C490 Computer Arithmetic

advertisement
ECE-C490 Security in Computing
Winter Term 2005
Quiz #5 Solutions
1. If you are given the following congruence:
42  12 (mod 10)
a) Can you legitimately cancel the factor 3 from the congruence?
Yes: 14  4 (mod 10)
b) Can you legitimately cancel the factor 6 from the congruence?
No: 7 is not equivalent to 2 (mod 10).
c) Defend your answers to parts (a) and (b). What is the rule that determines
whether or not a factor can be cancelled from a congruence?
The number you are attempting to factor out must be relatively prime to
the modulus. For example, in part a, we are allowed to factor out 3
because gcd(3,10) = 1. Part b does not work because gcd(6,10) = 2, not 1.
2. Given some integer x, how many of the numbers from 0, 1, 2,… , m –1 are
congruent to x (mod m)?
There is only one! By calculating x (mod m), you ensure that the result will be a
unique number between 0 and (m-1).
Don’t confuse x (mod m) with an expression asking for the number of values that
map to the same number (mod m), which is infinite, as many of you suggested.
That is, if you say x (mod m) = 2, there are an infinite number of solutions. Say m
= 5; then some of the first possible values of x are 2, 7, 12, 17, etc. The list is
infinite.
But if x and m are both unique numbers, as in this question, there can only be one
result of x (mod m). Think of it this way: x (mod m) is just the remainder when
you divide x by m. Have you ever gotten more than one remainder when dividing
two numbers? I would hope not!
Here’s a final example to illustrate the point:
x = 17
m=7
Then x (mod m) = remainder of (17/7) = 3. The set of numbers from 0… m-1 is
{0, 1, 2, 3, 4, 5, 6}, of which only one element is equal to 3.
Download