0% found this document useful (0 votes)
43 views15 pages

MODULE 6 - Codes

Uploaded by

sambasares29
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views15 pages

MODULE 6 - Codes

Uploaded by

sambasares29
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Module Mathematics as a Tool

6 CODES

https://tinyurl.com/y2v3dckn

Overview

Mathematics may be an effective instrument for worldwide understanding and


communication that organizes our lives and anticipates chaos. It plays an imperative part in all
angles of life, whether in ordinary things such as time following, driving, cooking, or
employments such as bookkeeping, fund, managing an account, building, and computer
program. These capacities require a solid scientific foundation, and logical tests by researchers
require scientific methods. They are a dialect to depict scientists' work and accomplishments.
Arithmetic is one of the foremost critical sciences that cannot be apportioned with, and the
individuals require for science is no less than the require of society.
This section will show you that the value of mathematics goes beyond our everyday
lives. Mathematics enables the development of codes and symbols that are useful to
individuals and society.

Learning Outcomes

After successful completion of this module, you should be able to:


a. Use coding schemes to encode and decode different types of information for
identification, privacy and security purposes (S)

b. Exemplify honesty and integrity when using codes for security purposes (V)

Page 116
GEED10053_Mathematics In The Modern World_JKFS
Course Materials

Coding Scheme is a convention that associates each character with character set
with a unique bit pattern-a binary representation of the integers from 0. (Tabut, 2015)

Three Common Coding Schemes


• ASCII (American Standard Code for Information Interchange)
• EBCDIC (Extended Binary Coded Decimal Interchange Code)
• UNICODE (Universal Code)

ASCII (American Standard Code for Information Interchange)

Watch: ASCII Code and Binary (https://www.youtube.com/watch?v=H4l42nbYmrU)

American Standard Code for Information Interchange is the most common format for
text file in computers and on the internet. In an ASCII file, each alphabetic, numeric, or
special character in representation with a 7-bit binary number (as string of seven 0’s or 1’s)
EBCDIC (Extended Binary Coded Decimal Interchange Code)
Extended Binary Coded Decimal Interchange Code is a binary code for alphabetic,
numeric characters that IBM developed for its largest systems. IBM (Internet Business
Machines) is the largest computer company in the world. IBM started in 1911 as a producer
of punch card tabulating machines. IBM came to donate the new field of mainframe and
minicomputers.
✓ It has 8-bit, 4-bits for zone, 4-bits for digits.
✓ It allows 28 = 256 combinations and represents 256 unique symbols.
✓ It is used mainly in mainframe computers.

UNICODE (Universal code)

Watch: Unicode (https://www.youtube.com/watch?v=2r6OZD5n-wc)

Universal code is the coding scheme that is new ANSI (American National Standard
Institute) standards. It supports most of the world’s languages and is becoming the Internet
standard. It is a 16-bit coding scheme that has the capacity of representing more than 65,000
characters and symbols.
✓ It represents text, symbols, characters in multilingual environment.
✓ It uniquely represents a symbol in language like China and Japanese, etc. and
mathematical and scientific symbols.
✓ It has 32 bits and allows 232 approximately 4 billion combinations.
✓ It is compatible and identical to ASCII-8.
✓ It is implemented by character encoding and commonly used encoding scheme. It
uses 8-32 bits per code.

Watch: Understanding ASCII and Unicode (GCSE)


(https://www.youtube.com/watch?v=5aJKKgSEUnY)

Page 117
GEED10053_Mathematics In The Modern World_JKFS
Lesson 1: Binary codes

Watch: How exactly does binary code work? - José Américo N L F de Freitas
(https://www.youtube.com/watch?v=wgbV6DLVezo)

A binary code represents text, computer processor instructions, or any other data using a two-
symbol system. The two-symbol system used is often "0" and "1" from the binary number
system. The binary code assigns a pattern of binary digits, also known as bits, to each
character, instruction, etc. For example, a binary string of eight bits can represent any of 256
possible values and can, therefore, represent a wide variety of different items. (Wikipedia)

Binary file
Binary file is a type of computer file that is used to store binary data. It may contain any type
of formatted or unformatted data encoded within binary format.

Binary digit (bit)


Binary digit (bit) is the smallest unit information in a computer. It is used for storing
information and has value of true/false, or on/off.

Lesson 2: Integers in Computers

An integer is a datum of integral data type, a data type that represents some range of
mathematical integers. Integers are commonly represented in a computer as a group of binary
digits (bits).

Byte initially meant (the smallest addressable unit of memory”. In the past, 5-,6-,7-,8-, and 9-
bit bytes all been used.

Octet always refers to an 8-bit quantity. It is mostly used in the field of computer networking,
where computers with different byte widths might have to communicate.

“Word” is used for a small group of bits that are handled simultaneously by processors of a
particular architecture.

Short integer can represent a whole number that may take less storage, while having a smaller
range, compared with a standard integer on the same machine.

Long integer can represent a whole integer whose range is greater than or equal to that of a
standard integer on the same machine.

Computer system regularly use numeral system of bases other than 10.
✓ Base 2 (binary)
✓ Base 8 (octal)
✓ Base 16 (hexadecimal) numeral systems

Are used because designing a computer system is simpler in this manner than for other
bases. Binary numbers are the core of all computer operations

Page 118
GEED10053_Mathematics In The Modern World_JKFS
Operations on Binary Numbers
Decimal
Let us have this example 329 for the base 10 or decimal

= three (100) + two (10) + 9 (1)


= three hundred + twenty + nine
=three hundred twenty nine
=329
Binary
Suppose the number 101 is in base 2 or binary.

= one (4) + zero (2) + one (1)


=4+0+1
=5
So, 101 in binary = 5 in decimal

Addition of Binary Numbers (https://byjus.com/maths/binary-addition/)

Watch: How To Add Binary Numbers - The Easy Way!


(https://www.youtube.com/watch?v=5F6orbqZigI)

The binary addition operation works similarly to the base 10 decimal system, except
that it is a base 2 system. The binary system consists of only two digits, 1 and 0. Most of the
functionalities of the computer system use the binary number system. The binary code uses
the digits 1’s and 0’s to make certain processes turn off or on. The process of the addition
operation is very familiar to the decimal system by adjusting to the base 2.
Before attempting the binary addition process, we should have complete knowledge of
how the place works in the binary number system. Because most of the modern digital
computers and electronic circuits perform the binary operation by representing each bit as a
voltage signal. The bit 0 represents the “OFF” state, and the bit 1 represents the “ON” state.
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

Page 119
GEED10053_Mathematics In The Modern World_JKFS
A few examples of binary additions are as follows:
Example 1: 10001 + 11101 Example 2: 10111 + 110001
Solution: Solution:
1 111
10001 10111
(+) 1 1 1 0 1 (+) 1 1 0 0 0 1
———————– ———————–
101110 1001000

Subtraction of binary numbers (https://byjus.com/maths/binary-subtraction/)

Watch: How to Subtract Binary Numbers


(https://www.youtube.com/watch?v=OHf0Eg9ZhGQ)

Binary subtraction is one of the four binary operations, where we perform the
subtraction method for two binary numbers (comprising of only two digits, 0 and 1). This
operation is similar to the basic arithmetic subtraction performed on decimal numbers in Maths.
Hence, when we subtract 1 from 0, we need to borrow 1 from the next higher order digit, to
reduce the digit by 1 and the remainder left here is also 1.
Can you subtract binary numbers? The answer is yes. Subtraction of binary numbers
is an arithmetic operation similar to the subtraction of decimal numbers or base 10 numbers.
For example, 1 + 1 + 1 = 3 in base 10 and 1 + 1 + 1 = 11 in binary number system. When you
add and subtract binary numbers, you will need to be careful when borrowing as these will take
place more often.
When you subtract several columns of binary digits, you must take into account the
borrowing. When 1 is to be subtracted from 0, the result is 1 where 1 is borrowed from the next
highest order bit or digit.

0–0=0

1–0=1

1–1=0

0 – 1 = 1 (Borrow 1)

Page 120
GEED10053_Mathematics In The Modern World_JKFS
Consider other examples of binary subtractions are as follows:
1: 0011010 – 001100
Solution:
1 1 Borrow
0011010
(-) 0 0 1 1 0 0
——————
0001110
Decimal Equivalent:
0 0 1 1 0 1 0 = 26
0 0 1 1 0 0 = 12
Therefore, 26 – 12 = 14
The binary resultant 0 0 0 1 1 1 0 is equivalent to the
14

2: 0100010 – 0001010
Solution:
1 1 Borrow
0 1 0 0 0 1 0 = 3410
(-) 0 0 0 1 0 1 0 = 1010
—————
0 0 1 1 0 0 0 = 2410

Multiplication of binary numbers (https://byjus.com/maths/binary-multiplication/)

Watch: Multiplying Binary Numbers


(https://www.youtube.com/watch?v=Va_UvwJULcI)

The binary multiplication operation is actually a process of addition and shifting


operation. This process has to be continued until all the multiplier is done, and finally, the
addition operation is made.

Similar to the decimal system, the multiplication of the binary numbers is done by
multiplying the multiplicand with the multiplier. It is noted that the multiplication by zero makes
all the bits zero, and this step may be ignored in the intermediate steps. The multiplication by
1 makes all the multiplicand value unchanged.

0×0=0

0×1=0

1×0=0

1×1=1

Page 121
GEED10053_Mathematics In The Modern World_JKFS
Some binary multiplication examples are given below for a better understanding of this
concept.
1: Solve 1010 × 101
Solution:
1010 × 101
1010
(×) 101
—————–
1010
0000
——————
01010 ……. First Intermediate
Sum
1010
——————–
110010

Comparison with Decimal values:


10102 = 1010
10102 = 510
10 x 5 = 5010
(110010)
2: 1011.012 =×5010
110.1
Solution:

Here, the decimal point is placed three


places from the least significant bit.
Because, the binary number 1011.01, the
decimal point is 2 places from the LSB
and 110.1 the decimal point is placed 1
place from the LSB.

Division of Binary Numbers (https://byjus.com/maths/binary-division/)

Page 122
GEED10053_Mathematics In The Modern World_JKFS
Watch: Dividing Binary Numbers (https://www.youtube.com/watch?v=ubCCemtuZH8)

The binary division operation is similar to the base 10 decimal system, except the base
2 system. The division is probably one of the most challenging operations of the basic
arithmetic operations. There are different ways to solve division problems using binary
operations. Long division is one of them and the easiest and the most efficient way.
The binary division is much easier than the decimal division when you remember the
following division rules. The three main rules of the binary division include:

1÷1 = 1
1÷0 = 0
0÷1 = Meaningless
0÷0 = Meaningless

Similar to the decimal number system, the binary division is similar, which follows the four-
step process
Divide
Multiply
Subtract
Bring down

Important Note: Binary division follows the long division method to find the resultant in an
easy way. In dividing binary numbers, we will use the same process as in decimals
Some binary division examples are given below for a better understanding of this concept.

1. Solve 01111100 ÷ 0010

Solution:

Given

01111100 ÷ 0010

Here the dividend is 01111100, and the divisor is 0010

Remove the zero’s in the Most Significant Bit in both the dividend and divisor, that
doesn’t change the value of the number.

So the dividend becomes 1111100, and the divisor becomes 10.

Page 123
GEED10053_Mathematics In The Modern World_JKFS
Now, use the long division method.

Step 1: First, look at the first two numbers in the dividend and compare with the divisor. Add
the number 1 in the quotient place. Then subtract the value, you get 1 as remainder.

Step 2: Then bring down the next number from the dividend portion and do the step 1 process
again

Step 3: Repeat the process until the remainder becomes zero by comparing the dividend and
the divisor value.

Step 4: Now, in this case, after you get the remainder value as 0, you have zero left in the
dividend portion, so bring that zero to the quotient portion.

Therefore, the resultant value is quotient value which is equal to 111110


So, 01111100 ÷ 0010 = 111110

2: Solve using the long division method: 101101 ÷ 101


Solution:

So, when you bring down the fourth bit of the dividend, it does not match with the
divisor. In order to bring down the 5th and 6th bit of the dividend, add two zeros in the quotient
value.

Page 124
GEED10053_Mathematics In The Modern World_JKFS
Lesson 3: Text data

Text Data (techopedia) mining involves combing through a text document or resource to get
valuable structured information. This requires sophisticated analytical tools that process text
in order to glean specific keywords or key data points from what are considered relatively raw
or unstructured formats. Text data mining is also known as text mining or text analytics.

Sentiment analysis is a unique component of text mining which is generally much more
difficult than statistical analysis.

Encoding and Decoding

Encoding (techopedia) is an element of communication. Process of assembling the message


(information, ideas, and thoughts) into a representative design with the objective of ensuring
that the receiver can comprehend it.

Decoding is listening and reading directions carefully. In computer application, encoding is


the process of converting the characters to integers and decoding converts integers back to
characters.

Lesson 4: Errors and Error Correction

Error Correction is the process of detecting errors in transmitted messages and


reconstructing the original error-free data.

It ensures that corrected and error-free messages are obtained at the receiver side.
ARQ is an error control (error control) method that uses error-detection codes and positive
and negative acknowledgements.

When the transmitter either receives a negative acknowledgement or a timeout happens


before acknowledgement is received, the ARQ makes the transmitter resend the message.

Lesson 5: Error Detecting Codes

In networking, Error Detection refers to the techniques used to detect noise or other
impairments introduced into data while it is transmitted from source to destination.

➢ It ensures reliable delivery of data across vulnerable networks.


➢ It minimizes the probability of passing incorrect frames to the destination, known as
undetected error probability.

Parity is the oldest method of error correction. It works by adding an additional bit to each
character word transmitted. The state of the bit is determined by a number of factors such as
the type of parity and the number of logic-one bits in the data character.

Parity Bit is a bit appended to the data of binary bits to ensure that the total number of 1’s in
the data are even or odd. Parity bits are used for error detection.

Page 125
GEED10053_Mathematics In The Modern World_JKFS
Two types of Parity Bits

1. Even Parity
In the case of even parity, for a given set of bits, the number of 1’s are counted. If that
count is odd, the parity bit value is set to 1, making the total count of occurrences of 1’s an
even number. If the total number of 1’s in a given set of bits is already even, the parity
bit’s value is 0.

2. Odd Parity Bit


In the case of even parity, for a given set of bits, the number of 1’s are counted. If that
count is even, the parity bit value is set to 1, making the total count of occurrences of 1’s
an odd number. If the total number of 1’s in a given set of bits is already odd, the parity
bit’s value is 0.

Another mechanism that relates to error detection. It is a coding schema that repeats bits
across channels to achieve error-free communication.

➢ Data bits in a stream of data are divided into blocks of bits.


➢ Every block is transmitted a predetermined number of times.
➢ They are not as effective as parity, because the occurrence of errors in the same
place leads to more problems.

However, they are simple and used in the transmission of number stations.

Checksum

Is an error detection method that is a modular arithmetic sum of message code words of
fixed word length. Checksum schemes involve longitudinal redundancy checks, parity bits
and check digits.

Watch: What is Parity? (https://www.youtube.com/watch?v=DdMcAUlxh1M)

Lesson 6: Repetition and Hamming Codes

Hamming Codes is a set of error-correction codes that can be used to detect and correct the
errors that can occur when the data is moved or stored from the sender to the receiver. It is
technique developed by R.W. Hamming for error correction.
It can be applied to data units of any length. It is used to detect and correct single bit error.

Hamming code structure

If the receiver did not get the correct message, there must be an error in the message.
We can use Hamming code to detect and correct the error.

Page 126
GEED10053_Mathematics In The Modern World_JKFS
Rules:
The value of parity (P) bits are determined by the sequence of bits that is alternatively as
checks and skips.

Given that Hamming code is used to detect error in transmitting code and correct the error in
the transmitted code. Parity bits indicate if a binary number has odd or even number of 1’s

Solution:
1001 –even parity because it has two 1’s
1110 – odd parity because it has three 1’s

The transmitted code (received code) has two parts the message bits and the parity bits. If
the original message is 1001 and received as 11001, then the message bits are 1001 and
the parity bit is 1 in the first place from the left.

Redundant bits

Extra bits that are generated and added to the information-carrying bits of data transfer to
ensure that no bits were lost during the data transfer.
The number of redundant bits can be calculated using the following formula:
2p >m + p + 1,
where, p = redundant/parity bit, m = data/message bit

Example
Suppose the number of data bits is 7, then the number of redundant bits can be calculated
using:
24 >7 + 4 + 1 → 16 >12
Thus, the number of redundant bits = 4 bits greater than 12.

Repetition

Repetition of codes happens because sometimes one code may be repeated for every
data bit in multiple times and can be checked if it was sent correctly. For instance, if the data
bit to be sent is a 1, an n = 3 repetition code will send 111. If the three bits received are not
identical, an error occurred during transmission. If the channel is clean enough, most of the
time only one bit will change in each triple. Therefore, 001, 010, and 100 each correspond to
a 0 bit, while 110, 101, and 011 correspond to a 1 bit, with the greater quantity of digits that
are the same (0 or a 1) indicating what the data bit should be. A code with this ability to
reconstruct the original message in the presence of errors is known as an error-correcting
code. This triple repetition code is Hamming code with m = 2, since there are two parity bits,
and 22-2 – 1 = 1 data bit.

Watch: Hamming Code | Error detection


(https://www.youtube.com/watch?v=1A_NcXxdoCc)

Hamming Code | Error Correction


(https://www.youtube.com/watch?v=wbH2VxzmoZk)

Page 127
GEED10053_Mathematics In The Modern World_JKFS
Assessment

I. Perform the indicated binary operation.

1. 1010 + 1010
2. 11101 + 1010
3. 11111 + 11111
4. 1001 – 11
5. 1101 – 11
6. 10001 – 100
7. 101 * 10
8. 1011 * 101
9. 1101/11
10. 10111/10

II. Test if these code words are correct, assuming they were created using an even parity
Hamming Code. If one is incorrect, indicate what the correct code word should have been.
Also, indicate what the original data was.

1. 010101100011
2. 111110001100
3. 000010001010

Grading System

Numerical Scores

Page 128
GEED10053_Mathematics In The Modern World_JKFS
References

Adam, J. A. (2011). Mathematics in Nature: Modeling Patterns in the Natural World.


Princeton University Press.
Adam, J. A. (2015). A Mathematical Nature Walk. https://ifarus.com/mathematical-
nature-wal-john-adam .
Aufmann, R. (2018). Mathematics in the Modern World. Sampaloc, Manila: Rex Book
Store, Inc.
Chein, A. a. (n.d.). Mathematics Excursions.
Daligdig, R. (2019). Mathematics in the Modern World. Qezon City, Manila: Lorimar
Publishing, Inc.
Education, C. o. (2013). General education curriculum: Holistic understandings,
intellectual and civic competencies. . Retrieved March 31, 2017, from
http://www.ched.gov.ph/wp-content/uploads/2013/ 07/CMO-No.20-s2013.pdf .
Enzensberger, H. M. (2016). The Number Devil .
Hipolito, L. M. (2019). Mathematics in the Modern World. Sampaloc, Manila: Rex
Book Store, Inc. .
Polytechnic University of the Philippines. (1998-2020). Vision and Mission. Retrieved
from pup.edu.ph: https://www.pup.edu.ph/about/vm
Ruiz, A. a. (2008). A day’s adventure in Math Wonderland.
Sirug, W. (2018). Mathematics in the Modern World. Intramuros, Manila :
Mindshapers Co.,Inc. .
Stewart, I. ( 1997). Nature’s Number: the unreal reality of Mathematics . Basic Books,
A division of HarperCollins Publisher, Inc.

Online
Freitas L. TED-Ed (2018, July 12) How exactly does binary code work?
https://www.youtube.com/watch?v=wgbV6DLVezo
Binary Addition-Definition, Rules, Method, Tricks and Examples
https://byjus.com/maths/binary-addition/
Binary Subtraction(Rules, Examples, 1/s complement)
https://byjus.com/maths/binary-subtraction/
Binary Multiplication (Rules and Solved Examples)
https://byjus.com/maths/binary-multiplication/
Binary Division-Rules, Tricks, Examples and Steps to Solve Questions
https://byjus.com/maths/binary-division/
BitMerge (2018,January 28) Unicode
https://www.youtube.com/watch?v=2r6OZD5n-wc
Neso Academy (2015, January 20) Hamming Code l Error detection
https://www.youtube.com/watch?v=1A_NcXxdoCc
Neso Academy (2015, January 20) Hamming Code l Error correction
https://www.youtube.com/watch?v=wbH2VxzmoZk
Neso Academy (2014, October 17) What is Parity?
https://www.youtube.com/watch?v=DdMcAUlxh1M
Raut, N. (2019, January 2) Hamming code for single error correction, double detection
https://www.tutorialspoint.com/hamming-code-for-single-error-correction-double-error-
detection
The Organic Chemistry Tutor (2018, May 26.) How to Add Binary Numbers
https://www.youtube.com/watch?v=5F6orbqZigI
The Organic Chemistry Tutor (2019, November 3) ASCII Code and Binary

Page 129
GEED10053_Mathematics In The Modern World_JKFS
https://www.youtube.com/watch?v=H4l42nbYmrU
The Organic Chemistry Tutor (2018, May 26). How to Subtract Binary Numbers
https://www.youtube.com/watch?v=OHf0Eg9ZhGQ
The Organic Chemistry Tutor (2018, May 26). Dividing Binary Numbers
https://www.youtube.com/watch?v=ubCCemtuZH8
The Organic Chemistry Tutor (2018, May 26). Multiplying Binary Numbers
https://www.youtube.com/watch?v=Va_UvwJULcI
The Tech Train (2017, Decemebr 6) Understanding ASCII and UNICODE (GCSE)
https://www.youtube.com/watch?v=5aJKKgSEUnY
Wikipedia (2020, September 8) Binary Codehttps://en.wikipedia.org/wiki/Binary_code

Page 130
GEED10053_Mathematics In The Modern World_JKFS

You might also like