Lecture 1 & 2: Integer and Modular Arithmetic

Size: px
Start display at page:

Download "Lecture 1 & 2: Integer and Modular Arithmetic"

Transcription

1 CS681: Computational Numer Theory and Algera (Fall 009) Lecture 1 & : Integer and Modular Arithmetic July 30, 009 Lecturer: Manindra Agrawal Scrie: Purushottam Kar 1 Integer Arithmetic Efficient recipes for performing integer arithmetic are indispensale as they are widely used in several algorithms in diverse areas such as cryptology, computer graphics and other engineering areas. Hence our first oject of study would e the most asic integer operations - namely addition, sutraction, multiplication and division. We will start off with algorithms that are typically referred to as high-school or peasant algorithms and move on to more efficient ones wherever scope for improvement is found. 1.1 Integer Addition and Sutraction Given two n-it numers a and, the high-school algorithms take O (n) time to perform addition and sutraction. Now this is optimal upto constant factors since the input size itself is Ω(n). Hence these do not pose a challenge to us. Of course for someone designing a processor, these constant factors may decide whether the chip ecomes a market leader or not ut we shall consider the issue of integer addition and sutraction closed from now on having otained optimal algorithms for the same (many thanks to our respective high school Math teachers for this). 1. Integer Multiplication Unfortunately we have less to thank our high school teachers on this matter since the high school algorithm takes O (n ) time to multiply two n-it numers. This is too slow for most scientific calculations. A slight improvement comes due to an oservation of Gauss on multiplication of complex numers. Gauss oserved that the product (a+i)(c+di) can e calculated using just three multiplications and five additions instead of four multiplications and four additions. Let k 1 = ac, k = d, k 3 = (a + )(c + d). Then (a + i)(c + di) = (k 1 k ) + (k 3 k 1 k )i. This was the trick employed y Karatsua and Ofman in [KO6] to arrive at an O ( n log 3) algorithm for integer multiplication. What is done in this algorithm is to express each n-it numer using two n -it numers. Thus a = a 1 n + a 0 and = 1 n + 0. Hence we can use the aove trick to multiply these two numers using three n -it multiplications and some constant numer of O (n) operations which include adding the intermediate results, left shifts etc. So the time complexity of this algorithm is M(n) = 3M ( ) ( ) n + O (n) which gives M(n) = O n log 3. 1

2 This method of reaking up numers can e generalized to reak numers into more parts and save on some multiplications using similar tricks. This led to a family of multiplication algorithms known as Toom-Cook methods [Too63, Coo66] which give an asymptotic time complexity of O (n log(k 1) log(k) ) for any k > 1 and hence can give a complexity of O (n 1+ɛ ) for any ɛ > 0. This was improved y Schönage and Strassen using Spectral techniques (more specifically Fourier Analysis) to O (n log n log log n) in [SS71]. After this came a long period of waiting efore Fürer and De-Kurur-Saha-Saptharishi in a series of closely spaced papers [F 07, DKSS08] improved the time complexity to O ( n log n log n ) where log denotes the iterated log function. Of course one does not typically use the fastest method on all instances. As it turns out the algorithms y Fürer and De et al outperform the Schönage-Strassen algorithm in practice only on astronomically large numers due to the large constants involved. Thus for really huge numers, one uses the algorithms due to Fürer and De et al at the top level ut as the recursive calls are made to smaller numers, one switches to the Schönage-Strassen algorithm only to switch to the Karatsua algorithm for still smaller numers and finally to the high school algorithm for the ottom level recursive calls. 1.3 Integer Division As it turns out, if asymptotic complexity is all that we are interested in then integer division has the same time complexity as integer multiplication. In fact the operations of multiplication, squaring, division, inversion and square-rooting all have the same time complexity. However in this lecture our aim is only to show that division is no more difficult than multiplication. For this we require the Newton-Raphson method for inversion. This method is used in general to find roots of a real valued function f y starting with a wellinformed guess x 0 for the root and improving it iteratively using the update rule x i+1 = x i f(x i) f (x i ). The method typically has a quadratic convergence ut is also known to go astray at times. But in our case we will show that it approaches its goal in a steadfast manner. We shall of course use a slightly modified version of the algorithm keeping in mind not to keep very high precision numers. Note that all logarithms are taken to ase unless otherwise mentioned. Let us take the two n-it integers to e divided as a and where < a. We want to find integers d and r such that a = d + r and r <. We will always work only with positive integers for simplicity. For now let us assume that has een scaled down to the range ( 1, 1) y dividing y an appropriate power or. For this assume >. The case = is clearly very simple to handle. From now on, till otherwise mentioned, we shall call this scaled down n-it numer as. Our goal here is to find a good approximation of 1. Note that 1 (1, ). Let us choose x 0 = 1 as our first approximation. Clearly x 0 < 1 and 1 x 0 < 1. Truncate 1 x 0 to the first it after the decimal point and call this quantity y 0. Clearly y 0 < 1 as well. Define y i = yi 1 and x i+1 = x i (1 + y i ) for all i > 0. Consider the following results : Lemma 1.1. For any i > 0, we have the following to e true 1. y i < 1 i

3 . 1 x i < 1 i 3. y i is at most i its long 4. x i is at most i its long Proof. We present the respective proofs elow. All proofs are y induction on i. 1. For i = 0 we have already shown the result. Suppose the result also holds upto some i, then we have y i+1 = y i < 1 i+1.. For i = 0 we have already shown the result. Suppose the result also holds ( upto some ) i, then we have 1 x i+1 = 1 x i (1 + y i ) = 1 x i x i y i < ( ) i i y i < = 1. i i i i+1 3. For i = 0 this is true ecause of choice of y 0. Suppose the result also holds upto some i, then we have y i+1 = y i and hence the numer of its in y i+1 can e atmost twice that of y i. Hence the result holds. 4. For i = 0 this is true y choice of x 0. Suppose the result also holds upto some i, then we have x i+1 = x i (1 + y i ). Since y i < 1 and oth x i and y i are at most i its long, the result holds. At this point we fix the issue of scaling to within the range ( 1, 1). Let m > 0 such that = [ 1, 1). Then it is clear that if x is such that 1 x < ɛ then if x = x then 1 x < ɛ m m as well. Now we state a final lemma efore moving on to prove our desired result. Lemma 1.. Fix i = log n + 1. Then if a = d + r then a x i d 1. Proof. Clearly a x i d = d( x i 1) + r x i < d + r d i i and log d n. 1 since r <, log n The preceding lemmata give us an O (M(n)) algorithm for integer division where M(n) is the asymptotic complexity for integer multiplication. This can e shown as follows : at the i-th iteration, all we do is multiply and add i -it numers (this includes the squaring step). This takes M (O ( i )) + O ( i ) time which is O (M ( i )) since M (O (n)) = O (M(n)) and M(n) = Ω(n). Another outcome of M(n) = Ω(n) is that M(a) + M() M(a + ) for all a, 1. In the eginning we calculate 1 x 0 which takes O (M(n)) time. The calculations at the end to find d from x log n+1 also takes O (M(n)) time. Due to some uncertainty in the value of d, we may have to try out a constant numer of values in the vicinity of the d otained. All this will take time O (M(n)). Hence integer division is no more difficult than integer multiplication. 3

4 Note: There are some minute details of the algorithm that need to e taken care of. It can e seen that the algorithm will fail if y 0 = 0. However this is actually a good thing for us ecause it tells us that our very first approximation is as good as something we hoped to get several iterations down 1 the line. Thus if 1 x l 1 0 > 1, then we can retain log l its of 1 x l 0 and call this the log l -th iteration and proceed. Modular Arithmetic In this section we will deal with how to do the four asic integer operations on n-it numers a and modulo another n-it numer m. It should e clear that modular addition, sutraction and multiplication can e done in O (M(n)) time. As far as division is concerned we first have to define what does it mean for a to e z mod m. Definition.1. For any three integers a, and c, a mod m is said to e defined if there exists an integer z such that z a mod m. In such a situation we say a z mod m. a Lemma.. mod m for integers a and such that (a, ) = 1 is defined iff (m, ) = 1. = rm + z where z Z and r Q such that Proof. ( ) Suppose a mod m is defined and a r Z. Hence a = rm + z. Now suppose (m, ) > 1. This implies from the aove equation that (a, ) > 1 as well which is contradictory to our assumption. Hence (m, ) = 1. ( ) Suppose (m, ) = 1, hence there exist p, q Z such that pm + q = 1. Hence apm + aq = a which implies (aq) a mod m. Hence a mod m is defined. Using the aove lemma we can easily find a mod m in O (n ) time. First using the extended Euclid s algorithm determine if (m, ) = 1. If this is indeed the case then the algorithm will also output the pair (p, q) and clearly q 1 mod m. Hence aq 1 mod m. Since the Euclid s algorithm works in quadratic time and M(n) = o(n ) hence the algorithm takes only O (n ) time. References [Coo66] Stephen A. Cook. On the Minimum Computation Time of Functions. PhD thesis, Department of Mathematics, Harvard University, [DKSS08] Anindya De, Piyush Kurur, Chandan Saha, and Ramprasad Saptharishi. Fast Integer Multiplication Using Modular Arithmetic. In Fortieth Annual ACM Symposium on Theory of Computing, 008. [F 07] [KO6] Martin Fürer. Faster Integer Multiplication. In Thirty Ninth Annual ACM Symposium on Theory of Computing, 007. A. Karatsua and Yu. Ofman. Multiplication of Many-Digital Numers y Automatic Computers. Proceedings of the USSR Academy of Sciences, 145:93 94,

5 [SS71] A. Schönhage and V. Strassen. Schnelle Multiplikation großer Zahlen. Computing, 7:81 9, [Too63] Andrei Toom. The Complexity of a Scheme of Functional Elements Realizing the Multiplication of Integers. Soviet Mathematics - Doklady, 3: ,

Fast Polynomials Multiplication Using FFT

Fast Polynomials Multiplication Using FFT Li Chen lichen.xd at gmail.com Xidian University January 17, 2014 Outline 1 Discrete Fourier Transform (DFT) 2 Discrete Convolution 3 Fast Fourier Transform (FFT) 4 umber Theoretic Transform (TT) 5 More

More information

Fast inverse for big numbers: Picarte s iteration

Fast inverse for big numbers: Picarte s iteration Fast inverse for ig numers: Picarte s iteration Claudio Gutierrez and Mauricio Monsalve Computer Science Department, Universidad de Chile cgutierr,mnmonsal@dcc.uchile.cl Astract. This paper presents an

More information

CPSC 518 Introduction to Computer Algebra Asymptotically Fast Integer Multiplication

CPSC 518 Introduction to Computer Algebra Asymptotically Fast Integer Multiplication CPSC 518 Introduction to Computer Algebra Asymptotically Fast Integer Multiplication 1 Introduction We have now seen that the Fast Fourier Transform can be applied to perform polynomial multiplication

More information

Implementation of the DKSS Algorithm for Multiplication of Large Numbers

Implementation of the DKSS Algorithm for Multiplication of Large Numbers Implementation of the DKSS Algorithm for Multiplication of Large Numbers Christoph Lüders Universität Bonn The International Symposium on Symbolic and Algebraic Computation, July 6 9, 2015, Bath, United

More information

Algorithms (II) Yu Yu. Shanghai Jiaotong University

Algorithms (II) Yu Yu. Shanghai Jiaotong University Algorithms (II) Yu Yu Shanghai Jiaotong University Chapter 1. Algorithms with Numbers Two seemingly similar problems Factoring: Given a number N, express it as a product of its prime factors. Primality:

More information

MCS 115 Exam 2 Solutions Apr 26, 2018

MCS 115 Exam 2 Solutions Apr 26, 2018 MCS 11 Exam Solutions Apr 6, 018 1 (10 pts) Suppose you have an infinitely large arrel and a pile of infinitely many ping-pong alls, laeled with the positive integers 1,,3,, much like in the ping-pong

More information

Module 9: Further Numbers and Equations. Numbers and Indices. The aim of this lesson is to enable you to: work with rational and irrational numbers

Module 9: Further Numbers and Equations. Numbers and Indices. The aim of this lesson is to enable you to: work with rational and irrational numbers Module 9: Further Numers and Equations Lesson Aims The aim of this lesson is to enale you to: wor with rational and irrational numers wor with surds to rationalise the denominator when calculating interest,

More information

Lecture 11: Cantor-Zassenhaus Algorithm

Lecture 11: Cantor-Zassenhaus Algorithm CS681 Computational Number Theory Lecture 11: Cantor-Zassenhaus Algorithm Instructor: Piyush P Kurur Scribe: Ramprasad Saptharishi Overview In this class, we shall look at the Cantor-Zassenhaus randomized

More information

Exploring Lucas s Theorem. Abstract: Lucas s Theorem is used to express the remainder of the binomial coefficient of any two

Exploring Lucas s Theorem. Abstract: Lucas s Theorem is used to express the remainder of the binomial coefficient of any two Delia Ierugan Exploring Lucas s Theorem Astract: Lucas s Theorem is used to express the remainder of the inomial coefficient of any two integers m and n when divided y any prime integer p. The remainder

More information

Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6

Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6 CS 70 Discrete Mathematics and Probability Theory Fall 2018 Alistair Sinclair and Yun Song Note 6 1 Modular Arithmetic In several settings, such as error-correcting codes and cryptography, we sometimes

More information

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5 CS 70 Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 5 Modular Arithmetic In several settings, such as error-correcting codes and cryptography, we sometimes wish to work over a

More information

Polynomial Degree and Finite Differences

Polynomial Degree and Finite Differences CONDENSED LESSON 7.1 Polynomial Degree and Finite Differences In this lesson, you Learn the terminology associated with polynomials Use the finite differences method to determine the degree of a polynomial

More information

Computing rank-width exactly

Computing rank-width exactly Computing rank-width exactly Sang-il Oum Department of Mathematical Sciences KAIST 335 Gwahangno Yuseong-gu Daejeon 305-701 South Korea September 9, 2008 Abstract We prove that the rank-width of an n-vertex

More information

Computer Vision, Convolutions, Complexity and Algebraic Geometry

Computer Vision, Convolutions, Complexity and Algebraic Geometry Computer Vision, Convolutions, Complexity and Algebraic Geometry D. V. Chudnovsky, G.V. Chudnovsky IMAS Polytechnic Institute of NYU 6 MetroTech Center Brooklyn, NY 11201 December 6, 2012 Fast Multiplication:

More information

Factoring. there exists some 1 i < j l such that x i x j (mod p). (1) p gcd(x i x j, n).

Factoring. there exists some 1 i < j l such that x i x j (mod p). (1) p gcd(x i x j, n). 18.310 lecture notes April 22, 2015 Factoring Lecturer: Michel Goemans We ve seen that it s possible to efficiently check whether an integer n is prime or not. What about factoring a number? If this could

More information

Implementation of the DKSS Algorithm for Multiplication of Large Numbers

Implementation of the DKSS Algorithm for Multiplication of Large Numbers Implementation of the DKSS Algorithm for Multiplication of Large Numbers Christoph Lüders Universität Bonn Institut für Informatik Bonn, Germany chris@cfos.de ABSTRACT The Schönhage-Strassen algorithm

More information

Three Ways to Test Irreducibility

Three Ways to Test Irreducibility Three Ways to Test Irreducibility Richard P. Brent Australian National University joint work with Paul Zimmermann INRIA, Nancy France 12 Feb 2009 Outline Polynomials over finite fields Irreducibility criteria

More information

Three Ways to Test Irreducibility

Three Ways to Test Irreducibility Outline Three Ways to Test Irreducibility Richard P. Brent Australian National University joint work with Paul Zimmermann INRIA, Nancy France 8 Dec 2008 Polynomials over finite fields Irreducibility criteria

More information

1 Caveats of Parallel Algorithms

1 Caveats of Parallel Algorithms CME 323: Distriuted Algorithms and Optimization, Spring 2015 http://stanford.edu/ reza/dao. Instructor: Reza Zadeh, Matroid and Stanford. Lecture 1, 9/26/2015. Scried y Suhas Suresha, Pin Pin, Andreas

More information

arxiv: v3 [cs.sc] 19 Sep 2008

arxiv: v3 [cs.sc] 19 Sep 2008 Fast Integer Multiplication Using Modular Arithmetic arxiv:0801.1416v3 [cs.sc] 19 Sep 2008 Anindya De, Piyush P Kurur, Chandan Saha Dept. of Computer Science and Engineering Indian Institute of Technology,

More information

Discrete Mathematics U. Waterloo ECE 103, Spring 2010 Ashwin Nayak May 17, 2010 Recursion

Discrete Mathematics U. Waterloo ECE 103, Spring 2010 Ashwin Nayak May 17, 2010 Recursion Discrete Mathematics U. Waterloo ECE 103, Spring 2010 Ashwin Nayak May 17, 2010 Recursion During the past week, we learnt about inductive reasoning, in which we broke down a problem of size n, into one

More information

PUTTING FÜRER ALGORITHM INTO PRACTICE WITH THE BPAS LIBRARY. (Thesis format: Monograph) Linxiao Wang. Graduate Program in Computer Science

PUTTING FÜRER ALGORITHM INTO PRACTICE WITH THE BPAS LIBRARY. (Thesis format: Monograph) Linxiao Wang. Graduate Program in Computer Science PUTTING FÜRER ALGORITHM INTO PRACTICE WITH THE BPAS LIBRARY. (Thesis format: Monograph) by Linxiao Wang Graduate Program in Computer Science A thesis submitted in partial fulfillment of the requirements

More information

At first numbers were used only for counting, and 1, 2, 3,... were all that was needed. These are called positive integers.

At first numbers were used only for counting, and 1, 2, 3,... were all that was needed. These are called positive integers. 1 Numers One thread in the history of mathematics has een the extension of what is meant y a numer. This has led to the invention of new symols and techniques of calculation. When you have completed this

More information

1Number ONLINE PAGE PROOFS. systems: real and complex. 1.1 Kick off with CAS

1Number ONLINE PAGE PROOFS. systems: real and complex. 1.1 Kick off with CAS 1Numer systems: real and complex 1.1 Kick off with CAS 1. Review of set notation 1.3 Properties of surds 1. The set of complex numers 1.5 Multiplication and division of complex numers 1.6 Representing

More information

Chaos and Dynamical Systems

Chaos and Dynamical Systems Chaos and Dynamical Systems y Megan Richards Astract: In this paper, we will discuss the notion of chaos. We will start y introducing certain mathematical concepts needed in the understanding of chaos,

More information

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 3

Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 3 CS 70 Discrete Mathematics and Probability Theory Fall 2013 Vazirani Note 3 Modular Arithmetic In several settings, such as error-correcting codes and cryptography, we sometimes wish to work over a smaller

More information

Elliptic Curves Spring 2013 Lecture #3 02/12/2013

Elliptic Curves Spring 2013 Lecture #3 02/12/2013 18.783 Elliptic Curves Spring 2013 Lecture #3 02/12/2013 3.1 Arithmetic in finite fields To make explicit computations with elliptic curves over finite fields, we need to know how to perform arithmetic

More information

On the computational complexity of mathematical functions

On the computational complexity of mathematical functions On the computational complexity of mathematical functions Jean-Pierre Demailly Institut Fourier, Université de Grenoble I & Académie des Sciences, Paris (France) November 26, 2011 KVPY conference at Vijyoshi

More information

THE INFLATION-RESTRICTION SEQUENCE : AN INTRODUCTION TO SPECTRAL SEQUENCES

THE INFLATION-RESTRICTION SEQUENCE : AN INTRODUCTION TO SPECTRAL SEQUENCES THE INFLATION-RESTRICTION SEQUENCE : AN INTRODUCTION TO SPECTRAL SEQUENCES TOM WESTON. Example We egin with aelian groups for every p, q and maps : + (here, as in all of homological algera, all maps are

More information

Algebra I Notes Concept 00b: Review Properties of Integer Exponents

Algebra I Notes Concept 00b: Review Properties of Integer Exponents Algera I Notes Concept 00: Review Properties of Integer Eponents In Algera I, a review of properties of integer eponents may e required. Students egin their eploration of power under the Common Core in

More information

Kartsuba s Algorithm and Linear Time Selection

Kartsuba s Algorithm and Linear Time Selection CS 374: Algorithms & Models of Computation, Fall 2015 Kartsuba s Algorithm and Linear Time Selection Lecture 09 September 22, 2015 Chandra & Manoj (UIUC) CS374 1 Fall 2015 1 / 32 Part I Fast Multiplication

More information

1 Substitution method

1 Substitution method Recurrence Relations we have discussed asymptotic analysis of algorithms and various properties associated with asymptotic notation. As many algorithms are recursive in nature, it is natural to analyze

More information

SECTION 9.2: ARITHMETIC SEQUENCES and PARTIAL SUMS

SECTION 9.2: ARITHMETIC SEQUENCES and PARTIAL SUMS (Chapter 9: Discrete Math) 9.11 SECTION 9.2: ARITHMETIC SEQUENCES and PARTIAL SUMS PART A: WHAT IS AN ARITHMETIC SEQUENCE? The following appears to be an example of an arithmetic (stress on the me ) sequence:

More information

Speedy Maths. David McQuillan

Speedy Maths. David McQuillan Speedy Maths David McQuillan Basic Arithmetic What one needs to be able to do Addition and Subtraction Multiplication and Division Comparison For a number of order 2 n n ~ 100 is general multi precision

More information

CS/COE 1501 cs.pitt.edu/~bill/1501/ Integer Multiplication

CS/COE 1501 cs.pitt.edu/~bill/1501/ Integer Multiplication CS/COE 1501 cs.pitt.edu/~bill/1501/ Integer Multiplication Integer multiplication Say we have 5 baskets with 8 apples in each How do we determine how many apples we have? Count them all? That would take

More information

Laver Tables A Direct Approach

Laver Tables A Direct Approach Laver Tables A Direct Approach Aurel Tell Adler June 6, 016 Contents 1 Introduction 3 Introduction to Laver Tables 4.1 Basic Definitions............................... 4. Simple Facts.................................

More information

Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane.

Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane. Queens College, CUNY, Department of Computer Science Numerical Methods CSCI 361 / 761 Spring 2018 Instructor: Dr. Sateesh Mane c Sateesh R. Mane 2018 3 Lecture 3 3.1 General remarks March 4, 2018 This

More information

Essential Maths 1. Macquarie University MAFC_Essential_Maths Page 1 of These notes were prepared by Anne Cooper and Catriona March.

Essential Maths 1. Macquarie University MAFC_Essential_Maths Page 1 of These notes were prepared by Anne Cooper and Catriona March. Essential Maths 1 The information in this document is the minimum assumed knowledge for students undertaking the Macquarie University Masters of Applied Finance, Graduate Diploma of Applied Finance, and

More information

Lecture 15 and 16: BCH Codes: Error Correction

Lecture 15 and 16: BCH Codes: Error Correction CS681 Computational Number Theory Lecture 15 and 16: BCH Codes: Error Correction Instructor: Piyush P Kurur Scribe: Ramprasad Saptharishi Overview In these two lectures, we shall see how error correction

More information

Fast Integer Multiplication Using Modular Arithmetic

Fast Integer Multiplication Using Modular Arithmetic Fast Integer Multiplication Using Modular Arithmetic Anindya De Computer Science Division University of California at Berkeley Berkeley, CA 94720, USA anindya@eecs.berkeley.edu Chandan Saha Dept. of Computer

More information

CURRICULUM TIDBITS FOR THE MATHEMATICS CLASSROOM

CURRICULUM TIDBITS FOR THE MATHEMATICS CLASSROOM TANTON S TAKE ON LOGARITHMS CURRICULUM TIDBITS FOR THE MATHEMATICS CLASSROOM APRIL 01 Try walking into an algera II class and writing on the oard, perhaps even in silence, the following: = Your turn! (

More information

. Divide common fractions: 12 a. = a b. = a b b. = ac b c. 10. State that x 3 means x x x, . Cancel common factors in a fraction : 2a2 b 3.

. Divide common fractions: 12 a. = a b. = a b b. = ac b c. 10. State that x 3 means x x x, . Cancel common factors in a fraction : 2a2 b 3. Page 1 of 6 Target audience: Someone who understands the previous Overview chapters and can comfortaly: 2. Divide common fractions: 3 4 5 = 2 3 5 4 = 10 12 a = a 1 c c = a = ac c 1. Find common denominators:

More information

All variables a, b, n, etc are integers unless otherwise stated. Each part of a problem is worth 5 points.

All variables a, b, n, etc are integers unless otherwise stated. Each part of a problem is worth 5 points. Math 152, Problem Set 2 solutions (2018-01-24) All variables a, b, n, etc are integers unless otherwise stated. Each part of a problem is worth 5 points. 1. Let us look at the following equation: x 5 1

More information

6.S897 Algebra and Computation February 27, Lecture 6

6.S897 Algebra and Computation February 27, Lecture 6 6.S897 Algebra and Computation February 7, 01 Lecture 6 Lecturer: Madhu Sudan Scribe: Mohmammad Bavarian 1 Overview Last lecture we saw how to use FFT to multiply f, g R[x] in nearly linear time. We also

More information

Lecture 4: Number theory

Lecture 4: Number theory Lecture 4: Number theory Rajat Mittal IIT Kanpur In the next few classes we will talk about the basics of number theory. Number theory studies the properties of natural numbers and is considered one of

More information

Numerical Methods. King Saud University

Numerical Methods. King Saud University Numerical Methods King Saud University Aims In this lecture, we will... Introduce the topic of numerical methods Consider the Error analysis and sources of errors Introduction A numerical method which

More information

= 1 2x. x 2 a ) 0 (mod p n ), (x 2 + 2a + a2. x a ) 2

= 1 2x. x 2 a ) 0 (mod p n ), (x 2 + 2a + a2. x a ) 2 8. p-adic numbers 8.1. Motivation: Solving x 2 a (mod p n ). Take an odd prime p, and ( an) integer a coprime to p. Then, as we know, x 2 a (mod p) has a solution x Z iff = 1. In this case we can suppose

More information

The next sequence of lectures in on the topic of Arithmetic Algorithms. We shall build up to an understanding of the RSA public-key cryptosystem.

The next sequence of lectures in on the topic of Arithmetic Algorithms. We shall build up to an understanding of the RSA public-key cryptosystem. CS 70 Discrete Mathematics for CS Fall 2003 Wagner Lecture 10 The next sequence of lectures in on the topic of Arithmetic Algorithms. We shall build up to an understanding of the RSA public-key cryptosystem.

More information

Recurrence Relations

Recurrence Relations Recurrence Relations Recurrence Relations Reading (Epp s textbook) 5.6 5.8 1 Recurrence Relations A recurrence relation for a sequence aa 0, aa 1, aa 2, ({a n }) is a formula that relates each term a k

More information

Integer Multiplication

Integer Multiplication Integer Multiplication in almost linear time Martin Fürer CSE 588 Department of Computer Science and Engineering Pennsylvania State University 1/24/08 Karatsuba algebraic Split each of the two factors

More information

Lecture 6 January 15, 2014

Lecture 6 January 15, 2014 Advanced Graph Algorithms Jan-Apr 2014 Lecture 6 January 15, 2014 Lecturer: Saket Sourah Scrie: Prafullkumar P Tale 1 Overview In the last lecture we defined simple tree decomposition and stated that for

More information

Clock Arithmetic. 1. If it is 9 o clock and you get out of school in 4 hours, when do you get out of school?

Clock Arithmetic. 1. If it is 9 o clock and you get out of school in 4 hours, when do you get out of school? Clock Arithmetic We are going to learn all about clock addition and the relationship to remainders when you divide numbers. 1 Standard Clock Addition 1. If it is 9 o clock and you get out of school in

More information

Fall 2017 November 10, Written Homework 5

Fall 2017 November 10, Written Homework 5 CS1800 Discrete Structures Profs. Aslam, Gold, & Pavlu Fall 2017 November 10, 2017 Assigned: Mon Nov 13 2017 Due: Wed Nov 29 2017 Instructions: Written Homework 5 The assignment has to be uploaded to blackboard

More information

CS 577 Introduction to Algorithms: Strassen s Algorithm and the Master Theorem

CS 577 Introduction to Algorithms: Strassen s Algorithm and the Master Theorem CS 577 Introduction to Algorithms: Jin-Yi Cai University of Wisconsin Madison In the last class, we described InsertionSort and showed that its worst-case running time is Θ(n 2 ). Check Figure 2.2 for

More information

3.5 Solving Quadratic Equations by the

3.5 Solving Quadratic Equations by the www.ck1.org Chapter 3. Quadratic Equations and Quadratic Functions 3.5 Solving Quadratic Equations y the Quadratic Formula Learning ojectives Solve quadratic equations using the quadratic formula. Identify

More information

Conceptual Explanations: Logarithms

Conceptual Explanations: Logarithms Conceptual Eplanations: Logarithms Suppose you are a iologist investigating a population that doules every year. So if you start with 1 specimen, the population can e epressed as an eponential function:

More information

2WF15 - Discrete Mathematics 2 - Part 1. Algorithmic Number Theory

2WF15 - Discrete Mathematics 2 - Part 1. Algorithmic Number Theory 1 2WF15 - Discrete Mathematics 2 - Part 1 Algorithmic Number Theory Benne de Weger version 0.54, March 6, 2012 version 0.54, March 6, 2012 2WF15 - Discrete Mathematics 2 - Part 1 2 2WF15 - Discrete Mathematics

More information

Fast, Parallel Algorithm for Multiplying Polynomials with Integer Coefficients

Fast, Parallel Algorithm for Multiplying Polynomials with Integer Coefficients , July 4-6, 01, London, UK Fast, Parallel Algorithm for Multiplying Polynomials with Integer Coefficients Andrzej Chmielowiec Abstract This paper aims to develop and analyze an effective parallel algorithm

More information

Fermat's Little Theorem

Fermat's Little Theorem Fermat's Little Theorem CS 2800: Discrete Structures, Spring 2015 Sid Chaudhuri Not to be confused with... Fermat's Last Theorem: x n + y n = z n has no integer solution for n > 2 Recap: Modular Arithmetic

More information

Modular Arithmetic Instructor: Marizza Bailey Name:

Modular Arithmetic Instructor: Marizza Bailey Name: Modular Arithmetic Instructor: Marizza Bailey Name: 1. Introduction to Modular Arithmetic If someone asks you what day it is 145 days from now, what would you answer? Would you count 145 days, or find

More information

Definition: A sequence is a function from a subset of the integers (usually either the set

Definition: A sequence is a function from a subset of the integers (usually either the set Math 3336 Section 2.4 Sequences and Summations Sequences Geometric Progression Arithmetic Progression Recurrence Relation Fibonacci Sequence Summations Definition: A sequence is a function from a subset

More information

CSE 20 DISCRETE MATH. Winter

CSE 20 DISCRETE MATH. Winter CSE 20 DISCRETE MATH Winter 2017 http://cseweb.ucsd.edu/classes/wi17/cse20-ab/ Today's learning goals Determine whether a relation is an equivalence relation by determining whether it is Reflexive Symmetric

More information

Algebra I Notes Unit Nine: Exponential Expressions

Algebra I Notes Unit Nine: Exponential Expressions Algera I Notes Unit Nine: Eponential Epressions Syllaus Ojectives: 7. The student will determine the value of eponential epressions using a variety of methods. 7. The student will simplify algeraic epressions

More information

CPSC 467: Cryptography and Computer Security

CPSC 467: Cryptography and Computer Security CPSC 467: Cryptography and Computer Security Michael J. Fischer Lecture 9 September 30, 2015 CPSC 467, Lecture 9 1/47 Fast Exponentiation Algorithms Number Theory Needed for RSA Elementary Number Theory

More information

Non-Linear Regression Samuel L. Baker

Non-Linear Regression Samuel L. Baker NON-LINEAR REGRESSION 1 Non-Linear Regression 2006-2008 Samuel L. Baker The linear least squares method that you have een using fits a straight line or a flat plane to a unch of data points. Sometimes

More information

Continuing discussion of CRC s, especially looking at two-bit errors

Continuing discussion of CRC s, especially looking at two-bit errors Continuing discussion of CRC s, especially looking at two-bit errors The definition of primitive binary polynomials Brute force checking for primitivity A theorem giving a better test for primitivity Fast

More information

III.A. ESTIMATIONS USING THE DERIVATIVE Draft Version 10/13/05 Martin Flashman 2005 III.A.2 NEWTON'S METHOD

III.A. ESTIMATIONS USING THE DERIVATIVE Draft Version 10/13/05 Martin Flashman 2005 III.A.2 NEWTON'S METHOD III.A. ESTIMATIONS USING THE DERIVATIVE Draft Version 10/13/05 Martin Flashman 2005 III.A.2 NEWTON'S METHOD Motivation: An apocryphal story: On our last trip to Disneyland, California, it was about 11

More information

1.1 Administrative Stuff

1.1 Administrative Stuff 601.433 / 601.633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Introduction, Karatsuba/Strassen Date: 9/4/18 1.1 Administrative Stuff Welcome to Algorithms! In this class you will learn the

More information

Creating Good Equations for the Classroom: Rational, Logarithmic and Square Root aversion ""Î# 9Î#!"'

Creating Good Equations for the Classroom: Rational, Logarithmic and Square Root aversion Î# 9Î#!' Creating Good Equations for the Classroom: Rational, Logarithmic and Square Root aversion ""Î 9Î!"' Alan Roeuck Chaffey College alan.roeuck@chaffey.edu We're math teachers. We don't just solve equations,

More information

Representation theory of SU(2), density operators, purification Michael Walter, University of Amsterdam

Representation theory of SU(2), density operators, purification Michael Walter, University of Amsterdam Symmetry and Quantum Information Feruary 6, 018 Representation theory of S(), density operators, purification Lecture 7 Michael Walter, niversity of Amsterdam Last week, we learned the asic concepts of

More information

Divide-and-Conquer. Reading: CLRS Sections 2.3, 4.1, 4.2, 4.3, 28.2, CSE 6331 Algorithms Steve Lai

Divide-and-Conquer. Reading: CLRS Sections 2.3, 4.1, 4.2, 4.3, 28.2, CSE 6331 Algorithms Steve Lai Divide-and-Conquer Reading: CLRS Sections 2.3, 4.1, 4.2, 4.3, 28.2, 33.4. CSE 6331 Algorithms Steve Lai Divide and Conquer Given an instance x of a prolem, the method works as follows: divide-and-conquer

More information

Class Note #14. In this class, we studied an algorithm for integer multiplication, which. 2 ) to θ(n

Class Note #14. In this class, we studied an algorithm for integer multiplication, which. 2 ) to θ(n Class Note #14 Date: 03/01/2006 [Overall Information] In this class, we studied an algorithm for integer multiplication, which improved the running time from θ(n 2 ) to θ(n 1.59 ). We then used some of

More information

THE JACOBI SYMBOL AND A METHOD OF EISENSTEIN FOR CALCULATING IT

THE JACOBI SYMBOL AND A METHOD OF EISENSTEIN FOR CALCULATING IT THE JACOBI SYMBOL AND A METHOD OF EISENSTEIN FOR CALCULATING IT STEVEN H. WEINTRAUB ABSTRACT. We present an exposition of the asic properties of the Jacoi symol, with a method of calculating it due to

More information

CHAPTER 3. Congruences. Congruence: definitions and properties

CHAPTER 3. Congruences. Congruence: definitions and properties CHAPTER 3 Congruences Part V of PJE Congruence: definitions and properties Definition. (PJE definition 19.1.1) Let m > 0 be an integer. Integers a and b are congruent modulo m if m divides a b. We write

More information

Lecture 6: Finite Fields

Lecture 6: Finite Fields CCS Discrete Math I Professor: Padraic Bartlett Lecture 6: Finite Fields Week 6 UCSB 2014 It ain t what they call you, it s what you answer to. W. C. Fields 1 Fields In the next two weeks, we re going

More information

Fast Polynomial Multiplication

Fast Polynomial Multiplication Fast Polynomial Multiplication Marc Moreno Maza CS 9652, October 4, 2017 Plan Primitive roots of unity The discrete Fourier transform Convolution of polynomials The fast Fourier transform Fast convolution

More information

Integer multiplication and the truncated product problem

Integer multiplication and the truncated product problem Integer multiplication and the truncated product problem David Harvey Arithmetic Geometry, Number Theory, and Computation MIT, August 2018 University of New South Wales Political update from Australia

More information

Q 2.0.2: If it s 5:30pm now, what time will it be in 4753 hours? Q 2.0.3: Today is Wednesday. What day of the week will it be in one year from today?

Q 2.0.2: If it s 5:30pm now, what time will it be in 4753 hours? Q 2.0.3: Today is Wednesday. What day of the week will it be in one year from today? 2 Mod math Modular arithmetic is the math you do when you talk about time on a clock. For example, if it s 9 o clock right now, then it ll be 1 o clock in 4 hours. Clearly, 9 + 4 1 in general. But on a

More information

Math 109 HW 9 Solutions

Math 109 HW 9 Solutions Math 109 HW 9 Solutions Problems IV 18. Solve the linear diophantine equation 6m + 10n + 15p = 1 Solution: Let y = 10n + 15p. Since (10, 15) is 5, we must have that y = 5x for some integer x, and (as we

More information

SOLUTION OF ALGEBRAIC AND TRANSCENDENTAL EQUATIONS BISECTION METHOD

SOLUTION OF ALGEBRAIC AND TRANSCENDENTAL EQUATIONS BISECTION METHOD BISECTION METHOD If a function f(x) is continuous between a and b, and f(a) and f(b) are of opposite signs, then there exists at least one root between a and b. It is shown graphically as, Let f a be negative

More information

Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively

Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively 6 Prime Numbers Part VI of PJE 6.1 Fundamental Results Definition 6.1 (p.277) A positive integer n is prime when n > 1 and the only positive divisors are 1 and n. Alternatively D (p) = { p 1 1 p}. Otherwise

More information

Solving Systems of Linear Equations Symbolically

Solving Systems of Linear Equations Symbolically " Solving Systems of Linear Equations Symolically Every day of the year, thousands of airline flights crisscross the United States to connect large and small cities. Each flight follows a plan filed with

More information

Approximate Binary Search Algorithms for Mean Cuts and Cycles

Approximate Binary Search Algorithms for Mean Cuts and Cycles Approximate Binary Search Algorithms for Mean Cuts and Cycles S. Thomas McCormick Faculty of Commerce and Business Administration University of British Columbia Vancouver, BC V6T 1Z2 Canada June 1992,

More information

Efficient Modular Arithmetic in Adapted Modular Number System using Lagrange Representation

Efficient Modular Arithmetic in Adapted Modular Number System using Lagrange Representation Efficient Modular Arithmetic in Adapted Modular Number System using Lagrange Representation Christophe Negre 1, Thomas Plantard 2 1 Team DALI, University of Perpignan, France. 2 Centre for Information

More information

Number Theory. Zachary Friggstad. Programming Club Meeting

Number Theory. Zachary Friggstad. Programming Club Meeting Number Theory Zachary Friggstad Programming Club Meeting Outline Factoring Sieve Multiplicative Functions Greatest Common Divisors Applications Chinese Remainder Theorem Throughout, problems to try are

More information

Upper Bounds for Stern s Diatomic Sequence and Related Sequences

Upper Bounds for Stern s Diatomic Sequence and Related Sequences Upper Bounds for Stern s Diatomic Sequence and Related Sequences Colin Defant Department of Mathematics University of Florida, U.S.A. cdefant@ufl.edu Sumitted: Jun 18, 01; Accepted: Oct, 016; Pulished:

More information

The first property listed above is an incredibly useful tool in divisibility problems. We ll prove that it holds below.

The first property listed above is an incredibly useful tool in divisibility problems. We ll prove that it holds below. 1 Divisiility Definition 1 We say an integer is divisile y a nonzero integer a denoted a - read as a divides if there is an integer n such that = an If no such n exists, we say is not divisile y a denoted

More information

Prime Number Theory and the Riemann Zeta-Function

Prime Number Theory and the Riemann Zeta-Function 5262589 - Recent Perspectives in Random Matrix Theory and Number Theory Prime Number Theory and the Riemann Zeta-Function D.R. Heath-Brown Primes An integer p N is said to be prime if p and there is no

More information

NUMBER SYSTEMS. Number theory is the study of the integers. We denote the set of integers by Z:

NUMBER SYSTEMS. Number theory is the study of the integers. We denote the set of integers by Z: NUMBER SYSTEMS Number theory is the study of the integers. We denote the set of integers by Z: Z = {..., 3, 2, 1, 0, 1, 2, 3,... }. The integers have two operations defined on them, addition and multiplication,

More information

1.1.1 Algebraic Operations

1.1.1 Algebraic Operations 1.1.1 Algebraic Operations We need to learn how our basic algebraic operations interact. When confronted with many operations, we follow the order of operations: Parentheses Exponentials Multiplication

More information

Number Theory. Modular Arithmetic

Number Theory. Modular Arithmetic Number Theory The branch of mathematics that is important in IT security especially in cryptography. Deals only in integer numbers and the process can be done in a very fast manner. Modular Arithmetic

More information

A Few Primality Testing Algorithms

A Few Primality Testing Algorithms A Few Primality Testing Algorithms Donald Brower April 2, 2006 0.1 Introduction These notes will cover a few primality testing algorithms. There are many such, some prove that a number is prime, others

More information

CMPUT 403: Number Theory

CMPUT 403: Number Theory CMPUT 403: Number Theory Zachary Friggstad February 26, 2016 Outline Factoring Sieve Multiplicative Functions Greatest Common Divisors Applications Chinese Remainder Theorem Factoring Theorem (Fundamental

More information

5 + 9(10) + 3(100) + 0(1000) + 2(10000) =

5 + 9(10) + 3(100) + 0(1000) + 2(10000) = Chapter 5 Analyzing Algorithms So far we have been proving statements about databases, mathematics and arithmetic, or sequences of numbers. Though these types of statements are common in computer science,

More information

CPSC 518 Introduction to Computer Algebra Schönhage and Strassen s Algorithm for Integer Multiplication

CPSC 518 Introduction to Computer Algebra Schönhage and Strassen s Algorithm for Integer Multiplication CPSC 518 Introduction to Computer Algebra Schönhage and Strassen s Algorithm for Integer Multiplication March, 2006 1 Introduction We have now seen that the Fast Fourier Transform can be applied to perform

More information

Math 2602 Finite and Linear Math Fall 14. Homework 8: Core solutions

Math 2602 Finite and Linear Math Fall 14. Homework 8: Core solutions Math 2602 Finite and Linear Math Fall 14 Homework 8: Core solutions Review exercises for Chapter 5 page 183 problems 25, 26a-26b, 29. Section 8.1 on page 252 problems 8, 9, 10, 13. Section 8.2 on page

More information

CSE 20 DISCRETE MATH. Fall

CSE 20 DISCRETE MATH. Fall CSE 20 DISCRETE MATH Fall 2017 http://cseweb.ucsd.edu/classes/fa17/cse20-ab/ Today's learning goals Determine whether a relation is an equivalence relation by determining whether it is Reflexive Symmetric

More information

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}.

2 Arithmetic. 2.1 Greatest common divisors. This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}. 2 Arithmetic This chapter is about properties of the integers Z = {..., 2, 1, 0, 1, 2,...}. (See [Houston, Chapters 27 & 28]) 2.1 Greatest common divisors Definition 2.16. If a, b are integers, we say

More information

On the Exponent of the All Pairs Shortest Path Problem

On the Exponent of the All Pairs Shortest Path Problem On the Exponent of the All Pairs Shortest Path Problem Noga Alon Department of Mathematics Sackler Faculty of Exact Sciences Tel Aviv University Zvi Galil Department of Computer Science Sackler Faculty

More information

Numerical Analysis Lecture Notes

Numerical Analysis Lecture Notes Numerical Analysis Lecture Notes Peter J Olver 8 Numerical Computation of Eigenvalues In this part, we discuss some practical methods for computing eigenvalues and eigenvectors of matrices Needless to

More information