Understanding the Mod Operator: Binary vs. Congruence Relation, Exercises of Cryptography and System Security

This document clarifies the distinction between using the mod operator as a binary operator and as a congruence relation in mathematics. It explains the notation and provides examples of both applications. Useful for students and researchers in mathematics and computer science.

Typology: Exercises

2011/2012

Uploaded on 07/17/2012

pamelaaaa
pamelaaaa 🇮🇳

4.5

(12)

103 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1/12/06
D-2
The operator mod is used in this book, and in the literature, in two different ways, as a binary
operator and as a congruence relation. This appendix explains the distinction and precisely
defines the notation used in this book regarding parentheses. This notation is common but,
unfortunately, not universal.
D.1 THE BINARY OPERATOR mod
If a is an integer and n is a nonzero integer, we define a mod n to be the remainder when a is
divided by n. The integer n is called the modulus, and the remainder is called the residue. Thus,
for any integer a, we can always write:
a = a/n × n + (a mod n)
Formally, we define the operator mod as follows:
a mod n = aa/n × nfor n 0
As a binary operation, mod takes two integer arguments and returns the remainder. For
example, 7 mod 3 = 1. The arguments may be integers, integer variables, or integer variable
expressions. For example, all of the following are valid, with the obvious meanings:
7 mod 3
7 mod m
x mod 3
x mod m
(x2 + y + 1) mod (2m + n)
docsity.com
pf3

Partial preview of the text

Download Understanding the Mod Operator: Binary vs. Congruence Relation and more Exercises Cryptography and System Security in PDF only on Docsity!

D-

The operator mod is used in this book, and in the literature, in two different ways, as a binary operator and as a congruence relation. This appendix explains the distinction and precisely defines the notation used in this book regarding parentheses. This notation is common but, unfortunately, not universal.

D.1 THE BINARY OPERATOR mod

If a is an integer and n is a nonzero integer, we define a mod n to be the remainder when a is divided by n. The integer n is called the modulus , and the remainder is called the residue. Thus, for any integer a , we can always write: a =  a / n  × n + ( a mod n ) Formally, we define the operator mod as follows: a mod n = a –  a / n  × n for n ≠ 0 As a binary operation, mod takes two integer arguments and returns the remainder. For example, 7 mod 3 = 1. The arguments may be integers, integer variables, or integer variable expressions. For example, all of the following are valid, with the obvious meanings: 7 mod 3 7 mod m x mod 3 x mod m ( x^2 + y + 1) mod (2 m + n )

D-

where all of the variables are integers. In each case, the left-hand term is divided by the right- hand term, and the resulting value is the remainder. Note that if either the left- or right-hand argument is an expression, the expression is parenthesized. The operator mod is not inside parentheses. In fact, the mod operation also works if the two arguments are arbitrary real numbers, not just integers. In this book, we are concerned only with the integer operation.

D.1 THE CONGRUENCE RELATION mod

As a congruence relation, mod expresses that two arguments have the same remainder with respect to a given modulus. For example 7 ≡ 4 (mod 3) expresses the fact that both 7 and 4 have a remainder of 1 when divided by 3. The following two expressions are equivalent: ab (mod m ) ⇔ a mod m = b mod m Another way of expressing it is to say that the expression ab (mod m ) is the same as saying that ab is an integral multiple of m. Again, all the arguments may be integers, integer variables, or integer variable expressions. For example, all of the following are valid, with the obvious meanings: 7 ≡ 4 (mod 3 ) xy (mod m) ( x^2 + y + 1) ≡ ( a + 1) (mod [ m + n ] ) where all of the variables are integers. Two conventions are used. The congruence sign is ≡. The modulus for the relation is defined by placing the mod operator followed by the modulus in parentheses.