Tuesday, August 20, 2019
Advantages of Binary System
Advantages of Binary System The binary number system, base two, uses only two symbols, 0 and 1. Two is the smallest whole number that can be used as the base of a number system. For many years, mathematicians saw base two as a primitive system and overlooked the potential of the binary system as a tool for developing computer science and many electrical devices. Base two has several other names, including the binary positional numeration system and the dyadic system. Many civilizations have used the binary system in some form, including inhabitants of Australia, Polynesia, South America, and Africa. Ancient Egyptian arithmetic depended on the binary system. Records of Chinese mathematics trace the binary system back to the fifth century and possibly earlier. The Chinese were probably the first to appreciate the simplicity of noting integers as sums of powers of 2, with each coefficient being 0 or 1. For example, the number 10 would be written as 1010: 10= 1 x 23 + 0 x 22 + 1 x 21 + 0 x 20 Users of the binary system face something of a trade-off. The two-digit system has a basic purity that makes it suitable for solving problems of modern technology. However, the process of writing out binary numbers and using them in mathematical computation is long and cumbersome, making it impractical to use binary numbers for everyday calculations. There are no shortcuts for converting a number from the commonly used denary scale (base ten) to the binary scale. Over the years, several prominent mathematicians have recognized the potential of the binary system. Francis Bacon (1561-1626) invented a bilateral alphabet code, a binary system that used the symbols A and B rather than 0 and 1. In his philosophical work, The Advancement of Learning, Bacon used his binary system to develop ciphers and codes. These studies laid the foundation for what was to become word processing in the late twentieth century. The American Standard Code for Information Interchange (ASCII), adopted in 1966, accomplishes the same purpose as Bacons alphabet code. Bacons discoveries were all the more remarkable because at the time Bacon was writing, Europeans had no information about the Chinese work on binary systems. A German mathematician, Gottfried Wilhelm von Leibniz (1646-1716), learned of the binary system from Jesuit missionaries who had lived in China. Leibniz was quick to recognize the advantages of the binary system over the denary system, but he is also well known for his attempts to transfer binary thinking to theology. He speculated that the creation of the universe may have been based on a binary scale, where God, represented by the number 1, created the Universe out of nothing, represented by 0. This widely quoted analogy rests on an error, in that it is not strictly correct to equate nothing with zero. The English mathematician and logician George Boole (1815-1864) developed a system of Boolean logic that could be used to analyze any statement that could be broken down into binary form (for example, true/false, yes/no, male/female). Booles work was ignored by mathematicians for 50 years, until a graduate student at the Massachusetts Institute of Technology realized that Boolean algebra could be applied to problems of electronic circuits. Boolean logic is one of the building blocks of computer science, and computer users apply binary principles every time they conduct an electronic search. The binary system works well for computers because the mechanical and electronic relays recognize only two states of operation, such as on/off or closed/open. Operational characters 1 and 0 stand for 1 = on = closed circuit = true 0 = off = open circuit = false. The telegraph system, which relies on binary code, demonstrates the ease with which binary numbers can be translated into electrical impulses. The binary system works well with electronic machines and can also aid in encrypting messages. Calculating machines using base two convert decimal numbers to binary form, then take the process back again, from binary to decimal. The binary system, once dismissed as primitive, is thus central to the development of computer science and many forms of electronics. Many important tools of communication, including the typewriter, cathode ray tube, telegraph, and transistor, could not have been developed without the work of Bacon and Boole. Contemporary applications of binary numerals include statistical investigations and probability studies. Mathematicians and everyday citizens use the binary system to explain strategy, prove mathematical theorems, and solve puzzles. Basic Concepts behind the Binary System To understand binary numbers, begin by remembering basic school math. When we were first taught about numbers, we learnt that, in the decimal system, things are categorised into columns: H | T | O 1 | 9 | 3 such that H is the hundreds column, T is the tens column, and O is the ones column. So the number 193 is 1-hundreds plus 9-tens plus 3-ones. Afterwards we learnt that the ones column meant 10^0, the tens column meant 10^1, the hundreds column 10^2 and so on, such that 10^2|10^1|10^0 1 | 9 | 3 The number 193 is really {(1*10^2) + (9*10^1) + (3*10^0)}. We know that the decimal system uses the digits 0-9 to represent numbers. If we wished to put a larger number in column 10^n (e.g., 10), we would have to multiply 10*10^n, which would give 10 ^ (n+1), and be carried a column to the left. For example, if we put ten in the 10^0 column, it is impossible, so we put a 1 in the 10^1 column, and a 0 in the 10^0 column, therefore using two columns. Twelve would be 12*10^0, or 10^0(10+2), or 10^1+2*10^0, which also uses an additional column to the left (12). The binary system works under the exact same principles as the decimal system, only it operates in base 2 rather than base 10. In other words, instead of columns being 10^2|10^1|10^0 They are, 2^2|2^1|2^0 Instead of using the digits 0-9, we only use 0-1 (again, if we used anything larger it would be like multiplying 2*2^n and getting 2^n+1, which would not fit in the 2^n column. Therefore, it would shift you one column to the left. For example, 3 in binary cannot be put into one column. The first column we fill is the right-most column, which is 2^0, or 1. Since 3>1, we need to use an extra column to the left, and indicate it as 11 in binary (1*2^1) + (1*2^0). Binary Addition Consider the addition of decimal numbers: 23 +48 ___ We begin by adding 3+8=11. Since 11 is greater than 10, a one is put into the 10s column (carried), and a 1 is recorded in the ones column of the sum. Next, add {(2+4) +1} (the one is from the carry) = 7, which is put in the 10s column of the sum. Thus, the answer is 71. Binary addition works on the same principle, but the numerals are different. Begin with one-bit binary addition: 0 0 1 +0 +1 +0 ___ ___ ___ 0 1 1 1+1 carries us into the next column. In decimal form, 1+1=2. In binary, any digit higher than 1 puts us a column to the left (as would 10 in decimal notation). The decimal number 2 is written in binary notation as 10 (1*2^1)+(0*2^0). Record the 0 in the ones column, and carry the 1 to the twos column to get an answer of 10. In our vertical notation, 1 +1 ___ 10 The process is the same for multiple-bit binary numbers: 1010 +1111 ______ Step one: Column 2^0: 0+1=1. Record the 1.Ãâà Temporary Result: 1; Carry: 0 Step two: Column 2^1: 1+1=10.Ãâà Record the 0 carry the 1. Temporary Result: 01; Carry: 1 Step three: Column 2^2: 1+0=1 Add 1 from carry: 1+1=10.Ãâà Record the 0, carry the 1. Temporary Result: 001; Carry: 1 Step four: Column 2^3: 1+1=10. Add 1 from carry: 10+1=11. Record the 11.Ãâà Final result: 11001 Alternately: 11 (carry) 1010 +1111 ______ 11001 Always remember 0+0=0 1+0=1 1+1=10 Try a few examples of binary addition: 111 101 111 +110 +111 +111 ______ _____ _____ 1101 1100 1110 Binary Multiplication Multiplication in the binary system works the same way as in the decimal system: 1*1=1 1*0=0 0*1=0 101 * 11 ____ 101 1010 _____ 1111 Note that multiplying by two is extremely easy. To multiply by two, just add a 0 on the end. Binary Division Follow the same rules as in decimal division. For the sake of simplicity, throw away the remainder. For Example: 111011/11 10011 r 10 _______ 11)111011 -11 ______ 101 -11 ______ 101 11 ______ 10 Decimal to Binary Converting from decimal to binary notation is slightly more difficult conceptually, but can easily be done once you know how through the use of algorithms. Begin by thinking of a few examples. We can easily see that the number 3= 2+1. and that this is equivalent to (1*2^1)+(1*2^0). This translates into putting a 1 in the 2^1 column and a 1 in the 2^0 column, to get 11. Almost as intuitive is the number 5: it is obviously 4+1, which is the same as saying [(2*2) +1], or 2^2+1. This can also be written as [(1*2^2)+(1*2^0)]. Looking at this in columns, 2^2 | 2^1 | 2^0 1 0 1 or 101. What were doing here is finding the largest power of two within the number (2^2=4 is the largest power of 2 in 5), subtracting that from the number (5-4=1), and finding the largest power of 2 in the remainder (2^0=1 is the largest power of 2 in 1). Then we just put this into columns. This process continues until we have a remainder of 0. Lets take a look at how it works. We know that: 2^0=1 2^1=2 2^2=4 2^3=8 2^4=16 2^5=32 2^6=64 2^7=128 and so on. To convert the decimal number 75 to binary, we would find the largest power of 2 less than 75, which is 64. Thus, we would put a 1 in the 2^6 column, and subtract 64 from 75, giving us 11. The largest power of 2 in 11 is 8, or 2^3. Put 1 in the 2^3 column, and 0 in 2^4 and 2^5. Subtract 8 from 11 to get 3. Put 1 in the 2^1 column, 0 in 2^2, and subtract 2 from 3. Were left with 1, which goes in 2^0, and we subtract one to get zero. Thus, our number is 1001011. Making this algorithm a bit more formal gives us: Let D=number we wish to convert from decimal to binary Repeat until D=0 a. Find the largest power of two in D. Let this equal P. b. Put a 1 in binary column P. c. Subtract P from D. Put zeros in all columns which dont have ones. This algorithm is a bit awkward. Particularly step 3, filling in the zeros. Therefore, we should rewrite it such that we ascertain the value of each column individually, putting in 0s and 1s as we go: Let D= the number we wish to convert from decimal to binary Find P, such that 2^P is the largest power of two smaller than D. Repeat until P If 2^P put 1 into column P subtract 2^P from D Else put 0 into column P End if Subtract 1 from P Now that we have an algorithm, we can use it to convert numbers from decimal to binary relatively painlessly. Lets try the number D=55. Our first step is to find P. We know that 2^4=16, 2^5=32, and 2^6=64. Therefore, P=5. 2^5 Subtracting 55-32 leaves us with 23. Subtracting 1 from P gives us 4. Following step 3 again, 2^4 Next, subtract 16 from 23, to get 7. Subtract 1 from P gives us 3. 2^3>7, so we put a 0 in the 2^3 column:Ãâà 110 Next, subtract 1 from P, which gives us 2. 2^2 Subtract 4 from 7 to get 3. Subtract 1 from P to get 1. 2^1 Subtract 2 from 3 to get 1. Subtract 1 from P to get 0. 2^0 Subtract 1 from 1 to get 0. Subtract 1 from P to get -1. P is now less than zero, so we stop. Another algorithm for converting decimal to binary However, this is not the only approach possible. We can start at the right, rather than the left. All binary numbers are in the form a[n]*2^n + a[n-1]*2^(n-1)++a[1]*2^1 + a[0]*2^0 where each a[i] is either a 1 or a 0 (the only possible digits for the binary system). The only way a number can be odd is if it has a 1 in the 2^0 column, because all powers of two greater than 0 are even numbers (2, 4, 8, 16). This gives us the rightmost digit as a starting point. Now we need to do the remaining digits. One idea is to shift them. It is also easy to see that multiplying and dividing by 2 shifts everything by one column: two in binary is 10, or (1*2^1). Dividing (1*2^1) by 2 gives us (1*2^0), or just a 1 in binary. Similarly, multiplying by 2 shifts in the other direction: (1*2^1)*2=(1*2^2) or 10 in binary. Therefore {a[n]*2^n + a[n-1]*2^(n-1) + + a[1]*2^1 + a[0]*2^0}/2 is equal to a[n]*2^(n-1) + a[n-1]*2^(n-2) + + a[1]2^0 Lets look at how this can help us convert from decimal to binary. Take the number 163. We know that since it is odd, there must be a 1 in the 2^0 column (a[0]=1). We also know that it equals 162+1. If we put the 1 in the 2^0 column, we have 162 left, and have to decide how to translate the remaining digits. Twos column: Dividing 162 by 2 gives 81. The number 81 in binary would also have a 1 in the 2^0 column. Since we divided the number by two, we took out one power of two. Similarly, the statement a[n-1]*2^(n-1) + a[n-2]*2^(n-2) + + a[1]*2^0 has a power of two removed. Our new 2^0 column now contains a1. We learned earlier that there is a 1 in the 2^0 column if the number is odd. Since 81 is odd, a[1]=1. Practically, we can simply keep a running total, which now stands at 11 (a[1]=1 and a[0]=1). Also note that a1 is essentially multiplied again by two just by putting it in front of a[0], so it is automatically fit into the correct column. Fours column: Now we can subtract 1 from 81 to see what remainder we still must place (80). Dividing 80 by 2 gives 40. Therefore, there must be a 0 in the 4s column, (because what we are actually placing is a 2^0 column, and the number is not odd). Eights column: We can divide by two again to get 20. This is even, so we put a 0 in the 8s column. Our running total now stands at a[3]=0, a[2]=0, a[1]=1, and a[0]=1. Negation in the Binary System Signed Magnitude Ones Complement Twos Complement Excess 2^(m-1) These techniques work well for non-negative integers, but how do we indicate negative numbers in the binary system? Before we investigate negative numbers, we note that the computer uses a fixed number of bits or binary digits. An 8-bit number is 8 digits long. For this section, we will work with 8 bits. Signed Magnitude: The simplest way to indicate negation is signed magnitude. In signed magnitude, the left-most bit is not actually part of the number, but is just the equivalent of a +/- sign. 0 indicates that the number is positive, 1 indicates negative. In 8 bits, 00001100 would be 12 (break this down into (1*2^3) + (1*2^2) ). To indicate -12, we would simply put a 1 rather than a 0 as the first bit: 10001100. Ones Complement: In ones complement, positive numbers are represented as usual in regular binary. However, negative numbers are represented differently. To negate a number, replace all zeros with ones, and ones with zeros flip the bits. Thus, 12 would be 00001100, and -12 would be 11110011. As in signed magnitude, the leftmost bit indicates the sign (1 is negative, 0 is positive). To compute the value of a negative number, flip the bits and translate as before. Twos Complement: Begin with the number in ones complement. Add 1 if the number is negative. Twelve would be represented as 00001100, and -12 as 11110100. To verify this, lets subtract 1 from 11110100, to get 11110011. If we flip the bits, we get 00001100, or 12 in decimal. In this notation, m indicates the total number of bits. For us (working with 8 bits), it would be excess 2^7. To represent a number (positive or negative) in excess 2^7, begin by taking the number in regular binary representation. Then add 2^7 (=128) to that number. For example, 7 would be 128 + 7=135, or 2^7+2^2+2^1+2^0, and, in binary, 10000111. We would represent -7 as 128-7=121, and, in binary, 01111001. Note: Unless you know which representation has been used, you cannot figure out the value of a number. A number in excess 2 ^ (m-1) is the same as that number in twos complement with the leftmost bit flipped. To see the advantages and disadvantages of each method, lets try working with them. Using the regular algorithm for binary addition, add (5+12), (-5+12), (-12+-5), and (12+-12) in each system. Then convert back to decimal numbers. APPLICATIONS OF BINARY NUMBER SYSTEM The binary number system, also called theÃâà base-2Ãâà number system, is a method of representing numbers that counts by using combinations of only two numerals: zero (0) and one (1). Computers use the binary number system to manipulate and store all of their data including numbers, words, videos, graphics, and music. The term bit, the smallest unit of digital technology, stands for Binary digit. A byte is a group of eight bits. A kilobyte is 1,024 bytes or 8,192 bits. Using binary numbers, 1 + 1 = 10 because 2 does not exist in this system. A different number system, the commonly used decimal orÃâà base-10Ãâà number system, counts by using 10 digits (0,1,2,3,4,5,6,7,8,9) so 1 + 1 = 2 and 7 + 7 = 14. Another number system used by computer programmers is hexadecimal system,Ãâà base-16Ãâà , which uses 16 symbols (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F), so 1 + 1 = 2 and 7 + 7 = E. Base-10 and base-16 number systems are more compact than the binary system. Programmers use the hexadecimal number system as a convenient, more compact way to represent binary numbers because it is very easy to convert from binary to hexadecimal and vice versa. It is more difficult to convert from binary to decimal and from decimal to binary. The advantage of the binary system is its simplicity. A computing device can be created out of anything that has a series of switches, each of which can alternate between an on position and an off position. These switches can be electronic, biological, or mechanical, as long as they can be moved on command from one position to the other. Most computers have electronic switches. When a switch is on it represents the value of one, and when the switch is off it represents the value of zero. Digital devices perform mathematical operations by turning binary switches on and off. The faster the computer can turn the switches on and off, the faster it can perform its calculations. Binary Decimal Hexadecimal Number Number Number System System System 0 0 0 1 1 1 10 2 2 11 3 3 100 4 4 101 5 5 110 6 6 111 7 7 1000 8 8 1001 9 9 1010 10 A 1011 11 B 1100 12 C 1101 13 D 1110 14 E 1111 15 F 10000 16 10 Positional Notation Each numeral in a binary number takes a value that depends on its position in the number. This is called positional notation. It is a concept that also applies to decimal numbers. For example, the decimal number 123 represents the decimal value 100 + 20 + 3. The number one represents hundreds, the number two represents tens, and the number three represents units. A mathematical formula for generating the number 123 can be created by multiplying the number in the hundreds column (1) by 100, or 102; multiplying the number in the tens column (2) by 10, or 101; multiplying the number in the units column (3) by 1, or 100; and then adding the products together. The formula is: 1Ãâà ÃÆ'-Ãâà 102Ãâà + 2Ãâà ÃÆ'-Ãâà 101Ãâà + 3Ãâà ÃÆ'-Ãâà 100Ãâà = 123. This shows that each value is multiplied by the base (10) raised to increasing powers. The value of the power starts at zero and is incremented by one at each new position in the formula. This concept of positional notation also applies to binary numbers with the difference being that the base is 2. For example, to find the decimal value of the binary number 1101, the formula is 1Ãâà ÃÆ'-Ãâà 23Ãâà + 1Ãâà ÃÆ'-Ãâà 22Ãâà + 0Ãâà ÃÆ'-Ãâà 21Ãâà + 1Ãâà ÃÆ'-Ãâà 20Ãâà = 13. Binary Operations Binary numbers can be manipulated with the same familiar operations used to calculate decimal numbers, but using only zeros and ones. To add two numbers, there are only four rules to remember: Therefore, to solve the following addition problem, start in the rightmost column and add 1 + 1 = 10; write down the 0 and carry the 1. Working with each column to the left, continue adding until the problem is solved. To convert a binary number to a decimal number, each digit is multiplied by a power of two. The products are then added together. For example, to translate the binary number 11010 to decimal, the formula would be as follows: To convert a binary number to a hexadecimal number, separate the binary number into groups of four starting from the right and then translate each group into its hexadecimal equivalent. Zeros may be added to the left of the binary number to complete a group of four. For example, to translate the number 11010 to hexadecimal, the formula would be as follows: Binary Number System A Binary Number is made up of only 0s and 1s. http://www.mathsisfun.com/images/binary-number.gif This is 1ÃÆ'-8 + 1ÃÆ'-4 + 0ÃÆ'-2 + 1 + 1ÃÆ'-(1/2) + 0ÃÆ'-(1/4) + 1ÃÆ'-(1/8) (= 13.625 in Decimal) Similar to theÃâà Decimal System, numbers can be placed to the left or right of the point, to indicate values greater than one or less than one. For Binary Numbers: 2 Different Values Because you can only have 0s or 1s, this is how you count using Binary: Decimal: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Binary: 0 1 10 11 100 101 110 111 1000 1001 1010 1011 1100 1101 1110 1111 Binary is as easy as 1, 10, 11. Here are some more equivalent values: Decimal: 20 25 30 40 50 100 200 500 Binary: 10100 11001 11110 101000 110010 1100100 11001000 111110100 Ãâà How to Show that a Number is Binary To show that a number is aÃâà binaryÃâà number, follow it with a little 2 like this:Ãâà 1012 This way people wont think it is the decimal number 101 (one hundred and one). Examples: Example 1: What is 11112Ãâà in Decimal? The 1 on the left is in the 2ÃÆ'-2ÃÆ'-2 position, so that means 1ÃÆ'-2ÃÆ'-2ÃÆ'-2 (=8) The next 1 is in the 2ÃÆ'-2 position, so that means 1ÃÆ'-2ÃÆ'-2 (=4) The next 1 is in the 2 position, so that means 1ÃÆ'-2 (=2) The last 1 is in the units position, so that means 1 Answer: 1111 = 8+4+2+1 = 15 in Decimal Example 2: What is 10012Ãâà in Decimal? The 1 on the left is in the 2ÃÆ'-2ÃÆ'-2 position, so that means 1ÃÆ'-2ÃÆ'-2ÃÆ'-2 (=8) The 0 is in the 2ÃÆ'-2 position, so that means 0ÃÆ'-2ÃÆ'-2 (=0) The next 0 is in the 2 position, so that means 0ÃÆ'-2 (=0) The last 1 is in the units position, so that means 1 Answer: 1001 = 8+0+0+1 = 9 in Decimal Example 3: What is 1.12Ãâà in Decimal? The 1 on the left side is in the units position, so that means 1. The 1 on the right side is in the halves position, so that means 1ÃÆ'-(1/2) So, 1.1 is 1 and 1 half = 1.5 in Decimal Example 4: What is 10.112Ãâà in Decimal? The 1 is in the 2 position, so that means 1ÃÆ'-2 (=2) The 0 is in the units position, so that means 0 The 1 on the right of the point is in the halves position, so that means 1ÃÆ'-(1/2) The last 1 on the right side is in the quarters position, so that means 1ÃÆ'-(1/4) So, 10.11 is 2+0+1/2+1/4 = 2.75 in Decimal
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.