CECS 228 Lectures

CECS 228 Lectures

CECS 228 Lectures Darin Goldstein 1 Modular Arithmetic Introduction The modulus relation is special and is used in computer science all the time. You can think of all numbers in the world of (mod n) as being represented by what is left over when they are divided by n; therefore, all numbers are related to some number between 0 and n-1 in world of (mod n). You are allowed to add, subtract, and multiply in the world of (mod n), but not divide! Why not? What is 4 divided by 2 in the word of (mod 4)? Is it 0 or 2? Calculate the following expressions: • 7 + 9(mod 11) • 4 · 6(mod 11) • 43 · 172(mod 5) • 10017(mod 6) • 97(1023)52(mod 3) 1.1 Application Consider the following network: 1 Imagine that there is a source that is sending data through the network. (Netflix is streaming a movie, for example, to two customers.) For the sake of clarity, assume that the source can send only a single bit through each line segment per time unit. If there is only one customer (either side), then it is clear that the source can simultaneously send two bits of information through the network, both aimed at the same destination. However, if both of the destination nodes are considered customers, then there is contention for the middle link. If we treat the data as if it were water flowing through a pipe, it is clear that the source can only send 1 bit to each destination. In other words, Netflix would have to send the same bit to both customers, one to the left and one to the right, cutting down the throughput from 2 bits with one customer to 1 bit for 2 customers. Now imagine that we send two different bits, b1 down the left and b2 down the right. (The bits might not actually be different, but they don't necessarily have to be the same.) Assume the secondary node, then copies the bits and sends one down the left and one down the right. The node in the center computes b1 + b2 (in the world of (mod Z2)). That value is then sent to both nodes along with the value of b1 on the left and b2 on the right. Observe that when the two customers get their bits, they can both retrieve the original two bits! So we now have 2 bits for 2 customers without changing the network at all! 1.2 Units ∗ ∗ Let Zn denote the set of numbers in the world of (mod n) such that x 2 Zn ! ∗ 9y 2 Zn; yx = 1. The number y is called the inverse of the number x. ∗ ∗ Example: Z10 consists of the numbers f1; 3; 7; 9g. Z11 consists of f1; 2;:::; 10g. ∗ Z12 consists of f1; 5; 7; 11g. 1.3 Subgroups ∗ Let S ⊆ Zn such that the following three rules hold (a) 1 2 S (b) x; y 2 S ! xy 2 S (c) x 2 S ! 9y 2 S; yx = 1. S is called a subgroup. ∗ Example: All of these are subgroups: f1g ⊂ f1; 7g ⊂ f1; 5; 7; 11g = Z12 ∗ For each x in Zn, if S is a subgroup, define xS = fxs : s 2 Sg. Exercise: Show that 8s 2 S; sS = S. • Choose any s 2 S. For any s0 2 S; ss0 2 S ) sS ⊆ S. • Now choose any s0 2 S. Note that s−1 2 S ) s−1s0 2 S ) s(s−1s0) = s0 2 sS ) sS ⊆ S 2 Lagrange's theorem ∗ ∗ Lagrange's theorem: For any subgroup S of Zn, jSj divides jZnj. 2 Examples: ∗ f1g ⊂ f1; 7g ⊂ f1; 5; 7; 11g = Z12 ∗ f1g ⊂ f1; 4g ⊂ f1; 2; 4; 8g ⊂ f1; 2; 4; 7; 8; 11; 13; 14g = Z15 Proof: Notice the following facts: S ∗ 1. 1 2 S ) ∗ xS = Z x2Zn n 2. xS \ yS 6= ; ) 9s; s0 2 S; xs = ys0 ) x = ys0s−1 ) xS = ys0s−1S ) (by the exercise from yesterday) xS = yS (Either xS and yS do not intersect or they are the same!) 3. jxSj ≤ jSj 4. Is it possible for jxSj < jSj? In this case, by the Pigeonhole Principle, there −1 −1 must exist two s1 6= s2 2 S; xs1 = xs2 ) x xs1 = x xs2 ) s1 = s2 which is a contradiction. So jxSj ≥ jSj ) jxSj = jSj. ∗ We've sliced up Zn into sets xS, all of which have size jSj, none of which ∗ overlap, and all of which, when taken together, make up Zn. 2 3 Euclidean algorithm Find GCD(1001,221) using the Euclidean algorithm. Find an integer solution for x; y: 5x + 3y = 1. Find an integer solution for x; y: 1001x+221y = 39. Can you find a solution for 1001x + 221y = 39? In general, when can you expect a solution to exist? A solution exists if and only if the gcd of the two coefficients evenly divides the constant. Why does the Euclidean algorithm work? First, notice that gcd(a; b) must divide into the final remainder because it divides into both a and b and therefore the remainder (and this argument continues to the very bottom). Thus gcd(a; b) is less than or equal to the final remainder. Can gcd(a; b) be strictly smaller than the final remainder? It is clear that the final remainder evenly divides both a and b (Start from the bottom and work your way up.) and the gcd(a; b) is the greatest number that has that property. 4 Lame's theorem and Inverses 4.1 Inverses Find the inverse of 87 in the world of (mod 101). In general, when can you expect an inverse of a modulo b to exist? When gcd(a; b) = 1. 3 4.2 Recall Assume that there is a breed of immortal rabbits. A mature pair of these rabbits makes a new pair of baby rabbits every month (but it takes the full month to produce them). Baby rabbits mature after a single month. Assume that we go to an initially rabbit-free island and drop a pair of baby rabbits from a helicopter. Let f(n) be the number of pairs of rabbits during the nth month. Then f(n) is the function that represents the Fibonacci numbers. Recall that we previously showed that f(0) = 0; f(1) = 1; and f(n) = f(n − 1) + f(n − 2) ) p p 1 1 + 5 1 1 − 5 f(n) = p ( )n − p ( )n 5 2 5 2 This implies that f(n) ∼ γn where γ is the golden ratio. • One Egyptian pyramid is remarkably close to a "golden pyramid"the Great Pyramid of Giza (also known as the Pyramid of Cheops or Khufu). Its slope is extremely close to the "golden" pyramid inclination; other pyra- mids at Giza are also quite close. Whether the relationship to the golden ratio in these pyramids is by design or by accident remains open to specu- lation. Adding fuel to controversy over the architectural authorship of the Great Pyramid, Eric Temple Bell, mathematician and historian, claimed in 1950 that Egyptian mathematics would not have supported the ability to calculate the slant height of the pyramids, or the ratio to the height, except in the case of the 3:4:5 pyramid, since the 3:4:5 triangle was the only right triangle known to the Egyptians and they did not know the Pythagorean theorem nor any way to reason about irrationals. • Golden ratio appearances in paintings: The Parthenon's faade as well as elements of its faade and elsewhere are said by some to be circumscribed by golden rectangles. Leonardo da Vinci's illustrations of polyhedra in De divina proportione (On the Divine Proportion) and his views that some bodily proportions exhibit the golden ratio have led some scholars to speculate that he incorporated the golden ratio in his paintings. Salvador Dal explicitly used the golden ratio in his masterpiece, The Sacrament of the Last Supper. The dimensions of the canvas are a golden rectangle. A huge dodecahedron, in perspective so that edges appear in golden ratio to one another, is suspended above and behind Jesus and dominates the composition. • Some sources claim that the golden ratio is commonly used in everyday design, for example in the shapes of postcards, playing cards, posters, wide-screen televisions, photographs, light switch plates and cars. • The golden ratio expressed in the arrangement of parts such as leaves and branches along the stems of plants and of veins in leaves and the skeletons of animals and the branchings of their veins and nerves. 4 • Since 1991, several researchers have proposed connections between the golden ratio and human genome DNA. In 2010, the journal Science re- ported that the golden ratio is present at the atomic scale in the magnetic resonance of spins in cobalt niobate crystals. 4.3 Analysis of Euclidean Algorithm Lame's Theorem: The Euclidean algorithm that is used to find gcd(a; b) takes number of steps proportional to logγ (minfa; bg) where γ is the golden ratio. Proof: What is the worst possible sequence for the Euclidean algorithm? We claim that the quotient should be as small as possible for every step, one. Consider the worst possible sequence in reverse: x = g(1)+0; x+g = x(1)+g; 2x+g = (x+g)(1)+x; 3x+2g = (2x+g)(1)+(x+g); etc: Notice that the bottom line means that x = g so the sequence becomes g = g; 2g = g(1) + g; 3g = 2g(1) + g; 5g = 3g(1) + 2g; etc: Indexing in reverse, we claim that the nth step has left-hand side equal to f(n + 2)g.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    38 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us