binary numbers
TRANSCRIPT
BINARY NUMBERSMaking sense out of 0’s and 1’s
Numbers4710
XXXXVII
XLVII
529
Decimal Numbering System
Decimal Numbering System
• Based on 10
Decimal Numbering System
• Based on 10
• Uses 10 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
Decimal Numbering System
• Based on 10
• Uses 10 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
• Largest symbol has value 1 less than 10 (9)
Decimal Numbering System
• Based on 10
• Uses 10 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
• Largest symbol has value 1 less than 10 (9)
• Place-Value Based System
Decimal Numbering System
• Based on 10
• Uses 10 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
• Largest symbol has value 1 less than 10 (9)
• Place-Value Based System
• Value of symbol depends partially on place in number
Decimal Numbering System
• Based on 10
• Uses 10 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
• Largest symbol has value 1 less than 10 (9)
• Place-Value Based System
• Value of symbol depends partially on place in number
• Place values start with 1
Decimal Numbering System
• Based on 10
• Uses 10 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
• Largest symbol has value 1 less than 10 (9)
• Place-Value Based System
• Value of symbol depends partially on place in number
• Place values start with 1
• Place values increase by a factor of 10 as you move to left Place values decrease by a factor of 10 as you move to right Place values are 10 raised to power
Decimal Numbering System
• Based on 10
• Uses 10 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
• Largest symbol has value 1 less than 10 (9)
• Place-Value Based System
• Value of symbol depends partially on place in number
• Place values start with 1
• Place values increase by a factor of 10 as you move to left Place values decrease by a factor of 10 as you move to right Place values are 10 raised to power
• Value of a number is the weighted sum of the digits where each digit is multiplied by its place value before being added to the sum
Binary Numbering System
Binary Numbering System• Based on 2
Binary Numbering System• Based on 2
• Uses 2 symbols (0, 1)
Binary Numbering System• Based on 2
• Uses 2 symbols (0, 1)
• Largest symbol has value 1 less than 2 (1)
Binary Numbering System• Based on 2
• Uses 2 symbols (0, 1)
• Largest symbol has value 1 less than 2 (1)
• Place-Value Based System
Binary Numbering System• Based on 2
• Uses 2 symbols (0, 1)
• Largest symbol has value 1 less than 2 (1)
• Place-Value Based System
• Value of symbol depends partially on place in number
Binary Numbering System• Based on 2
• Uses 2 symbols (0, 1)
• Largest symbol has value 1 less than 2 (1)
• Place-Value Based System
• Value of symbol depends partially on place in number
• Place values start with 1
Binary Numbering System• Based on 2
• Uses 2 symbols (0, 1)
• Largest symbol has value 1 less than 2 (1)
• Place-Value Based System
• Value of symbol depends partially on place in number
• Place values start with 1
• Place values increase by a factor of 2 as you move to left Place values decrease by a factor of 2 as you move to right Place values are 2 raised to power
Binary Numbering System• Based on 2
• Uses 2 symbols (0, 1)
• Largest symbol has value 1 less than 2 (1)
• Place-Value Based System
• Value of symbol depends partially on place in number
• Place values start with 1
• Place values increase by a factor of 2 as you move to left Place values decrease by a factor of 2 as you move to right Place values are 2 raised to power
• Value of a number is the weighted sum of the digits where each digit is multiplied by its place value before being added to the sum
Comparison:Decimal vs Binary
• Based on 10
• Uses 10 symbols (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
• Largest symbol has value 1 less than 10 (9)
• Place-Value Based System
• Value of symbol depends partially on place in number
• Place values start with 1
• Place values increase by a factor of 10 as you move to left
Place values decrease by a factor of 10 as you move to right Place values are 10 raised to power
• Value of a number is the weighted sum of the digits where
each digit is multiplied by its place value before being added to the sum
• Based on 2
• Uses 2 symbols (0, 1)
• Largest symbol has value 1 less than 2 (1)
• Place-Value Based System
• Value of symbol depends partially on place in number
• Place values start with 1
• Place values increase by a factor of 2 as you move to left
Place values decrease by a factor of 2 as you move to right Place values are 2 raised to power
• Value of a number is the weighted sum of the digits where
each digit is multiplied by its place value before being added to the sum
Base 10 (Decimal) Example
1239
1 2 3 9103 102 101 1001000 100 10 1
9 x 1 = 93 x 10 = 302 x 100 = 2001 x 1000 = 1000----------------------Total = 1239
Base 2 (Binary) Example
10011010111
1 0 0 1 1 0 1 0 1 1 1 210 29 28 27 26 25 24 23 22
21 20 1024 512 256 128 64 32 16 8 4 2 1
1 x 1 = 11 x 2 = 21 x 4 = 40 x 8 = 01 x 16 = 160 x 32 = 01 x 64 = 641 x 128 = 1280 x 256 = 00 x 512 = 01 x 1024= 1024----------------------Total = 1239
Base 2 (Binary) Example
10011010111
1 0 0 1 1 0 1 0 1 1 1 210 29 28 27 26 25 24 23 22
21 20 1024 512 256 128 64 32 16 8 4 2 1
1 x 1 = 11 x 2 = 21 x 4 = 41 x 16 = 161 x 64 = 641 x 128 = 1281 x 1024= 1024----------------------Total = 1239
We find the value of the number by simply adding all the place values that contain 1’s
Example Problem
What is the value of the Binary number 1 0 1 1 0 0 1 ?
Remember: Place values start at the right at 1 and double as you move to the left!
Place values: 64 32 16 8 4 2 1
Example Problem
What is the value of the Binary number 1 0 1 1 0 0 1 ?
Place values : 64 32 16 8 4 2 1
Answer: 64 + 16 + 8 + 1 => 89
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13 = 8 + 4 + 1
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 8 + 4 + 1
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 8 + 4 + 1
= 16 + 1
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 31
= 8 + 4 + 1
= 16 + 1
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 31
= 8 + 4 + 1
= 16 + 1
= 16 + 8 + 4 + 2 + 1
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 31
= 8 + 4 + 1
= 16 + 1
= 16 + 8 + 4 + 2 + 1= 32 -1
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 31
= 23
= 8 + 4 + 1
= 16 + 1
= 16 + 8 + 4 + 2 + 1= 32 -1
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 31
= 23
= 8 + 4 + 1
= 16 + 1
= 16 + 8 + 4 + 2 + 1
= 16 + 4 + 2 + 1
= 32 -1
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 31
= 23
= 8 + 4 + 1
= 16 + 1
= 16 + 8 + 4 + 2 + 1
= 16 + 4 + 2 + 1
= 32 -1
= 31 – 8
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 31
= 23
= 29
= 8 + 4 + 1
= 16 + 1
= 16 + 8 + 4 + 2 + 1
= 16 + 4 + 2 + 1
= 32 -1
= 31 – 8
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 31
= 23
= 29
= 8 + 4 + 1
= 16 + 1
= 16 + 8 + 4 + 2 + 1
= 16 + 4 + 2 + 1
= 16 + 8 + 4 + 1
= 32 -1
= 31 – 8
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 31
= 23
= 29
= 8 + 4 + 1
= 16 + 1
= 16 + 8 + 4 + 2 + 1
= 16 + 4 + 2 + 1
= 16 + 8 + 4 + 1
= 32 -1
= 31 – 8
= 31 – 2
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 31
= 23
= 29
= 198
= 8 + 4 + 1
= 16 + 1
= 16 + 8 + 4 + 2 + 1
= 16 + 4 + 2 + 1
= 16 + 8 + 4 + 1
= 32 -1
= 31 – 8
= 31 – 2
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 31
= 23
= 29
= 198
= 8 + 4 + 1
= 16 + 1
= 16 + 8 + 4 + 2 + 1
= 16 + 4 + 2 + 1
= 16 + 8 + 4 + 1
= 128 + 64 + 4 + 2
= 32 -1
= 31 – 8
= 31 – 2
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 31
= 23
= 29
= 198
= 170
= 8 + 4 + 1
= 16 + 1
= 16 + 8 + 4 + 2 + 1
= 16 + 4 + 2 + 1
= 16 + 8 + 4 + 1
= 128 + 64 + 4 + 2
= 32 -1
= 31 – 8
= 31 – 2
128 64 32 16 8 4 2 1
Problems: Binary to Decimal
1 1 0 1
1 0 0 0 1
1 1 1 1 1
1 0 1 1 1
1 1 1 0 1
1 1 0 0 0 1 1 0
1 0 1 0 1 0 1 0
= 13
= 17
= 31
= 23
= 29
= 198
= 170
= 8 + 4 + 1
= 16 + 1
= 16 + 8 + 4 + 2 + 1
= 16 + 4 + 2 + 1
= 16 + 8 + 4 + 1
= 128 + 64 + 4 + 2
= 128 + 32 + 8 + 2
= 32 -1
= 31 – 8
= 31 – 2
128 64 32 16 8 4 2 1
Decimal to Binary
The binary representation of a number is the collection of powers of two that add up to the number we want to represent.
The key will be to discover what powers of two will add up to the target Base 10 number.
Example
What is the binary representation of 27?(What powers of 2 will add up to 27?)
We can find these by subtracting different powers of two (no more than once)until we reach zero.
These Powers of two must then be the ones we need to represent the numberin binary.
Start with highest that is less than or equal to the present value and work ourway down to zero.
Example
What is the binary representation of 27?(What powers of 2 will add up to 27?)
Start with highest that is less than or equal to the present value and work ourway down to zero.
The highest power that is less than or equal to 27 is 16:27 – 16 = 11
Repeat for 1111 – 8 = 3
Repeat for 33 – 2 = 1
Repeat for 11 – 1 = 0
Fill in the remaining places with 0 0
Answer: 2710 = 110112
The binary number must have a 1 in the following positions:16, 8, 2 and 1:
1 1 1 1--- --- --- --- ---16 8 4 2 1
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0 = 101
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 101
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 101
= 10010
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 25-16 = 9-8 = 1-1 = 0
= 101
= 10010
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 25-16 = 9-8 = 1-1 = 0
= 101
= 10010
= 11001
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 25-16 = 9-8 = 1-1 = 0
= 53-32 = 21-16 = 5-4 = 1-1 = 0
= 101
= 10010
= 11001
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 25-16 = 9-8 = 1-1 = 0
= 53-32 = 21-16 = 5-4 = 1-1 = 0
= 101
= 10010
= 11001
= 110101
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 25-16 = 9-8 = 1-1 = 0
= 53-32 = 21-16 = 5-4 = 1-1 = 0
= 78-64 = 12-8 = 4-4 = 0
= 101
= 10010
= 11001
= 110101
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 25-16 = 9-8 = 1-1 = 0
= 53-32 = 21-16 = 5-4 = 1-1 = 0
= 78-64 = 12-8 = 4-4 = 0
= 101
= 10010
= 11001
= 110101
= 1001100
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 25-16 = 9-8 = 1-1 = 0
= 53-32 = 21-16 = 5-4 = 1-1 = 0
= 78-64 = 12-8 = 4-4 = 0
= 113-64 = 49-32 = 17-16 = 1-1 = 0
= 101
= 10010
= 11001
= 110101
= 1001100
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 25-16 = 9-8 = 1-1 = 0
= 53-32 = 21-16 = 5-4 = 1-1 = 0
= 78-64 = 12-8 = 4-4 = 0
= 113-64 = 49-32 = 17-16 = 1-1 = 0
= 101
= 10010
= 11001
= 110101
= 1001100
= 1110001
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 25-16 = 9-8 = 1-1 = 0
= 53-32 = 21-16 = 5-4 = 1-1 = 0
= 78-64 = 12-8 = 4-4 = 0
= 113-64 = 49-32 = 17-16 = 1-1 = 0
= 143-128 = 15-8 = 7-4 = 3-2 = 1-1 = 0
= 101
= 10010
= 11001
= 110101
= 1001100
= 1110001
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 25-16 = 9-8 = 1-1 = 0
= 53-32 = 21-16 = 5-4 = 1-1 = 0
= 78-64 = 12-8 = 4-4 = 0
= 113-64 = 49-32 = 17-16 = 1-1 = 0
= 143-128 = 15-8 = 7-4 = 3-2 = 1-1 = 0
= 101
= 10010
= 11001
= 110101
= 1001100
= 1110001
= 10001111
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 25-16 = 9-8 = 1-1 = 0
= 53-32 = 21-16 = 5-4 = 1-1 = 0
= 78-64 = 12-8 = 4-4 = 0
= 113-64 = 49-32 = 17-16 = 1-1 = 0
= 143-128 = 15-8 = 7-4 = 3-2 = 1-1 = 0
= 179-128 = 51-32 = 19-16 = 3-2 = 1-1 = 0
= 101
= 10010
= 11001
= 110101
= 1001100
= 1110001
= 10001111
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 25-16 = 9-8 = 1-1 = 0
= 53-32 = 21-16 = 5-4 = 1-1 = 0
= 78-64 = 12-8 = 4-4 = 0
= 113-64 = 49-32 = 17-16 = 1-1 = 0
= 143-128 = 15-8 = 7-4 = 3-2 = 1-1 = 0
= 179-128 = 51-32 = 19-16 = 3-2 = 1-1 = 0
= 101
= 10010
= 11001
= 110101
= 1001100
= 1110001
= 10001111
= 10110011
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 25-16 = 9-8 = 1-1 = 0
= 53-32 = 21-16 = 5-4 = 1-1 = 0
= 78-64 = 12-8 = 4-4 = 0
= 113-64 = 49-32 = 17-16 = 1-1 = 0
= 143-128 = 15-8 = 7-4 = 3-2 = 1-1 = 0
= 179-128 = 51-32 = 19-16 = 3-2 = 1-1 = 0
= 220-128 = 92-64 = 28-16 = 12-8 = 4-4 = 0
= 101
= 10010
= 11001
= 110101
= 1001100
= 1110001
= 10001111
= 10110011
Decimal to Binary: Problems
5
18
25
53
78
113
143
179
220
= 5-4 = 1-1 = 0
= 18-16 = 2-2 = 0
= 25-16 = 9-8 = 1-1 = 0
= 53-32 = 21-16 = 5-4 = 1-1 = 0
= 78-64 = 12-8 = 4-4 = 0
= 113-64 = 49-32 = 17-16 = 1-1 = 0
= 143-128 = 15-8 = 7-4 = 3-2 = 1-1 = 0
= 179-128 = 51-32 = 19-16 = 3-2 = 1-1 = 0
= 220-128 = 92-64 = 28-16 = 12-8 = 4-4 = 0
= 101
= 10010
= 11001
= 110101
= 1001100
= 1110001
= 10001111
= 10110011
= 11011100