01.07.2013 Views

chapter 3 - Bentham Science

chapter 3 - Bentham Science

chapter 3 - Bentham Science

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Spreadsheet Conditional Formatting Applications of Spreadsheets in Education The Amazing Power of a Simple Tool 65<br />

be included in the school curriculum is long overdue. With just a little effort, this material may be<br />

made accessible and, hopefully, appealing to secondary school mathematics students.<br />

In this <strong>chapter</strong> we show that informative investigations may be carried out using spreadsheets[2]<br />

and present new spreadsheet-based approaches for computing and illustrating multiplication tables<br />

for modular arithmetic. The modular arithmetic spreadsheet described in this <strong>chapter</strong> allows investigation<br />

of a variety of properties and concepts in modular arithmetic, including that of modular<br />

inverse, which is essential for understanding of public-key cryptosystems such as RSA.<br />

4.2 Modular Arithmetic<br />

Due in significant part to its widespread application to cryptography and coding theory, basic knowledge<br />

of this important branch of mathematics is now considered almost essential for IT professionals,<br />

and others. However, in the experience of the authors, relatively few IT graduates seem to<br />

appreciate that integer arithmetic on a digital computer is none other than modular arithmetic. This<br />

is so, as all integer operations are performed modulo some power of 2 – it is the nature of a digital,<br />

binary CPU. All integer arithmetic done on a digital computer is with respect to a maximum word<br />

size, and therefore is modulo some positive integer. For example, on a contemporary desktop machine,<br />

an integer may be represented by 32 bits. This means that additions and multiplications will<br />

be modulo 2 32 (for cardinals), or 2 31 (for signed integers). When two integers are added on such<br />

a machine, and the sum exceeds the maximum value representable with 32 bits, e.g., 2 32 − 1 for a<br />

cardinal, then the processor overflow flag will be set, and the sum will only be correct modulo 2 32 .<br />

In many instances, this situation corresponds to a serious run-time error. However, if we are doing<br />

arithmetic modulo 2 32 , then we may legitimately ignore the overflow flag, as this is just the result<br />

we want.<br />

4.2.1 Rules of the Game<br />

What is modular arithmetic and how does it work? What are the basic rules? For the most part,<br />

these are very simple. The first concept we need is that of remainder or residue. Suppose we wish to<br />

divide 38 by 9. We have 38=(4×9)+2. In this equation, 38 is the dividend, 9 is the divisor, 4 is the<br />

quotient, and 2 called the remainder or residue. The word residue means “something left over”. By<br />

definition, it is non-negative and less than the divisor, so it could be zero. In other words, residues<br />

run from 0 up to one less than the divisor. In some contexts the divisor is called the modulus (plural<br />

moduli), and we consider this very soon. Given any dividend and a non-zero divisor, the quotient<br />

and remainder are unique. This is guaranteed by the so-called division algorithm.<br />

Theorem 4.1 (The division algorithm) Given integers n and d = 0, there exist unique integers q<br />

(quotient) and r (residue or remainder) such that n=qd+ r and 0≤r≤d− 1.<br />

Definition 4.1 In Theorem 4.1, the residue r is also written as n mod d.<br />

Example 4.1 We have 38=(4×9)+2, so 38 mod 9=2.<br />

Example 4.2 We have−38=(−5×9)+7, so−38 mod 9=7.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!