1 / 11

CSE20 Lecture 5 4/12/11

CSE20 Lecture 5 4/12/11. CK Cheng UC San Diego. Residual Numbers (NT-1 and Shaum’s Chapter 11). Introduction Definition Operations Range of numbers. Introduction. Applications: communication, cryptography, and high performance signal processing

sibyl
Download Presentation

CSE20 Lecture 5 4/12/11

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE20 Lecture 54/12/11 CK Cheng UC San Diego

  2. Residual Numbers(NT-1 and Shaum’s Chapter 11) • Introduction • Definition • Operations • Range of numbers

  3. Introduction • Applications: communication, cryptography, and high performance signal processing • Goal: Simplify arithmetic operations (+, -, x) when bit width n is huge, e.g. n= 1000. Note no division is involved. • Flow: Residual number (x1, x2, …, xk) +, -, x operations for each xi under mi Mod Operation Number x Moduli (m1, m2, …, mk) Results Chinese Remainder Theorem

  4. Definition Mod (Modular) operation. • Given integer x and d (d> 0), find q and r such that x = q*d+r, 0<= r <d, where q: quotient, d: divisor, and r: remainder. We define x%d= r. Conversion to residual system: Given moduli (m1, m2, …, mk), where all mi are mutually prime, transform integer x to (r1, r2, …, rk), where ri=x%mi

  5. Definitions • Mutually Prime: Two integers a & b are mutually (or relatively) prime if their greatest common divisor is 1. • e.g. 3 & 8, 4 & 9, but not 6 & 9 • Residual number: Given (m1, m2,…,mk) where mis are mutually prime and a positive integer x <M=m1xm2x…xmk (0 ≤x <M ) represent x as ( x%m1, x%m2,…, x%mk )

  6. Examples (x%mi=ri) Given (m1, m2, m3) = (3, 5, 7), convert x: (r1, r2, r3). • 0: (0, 0, 0); 0%3=0, 0%5=0, 0%7= 0 • 2: (2, 2, 2); 2%3=2, 2%5=2, 2%7=2 • 21: (0, 1, 0); 21%3=0 , 21%5=1, 21%7=0 • -2: (1, 3, 5); -2%3=1, -2%5=3, -2%7=5 • -3: (0, 2, 4); -3%3=0, -3%5=2, -3%7=4 • -21: (0, 4, 0); -21%3=0, -21%5= 4, -21%7=0 Hint: 0<= ri < mi

  7. Examples • k = 3 ( m1, m2, m3) = ( 2, 3, 7 ) • M = m1 x m2 x m3= 2 x 3 x 7 = 42 • Given x=30, ( x%m1, x%m2, x%m3) = ( 30%2, 30%3, 30%7 ) = ( 0, 0, 2 ) • Given y=4, ( y%m1, y%m2, y%m3) = ( 4%2, 4%3, 4%7 ) = ( 0, 1, 4 ) • Given x+y=34, ((x+y)%m1,(x+y)%m2,(x+y)%m3) = ( 34%2, 34%3, 34%7 ) = ( 0, 1, 6 )

  8. 3. Modular Operations Theorem: Given three integers x,y,d, we have (x+y)%d=(x%d+y%d)%d. Proof: Let x = qxd + rx, y = qyd + ry We have (x+y)%d = (qxd + rx + qyd + ry)%d =(rx+ry)%d Therefore, (x+y)%d = (x%d+y%d)%d

  9. 3. Modular Operations Theorem: Given three integers x,y,d, we have (x*y)%d=(x%d * y%d)%d. Proof: Let x = qxd + rx, y = qyd + ry We have (x*y)%d = (qxd + rx )*(qyd + ry)%d =(qxqyd2+ryqxd+rxqyd+rx*ry)%d = (rx*ry)%d Therefore, (x*y)%d = (x%d * y%d)%d

  10. 3. Modular Operations • What about division? • Could we state the following equality? ((x%d)/(y%d))%d= (x/y)%d Answer: No! We have the following problems. • y%d can be zero. • (x%d)/(y%d) or x/y can be fractional.

  11. Range of Numbers Theorem: Given (m1, m2, …, mk), where all mi are mutually prime, let M=m1xm2x…xmk. For 0<= x< M, the residual number (x1, x2, …, xk) is distinct. Proof: By contradiction, let 0<= y<x < M. Suppose (x1, x2, …, xk)=(y1, y2, …, yk) then x-y : (0,0, …,0). However, for all numbers in the range of the interval, only 0 : (0,0, …,0) because the mods mi are mutually prime.

More Related