Number
System
Numbering systems are, in fact, puremathematics.
And because computers are computing devices, learning mathematics makes you more efficient to understand
and use computers.
Number systems are an organized and
systematic way of representing numbers. Each numbering system has its
own set of symbols and a set of rules to determine how a quantity is
represented and how operations can be performed. For example RomanNumber System has
symbols like I, II, III, IV, V, …. and Hindu Arabic System (Decimal) has
symbols like १, २, ३, ४, ५…. or 1, 2,
3, 4, 5….
A numbering system is positional if the position of a number matters
the value it represents. For example in 002000 and 000020 the value ‘2’
represents is different because it is on different positions in those two
numbers. In first number the 2 represents 2 * 10 ^ 3 (2 into 10 to the power 3)
= 2000 whereas in second number 2 represents 2 * 10 ^ 1 (2 into 10 to the power
1) = 20.
A numbering system is non-positional if each symbol represents same value
regardless of its position. Roman numbering system is an example of non
positional numbering system.
Among these numbering systems, we are more
concerned with positional numbering systems.
There are different number systems in positional systems based on how
many symbols it has. Such as:
Binary – 2 different symbols – 0 & 1
Quinary – 5
differnt symbols – 0, 1, 2, 3 and 4
Octal – 8
different symbols – 0, 1, 2, 3, 4, 5, 6 and 7
Decimal – 10
different symbols – 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9
Hexadecimal – 16
different symbols – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F
The value a number in any system represents is the product of the sum of its
digits and its positional value. for example:
1101 in binary represents
1 * 2 ^ 3 + 1 * 2 ^ 2 + 0 * 2 ^ 1 + 1 * 2 ^ 0 = 8 + 4 + 0 + 1 = 13
2031 in quinary represents
2 * 5 ^ 3 + 0 * 5 ^ 2 + 3 * 5 ^ 1 + 1 * 5 ^ 0 = 250 + 0 + 15 + 1 = 266
1360 in octal represents
1 * 8 ^ 3 + 3 * 8 ^ 2 + 6 * 8 ^ 1 + 0 * 8 ^ 0 = 512 + 192 + 48 + 0 = 752
8316 in decimal represents
8 * 10 ^ 3 + 3 * 10 ^ 2 + 1 * 10 ^ 1 + 6 * 10 ^ 0 = 8000 + 300 + 10 + 6 = 8316
3A2F in hexadecimal represents
3 * 16 ^ 3 + A * 16 ^ 2 + 2 * 16 ^ 1 + F * 16 ^ 0 = 12288 + 2560 + 32 + 15 = 14895
In above example, the numbers in red color are
place value. * is used as multiplication sign and ^ as raised power.
For our computer operator and similar jobs
examination, we need to learn how to convert a number expressed in one system
into another (conversion) and perform binary addition, subtraction, multiplication
and division of binary numbers (operations). Among these, you already learned
one method!
Converting numbers from any system into
decimal numbering systems
No mater in which numbering system the given
number is, you can get
the decimal equivalent by
1) multiply each digit by its face value
2) add all the products.
In above examples, we have converted binary 1101
into decimal 13; quinary 2031 into decimal 267; octal 1360 into decimal 752 and
hex 3A2F into decimal 14895
Converting decimal numbers into any other
systems
To convert given decimal into any other required
system, you will perform the following action
1) Divide the number by the base of new system
succesively (integer division – no decimals)
2) Note down the remainders in reverse order
For example:
a) Convert 74 into binary.
Solution,
Successive division
74 / 2 = 37 remainder 0
37 / 2 = 18 remainder 1
18 / 2 = 9 remainder 0
9 / 2 = 4 remainder 1
4 / 2 = 2 remainder 0
2 / 2 = 1 remainder 0
1 / 1 = 0 remainder 1
Collect remainder in reverse order (bottom to top)
= binary 1001010
b) Convert 379 into octal
Solution:
Successive division
379 / 8 = 47 remainder 3
47 / 8 = 5 remainder 7
5 / 8 = 0 remainder 5
Collect remainder in reverse order
= octal 573
c) Convert 984 into Hexadecimal
Successive division
984 / 16 = 61 remainder 8
61 / 16 = 3 remainder 13 (i.e. D)
3 / 16 = 0 remainder 3
Collect remainder in reverse order
= octal 3D8
Quick method to convert decimal into
binary
You can find the binary equivalent of a decimal
number by
1) break the number into the sum of different
powers of 2
Numbers -> 1, 2, 4, 8, 16, 32, 64, 128, 256,
512, 1024, …. are the numbers that can be raised power of 2
Powers of 2 -> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
2) note down the presence and absense of
positions
Example:
Convert 1568 into binary
Break the number. The closest number to 1568 that can be raised power of 2 is
1024 (i.e. 2^10)
= 1024 + 544 [Again, the closesest number to 544
is 512 (i.e. 2^9)]
= 1024 + 512 + 32 [Again, the closest number to 31 is 16 (i.e. 2^4)]
= 1024 + 512 + 32
= 2 ^ 10 + 2^9 + 2^5
You don’t need to show all the procedure as
above. Just write the closest number and then write closest of the remainder
and so on. Finally when you get the sequence of numbers like below, the job is
almost done!
= 1024 + 512 + 32
Power of 2 of above numbers = 10 + 9 + 5
Now, write 1 for all the positions that are
present and 0 for the positions that are absent. In above example, position
10,9 and 5 are present other positions are absent. So the binary number will
be:
Therefore binary 11000100000 is equivalent to
1567.
If you practice for some time with your
mind-work, you’ll be able to convert into binary very quickly. All you need to
remember is the numbers that can be raised power of 2.
Binary number into Octal
Any number given in Binary can be very easily
converted into Octal numbering system
1. Create groups from right most with 3 bits
2. Convert each group into binary
Example:
10110100110 into octal
Solution: Grouping 10 110 100 110
Convert each group 2 6 4 6
Therefore, 2646 in octal.
Octal number into binary
Any given octal number can be converted into
binary by:
1. Convert each digit into binary.
2. Add leading zeros if there are not 3 bits for
every digit
Example:
Convert octal 6125 into binary
Solution: convert each digit 6 1 2 5
110 1 10 101
Make 3 bits for each digit 110 001 010 101
Therefore, 110001010101 is binary equivalent.
Hex number into Binary
Converting hexadecimal number into binary is similar to that
of octal to binary. Only the difference is the number of bits in each group. In
case of hexadecimal, there should
be 4 bits in each group.
Example:
Convert 3A2F into binary
Solution: Convert each digit
3 A (10) 2 F (15) [A is 10, B is 11, C is 12, D
is 13, E is 14 and F is 15]
11 1010 10 1111
Make 4 bits for each conversion by adding leading
zeros
0011 1010 0010 1111
Therefore, 11 1010 0010 1111 is the binary
equivalent.
Binary into Hexadecimal
This is also similar to the binary into octal.
Only remember that there should be 4 bits.
Example: 1011101001000110
Solution: Grouping 4 bits from right 1011 1010
0100 0110
Convert each group 11 (B) 10(A) 4 6
Therefore, BA46 is hex equivalent.
Another type of question included in PSC Exam is
binary operation – add, subtract, multiply and divide binary numbers.
Binary Addition
Binary addition is fairly simple and fun to
operate. Following is the rules related to binary addition:
1) 1 + 0 = 1 [pretty obvious, isn’t it?]
2) 0 + 1 = 1 [Addition is associative. a+b = b+a, so same result]
3) 0+0 = 0 [What’s new? this is what we are always doing!]
4) 1+1=10 [Here is what binary differs. In decimal system 1+1 = 2 and that 2 is
10 in binary. So it is fairly understandable.] While you perform addition, you
will write 0 on the sum and take 1 as balance to add up to the sum of preceding
digit.
Example
Add 1011010 and 10110
Solution
1 0 1 1 0 1 0
1 0 1 1 0
------------------
1 1 1 0 0 0 0
- Addition
is done from the last digit. Because both digits are zero, so write 0 on
the answer line.
- On next
digit (second last digit of both numbers), because both digits are 1, due
to the rule #4 the sum is 10. So write 0 on the answer line and take 1 as
balance.
- For the
third last digit, because given numbers are 0 and 1, their sum is 1 (rule
#2). This sum 1 and our previous balance 1 have to be added makes 10. So
write 0 on the answer line and take 1 as balance for next digit.
- Now on
fourth last digit we have 1 & 0. The sum is 1 and with the previous
balance, updated sum is 10. Write 0 on the answer line and take 1 as
balance for next digit.
- On fifth
last digit, we have 1 & 1 to add. Sum became 10. because we had
previous balance 1 the updated sum is 11 (10+1 = 11). Write 1 on the
answer line and take 1 as balance.
- Because
the second number does not have sixth last digit, 0 from the first number
and previous balance 1 makes up the sum of 1. Write that 1 in answer line.
Remember there is no balance on this step.
- For the
seventh last or the first digit of first number, we don’t have digit from
second number and also we don’t have previous balance. Therefore, copy
that digit 1 into the answer line.
Thus, finally, we have 1110000 as the sum of
given two numbers.
Binary Subtraction
Binary subtraction is as simple as that addition
was. In addition, you just need to remember to adjust the balance, in case of
binary subtraction, you’ll remember to adjust the carry over.
The rules for subtraction is:
1) 0-0=0 [obvious!]
2) 1-0=1 [nothing different]
3) 1-1=0 [this is what we are always doing]
4) 0-1=1 with carry over 1 [Here is what binary operations comes]
Example
Subtract 10011 from 10110101
Solution:
1 0 1 1 0 1 0 1
1 0 0 1 1
-------------------
1 0 1 0 0 0 1 0
- Subtraction
is done from last digit of the numbers. Because both the numbers has 1 on
its last digit, the difference is 0 (1-1=0). Write that 0 on answer line.
- On second
last digit, you need to subtract 0-1. Because the difference is 1 with
carry over 1, write difference 1 on answer line. Remember there is carry
over.
- On third
last digit, because carry over 1 is there, subtract it from the 1 of first
number. The adjusted difference is 0. From this 0 you need to subtract 0
of second number, because 0 – 0 = 0, write 0 on answer line. No carry
over.
- On fourth
last digit, both digits are 0, so write 0 on answer line. No carry over.
- On fifth
last digit, both digits are 1. So, write 0 on answer line. No carry over.
- Because
there are no digits left on second number copy other digits in answer
line.
Thus, we got 10100010 as the answer.
Binary Multiplication
Binary multiplication is very similar to the decimal
multiplication except when you are adding. The rules of binary multiplication
is as follows:
1) 1 x 1 = 1
2) 1 x 0 = 0
3) 0 x 1 = 0
4) 0 x 0 = 0
Everything perfectly same, isn’t it? Let’s see an
example.
Example:
Multiply 1011 by 110.
Solution:
1011
x 110
--------------
0 0 0 0
1 0 1 1
1 0 1 1
--------------
1 0 0 0 0 1 0
Binary division
Binary division is easier than decimal division
as there are only two possibilities, either it will won’t go or if it goes, it
goes for 1 time.
Example
Divide 110110 by 110
1001
____________
110 ) 110110
-110
----------
110
-110
----------
x
Therefore, 1001 is the quotient of division and nothing is remainder.