Number Systems & Binary How to count
How do we represent numbers? Early systems: – Actual count : ||||| = 5 – Roman numers : XI = 11 Hard to do math: MCXXIII + CLXXIV = ????
What we are used to – Digits that have different meaning based on place: = 1 * * * * * 1 = Place Value Systems ten thousands thousandshundredstensones 12059
Decimal Numbers Base 10 : Each place increases by a power of 10 ten thousands 10 4 thousands 10 3 hundreds 10 2 tens 10 1 ones
Why Base 10? Only one thing special about base 10: Other systems have been used: – Mayans : Base 20 – Babylonians : Base 60
Other Bases Base determines the multiplier from one column to next Base 20 = 1 * * * * * 1 = thousands 20 4 eight- thousands 20 3 four- hundreds 20 2 twentys 20 1 ones
Base 2 Base two – Only 1 and 0 – Places are powers of 2 = 1 * * * * * * 1 = = 45 thirty-twos 2 5 sixteens 2 4 eights 2 3 fours2 twos 2 1 ones
Other Bases Base also determines how many digits needed: Base 10 : 10 digits : 0-9 Base 2 : 2 digits : 0-1 Base 8 : 8 digits : 0-7
Notation Subscript used to indicate base: 101 in base 2 (numeric value of 5) 101 in base 10 (numeric value of 101)
More digits = bigger numbers 4 digits we can represent values : 8 digits can represent digits can represent n digits can represent 0 to (2 n -1)
Leading 0's Leading 0's do not matter: 101 = 0101 =
Leading 0's Leading 0's do not matter: 101 = 0101 =
Counting to ten in binary In binary you generally show leading 0's Values for 1-10 (decimal) in binary:
Binary -> Decimal with Table 1. Make a table like this one 2. Write in the binary number 3. Add up all the numbers from the top that have a 1 under them: =
Decimal -> Binary with Table 1. Make a table like this one 2. Say we are converting 83: Look for largest number that is smaller than our value Look for largest number that is smaller than our value
Decimal -> Binary with Table 1. Make a table like this one 2. Say we are converting 83: Look for largest number that is smaller than our value Look for largest number that is smaller than our value We have 1 of those (0 of anything bigger) We have 1 of those (0 of anything bigger) Subtract that from our number 83 – 64 = still have 19 to make Subtract that from our number 83 – 64 = still have 19 to make
Decimal -> Binary with Table 1. Make a table like this one 2. Say we are converting 83: Look for largest number that is smaller than our value Look for largest number that is smaller than our value We have 1 of those (0 of anything bigger) We have 1 of those (0 of anything bigger) Subtract that from our number 83 – 64 = still have 19 to make Subtract that from our number 83 – 64 = still have 19 to make Look for largest value smaller than that… Now have 19 – 16 = 3 left Look for largest value smaller than that… Now have 19 – 16 = 3 left
Decimal -> Binary with Table 1. Make a table like this one 2. Say we are converting 83: Look for largest number that is smaller than our value Look for largest number that is smaller than our value We have 1 of those (0 of anything bigger) We have 1 of those (0 of anything bigger) Subtract that from our number 83 – 64 = still have 19 to make Subtract that from our number 83 – 64 = still have 19 to make Look for largest value smaller than that… Now have 19 – 16 = 3 left Look for largest value smaller than that… Now have 19 – 16 = 3 left Continue… need a 2, have one left… Continue… need a 2, have one left…
Decimal -> Binary with Table 1. Make a table like this one 2. Say we are converting 83: means =
Conversion With Division/ Multiplication Binary works in powers of 2 Multiplying/dividing by 2 shifts digits
Decimal -> Binary with Division Step 1: Start with a blank answer and the number your are converting Step 2: Divide your number by 2 to make a quotient and a remainder Step 3: Place your remainder on the left side of your answer Step 4: If your quotient is 0, you are done Otherwise, make the quotient your new number and go back to step 2 Convert 105 to binary: Number ÷ 2QR Answer 105
Decimal -> Binary with Division Step 1: Start with a blank answer and the number your are converting Step 2: Divide your number by 2 to make a quotient and a remainder Step 3: Place your remainder on the left side of your answer Step 4: If your quotient is 0, you are done Otherwise, make the quotient your new number and go back to step 2 Convert 105 to binary: Number ÷ 2QR Answer 105 ÷ 2521
Decimal -> Binary with Division Step 1: Start with a blank answer and the number your are converting Step 2: Divide your number by 2 to make a quotient and a remainder Step 3: Place your remainder on the left side of your answer Step 4: If your quotient is 0, you are done Otherwise, make the quotient your new number and go back to step 2 Convert 105 to binary: Number ÷ 2QR Answer 105 ÷ 25211
Decimal -> Binary with Division Step 1: Start with a blank answer and the number your are converting Step 2: Divide your number by 2 to make a quotient and a remainder Step 3: Place your remainder on the left side of your answer Step 4: If your quotient is 0, you are done Otherwise, make the quotient your new number and go back to step 2 Convert 105 to binary: Number ÷ 2QR Answer 105 ÷ ÷ 2
Decimal -> Binary with Division Step 1: Start with a blank answer and the number your are converting Step 2: Divide your number by 2 to make a quotient and a remainder Step 3: Place your remainder on the left side of your answer Step 4: If your quotient is 0, you are done Otherwise, make the quotient your new number and go back to step 2 Convert 105 to binary: Number ÷ 2QR Answer 105 ÷ ÷
Decimal -> Binary with Division Step 1: Start with a blank answer and the number your are converting Step 2: Divide your number by 2 to make a quotient and a remainder Step 3: Place your remainder on the left side of your answer Step 4: If your quotient is 0, you are done Otherwise, make the quotient your new number and go back to step 2 Convert 105 to binary: Number ÷ 2QR Answer 105 ÷ ÷ ÷
Decimal -> Binary with Division Step 1: Start with a blank answer and the number your are converting Step 2: Divide your number by 2 to make a quotient and a remainder Step 3: Place your remainder on the left side of your answer Step 4: If your quotient is 0, you are done Otherwise, make the quotient your new number and go back to step 2 Convert 105 to binary: Number ÷ 2QR Answer 105 ÷ ÷ ÷ ÷ ÷ ÷ ÷
Decimal -> Binary with Division Step 1: Start with a blank answer and the number your are converting Step 2: Divide your number by 2 to make a quotient and a remainder Step 3: Place your remainder on the left side of your answer Step 4: If your quotient is 0, you are done Otherwise, make the quotient your new number and go back to step 2 Convert 105 to binary: Number ÷ 2QR Answer 105 ÷ ÷ ÷ ÷ ÷ ÷ ÷ = 105
Binary -> Decimal with Multiplication Step 1: Start with the number your are converting and the answer of 0 Step 2: Multiply your answer by 2 Step 3: Remove the leftmost digit of number and add it to your answer Step 4: If number has no more digits, you are done Otherwise, go back to step 2 Convert to decimal: Number Answer 11010
Binary -> Decimal with Multiplication Step 1: Start with the number your are converting and the answer of 0 Step 2: Multiply your answer by 2 Step 3: Remove the leftmost digit of number and add it to your answer Step 4: If number has no more digits, you are done Otherwise, go back to step 2 Convert to decimal: Number Answer * 2
Binary -> Decimal with Multiplication Step 1: Start with the number your are converting and the answer of 0 Step 2: Multiply your answer by 2 Step 3: Remove the leftmost digit of number and add it to your answer Step 4: If number has no more digits, you are done Otherwise, go back to step 2 Convert to decimal: Number Answer * 2 + 1
Binary -> Decimal with Multiplication Step 1: Start with the number your are converting and the answer of 0 Step 2: Multiply your answer by 2 Step 3: Remove the leftmost digit of number and add it to your answer Step 4: If number has no more digits, you are done Otherwise, go back to step 2 Convert to decimal: Number Answer
Binary -> Decimal with Multiplication Step 1: Start with the number your are converting and the answer of 0 Step 2: Multiply your answer by 2 Step 3: Remove the leftmost digit of number and add it to your answer Step 4: If number has no more digits, you are done Otherwise, go back to step 2 Convert to decimal: Number Answer * 2
Binary -> Decimal with Multiplication Step 1: Start with the number your are converting and the answer of 0 Step 2: Multiply your answer by 2 Step 3: Remove the leftmost digit of number and add it to your answer Step 4: If number has no more digits, you are done Otherwise, go back to step 2 Convert to decimal: Number Answer * 2 + 1
Binary -> Decimal with Multiplication Step 1: Start with the number your are converting and the answer of 0 Step 2: Multiply your answer by 2 Step 3: Remove the leftmost digit of number and add it to your answer Step 4: If number has no more digits, you are done Otherwise, go back to step 2 Convert to decimal: Number Answer
Binary -> Decimal with Multiplication Step 1: Start with the number your are converting and the answer of 0 Step 2: Multiply your answer by 2 Step 3: Remove the leftmost digit of number and add it to your answer Step 4: If number has no more digits, you are done Otherwise, go back to step 2 Convert to decimal: Number Answer * 2
Binary -> Decimal with Multiplication Step 1: Start with the number your are converting and the answer of 0 Step 2: Multiply your answer by 2 Step 3: Remove the leftmost digit of number and add it to your answer Step 4: If number has no more digits, you are done Otherwise, go back to step 2 Convert to decimal: Number Answer * 2 + 0
Binary -> Decimal with Multiplication Step 1: Start with the number your are converting and the answer of 0 Step 2: Multiply your answer by 2 Step 3: Remove the leftmost digit of number and add it to your answer Step 4: If number has no more digits, you are done Otherwise, go back to step 2 Convert to decimal: Number Answer
Binary -> Decimal with Multiplication Step 1: Start with the number your are converting and the answer of 0 Step 2: Multiply your answer by 2 Step 3: Remove the leftmost digit of number and add it to your answer Step 4: If number has no more digits, you are done Otherwise, go back to step 2 Convert to decimal: Number Answer * 2
Binary -> Decimal with Multiplication Step 1: Start with the number your are converting and the answer of 0 Step 2: Multiply your answer by 2 Step 3: Remove the leftmost digit of number and add it to your answer Step 4: If number has no more digits, you are done Otherwise, go back to step 2 Convert to decimal: Number Answer _6 * 2 + 1
Binary -> Decimal with Multiplication Step 1: Start with the number your are converting and the answer of 0 Step 2: Multiply your answer by 2 Step 3: Remove the leftmost digit of number and add it to your answer Step 4: If number has no more digits, you are done Otherwise, go back to step 2 Convert to decimal: Number Answer _13
Binary -> Decimal with Multiplication Step 1: Start with the number your are converting and the answer of 0 Step 2: Multiply your answer by 2 Step 3: Remove the leftmost digit of number and add it to your answer Step 4: If number has no more digits, you are done Otherwise, go back to step 2 Convert to decimal: Number Answer _ = 13