Number System

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

The number system is a way to represent or express numbers.

You have heard of various types of


number systems such as the whole numbers and the real numbers. But in the context of computers, we
define other types of number systems. They are:
The decimal number system
The binary number system
The octal number system and
The hexadecimal number system
Decimal Number System (Base 10)
In this number system, the digits 0 to 9 represents numbers. As it uses 10 digits to represent a number,
it is also called the base 10 number system. Each digit has a value based on its position called place
value. The value of the position increases by 10 times as we move from right to left in the number.
For example, the value of 786 is
= 7 x 102 + 8 x 101 + 6 x 100
= 700 + 80 + 6
Binary Number System (Base 2)
A computer can understand only the “on” and “off” state of a switch. These two states are represented
by 1 and 0. The combination of 1 and 0 form binary numbers. These numbers represent various data. As
two digits are used to represent numbers, it is called a binary or base 2 number system.
The binary number system uses positional notation. But in this case, each digit is multiplied by the
appropriate power of two based on its position.
For example, (101101)2 in decimal is
= 1 x 25 + 0 x 24 + 1 x 23 + 1 x 22 + 0 x 21 + 1 x 20
= 1 x 32 + 0 x 16 + 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1
= 32 + 8 + 4 + 1
= (45)10
Bit
The term ‘bit’ is a contraction of the words ‘binary’ and ‘digit’. It is the smallest unit of memory or
instruction that can be given or stored on a computer. A bit is either a 0 or a 1. The number in the above
example is a 6-bit number as it has 6 binary digits (0s and 1s).
Byte
A group of 8 bits like 01100001 is a byte. Combination of bytes comes with various names like the
kilobyte. One kilobyte is a collection of 1000 bytes. A word or letter like ‘A’ or ‘G’ is worth 8 bits or one
byte. One thousand bytes make up a kilobyte (one thousand letters approximately). 1024 kilobytes form
a Megabyte (Mb) and so on.
Octal Number System (Base 8)
This system uses digits 0 to 7 (i.e. 8 digits) to represent a number and the numbers are as a base of 8.
For example, (24)8 in decimal is
= 2×81+4×80
= (20)10
Hexadecimal Number System (Base 16)
In this system, 16 digits used to represent a given number. Thus, it is also known as the base 16 number
system. Each digit position represents a power of 16. As the base is greater than 10, the number system
is supplemented by letters. Following are the hexadecimal symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E,
F
To take A, B, C, D, E, and F as part of the number system is conventional and has no logical or deductive
reason.

Binary Addition
Binary addition is done by adding the digits starting from the right side of the
numbers, in the same way as we add two or more base 10 numbers. In binary
addition, the place values are given as ones, twos, fours, eights, sixteens, etc.
We first add the digits in one's column, then we move towards the left, i.e.,
add the digits in the twos column, then the digits in the fours column, and so
on. The only difference is that here we do regrouping when the sum of the
digits becomes greater than 1. Let's learn more about binary addition in this
article.

What is Binary Addition?


Adding two or more binary numbers is one of the arithmetic operations on
binary numbers or base-2 number systems. In decimal addition, when we add 3
+ 2, we get 5. Similarly, when we add their binary equivalents, i.e (11)2 and
(10)2, we get, (11)2 + (10)2 = (101)2, which is 5 in base-10. The results of both
binary and decimal addition give us the same answer, the only difference is in
the place values of the digits. The process of binary addition will look very
familiar to you, the only difference is that in the decimal number system we
regroup the next place value whenever we get the sum of the digits greater
than 9 because in the decimal system we use 10 digits from 0 to 9. But while
adding binary numbers, we regroup the next place value when the sum of the
digits becomes greater than 1 as, in the binary number system, only two digits
can be used, and those are 0 and 1.
Binary Addition Rules
The four rules that apply when two binary digits are added are given below:
Now, let us use these binary addition rules to learn the process of adding
binary numbers.

How to Add Binary Numbers?


Binary numbers are used in computers to store and represent data using
digits 0 and 1. There are two cases that come up while learning about binary
addition, and those are given below:

 Binary addition without regrouping


 Adding binary numbers with regrouping

Binary Addition without Regrouping


When the addition of two digits results in 0 or 1, then we don't need to regroup
while adding two or more binary numbers. For example, let us add (101)2 and
(10)2, which are the binary equivalents of 5 and 2 respectively.

Step 1: Write all the digits of both the numbers in separate columns as per
their place values.

101
+10
-----------
-----------
Step 2: Start from the right-most column digits, 1 and 0. Apply one of the rules
of binary addition which says 1 + 0 = 1.

101
+10
-----------
1
------------

Step 3: Move to the next column to the left. Here, we have two digits 0 and 1.
Look at the rules given above and find out which rule will be applied here.
Apply one of the binary addition rules which says 0 + 1 = 1.

101
+10
-----------
11
------------

Step 4: Now, in the last column, we have only 1 left, so we can apply the rule,
1 + 0 = 1.

101
+10
----------
111
----------

Therefore, by adding (101)2 with (10)2, we get (111)2 as the final answer.
Adding Binary Numbers with Regrouping
When the addition of two digits results in a number greater than 1, then we
need to regroup while adding two or more binary numbers. For example, let
us add (1001)2 and (111)2, which are the binary equivalents of 9 and 7
respectively.
 Step 1: Arrange the numbers as shown below.
 Step 2: Follow the binary addition rules to add the numbers. First let us add the
digits in the one's place, which are 1 + 1 = 0 (1 carryover). Here, 1 + 1 is 10,
which is the binary equivalent of (2) 10, so we are regrouping the twos column by
taking 1 as a carryover.
 Step 3: Now, we move to the next place value towards left, which is twos place.
Here, we have 0 + 1 + 1 (carryover) = 10. So, again we will write 0 and take 1
as a carryover to the next place value. In the next column, we have 0 + 1 + 1 =
10. Similarly, we again take 1 as a carryover to the next column. In the last
column to the left, we have 1 + 1 (carryover) = 10.

Therefore, (1001)2 + (111)2 = (10000)2.


Binary Addition Using 1's Complement
The 1's complement of a number can be found by interchanging every 0 to 1
and every 1 to 0 in a binary number. For example, the 1's complement of the
binary number 110 is 001. Till now, we have studied adding all positive binary
numbers but by using 1's complement, we can even add two negative binary
numbers and one negative with a positive number. First, let us learn how
to add a positive number to a negative number.

When the positive number is greater, we find the 1's complement of the
negative number. Add the positive number and the 1's complement of the
negative number. Then, we again add the end-around carry of the sum to the
result to get the final answer. For example, let us add 1010 to (-1001). First,
let us find 1's complement of the negative binary number, (-1001) by replacing
0 with 1 and 1 with 0. So, the 1's complement is 0110. Now we will add 0110
to the positive number which is 1010.

1010
+0110
-------------
10000
-------------
Here, the end-around carry is 1, so we add it again to the rest of the number,
which is 0000. Now, 0000+1 = 0001. So, 0001 is the answer when we add a
positive number 1010 to a negative number (-1001).

When the negative number is greater than the positive number, then we
first take the 1's complement of the negative number, then we add it to the
positive number. Now, in this case, there will be no end-around carry. So, the
final answer is obtained by taking the 1's complement of the resultant value.
For example, to add 0111 and (-1000), we first find the 1's complement of -
1000, which is 0111. Now, we add the 1's complement to the given positive
binary number 0111.

0111
+0111
-------------
1110
-------------

Now, find the 1's complement of 1110, which is 0001. Therefore, 0001 is the
final answer after adding 0111 with -1000.

In the case of adding two negative binary numbers, first, we represent both
the numbers in the 5-bit register by attaching the required number of zeros to
the left. Then we find 1's complement of both the numbers and add the
values. The end-around carry will be again added to the rest of the number.
Note that in this case, we will always get a carryover digit. After adding, the 1's
complement is to be found for the resultant number. That value with a
negative sign will be the final answer.

For example, let us add two negative binary numbers -1010 and -0101. By
representing both these numbers in the 5-bit register, we get 01010 and
00101. Now, we have to find 1's complement of both by replacing 1 with 0 and
0 with 1. We get 10101 and 11010 respectively. We get 101111 after adding
both numbers. Here, 1 on the extreme left is the end-around carry and it will
again be added to the rest of the number to its right (01111). Now, we have to
find 1's complement of 10000, which is 01111. Hence, -01111 is the final
answer.

Binary Subtraction
Binary subtraction is the process of subtracting binary numbers. Binary
numbers include only 0 and 1. The process of binary subtraction is the same
as the arithmetic operation of subtraction that we do with numbers. Since only
0 and 1 are involved here, we may sometimes need to subtract 0 from 1. In
such cases, we use the concept of borrowing as we do in an arithmetic
subtraction. A binary number is expressed with a base-2. For example, a
binary number is written as \(101_{2}\)

Rules of Binary Subtraction


There are some rules in which binary numbers are subtracted. They are,

How To Do Binary Subtraction?


Decimal or base-10 numbers can be expressed as binary numbers. Binary
numbers are used in computers to represent data since they understand only
binary digits, 0 and 1. Let us understand how to subtract binary numbers with
the example shown below.

Case i) - Binary subtraction without borrowing

Subtract \(100_{2}\) from \(1111_{2}\) .Here number 4 is represented in binary


as \(100_{2}\) and number 15 is represented as \(1111_{2}\).

Step 1: Arrange the numbers as shown in the figure below.


Step 2: Follow the binary subtraction rules to subtract the numbers. In this
subtraction, we do not encounter the subtraction of 1 from 0. Hence, the
difference is \(1011_{2}\).

Step 3: The decimal equivalent of \(1011_{2}\) is 11. Hence the difference is


correct.

Case ii) Binary subtraction with borrowing

Subtract \(101_{2}\) from \(1001_{2}\). Here number 5 is represented in binary


as \(101_{2}\) and number 9 is represented as \(1001_{2}\).
Step 1: Arrange the numbers as shown below.

Step 2: Follow the binary subtraction rules to subtract the numbers. In this
subtraction, first, let us subtract the numbers starting from the right and move
to the next higher order digit. The first step is to subtract (1-1). This is equal to
0. Similarly, we move on to the next higher order digit and subtract (0 - 0),
which is 0. In the next step, we have to subtract (0 - 1), so we borrow a 1 from
the next higher order digit. Therefore, the result of subtracting (0 - 1) is 1.

Step 3: Therefore the dfference of \(1001_{2}\) and \(101_{2}\) is \(100_{2}\).


To verify this, let us find the decimal equivalent of \(100_{2}\), which is 4,
Therefore, 9 - 5 = 4.

Binary Subtraction Using 1's Complement


The 1's complement of a number is obtained by interchanging every 0 to 1
and every 1 to 0 in a binary number. For example, the 1's complement of the
binary number \(110_{2}\) is \(001_{2}\). To perform binary subtraction using
1's complement, please follow the steps mentioned below.
 Step 1: Find the 1's complement of the subtrahend, which means the
second number of subtraction.
 Step 2: Add it with the minuend or the first number.
 Step 3: If there is a carryover left then add it with the result obtained from
step 2.
 Step 4: If there are no carryovers, then the result obtained in step 2 is the
difference of the two numbers using 1's complement binary subtraction.

Let us understand this with an example.Subtract \(110010_{2}\) - \


(100101_{2}\) using 1's complement. Here the binary equivalent of 50 is \
(110101_{2}\) and the binary equivalent of 37 is \(100101_{2}\).

Step 1: Find out the 1's complement of the subtrahend (37), which is \
(011010_{2}\).

Step 2: Add it with the minuend(50), which is \(110010_{2}\).

Step 3: Arrange the numbers as follows and add them.

Step 4: The left-most digit 1 is a carryover of this addition. Since there is a


carryover we add it with the result, which is \(001100_{2}\).

Therefore, the result is \(1101_{2}\). Also, the difference of 50 - 37 is 13. The


binary equivalent of 13 is \(1101_{2}\).

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy