Friday 20 April 2012

Binary Number

In numeral system, Binary Number System is simplest. The base or the radix of the binary system is 2. So, there are two digits: 0 and 1. Gottfried Wilhelm Leibniz, the co-inventor of Calculus, first talked about binary number in the paper 'Essay d'une nouvelle science des nombres' in 1701.


As there are two symbols: 0 and 1, so , all the numbers are represented with this two symbols. Below table shows how decimal numbers are represented in binary system -

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

Suppose a binary number 1010 that is equivalent to 10 in decimal. The rightmost bit is called  Least Significant Bit (LSB) and the leftmost bit is called Most Significant Bit (MSB). Then 1 is MSB and 0 is LSB.

Fractions can also be represented in binary system. Suppose decimal 22.75 can be written in binary as (10110.11). Arithmetic in binary is much like arithmetic in other numeral systems. Addition, subtraction, multiplication, and division can be performed on binary numerals. There is a method of converting binary number in other number system.

The binary system is used internally by almost all modern computers and computer-based devices. Each digit is referred to as a bit. Computer memory comprises small elements that may only be in two states - off/on - that are associated with digits 0 and 1. Such an element is said to represent one bit - binary digit

Binary arithmetic

Addition:
Addition is done exactly like adding decimal numbers. Below is just rule in binary addition like decimal system. When 1 is added with 1, the result will be 0 and there will be an extra bit 1 that is called Carry. This carry will have to be added in the next column.

0+0 = 0
1+0 = 1
0+1 = 1
1+1 = 0, and you carry a 1. 
The two binary numbers (110)2=decimal 6 and (111)2=decimal 7 can be add in the following manner. The answer will be (1101)2 =decimal 13.
  110
+111
------------
 1101 

The above addition is for two positive numbers. But if it is the combination of positive and negative numbers then we have take other method. For example, when you handwrite a number that represent some physical quantity such as temperature, you can simply put a +  or - sign in front of the number to indicate that the number as positive or negative. Storing this value in computer is problematic.  To resolve this problem, it was decided that the most significant bit (MSB) will be reserved as sign data or bit.

To make computation easier with signed numbers, the magnitude of negative number is represented in a special form called 2's complement. It is formed by inverting each bit or digit and adding 1 to the result. Suppose in a 8 bit representation, the decimal number +5 can be written as 00000101 and decimal number -5 can be written as 10000101. Here we, at first, inverted 00000101(+5) and found 11111010. Then we add 1 with 11111010 and found 11111011(-5).  So addition of signed binary numbers can be done in following way -
0 0 0 0 1 1 0 1   (+13)
1 1 1 1 0 1 1 1   (-9) ( in 2's complement form )
----------------
0 0 0 0 0 1 0 0   (+4)

Subtraction:
Subtraction is same as decimal subtraction. When we subtract 1 from 0, the result will be 1 and we will hire 1 from next column. This hiring is called borrowing. Then the value of the next column becomes 0.
0 − 0 = 0
0 − 1 = 1, borrow 1
1 − 0 = 1
1 − 1 = 0
Here we subtract binary (1011)2=decimal 11 from binary (10101)2=decimal 21 and the result will be (1010)2=decimal 10. In that subtraction method, larger number should be top and smaller number should be in bottom.  
 1 0 1 0 1
-  1 0 1 1
 ----------
    1 0 1 0

Multiplication:
Multiplication in binary follows same rule that we use in decimal.
0 x 0 = 0
1 x 0 = 0
0 x 1 = 0
1 x 1 = 1, no carry and no borrow
Here, we will multiply binary (110)2=decimal 5 and (11)2=decimal 3. The result will be (10010)2=decimal 18.
          1 1 0
          x  1 1
     -------------
         1 1  0
      1 1 0
-- -------------
  1  0  0 1  0


No comments:

Post a Comment

What Is The Difference Beween Numerals and Number?

Number is a concept, it is a mathematical concept. To express the quantitative value of the object, this  is developed in ancient history. S...