BINARY NUMBERS and Letter

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

Handout for MATH 101

Codes
Prepared by:

Binary Codes
One of the uses of the development of codes and ciphers are th coding schemes used to encode and decode different
types of information for identification for privacy and security purposes.

A Binary Number – is made up of only 0s and 1s. The digital world uses binary numbers
There are NO 2, 3 , 4 ,5 , 7 , 8 or 9 in binary.
Bit – is a single binary digit
Ex : 110100 ( has 6 bits )

Decimal numbers are based on 10 digits ( 0 1 2 3 4 5 6 7 8 9 )


The Binary Code for the Computer System

.
BINARY NUMBERS 1- 19
Decimal Number Binary Code Decimal Number Binary Code
0 0 10 1010
1 1 11 1011
2 10 12 1100
3 11 13 1101
4 100 14 1110
5 101 15 1111
6 110 16 10000
7 111 17 10001
8 1000 18 10010
9 1001 19 10011

Decimal : 0 1 2 3 4 5 6 7 8 9 10
BINARY: 0 1 10 11 100 101 110 111 1000 1001 1010

Decimal : 20 25 30 35 40 45 50
BINARY: 10100 11001 11110 100011 101000 101101 110010
LETTERS BINARY CODES LETTERS BINARY CODES

M 01001101 M 01101101
A 01000001 A 01100001

T 01010100 T 01110100
H 01001000 H 01101000

A BIT STRING is a sequence of ze0 or more bits. The length of the string is the number of bits in the string.
2 6 5 8 8 is the Unit digit ( 100) or the 1’s place
5 is the Tens digit ( 101) or the 10’s place
6 is the Hundreds digit ( 102) or the 100’s place
2 is the Thousands digit ( 103) or the 1000’s place

The DECIMAL NUMBER SYSTEM


To decipher 2658 :
2,658 = 2( 1000) + 6( 100 ) + 5 ( 10 ) + 8 (1)
= 2,000 + 600 + 50 + 8

In BINARY SYSTEM , only 1 and 0 are the digits

1 1 1 1 0 1 from right:
1 is 1’s place ( 20 )
0 is the 2’s place ( 21)
1 is the 4’s place ( 22)
1 is the 8’s place ( 23)
1 is the 16’s place ( 24)
1 is the 32’s place ( 25)

Decimal Number representation 1101110


Binary Number representation 110112

CONVERSION of BINARY NUMBER TO DECIMAL NUMBER


The binary number 110112 has 5 bits

110112 = 1(24) + 1(23) + 0(22) + 1(21) + 1 (20)


= 1(16 ) + 1 (8 ) + 0(4) + 1(2) + 1 (1)
= 16 + 18 + 0 + 2 + 1
= 3710

10110112 = 1(26) + 0(25) + 1(24) + 1(23) + 0(22) + 1(21) + 1 (20)\


= 1(64) + 0(32) + 1(16 ) + 1 (8 ) + 0(4) + 1(2) + 1 (1)
= 64 + 0 +16 + 8 + 0 + 2
= 9110
The Reverse process:
91 = 2(45 ) +1 but 45 = 2 ( 22 ) + 1
= 2 [2(22) +1 ] +1
= 22 (22) + 2 + 1 but 22 = 2( 11)
= 22[2(11)] + 2 + 1 but 11 = 2(5) +1
=23( 2(5) +1 ] +2 + 1
= 24(5) +23 + 2 + 1 but 5 = 2(2) +1
= 24 [2(2) +1] + 2 + 1
= 25(2) + 24 +23 + 2 + 1
= 26 + 24 +23 + 21 + 1
= 10110112

CONVERSION OF DECIMAL TO BINARY


To convert decimals to binary numbers, divide by 2’s successively with the remainder recorded.

1. Change decimal 130 to binary.


Divide by 2 Quotient Remainder Place of bits
2 ) 130 65 0 1’s
2) 65 32 1 2’s
2) 32 16 0 4’s
2) 16 8 0 8’s
2) 8 4 0 16’s
2) 4 2 0 32’s
2) 2 1 0 64’s
2) 1 0 1 128’s
0

13010 = 100000102

2. Change decimal 69 to binary.


Division by 2 Quotient Remainder Place of bits
2 ) 69 34 1 1’s
2) 34 17 0 2’s
2) 17 8 1 4’s
2) 8 4 0 8’s
2) 4 2 0 16’s
2) 2 1 0 32’s
2) 1 0 1 64’s
0

6910 = 10001012

3. Change decimal 37 to binary.


Division by 2 Quotient Remainder Place of bits

EXERCISES:
1) 111112 = 1(16 ) + 1(8) + 1(4) + 1(2) + 1(1)
= 16 + 8 + 4 + 2 + 1
= 3110
TO CHECK:
DIVISION BY 2 QUOTIENT REMAINDER PLACE OF BITS
2) 31 15 1 1’
2) 15 7 1 2’S
2) 7 3 1 4’S
2) 3 1 1 8’S
2)1 0 1 16’S
0

2) 11110112 = 1(26 ) + 1(25 ) + 1(24) + 1(23 ) + 0(22 ) + 1( 21 ) 1( 20)


= 1(64) + 1(32) + 1(16) + 1(8) + 0 (4) + 1(2) + 1( 1)
= 64 + 32 + 16 + 8 + 0 + 2 + 1
= 12310
TO CHECK:
DIVISION BY 2 QUOTIENT REMAINDER PLACE OF BITS
E 61 1 1’
2) 61 30 1 2’S
2) 30 15 0 4’S
2) 15 7 1 8’S
2)7 3 1 16’S
2) 3 1 1 32’S
2)1 0 1 64’S
2) 0

EXERCISES:
1) 1111102 =
=
=
DIVISION BY 2 QUOTIENT REMAINDER PLACE OF BITS
ACTIVITY 1 CODES

NAME: ______________________________________YEAR AND SECTION : __________________SCORE:


______

A. CONVERT THE FF. BINARY NUMBERS TO DECIMAL


1) 100102 ________

2) 11100102 ________

3) 10010102 ________

4) 101111000102 ________

5) 101111100102 ________

B. WRITE THE FF. NUMBERS AS BINARY.

1) 234 =_______________

DIVISION BY 2 QUOTIENT REMAINDER PLACE OF BITS

2) 572 =________________

DIVISION BY 2 QUOTIENT REMAINDER PLACE OF BITS

3) 127 =_________________

DIVISION BY 2 QUOTIENT REMAINDER PLACE OF BITS


 OPERATIONS ON BINARY NUMBERS
1. ADDITION
THE SUM MUST BE 1 AND 0. THE SUM OF 0 AND O IS 0 , 1 AND 0 IS 1 AND 1 AND 1 IS 10.

EX. 1) ADD: 10012 + 11102


1
1 0 0 1
1 1 1 0
1 0 1 1 1

TO CHECK: CONVERT BINARY TO DECIMAL THEN ADD


10012 = 1(8) + 0(4) + 0(2) + 1 (1) = 9
11102 = 1(8) + 1(4) + 1(2) + 0(1) = 14 = 23

101112 = 1(16) + 0(8) + 1(4) + 1(2) + 1(1) = 23

2) SUM OF 1011012 + 1001102

1 1 1
1 0 1 1 0 1
1 0 0 1 1 0
1 0 1 0 0 1 1

3) SUM OF 1111112 + 1011112

1 1 1 1 1 1
1 1 1 1 1 1
1 0 1 1 1 1
1 1 0 1 1 1 1 0
EXERCISES:
FIND THE SUM OF THE FOLLOWING BINARY NUMBERS:

1) 101102 AND 101102

CHECKING :

2) 1000112 AND 1010012

CHECKING:

ACTIVITY 2
ADDING BINARY NUMBERS

NAMEL:____________________________________YEAR AND SECTION :____________________SCORE: ____________

1) 1011012 AND 1011102 2) 10111012 AND 11111102

3) 1000012 AND 1100102 4) 11100012 AND 11110102

5) 11000012 AND 11001102 6) 10110012 AND 10111102

7) 10010012 AND 10011102 8) 111100012


AND 100011102

9) 100010012 AND 110000102 10) 101112 AND 110012


2) SUBTRACTION
THE DIFFERENCE MUST 1 AND 0 ONLY. THE DIFFERENCE OF 0 AND 0 IS 0 , 1 AND 0 IS 1 , 0 AND 1 IS 1 ( NEED TO
BORROW ) AND DIFFERENCE OF 1 AND 1 IS 0.

EX. 1) SUBTRACT: 11102 + 10012

  1
1 1 1 0 1 1 0 0
 
1 0 0 1 1 0 0 1
   
TO CHECK: CONVERT BINARY TO DECIMAL THEN SUBTRACT
11102 = 1(8) +
1 0  1 1(4) + 1(2) + 0(1) = 14
10012 = 1(8) + 0(4) + 0(2) + 1 (1) = 9
1012 =1(4) + 1(2) + 1(1) = 5

2) DIFFERENCE OF 111102 + 101012 3) SUM OF 1111112 + 101111 2


1 1 1 1 1 1
  1 1 1 1 1 1 1
1 1 0 1 1 0 1 1 0 1 1 1 1
0 0 1 1 0 1 1 0 1 1 1 1 0
1 1 0 0 1 1

TO CHECK: CONVERT BINARY TO DECIMAL THEN ADD


10012 = 1(8) + 0(4) + 0(2) + 1 (1) = 9
11102 = 1(8) + 1(4) + 1(2) + 0(1) = 14 = 23

101112 = 1(16) + 0(8) + 1(4) + 1(2) + 1(1) = 23

2) SUM OF 1011012 + 1001102 3) SUM OF 1111112 + 1011112


1 1 1 1 1 1 1 1 1
1 0 1 1 0 1 1 1 1 1 1 1
1 0 0 1 1 0 1 0 1 1 1 1
1 0 1 0 0 1 1 1 1 0 1 1 1 1 0
https://www.convertbinary.com/numbers/
DE10CIMAL NUMBERS IN BINARY
0 0
1 1
2 10
3 11
4 100
5 101
6 110
7 111
8 1000
9 1001
10 1010
11 1011
12 1100
13 1101
14 1110
15 1111
16 10000
17 10001
18 10010
19 10011
20 10100
21 10101
22 10110
23 10111
24 11000
25 11001
26 11010
27 11011
28 11100
29 11101
30 11110
31 11111
32 100000
33 100001
34 100010
35 100011
36 100100
37 100101
38 100110
39 100111
40 101000
41 101001
42 101010
43 101011
44 101100
45 101101
46 101110
47 101111
48 110000
49 110001
50 110010
51 110011
52 110100
53 110101
54 110110
55 110111
56 111000
57 111001
58 111010
59 111011
60 111100
61 111101
62 111110
63 111111
64 1000000
65 1000001
66 1000010
67 1000011
68 1000100
69 1000101
70 1000110
71 1000111
72 1001000
73 1001001
74 1001010
75 1001011
76 1001100
77 1001101
78 1001110
79 1001111
80 1010000
81 1010001
82 1010010
83 1010011
84 1010100
85 1010101
86 1010110
87 1010111
88 1011000
89 1011001
90 1011010
91 1011011
92 1011100
93 1011101
94 1011110
95 1011111
96 1100000
97 1100001
98 1100010
99 1100011
100 1100100

BINARY JOKE

ALPHABET IN BINARY, CAPITAL LETTERS ALPHABET IN BINARY, LOWER CASE


A 01000001 a 01100001
B 01000010 b 01100010
C 01000011 c 01100011
D 01000100 d 01100100
E 01000101 e 01100101
F 01000110 f 01100110
G 01000111 g 01100111
H 01001000 h 01101000
I 01001001 i 01101001
J 01001010 j 01101010
K 01001011 k 01101011
L 01001100 l 01101100
M 01001101 m 01101101
N 01001110 n 01101110
O 01001111 o 01101111
P 01010000 p 01110000
Q 01010001 q 01110001
R 01010010 r 01110010
S 01010011 s 01110011
T 01010100 t 01110100
U 01010101 u 01110101
V 01010110 v 01110110
W 01010111 w 01110111
X 01011000 x 01111000
Y 01011001 y 01111001
Z 01011010 z 01111010

You might also like