SLM - Unit 03
SLM - Unit 03
3.1 Introduction
A set of values used to represent different quantities is known as number
system. For example, a number system can be used to represent the
number of students in a class or number of viewers watching a certain TV
program and so on. The digital computer represents all kinds of information
in binary numbers. This information can be in the form of text, audio, video
and many more. Number systems are used to describe quantity or to
represent certain information.
In computer operation with binary values, Boolean logic can be used to
describe zeros and ones. A Boolean algebra is an algebra of logic. The
Example: 2
Position of each digit is very important.
From example1, if you place "7" to the end: 547 it will be another value:
5×102+4×101+7×100= 500+40+7=547
Important note:
Any number in power of zero is 1;
100=1
X0=1
For example
1 carry bit
010
+ 010
100
The addition of the two 1’s in the second position to the left, with a carry-
over. Since 1 + 1 = 0 plus a carry-over of 1, the sum of 010 and 010 is 100.
Here are some examples of binary addition.
DECIMAL BINARY DECIMAL BINARY
6 110 15 1111
+ 7 + 111 + 20 +10100
13 1101 35 100011
Binary Subtraction
It is necessary to establish a procedure for subtracting a larger digit from a
smaller digit. The only case in which this occurs with binary numbers is
when 1 is subtracted from 0. The remainder is 1, but it is necessary to
borrow 1 from the next column to the left.
The rules of binary subtraction are:
0–0=0
1–0=1
1–1=0
0 – 1 = 1 with a borrow of 1
Following examples will make the procedure for binary subtraction clear:
DECIMAL BINARY DECIMAL BINARY
9 1001 16 10000
–5 – 101 –3 – 11
4 100 13 1101
3.2.3 Octal Number System
The octal number system has a base or radix 8. This means eight different
symbols are used to represent numbers. These symbols are 0, 1, 2, 3, 4, 5,
6 and 7.
Example 4: Consider the octal number 72601.12. It can be represented as
7×84 + 2 × 83 + 6×82 + 0×81 + 1 ×80 + 1 ×8-1 + 2× 8-2
2 12 1 0.125 * 2 = 0 0.6250 0
2 6 0 0.6250 * 2 = 1 0.2500 1
2 3 0 0.2500 * 2 = 0 0.5000 0
2 1 1 0.5000 * 2 = 1 0.0000 1
2 0 1
Thus, 25(10)= 11001 Thus 0.3215 (10) = 0101
Remainder
2 45
2 22 1 LSB
2 11 0
2 5 1 45(10) = 1 0 1 1 0 1 (2)
2 2 1 MSB LSB
2 1 0
0 1 MSB
Remainder
8 792
8 99 0 LSB
8 12 3
8 1 4 792 (10) = 1430 (8)
0 1 MSB
Remainder
8 1545
8 193 1 LSB
8 24 1
8 3 0 1545(10) = 3011 (8)
0 3 MSB
The process will further continue. The result has been taken up to 6 places
of hexadecimal point.
Therefore, (0.62)10 = (0.9EB851)16
Decimal Number to Hexadecimal Conversion – Integer Part
In this conversion, hexadecimal number system has base – 16. So the given
decimal number is repeatedly divided by 16 until the quotient is 0. While
division is carried out, the remainders generated at each division, are written
down separately. The first remainder is noted down as Least Significant
Digit (LSD) in the hexadecimal number and the last remainder as Most
Significant Digit (MSD).
Remainder
16 215
16 13 7 LSB
16 0 13 =D MSB 21510 = D716
0
Binary number 1 0 1 1 1
Weight of each bit 22 21 20 2-1 2-2
Weighted value 4×1 2×0 1×1 ½ ×1 ¼ ×1
Solved 4 0 1 0.5 0.25
multiplication
Binary number 0 1 1 1
Weight of each bit 20 2-1 2-2 2-3
Weighted value 1×0 0.5×1 1/4 ×1 1/8 ×1
Solved 0 0.5 0.25 0.125
multiplication
Octal number 2 3 4 3 2
Weight of each 82 81 80 8-1 8-2
bit
Weighted value 64 × 2 8× 3 1×4 1/8 × 3 1/64 × 2
Solved 128 24 4 0.375 0.03125
multiplication
Octal number 1 4 2 7
Weight of each bit 80 8-1 8-2 8-3
Step 1 65 (8) 6 x 81 + 5 x 80
Step 2 65 (8) 48 + 5
There are totally 8 combinations with 3-bit binary representation from 000 to
111, which can be mapped octal symbols 0 to 7.
To convert a given octal number to binary, simply replace the octal digit by
its equivalent 3-bit binary. Table 3.1 shows an octal number and an
equivalent 3-bit Binary representation
Table 3.1: Octal number and its equivalent 3-bit Binary representation
= 5 7 . 1 (8)
= 2 F . 2 (16)
Note: In the case of fractions Additional 0’s, if required, can be added to the
left of leftmost bit of integer part and to the right of rightmost bit in the
fractional part, while grouping.
Example 31: Find the octal equivalent of A45 (16)
Hexadecimal A 4 5
Number
Binary coded value 1010 0100 0101
Binary number: 0 1 0 1 0
1’s complement: 1 0 1 0 1
Since there is no carry in the sum, the result is a negative number and is in
one’s complement form. So to get answer in true form, take the one’s
complement of the sum and place a negative sign in front.
The one’s complement of the result (100000) is 011111. Now attach
negative sign.
Therefore, 1001 – 101000 = – 011111
Self-Assessment Questions
12. One’s complement of 0001 is ________.
13. One’s complement of 7 for 3-bit number is _________.
14. One’s complement of -4 for 4-bit number is __________.
15. Subtract 1010 from 1111 using one’s complement __________.
Example 33:
11001 11001
– 10100 = + 01100 (2’s complement of 10100)
00101 1 00101
Carry is dropped
Example 34: Perform subtraction on the given binary numbers using the 2’s
complement 1001 – 101000
The 2’s complement of the subtrahend 101000 = 011000
0 0 1 0 0 1: Minuend
+ 0 1 1 0 0 0: 2’s complement of subtrahend.
100001
Demorgan’s Theorem
DeMorgan, a mathematician, contributed two theorems, which are
extremely useful while simplifying logical expression using Boolean algebra.
Theorem 1: The complement of a product is equal to the sum of the
complements
Truth Table:
a b c a bc a b c
0 0 0 1 1
0 0 1 1 1
0 1 0 1 1
0 1 1 1 1
1 0 0 1 1
1 0 1 1 1
1 1 0 1 1
1 1 1 0 0
Truth Table:
a b c abc abc
0 0 0 1 1
0 0 1 0 0
0 1 0 0 0
0 1 1 0 0
1 0 0 0 0
1 0 1 0 0
1 1 0 0 0
1 1 1 0 0
Commutative Law
Commutative law of addition: A + B = B + A
The commutative law for addition states that, it makes no difference in the
output in whatever order the variables are ORed. In this law the truth tables
are identical. Table 3.5 shows a truth table for commutative law for “OR”
operation.
Table 3.5: Truth table for commutative law for “OR” operation
The commutative law for “OR” can be extended to any number of variables.
For example,
As, A + B = B + A, we can say that for three variable, A + B + C = B + A + C.
Table 3.6: Truth table for commutative law for “AND” operation
The commutative law for “AND” can be extended to any number of variables.
For example, for three variables, ABC = BAC.
Associative Law
Associative law of addition: A + (B + C) = (A + B) + C.
The associative law for addition, states that it makes no difference in
whatever order the variables are grouped, the result is same for several
variables. Table 3.7 shows a truth table for associative law for “OR”
operation.
Table 3.7: Truth table for associative law for “OR “operation
Table 3.8: Truth table for associative law for “AND” operation
Distributive law
Distributive law: A (B+C) = AB + AC
The Distributive law states that ORing several variables and ANDing the
result with a single variable is equivalent to ANDing several variables and
then ORing the products. Table 3.9 shows a truth table for distributive law.
.
Table 3.9: Truth table for distributive law
Self-Assessment Questions
21. If X=0, X+ X =_______.
22. X =_______.
23. If x, y, z contains values 0, 1, 1 then (x+z) y is _______.
24. A (B + C) = AB +AC is __________ law.
Note: Similarly OR operation can be defined for three or more inputs. For
example a three input OR operation can be given by x = a + b + c where a,
b, c are three input terminals and x is the output terminal.
3.8.3 NOT Gate
A NOT gate changes true to false and vice versa. A logical inversion or
negation is represented by NOT function.
Inversion logic or NOT function is represented by ‘bar’ over the variable. If a
is the input line or terminal and X is the output line, then X a . Figure 3.3
shows a symbol of NOT gate and Table 3.12 shows a truth table of NOT
gate.
Table 3.12: Truth Table of NOT gate
Input Output
a X
a X a 0 1
1 0
Figure 3.3: Symbol of NOT Gate
Self-Assessment Questions
25. A ______________ is an electronic circuit which operates on one or
more input signal to produce an output signal.
26. Boolean product of 1 and 0 in AND has ____ value.
27. Boolean sum of 1 and 0 in OR has _____ value.
28. Mention different types of basic gates.
29. A logical inversion or negation is represented by _________ gate.
3.9 Summary
A decimal number system has a base 10 and consists of ten digits
(0 to 9).
A binary number system has a base 2 and consists of two digits (called
bits) 1 and 0.
The octal number system has a base of 8 and consists of eight digits
(0 to 7)
The hexadecimal number system has a base of sixteen and consists of
16 digits ( 0 through 9 and A to F)
The 1’s complement of a binary number is derived by changing 1s to 0s
and 0s to 1s
The 2’s complement of a binary number is derived by adding 1 to the 1’s
complement
Binary subtraction can be accomplished by addition using the 1’s or 2’s
complement methods
Octal to binary conversion is accomplished by simply replacing each
octal digit with its three-bit binary equivalent.
To represent characters in computers there are different coding
schemes like BCD Code and ASCII Code.
Different rules are defined in the Boolean algebra for AND, OR and NOT
operator.
Three basic laws of Boolean algebra are the commutative, associative
and distributive laws.
A gate is an electronic circuit which operates on one or more input
signals to produce an output signal. There are three basic gates- OR,
AND, NOT etc.
In AND gate, output is true only when both the inputs are true.
In OR gate, output is true when any one of the inputs or all the inputs
are true.
In NOT gate, output is negation (If the input is True then the output will
be False OR if the input is False then the output will be True).
3.11 Answers
Self-Assessment Questions
1. 10
2. 0 and 1
3. False
4. 16
5. 1448
6. 1000010012
7. BA3.216
8. 284910
9. 10111010110010012
Sikkim Manipal University B2071 Page No.: 77
Fundamentals of Information Technology Unit 3
10. 9DE 16
11. 11618
12. 1110
13. 000
14. 1011
15. 01012
16. 010112
17. 01012
18. Four
19. American Standard Code for Information Interchange
20. 256
21. 1
22. X
23. 1
24. Distributive
25. Gate
26. 0
27. 1
28. AND,OR,NOT
29. NOT
Terminal Questions
1. a) 173 (Refer to section 3.3)
b) 54 (Refer to section 3.3)
2. a)187 (Refer to section 3.3)
b) 529 (Refer to section 3.3)
3. a) 325 (Refer to section 3.3)
b) 41665 (Refer to section 3.3)
4. a)1111010 (Refer to section 3.3)
b) 1100010 (Refer to section 3.3)
5. a) 479 (Refer to section 3.3)
b) 975 (Refer to section 3.3)
6. a) 8 (Refer to section 3.3)
b) 16 (Refer to section 3.3)
c) 8 (Refer to section 3.3)
7. BCD Code (Binary Coded Decimal): It is a four bit code that represents
one of the ten decimal digits from 0-9. (Refer to section 3.6)
ASCII Code: ASCII (American Standard Code for Information
Interchange) is a 7 bit character encoding scheme. (Refer to section 3.6)
8. Rules in Boolean algebra
The symbol that represents an arbitrary element of a boolean algebra is
known as variable. A variable and function can have a value either 0 or
1. (Refer to section 3.7)
Laws of Boolean algebra
In Boolean algebra there are basically three laws
o Commutative law
o Associative law
o Distributive law (Refer to section 3.7)