LEARNER’S MODULE:
Mathematics in the Modern World
                                  Chapter 6: CODES
   I.        OBJECTIVES:
             At the end of this chapter, students should be able to:
             a. Using coding schemes to encode and decode different types of
                information for identification, privacy and security purposes; and
             b. Exemplify honesty and integrity when using codes for security
                purposes.
   II.       OVERVIEW
             The utility of mathematics goes beyond the mundane. Mathematics
             enables the development of codes and ciphers that are useful to
             individuals and to society.
             Coding Scheme (Tabut, 2015) is a convention that associates each
             character with character set with a unique bit pattern-a binary
             representation of the integers from 0.
   III.      DISCUSSION
SAMPLE CODES AND CIPHERS
     A. The Caesar’s Cipher
            Nearly 2000 years ago, Julius Caesar was busy taking over the world,
        invading countries the size of the Roman Empire. He needed a way of
        communicating his battle plans and tactics to everyone on his side
        without the enemy finding it. So, Caesar would write messages to his
        generals in code. Instead of writing the letter ‘A’, he would write the
        letter that comes three places further on in the alphabet, the letter ‘D’.
        Instead of a ‘B’, he would write an ‘E’, instead of a ‘C’, he would write
        an ‘F’ and so on. When he got to the end of the alphabet, however, he
        would have to go right back to the beginning, so instead of an ‘X’, he
        would write an ‘A’, instead of a ‘Y’, he’d write a ‘B’ and instead of ‘Z’,
        he’d write a ‘C’
    Complete the table to find out how Caesar would encode the following
    message:
Caesar’s message              A T T A C K          A T     D A W N
                              B U
                              C V
Coded message                 D
          B. The Credit Card Cipher
                 Credit card encryption is a security measure used to reduce the
             likelihood of a credit or debit card information being stolen. Credit card
             encryption involves both the security of the card, the security of the
             terminal where a card is scanned, and the security of the transmission of
             the card’s information between the terminal and a back-end computer
             system.
             BRYAN S. AMBRE | Sir Amber
             bryanamber029@gmail.com
             0955-417-3898
                                                   LEARNER’S MODULE:
                                         Mathematics in the Modern World
     C. The Shifting Cipher
           This cipher got its name thru its process – shifting the alphabet forward
           three places, is the same as adding three to your starting number:
 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
 0 1 2 3 4 5 6 7 8 9 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2
                             0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
For example, encoding the letter ‘A’ is 0+3=3, which is a ‘D’, coding ‘I’ is 8+3=11,
which is ‘L’.
      However, you do have to be careful when you get to the end of the
alphabet, because there is no letter 26, so you have to go back to number 0. In
math we call this ‘MOD 26’, instead of writing 26, we go back to 0.
      Thus, EGG is ciphered as 7-9-9 or HJJ.
      SUN is ciphered as 21-23-16 0r VXQ.
      YACHT is ciphered as 27-3-5-10-22 (since 27 is higher than 26, 27 is translated
      as 1)…B-D-F-K-W.
      Have a go at coding your name by adding 3 to every letter. Then have a
go at coding your name by shifting the alphabet forward by more places by
adding greater numbers e.g. adding 5, then adding 10, then decoding is
subtraction, so if you’ve coded a message by adding 5, you will decode the
message by subtracting 5.
      D. The Tripling Cipher
         Let’s encipher the word CAT using tripling formula. The position 2, 0, and
         19 are tripled to 6, 0, 57.
         In mod 26, the 57 is reduced to 5, or the letter F (recall that we take away
         all the 26s). so the formula for a cipher number c# for each plain number
         p# is GAF.
         What is GAF is given and we want the original term, how do we do it?
      E. The ISBN Cipher
             ISBN, as we know is the International Standard Book Number, which
         is present at the back of every book.
          BRYAN S. AMBRE | Sir Amber
          bryanamber029@gmail.com
          0955-417-3898
                                                    LEARNER’S MODULE:
                                          Mathematics in the Modern World
             In its 10 digits, the ISBN uniquely identifies the book as well as telling
          you its country of origin and its publisher. But that’s not all this code does.
          The ISBN has a little magic worked into it.
             Say, I want to order a book and I know its ISBN. I type the number in,
          but I’m in a hurry and I made a mistake. You might think an amazing
          property: they can detect errors in themselves.
             Let me show you how.
             Here is a genuine ISBN, from one of my favorite books: 05-214-27061.
             Underneath, I have multiplied the digits by its position in the ISBN
          code. So – 0 gets multiplied by 1, 5 by 2, 2 by 3, and so on… You shall
          get these digits: 0, 10, 6, 4, 20, 12, 49, 0, 54, 10
          The sum of these number is 165.
        Wait, I will give another two examples before revealing the secret… Here
the first line is the ISBN, the second is the series in which each number is multiplied
by its position, the third is the sum of these:
   186-2307-369
         1, 16, 18, 8, 15, 0, 49, 24, 54, 90
           Sum: 275
   0486-2566-42
         0, 8, 24, 24, 10, 30, 42, 48, 36, 20
           Sum: 242
Notice anything about all these sums that have been cooked out of the ISBN?
Have you spotted the pattern?
     The calculation always gives a sum that’s divisible by 11. This is not an
amazing coincidence, but an example of cunning mathematical design.
      It’s only the first nine digits that contain the information about the book. The
tenth digit is included just to make this total number extracted from ISBN divisible
by 11. You might have spotted that some books have an X instead of a number
as their tenth digit. Because these nine digits are already divisible by 11.
Look for some books, try the ISBN cipher.
      F. The Binary Number System
            The binary number system is a numbering system that represents
         numeric values using two unique digits (0 and 1). Most computing
         devices use binary numbering to represent electronic circuit voltage
         state, (i.e., on/off switch), which considers 0 voltage input as off and 1
         as on. This is also known as the base 2 number system, or the binary
         numbering system.
            Microcontrollers only use binary logic in computing. Compare this to
         the decimal numbering system, which is comprised of 10 unique digits
         (0-9). For example, a user input of 345 (in decimal) is 101011001 in binary
         form.
          BRYAN S. AMBRE | Sir Amber
          bryanamber029@gmail.com
          0955-417-3898
                                           LEARNER’S MODULE:
                                 Mathematics in the Modern World
      Suppose we want to write the word “LOVE” in a binary code. The
  process is to look for the binary codes of the letters L, O, V, and E. That
  is,
                           LETTERS     BINARY CODES
                           L           01001100
                           O           01001111
                           V           01010110
                           E           01000101
     Can you do the lower case of the word “love”
                       LETTERS       BINARY CODES
                       l             01101100
                       o             01101111
                       v             01110110
                       e             01100101
     Thus, the word, “Chemistry” will have the binary codes,
                         LETTERS       BINARY CODES
                         C             01000011
                         h             01101000
                         e             01100101
                         m             01101101
                         i             01101001
                         s             01110011
                         t             01110100
                         r             01110010
                         y             01111001
Operations on Binary Systems
   BRYAN S. AMBRE | Sir Amber
   bryanamber029@gmail.com
   0955-417-3898
                                                 LEARNER’S MODULE:
                                       Mathematics in the Modern World
         a. Addition of Binary Numbers
             To add binary numbers, let us remember the following “Magic
             Table”:
             0+0=0
             1+0=1
             0+1=1
             1 + 1 = 10
             1 + 1 + 1 = 11
    Example:
  1 1 1      1 1
  1 1 0 1 0 1 1 = 1(26)+1(25)+0(24)+1(23)+0(22)+1(21)+1(20)=64+32+8+2+1=107
+   1 1 1 0 0 1 = 1(25)+1(24)+1(23)+1(22)+0(21)+1(20)= 32+16+8+1            = 57
                            7         5           1
1 0 1 0 0 1 0 0 = 1(2 ) + 0 + 1(2 ) + 0 + 0 + 1(2 ) + 0 + 0 = 𝟏𝟐𝟖 + 𝟑𝟐 + 𝟒 = 𝟏𝟔𝟒
             b. Subtraction of Binary Numbers
                To subtract binary numbers, then let us use the following “Magic
                Table”:
                1–1=0
                0–0=0
                1–0=1
                0 – 1 = 1 but carry is required 10 – 1 = 1
Example 1:
             1 0 1 1 1 = 16 + 4 + 2 + 1 = 23
    -        1 0 1 0 1 = 16 + 4 + 1     = 21
             0 0 0 1 0 =                =2
Example 2:
    1 1 0 = 1 0 10 = (borrow 1 from 1 to make 0 to be 10) = 4 + 2 = 6
-   1 0 1 = 1 0 1 =                                       =4+1=5
            0 0 1 =                                               =1
             c. Multiplication of Binary Numbers
                To multiply binary numbers, we will do the same process as
                decimals.
Example
                 0   1   0 1 = 4+1=           5
             x   1   0   1 1 = 8 + 2 + 1 = x 11
                 0   1   0 1                 55
          0      1   0   1
        0 0      0   0
    + 0 1 0      1
      0 1 1      0   1 1 1 = 32 + 16 + 4 + 2 + 1 = 55
          BRYAN S. AMBRE | Sir Amber
          bryanamber029@gmail.com
          0955-417-3898
                                             LEARNER’S MODULE:
                                   Mathematics in the Modern World
          d. Division of Binary Numbers
             In dividing binary numbers, we will use the same process as in
             decimals.
Example:
      0 0 1    1 0 1
 1 1 1 0 0     1 1 1
         1 1             = (Borrow 1 from the next digit)
      0 0 1    1
           1   1
           0   0 1 1
                 1 1
                 0 0
        BRYAN S. AMBRE | Sir Amber
        bryanamber029@gmail.com
        0955-417-3898