Unit-2-Number-System-and-Conversion-Boolean-Logic-1
Unit-2-Number-System-and-Conversion-Boolean-Logic-1
com
Computer Science
Grade: XI
Reference Note
The number system plays a vital role in computer calculations. Number system is an organized and
systematic way of representing numbers. Number systems are basically of two types: non-positional and
positional number systems.
The non-positional number system is a number system in which each symbol represents the same value,
regardless of its position in the number. The symbols are simply added to find out the value of a particular
number. The most common non-positional number system is the Roman Number System. It is a system
of representing numbers devised by the ancient Romans. It is based on certain letters which are given
values as numerals.
Positional number system can be represented by a few symbols called digits, which represent different
values depending on the position that they occupy. The value of each digit in such a number is determined
by the digits itself, the position of the digit in the number, and by the base of the number system. The
main positional number systems used in computer are decimal, binary, octal and hexadecimal.
a. Decimal number system: A number system having base or radix 10 is called decimal number
system.
Examples: (789)10 or (789)D
b. Binary number system: A number system having base or radix 2 is called binary number system.
Examples: (110)2
c. Octal number system: A number system having base or radix 6 is called octal number system.
Examples: (1234)8
d. Hexadecimal number system: A number system having base or radix 16 is called hexadecimal
number system. Examples: (C01F)16 or (C01F)H
Number Conversion:
Rules
1. Decimal Number System to Others (Binary, Octal, Hexa-Decimal) Number System = Divide (2,8,16)
2. Others (Binary, Octal, Hexa-Decimal) Number System to Decimal Number System= Multiply (2,8,16)
3. Binary Number system to Octal Number system and Vice versa = 3 bit binary Grouping Method (421)
4. Binary Number System to Hexa-Decimal Number System and Vice versa= 4 bit binary Grouping Method ( 8421)
5. Octal Number System to Hexa-decimal Number System and Vice versa= 3 bit & 4 bit groping Method (421 & 8421)
Binary (2)
b. Decimal to Octal
Here, (804)10
8 804 4
8 100 4
8 12 4
8 1 1
0
d. Binary to Decimal
Here, (100100)2 = 25 x 1 + 24 x 0 + 23 x 0 + 22 x 1 + 21 x 0 + 20 x 0
= 32 + 0 + 0 + 4 + 0 + 0
= (36)10
e. Octal to Decimal
Here, (2040)8 = 83 x 2 + 82 x 0 + 81 x 4 + 80 x 0
= 1024 + 32
= (1056)10
f. Hexa-decimal to Decimal
Here, (1E0D)16 = 163 x 1 + 162 x E + 161 x 0 + 160 x D
= 4096 + 256 x 14 + 0 + 1 x 13
= 4096 + 3584 + 13
= (7693)10
g. Binary to Octal
Here, (110111101)2
110 111 101 (: 3 bit binary grouping method
6 7 5
h. Binary to Hexa-decimal
Here, (1001110111)2
0010 0111 0111
2 7 7
i. Octal to Binary
Here, (375)8
3 7 5
011 111 101
j. Hexa-decimal to Binary
Here, (ABC)16
A B C
1010 1011 1100
k. Octal to Hexa-decimal
Here, (555)8
5 5 5
101 101 101
= (101101101)2
0001 0110 1101
1 6 D
l. Hexa-decimal to Octal
Here, (BCA)16
B C A
1011 1100 1010
= (101111001010)16
101 111 001 010
5 7 1 2
c. Decimal to Hexa-decimal
Here, (689.336)10
16 689 1
16 43 11 = B
16 2 2
0
Also
0.336 x 16 = 5.376 5
0.376 x 16 = 6.016 6
0.016 x 16 = 0.256 0
0.256 x 16 = 4.096 4
0.096 x 16 = 1.536 1
0.536 x 16 = 8.576 8
Therefore, (689.336)10 = (2B1.560418)16
d. Binary to Decimal
Here, (101.1101)2 = 22 x 1 + 21 x 0 + 20 x 1 + 2-1 x 1 + 2-2 x 1 + 2-3 x 0 + 2-4 x 1
= 4 + 0 + 1 + 0.5 + 0.25 + 0 + 0.0625
= (5.8125)10
e. Octal to Decimal
Here, (0.1042)8 = 8-1 x 1 + 8-2 x 0 + 8-3 x 4 + 8-4 x 2
= 0.125 + 0 + 0.0078125 + 0.00048828125
= (0.1333)10
f. Hexa-decimal to Decimal
Here, (FA.AEF)16 = 161 x 15 + 160 x 10 + 16-1 x 10 + 16-2 x 14 + 16-3 x 15
= 240 + 10 + 0.625 + 0.0546875 + 0.00366211
= 250.68335
g. Binary to Octal
Here, (101010.110111)2
101 010 110 111
5 2 6 7
Therefore, (101010.110111)2 = (52.67)8
h. Binary to Hexa-decimal
Here, (10101.11011)2
0001 0101 1101 1000
1 5 D 8
Therefore, (10101.11011)2 = (15.D8)16
i. Octal to Binary
Here, (77.226)8
7 7 2 2 6
111 111 010 010 110
Therefore, (77.226)8 = (111111.010010110)2
j. Octal to Hexa-decimal
Here, (0.376)8
3 7 6
011 111 110
= (011111110)2
0111 1111
7 F
k. Hexa-decimal to Binary
Here, (0.5AB)16
5 A B
0101 1010 1011
Therefore, (0.5AB)16 = (0.010110101011)2
l. Hexa-decimal to Octal
Here, (0.226)16
2 2 6
0010 0010 0110
= (0.001000100110)2
001 000 100 110
1 0 4 6
Therefore, (0.226)16 = (0.1046)8
Binary Arithmetic
a. Binary Addition
Here, 11111 + 10001 Rule for addition
11111 0+0=0
+ 10001 0+1=1
110000 1+0=1
1+1=10 (0 with carry over 1)
1+1+1=11 (1 with carry over 1)
1+1+1+1=100 (0 with carry over 10)
Here, 1111 + 1111 1+1+1+1+1=101 (0 with carry over 10)
1111
+ 1111
11110
b. Binary Subtraction
Here, 1100 - 11
1100
- 0011
1001
Rule for Subtraction
Here, 101010 - 1001 0-0=0
101010 1-0=1
- 001001 1-1=0
100001 0-1=1 (with borrowing 1 from left side
Then it becomes 10 i.e. 10-1=1)
c. Binary Multiplication
Here, 1010 x 1010
1010
x 1010 Rule for Multiplication
0x0=0
0000
1x0=0
1010x
0x1=0
0000xx 1x1=1
1010xxx
1100100
d. Binary Division
Here, 110100 / 110
110) 110100 (1000
Rule for Division
110
1÷1=1
________ 0÷1=0
100 1÷0= not defined
000 0÷0= not defined
_______
100
Therefore, Quotient = 1000 and Remainder = 100
2. Subtract 1111 from 1100 using 1's and 2's complement binary subtraction method.
Here, Main value =1100
Second value= 1111
Both are equal digit.
Using 1's complement method:
i. 1's complement of second value 1111 is 0000.
ii. Add both the bits:
1100
+ 0000
1100
Here, we did not get overflow bit so we again calculate 1's complement of 1100 i.e. 0011 and put
minus sign before it.
Thus, 1100 - 1111 = -11
Boolean algebra
Boolean algebra:
Boolean algebra is a study of mathematical operations performed on certain variables (called binary
variables) that can have only two values: true (represented by 1) or false (represented by 0).
A logic function is an expression algebraically with binary variables, logical operation symbols, parenthesis
and equal sign, is known as Boolean function. Example, F= A.B.C'+A.B
Truth Table:
Truth table is a table which represents all the possible values of logical variables/statements along with
all the possible results of the given combinations of values. For example, following logical statements can
have only one of the two values (TRUE (YES) or FALSE (NO)).
Logic gates:
Logic gates perform basic logical functions and are the fundamental building blocks of digital integrated
circuits. Most logic gates take an input of two binary values, and output a single value of a 1 or 0.
1. AND Gate: AND gate generates true output if all the inputs are true, otherwise it generates false
output. It is denoted by (.) operator and graphically represented by:
Logical Symbol
Truth Table
Input Output
A B F=A.B
0 0 0
0 1 0
1 0 0
1 1 1
2. OR Gate: OR gate generates true if at least any one of the input is true, otherwise it generates false
Output. It is denoted by (+) operator and graphically represented by:
Logical Symbol
Truth Table
Input Output
A B F=A+B
0 0 0
0 1 1
1 0 1
1 1 1
3. NOT Gate: It is also known as inverter. It inverts the input state from true to false and vice versa. It
is denoted by (_) or (') operator and graphically represented by:
Logical Symbol
Truth Table
Input Output
A F=A'
0 1
1 0
4. NAND Gate: NAND gate is the combination of AND and NOT gate. NAND gate generates true (1) output
if at least any of the input is false otherwise, it generates false output. Graphically it is represented by:
Logical Symbol
Truth table
Input Output
A B A.B F=(A.B)'
0 0 0 1
0 1 0 1
1 0 0 1
1 1 1 0
5. NOR Gate: NOR gate is the combination of the OR gate and NOT gate. This electronic gate produces
True (1) output when all inputs are False (0) otherwise the output will be False (0). It is the complement
of the OR gate. It has two or more inputs and only one output.
Logical Symbol:
The truth-table of NOR gate is:
Input Output
A B (A+B) F=(A+B)'
0 0 0 1
0 1 1 0
1 0 1 0
1 1 1 0
6. Exclusive (X-OR)Gates:
The XOR gate produces false output (0) when both the inputs are same otherwise, the output will be
true (1). It can also have two or more inputs which produces only one output.
Logical Symbol:
0 0 1 1 0 0 0
0 1 1 0 1 0 1
1 0 0 1 0 1 1
1 1 0 0 0 0 0
7. Exclusive-NOR(X-NOR) Gate:
The XNOR (exclusive-NOR) gate is a combination XOR gate followed by an inverter. Its output is "true" if
the inputs are the same and output is "false" if the inputs are different.
The X-NOR gate symbol is given below:
0 0 1 1 1 0 1
0 1 1 0 0 0 0
1 0 0 1 0 0 0
1 1 0 0 0 1 1
b. Theorem 2: The complement of a product of variables is equal to the sum of the complement of
each variables.
(A.B)' = A' + B'
Duality principle:
Duality principle state can be obtained by replacing AND (.) with OR (+) and vice versa, 1 with 0 and vice
versa keeping variables and complements and variables are unchanged.
For example, duality of the expression A.B' = A+B' and A'.B+C = A'+B.C
7.
a.
Here, A.(B +C) = A+(B.C)
b.
Here, A.B + C.1 + 0.1 = A + B.C + 0.1 + 0
c.
Here, C.D + A.0 + 1 = C + D.A + 1.0
d.
Here, 1.0 + A + C.1 = 0 + 1.A.C + 0
8.
Associative law states that when ORing or ANDing more than two variables, the result is the same
regardless of the grouping of the variables.
(a) (A + B) + C = A + (B + C)
(b) (A B) C = A (B C)
Proof:
A B C A+B B+C (A+B)+C A+(B+C)
0 0 0 0 0 0 0
0 0 1 0 1 1 1
0 1 0 1 1 1 1
0 1 1 1 1 1 1
1 0 0 1 0 1 1
1 0 1 1 1 1 1
1 1 0 1 1 1 1
1 1 1 1 1 1 1
Here, (A + B) + C = A + (B + C) thus proved.
Distributive law states that ORing/ANDing two or more variables and then ANDing/ORing the result with
a single variable is equivalent to ANDing/ORing the single variable with each of the two or more variables
and then ORing/ANDing the products/sums.
(a) A (B + C) = A.B + A . C
(b) A + (B . C) = (A + B) . (A + C)
Proof:
A B C B+C A.B A.C A.(B+C) A.B+A.C
0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0
1 0 0 1 0 0 0 0
1 0 1 1 0 1 1 1
1 1 0 1 1 0 1 1
1 1 1 1 1 1 1 1
9.
a.
Here,
AB + A'BC + BC
= AB + BC(A'+1)
=AB + BC
=B(A + C)
b.
Here,
PQ' + Q(P + Q) + P(P' + Q)
= PQ' + PQ + QQ + PP' + PQ
= PQ' + PQ + Q + 0
= P(Q'+Q) + Q
=P+Q
1 1 1
c.
Here,
(X + Y)(XY'Z + XYZ + XY'Z')
= XY'Z + XYZ + XY'Z' + XYY'Z + XYZ + XYY'Z'
= XY'Z + XYZ + XY'Z' + 0 + 0
=XY' (Z + Z') + XYZ
= XY' + XYZ
= X(Y'+YZ)
= X(Y'+ Z)
10.
Here,
a = A.B.C
b = A' + B + C
c = A'.B'.C
Principle of duality
Changing to symbol OR (+) operation from AND (.) operation or AND (.) operation from OR (+)
operation and digits 0 and 1 that is called principle of duality.
Example, (x+y).z=(x.y)+z
Uses of gates
Logical function are useful not only to the hardware designer in implementing circuits but also to
software designer in making decision, performing arithmetic, recognizing characters and patterns,
checking for errors, formatting output and assembling and disassembling data.