THE BINARY NUMBER SYSTEM “There are only 10 types of people in this world: Those who understand BINARY and those who do not.” IT’S ALL ONES AND ZEROS … - Computers speak in a language, very much like we speak in English. We call it binary code. - This language consists of two “letters”: 0 and 1 BINARY VERSUS DECIMAL NOTATION - We are used to seeing numbers in the decimal notation, for example: 143 - In decimal notation, we use digits from 0 to 9 - Each digit holds a value, which is some sequential power of 10 Let’s take a look: 143 = (1 x 100) + (4 x 10) + (3 x 1) Which can also be written as … 143 = (1 x 102 ) + (4 x 101 ) + (3 x 100 ) BINARY VERSUS DECIMAL NOTATION - In the binary system, we use only two digits: 0 and 1 A single 0 or 1 is called a “bit” A group of 8 bits is called a “byte” ex: 0100 1101 One byte has the possibility of 256 different values Each digit holds a value, which is some sequential power of 2 BINARY VERSUS DECIMAL NOTATION Let’s take a look at a few examples: Decimal Binary 2 10 5 101 38 100110 143 10001111 2 = 1 × 2 + (0 × 1) 2 = 1 × 21 + (0 × 20 ) 5 = 1 × 4 + 0 × 2 + (1 × 1) 5 = 1 × 22 + 0 × 21 + (1 × 20 ) 38 = (1 × 32) + 0 × 16 + 0 × 8 + 1 × 4 + 1 × 2 + 0 × 1 38 = (1 × 25 ) + 0 × 24 + 0 × 23 + 1 × 22 + 1 × 21 + 0 × 20 BINARY VERSUS DECIMAL NOTATION Decimal 64 32 16 8 4 2 1 2 Binary 128 (Byte) 0000 0010 0 0 0 0 0 0 1 0 5 0000 0101 0 0 0 0 0 1 0 1 38 0010 0110 0 0 1 0 0 1 1 0 143 1000 1111 1 0 0 0 1 1 1 1 TRY THIS … 1. Write these numbers out in binary form: a) 9 b) 22 c) 237 2. Convert these binary numbers into decimal notation: a) 111 b) 101011 c) 10101111 ANSWERS 1. Write these numbers out in binary form: a) 9 1001 b) 22 10110 c) 237 11101101 2. Convert these binary numbers into decimal notation: a) 111 7 b) 101011 43 c) 10101111 175 ASCII JUST FOR FUN …