CTE 121 DIGITAL COMPUTER FUNDAMENTAL I Edited
CTE 121 DIGITAL COMPUTER FUNDAMENTAL I Edited
FUNDAMENTAL I
Number System, Set and Logic Gate HANDBOOK
The memory unit stores programs as well as input, output and intermediate data.
The processor unit performs arithmetic and other data processing tasks as
specified by the program. The control unit supervises the flow of information
between various units. The program and data prepared by the user are transferred
into the memory unit by means of an input device such as punch card reader (or)
tele typewriter. An output device, such as printer, receives the result of the
computations and the printed results are presented to the user.
It can have different base values like: binary (base-2), octal (base-8), decimal
(base 10) and hexadecimal (base 16), here the base number represents the number
of digits used in that numbering system. As an example, in decimal numbering
system the digits used are: 0, 1, 2, 3, 4, 5, 6, 7, 8 and 9. Therefore the digits for
binary are: 0 and 1, the digits for octal are: 0, 1, 2, 3, 4, 5, 6 and 7. For the
hexadecimal numbering system, base 16, the digits are: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
A, B, C, D, E, F.
Numbers that contain only two digit 0 and 1 are called Binary Numbers. Each 0 or
1 is called a Bit, from binary digit. A binary number of 4 bits is called a Nibble. A
binary number of 8 bits is called a Byte. A binary number of 16 bits is called a
Word on some systems, on others a 32-bit number is called a Word while a 16-bit
number is called a Halfword.
a binary number of 3 bit, such numbers are 000, 001, 010, 011, 100, 101, 110, 111
a binary number of 4 bit, such numbers are 0000, 0001, 0010, 0011, 0100, 0101,
0110, 0111, 1000, 1001, 1010, 1011, 1100,1101,1110,1111
Each digit in a binary number has a value or weight. The LSB has a value of 1.
The second from the right has a value of 2, the next 4 , etc.,
1.3 List the number of digits of figures available in various number systems
Base 10, Base 8, Base 2, Base 16.
Table1.1 BinaryWeights
16 8 4 2 1
24 23 22 21 20
Table1.2 the binary equivalent for some decimal numbers are given
below.
Decimal 0 1 2 3 4 5 6 7 8 9 10 11
The traditional number systems that we learned in school and use every day (decimal,
binary, hexadecimal, octal etc.) are positional number systems. In such a system, a
number is represented by a string of digits where each digit position has an
associated weight. The value of a number is a weighted sum of the digits.
Q1. Express the decimal number 106.58 as a sum of the values of each digit.
Q2. What weight does the digit 7 have in each of the following numbers?
a. 1370 – Ans. 10
b. 6725 – Ans. 100
c. 7051 – Ans. 1000
d. 58.72 – Ans. 0.1
There are many methods or techniques which can be used to convert numbers
from one base to another. We'll demonstrate here the following −
Decimal to Other Base System
Binary to Octal
Octal to Binary
Binary to Hexadecimal
Hexadecimal to Binary
Step 1 − Divide the decimal number to be converted by the value of the new
base.
Step 2 − Get the remainder from Step 1 as the rightmost digit (least significant
digit) of new base number.
Step 3 − Divide the quotient of the previous divide by the new base.
Step 4 − Record the remainder from Step 3 as the next digit (to the left) of the
new base number.
Repeat Steps 3 and 4, getting remainders from right to left, until the
quotient becomes zero in Step 3.
The last remainder thus obtained will be the Most Significant Digit (MSD)
of the new base number.
Steps
Example
Steps
Example
Binary to Octal
Steps
Step 1 − Divide the binary digits into groups of three (starting from the
right).
Octal to Binary
Steps
Step 1 − Convert each octal digit to a 3 digit binary number (the octal
digits may be treated as decimal for this conversion).
Example
Steps
Step 1 − Divide the binary digits into groups of four (starting from the right).
Example
Table 1.9 Calculating the Hexadecimal equivalent of the Binary number - 101012
Hexadecimal to Binary
Steps
The procedure for converting an octal to a binary is shown by the arrow marked (a).
We can prove that replacing each octal digit by its 3-bit equivalent binary value gives
the right result:
= 1×26 + 7×23 +3
Binary Addition
Binary Subtraction
Binary Multiplication
Binary Division
The complete details for each operation are available in the linked lessons, and an
example question is provided below for better understanding.
Let us show that addition is a binary operation on real numbers (R) and natural
numbers (N). So if we add two operands which are natural numbers a and b, the result
will also be a natural number. The same holds good for real numbers. Hence,
+ : R x R → R is given by (a, b) → a + b
+ : N x N → N is given by (a, b) → a + b
Let us show that multiplication is a binary operation on real numbers (R) and natural
numbers (N). So if we multiply two operands which are natural numbers a and b, the
result will also be a natural number. The same holds good for real numbers. Hence,
x: R x R → R is given by (a, b) → a x b
x: N x N → N is given by (a, b) → a x b
Let us show that subtraction is a binary operation on real numbers (R). So if we subtract
two operands which are real numbers a and b, the result will also be a real number. The
same does not hold good for natural numbers. It is because if we take two natural
numbers, 3 and 4 as a and b, then 3 – 4 = -1, which is not a natural number. Hence,
Binary multiplication is one of the four binary arithmetic. The other three
fundamental operations are addition, subtraction and division. In the case of a binary
operation, we deal with only two digits, i.e. 0 and 1. The operation performed while finding
the binary product is similar to the conventional multiplication method. The four major steps
in binary digit multiplication are:
0×0=0
0×1=0
1×0=0
1×1=1
Note: The binary product of the two binary numbers 1 and 1 is equal to 1 only. And no
additional number is borrowed or carried forward in this operation.
Based on the above specification, we will solve here the problems online based on the
multiplication of binary numbers.
In this section, you will get answers for the questions about binary multiplication, including:
Similar to the decimal system, the multiplication of the binary numbers is done by
multiplying the multiplicand with the multiplier. It is noted that the multiplication by zero
makes all the bits zero, and this step may be ignored in the intermediate steps. The
multiplication by 1 makes all the multiplicand value unchanged.
0x0 0
1x0 0
0x1 0
1x1 1
0×0=0
0×1=0
1×0=0
1 × 1 = 1 [No borrow or carry method is applicable here]
As per these rules, it very clear, that if the binary multiplication includes 0, then it will result
in zero itself. Hence,
But,
Binary product of 1 and 1 is equal to 1.
To differentiate the rules for multiplication of binary numbers from other binary operations
such as addition, subtraction and division, please refer to below given table:
Solution:
1010 × 101
1010
(×) 101
—————–
1010
0000
——————
1010
——————–
110010
10102 = 510
10 x 5 = 5010
(110010)2 = 5010
Solution:
Here, the decimal point is placed three places from the least significant bit. Because, the
binary number 1011.01, the decimal point is 2 places from the LSB and 110.1 the decimal
point is placed 1 place from the LSB.
Binary Subtraction
Binary subtraction is one of the four binary operations, where we perform the
subtraction method for two binary numbers (comprising only two digits, 0 and 1). This
operation is similar to the basic arithmetic subtraction performed on decimal numbers in
Maths. Hence, when we subtract 1 from 0, we need to borrow 1 from the next higher order
digit, to reduce the digit by 1 and the remainder left here is also 1.
Binary Subtraction
0–0=0
1–0=1
1–1=0
0 – 1 = 1 (Borrow 1)
Note: For fractional binary numbers, the same rule applies for subtraction, and the decimal
should be appropriately placed.
Can you subtract binary numbers? The answer is yes. Subtraction of binary numbers is an
arithmetic operation similar to the subtraction of decimal numbers or base 10 numbers. For
example, 1 + 1 + 1 = 3 in base 10 and 1 + 1 + 1 = 11 in binary number system. When you
add and subtract binary numbers, you will need to be careful when borrowing as these will
take place more often.
When you subtract several columns of binary digits, you must take into account the
borrowing. When 1 is to be subtracted from 0, the result is 1 where 1 is borrowed from the
next highest order bit or digit.
0–0 0
1–0 1
Note:
The addition of two binary numbers 1 and 1 is 10, where we consider 0 and carry forward 1
to the next high order. But in the case of subtraction of 1 and 1, the answer is equal to 0, and
nothing is carried forward.
In the case of decimal subtraction, when 1 is subtracted from 0, then we borrow 1 from the
next preceding number and make it 10, and after subtraction, it results in 9, i.e. 10 – 1 = 9.
But for binary subtraction, it results in 1 only.
Rules and tricks: Binary subtraction is much easier than the decimal subtraction when you
remember the following rules:
0–0=0
0 – 1 = 1 ( with a borrow of 1)
1–0=1
1–1=0
Now, look at the example of the binary subtraction: 101 from 1010
1010
(-) 101
Step 1: First consider the 1’s column, and subtract the one’s column,( 0 – 1 ) and it gives the
result 1 as per the condition of binary subtraction with a borrow of 1 from the 10’s place.
Step 2: After borrowing 1 from the 10’s column, the value 1 in the 10’s column is changed
into the value 0
1 Borrow
1010
(-) 1 0 1
——————
1 Borrow
1010
(-) 1 0 1
——————
01
Step 4: Now subtract the values in 100’s place. Borrow 1 from the 1000’s place ( 0 – 1 ) = 1.
1 1 Borrow
1010
(-) 1 0 1
——————
0101
When you cross-check the binary subtraction resultant value with the decimal value, the
resultant value should be the same.
The binary value 1010 is equal to the decimal value 10, and 101 is equivalent to 5
So, 10 – 5 = 5
If the result has a carryover, then add that carry over in the least significant bit
If there is no carryover, then take the 1’s complement of the resultant, and it is
negative.
Question 1:
(110101)2 – (100101)2
Solution:
(1 1 0 1 0 1)2 = 5310
Now take the 1’s complement of the subtrahend and add with minuend.
1 carry
110101
(+) 0 1 1 0 1 0
——————
001111
1 carry
——————
010000
(010000)2 = 1610
Question 2:
(101011)2 – (111001)2
Solution:
111
101011
——————
110001
Now take the 1’s complement of the resultant since it does not carry 1
Solution:
1 1 Borrow
0011010
(-) 0 0 1 1 0 0
——————
0001110
Decimal Equivalent :
0 0 1 1 0 1 0 = 26
0 0 1 1 0 0 = 12
Therefore, 26 – 12 = 14
Solution:
1 1 Borrow
0 1 0 0 0 1 0 = 3410
(-) 0 0 0 1 0 1 0 = 1010
——————
0 0 1 1 0 0 0 = 2410
Practice Problems
ary Addition
Binary addition is one of the binary operations. To recall, the term “Binary Operation” represents
the basic operations of mathematics that are performed on two operands. Basic arithmetic operations like
addition, subtraction, multiplication, and division, play an important role in mathematics. In this lesson, all
the concepts about binary addition are explained, which includes:
Before attempting the binary addition process, we should have complete knowledge of how the place works
in the binary number system. Because most of the modern digital computers and electronic circuits perform
the binary operation by representing each bit as a voltage signal. The bit 0 represents the “OFF” state, and
the bit 1 represents the “ON” state.
0+0=0
0+1=1
1+0=1
1 + 1 =10
101
(+) 101
Step 1: First consider the 1’s column, and add the one’s column,( 1+1 ) and it gives the result 10 as per the
condition of binary addition.
Step 2: Now, leave the 0 in the one’s column and carry the value 1 to the 10’s column.
1
101
(+) 101
————–
Step 3: Now add 10’s place, 1+( 0 + 0 ) = 1. So, nothing carries to the 100’s place and leave the value 1 in the
10’s place
1
101
(+) 101
————-
10
Step 4: Now add the 100’s place ( 1 + 1 ) = 10. Leave the value 0 in the 100’s place and carries 1 to the 1000’s
place.
1
101
(+) 101
————-
1010
When you cross-check the binary value with the decimal value, the resultant value should be the same.
So, 5 + 5 = 10
x y x+y
0 0 0
0 1 1
1 0 1
You can see from the above table, x and y are the two binary numbers. So when we give the input for x = 0
and y = 0, then the output is equal to 0. When x = 0 or 1 and y = 1 or 0, then x+y = 1. But when both x and y
are equal to 1, then their addition equals to 0, but the carryover number will equal to 1, which means
basically 1 + 1 = 10 in binary addition, where 1 is carry forwarded to the next digit.
Solution:
10001
(+) 1 1 1 0 1
———————–
101110
Solution:
111
10111
(+) 1 1 0 0 0 1
———————–
1001000
Take the 1’s complement of the negative number, and the carry is added to the resultant sum at the 1’s place.
When you add the carry with the resultant, you will get the sum value.
Example:
+1111=01111
——————-
00001
———————
00010
Example:
+1 1 0 1 = 0 1 1 0 1
—————-
1110
——————
Take the 1’s complement of both the negative numbers and then add. The end around carrying will appear,
and it will generate a number 1 in the sign bit. The sum value can be obtained by taking the 1’s complement
of the resultant.
Example:
10001
—————————–
10010
—————————-
1÷1 = 1
1÷0 = Meaningless
0÷1 = 0
0÷0 = Meaningless
Similar to the decimal number system, the binary division is similar, which follows the four-step process:
Divide
Multiply
Subtract
Bring down
Important Note: Binary division follows the long division method to find the resultant in an easy way.
You will get the resultant value as 62 when you divide 124 by 2.
(111110)2 = 6210
Both the binary and the decimal system produce the same result.
Solution:
Given
01111100 ÷ 0010
Remove the zero’s in the Most Significant Bit in both the dividend and divisor, that doesn’t change the
value of the number.
Step 1: First, look at the first two numbers in the dividend and compare with the
divisor. Add the number 1 in the quotient place. Then subtract the value, you get 1 as
remainder.
Step 2: Then bring down the next number from the dividend portion and do the step 1
process again
Step 3: Repeat the process until the remainder becomes zero by comparing the
dividend and the divisor value.
Step 4: Now, in this case, after you get the remainder value as 0, you have zero left in
the dividend portion, so bring that zero to the quotient portion.
Therefore, the resultant value is quotient value which is equal to 111110
Solution:
So, when you bring down the fourth bit of the dividend, it does not match with the divisor. In
order to bring down the 5th and 6th bit of the dividend, add two zeros in the quotient value.
1's complement
The 1's complement of a number is found by changing all 1's to 0's and all 0's to
1's. This is called as taking complement or 1's complement. Example of 1's
Complement is as follows.
2's complement
Case 1: Addition of the positive number with a negative number when the positive
number has a greater magnitude.
Initially, calculate the 1's complement of the given negative number. Sum up with the given
positive number. If we get the end-around carry 1, it gets added to the LSB.
1. First, find the 1's complement of the negative number 1001. So, for finding 1's
complement, change all 0 to 1 and all 1 to 0. The 1's complement of the number 1001
is 0110.
2. Now, add both the numbers, i.e., 1101 and 0110;
1101+0110=1 0011
3. By adding both numbers, we get the end-around carry 1. We add this end around carry
to the LSB of 0011.
0011+1=0100
Case 2: Adding a positive value with a negative value in case the negative number has a
higher magnitude.
Initially, calculate the 1's complement of the negative value. Sum it with a positive number.
In this case, we did not get the end-around carry. So, take the 1's complement of the result to
get the final result.
In this case, first find the 1's complement of both the negative numbers, and then we add
both these complement numbers. In this case, we always get the end-around carry, which get
added to the LSB, and for getting the final result, we take the 1's complement of the result.
1. Firstly find the 1's complement of the negative numbers 01101 and 01110. So, for
finding 1's complement, we change all 0 to 1, and all 1 to 0. 1's complement of the
number 01110 is 10001, and 01101 is 10010.
2. Now, we add both the complement numbers, i.e., 10001 and 10010;
10001+10010= 1 00011
3. By adding both numbers, we get the end-around carry 1. We add this end-around carry
to the LSB of 00011.
00011+1=00100
4. Now, find the 1's complement of the result 00100 that is the final answer. So, the 1's
complement of the result 00100 is 110111, and add a negative sign before the number
so that we can identify that it is a negative number.
These are the following steps to subtract two binary numbers using 1's complement
We take 1's complement of subtrahend 00111, which comes out 11000. Now, sum them. So,
10101+11000 =1 01101.
In the above result, we get the carry bit 1, so add this to the LSB of a given result, i.e.,
01101+1=01110, which is the answer.
We take 1's complement of subtrahend 10111, which comes out 01000. Now, add both of the
numbers. So,
10101+01000 =11101.
In the above result, we didn't get the carry bit. So calculate the 1's complement of the result,
i.e., 00010, which is the negative number and the final answer.
2.3 The limitation of 1’s complement
1's complement notation is not very simple to understand because it is very much
different from the conventional way of representing signed numbers.
The other disadvantage is that there are two notations for 0 (0000 and 1111), which is
very inconvenient when the computer wants to test for a 0 result.
There are three different cases possible when we add two binary numbers using 2's
complement, which is as follows:
Case 1: Addition of the positive number with a negative number when the positive
number has a greater magnitude.
Initially find the 2's complement of the given negative number. Sum up with the given
positive number. If we get the end-around carry 1 then the number will be a positive number
and the carry bit will be discarded and remaining bits are the final result.
1. First, find the 2's complement of the negative number 1001. So, for finding 2's
complement, change all 0 to 1 and all 1 to 0 or find the 1's complement of the number
1001. The 1's complement of the number 1001 is 0110, and add 1 to the LSB of the
result 0110. So the 2's complement of number 1001 is 0110+1=0111
2. Add both the numbers, i.e., 1101 and 0111;
1101+0111=1 0100
3. By adding both numbers, we get the end-around carry 1. We discard the end-around
carry. So, the addition of both numbers is 0100.
Case 2: Adding of the positive value with a negative value when the negative number
has a higher magnitude.
Initially, add a positive value with the 2's complement value of the negative number. Here,
no end-around carry is found. So, we take the 2's complement of the result to get the final
result.
1. First, find the 2's complement of the negative number 1110. So, for finding 2's
complement, add 1 to the LSB of its 1's complement value 0001.
0001+1=0010
2. Add both the numbers, i.e., 1101 and 0010;
1101+0010= 1111
3. Find the 2's complement of the result 1110 that is the final result. So, the 2's
complement of the result 1110 is 0001, and add a negative sign before the number so
that we can identify that it is a negative number.
In this case, first, find the 2's complement of both the negative numbers, and then we will
add both these complement numbers. In this case, we will always get the end-around carry,
which will be added to the LSB, and forgetting the final result, we will take the2's
complement of the result.
1. Firstly find the 2's complement of the negative numbers 01101 and 01110. So, for
finding 2's complement, we add 1 to the LSB of the 1's complement of these numbers.
2's complement of the number 01110 is 10010, and 01101 is 10011.
2. We add both the complement numbers, i.e., 10001 and 10010;
10010+10011= 1 00101
3. By adding both numbers, we get the end-around carry 1. This carry is discarded and
the final result is the 2.s complement of the result 00101. So, the 2's complement of
the result 00101 is 11011, and we add a negative sign before the number so that we
can identify that it is a negative number.
These are the following steps to subtract two binary numbers using 2's complement
We take 2's complement of subtrahend 00111, which is 11001. Now, sum them. So,
10101+11001 =1 01110.
In the above result, we get the carry bit 1. So we discard this carry bit and remaining is the
final result and a positive number.
10101+01001 =11110.
In the above result, we didn't get the carry bit. So calculate the 2's complement of the result,
i.e., 00010. It is the negative number and the final answer.
Week 7 – 9: GENERAL OBJECTIVE 3: Understand the various methods of
minimization required to simplify digital combinational circuits.
A Venn diagram is a widely used diagram style that shows the logical relation between sets,
popularized by John Venn (1834–1923) in the 1880s. The diagrams are used to teach
elementary set theory, and to illustrate simple set relationships
in probability, logic, statistics, linguistics and computer science. A Venn diagram uses
simple closed curves drawn on a plane to represent sets. Very often, these curves are circles
or ellipses.
Let us observe a Venn diagram example. Here is the Venn diagram that shows the
correlation between the following set of numbers.
One set contains even numbers from 1 to 25 and the other set contains the numbers in the
5x table from 1 to 25.
The intersecting part shows that 10 and 20 are both even numbers and also multiples of 5
between 1 to 25.
Let us understand the following terms and concepts related to Venn Diagram, to understand
it better.
Universal Set
Whenever we use a set, it is easier to first consider a larger set called a universal set that
contains all of the elements in all of the sets that are being considered. Whenever we draw a
Venn diagram:
A large rectangle is used to represent the universal set and it is usually denoted by the
symbol E or sometimes U.
All the other sets are represented by circles or closed figures within this larger rectangle.
Every set is the subset of the universal set U.
Consider the above-given image:
U is the universal set with all the numbers 1-10, enclosed within the rectangle.
A is the set of even numbers 1-10, which is the subset of the universal set U and it is
placed inside the rectangle.
All the numbers between 1-10, that are not even, will be placed outside the circle and
within the rectangle as shown above.
Subset
Venn diagrams are used to show subsets. A subset is actually a set that is contained within
another set. Let us consider the examples of two sets A and B in the below-given figure.
Here, A is a subset of B. Circle A is contained entirely within circle B. Also, all the elements
of A are elements of set B.
There are more than 30 Venn diagram symbols. We will learn about the three most
commonly used symbols in this section. They are listed below as:
A ∪ B is read as A union B.
A ∩ B is read as A intersection B.
Let us understand the concept and the usage of the three basic Venn diagram symbols using
the image given below.
Total Elements
Symbol It refers to
(No. of students)
In set theory, we can perform certain operations on given sets. These operations are as
follows,
Union of Set
Intersection of set
Complement of set
Difference of set
The union of two sets A and B can be given by: A ∪ B = {x | x ∈ A or x ∈ B}. This
operation on the elements of set A and B can be represented using a Venn diagram with two
circles. The total region of both the circles combined denotes the union of sets A and B.
The intersection of sets, A and B is given by: A ∩ B = {x : x ∈ A and x ∈ B}. This operation
on set A and B can be represented using a Venn diagram with two intersecting circles. The
region common to both the circles denotes the intersection of set A and Set B.
The complement of any set A can be given as A'. This represents elements that are not
present in set A and can be represented using a Venn diagram with a circle. The region
covered in the universal set, excluding the region covered by set A, gives the complement of
A.
The difference of sets can be given as, A - B. It is also referred to as a ‘relative complement’.
This operation on sets can be represented using a Venn diagram with two circles. The region
covered by set A, excluding the region that is common to set B, gives the difference of sets A
and B.
We can observe the above-explained operations on sets using the figures given below,
Venn Diagram for Three Sets
Three sets Venn diagram is made up of three overlapping circles and these three circles show
how the elements of the three sets are related. When a Venn diagram is made of three sets, it
is also called a 3-circle Venn diagram. In a Venn diagram, when all these three circles
overlap, the overlapping parts contain elements that are either common to any two circles or
they are common to all the three circles. Let us consider the below given example:
Venn diagrams can be drawn with unlimited circles. Since more than three becomes very
complicated, we will usually consider only two or three circles in a Venn diagram. Here are
the 4 easy steps to draw a Venn diagram:
Step 4: Place all the pets in the relevant circles. If there are certain pets that fit both the
categories, then place them at the intersection of sets, where the circles overlap. Rabbits
and fish can be kept as indoor and outdoor pets, and hence they are placed at the
intersection of both circles.
Step 5: If there is a pet that doesn't fit either the indoor or outdoor sets, then place it
within the rectangle but outside the circles.
Venn Diagram Formula
For any two given sets A and B, the Venn diagram formula is used to find one of the
following: the number of elements of A, B, A U B, or A ⋂ B when the other 3 are given. The
formula says:
Example: In a cricket school, 12 players like bowling, 15 like batting, and 5 like both. Then
how many players like either bowling or batting.
Solution:
Let A and B be the sets of players who like bowling and batting respectively. Then
n(A) = 12
n(B) = 15
n(A ⋂ B) = 5
n(A U B) = 12 + 15 - 5 = 22.
We can visually organize information to see the relationship between sets of items, such
as commonalities and differences, and to depict the relations for visual communication.
We can compare two or more subjects and clearly see what they have in common versus
what makes them different. This might be done for selecting an important product or
service to buy.
Mathematicians also use Venn diagrams in math to solve complex equations.
We can use Venn diagrams to compare data sets and to find correlations.
Venn diagrams can be used to reason through the logic behind statements or equations.
Important Notes on Venn Diagrams:
Here is a list of a few points that should be remembered while studying Venn diagrams:
If we talk about the set theory, then you have to learn more than 30 symbols, but you can
make a Venn diagram by only understanding the few basic symbols. The diagram represents
the classification and comparison of data sets; therefore, you only have to learn six symbols
to get started.
A ꓵ B= {9, 10}
The symbol ꓵ between two sets represents only
ꓵ Intersection
similar elements. It shows the elements that are only
in both sets.
A – B= {1, 2, 3, 4}
− Difference By set A from set B, you get a solution set with
elements of set A that are not in set B.
Ac= U-A
Complement of
Ac You can find the complement of set A by subtracting
a set
all elements of set A from the universal set.
A={}
{} Empty Set This symbol depicts that the set does not have any
elements.
1. Union of sets
2. Intersection of sets
3. Difference of sets
Sometimes, students also get confused with the union and universal set. Union of two or
more sets is an operation performed on them, which results in a collection of elements
present in both the sets, whereas a universal set is itself a set, which contains all the elements
of other sets, including its own elements.
In the upcoming discussions, you will learn about the union operation on sets thoroughly.
The union of two sets X and Y is equal to the set of elements that are present in set X, in set
Y, or in both the sets X and Y. This operation can be represented as;
X ∪ Y = {a: a ∈ X or a ∈ Y}
Let us consider an example, say; set A = {1, 3, 5} and set B = {1, 2, 4} then;
A ∪ B = {1, 2, 3, 4, 5}
Now, let us learn how can we represent the union of two sets in a Venn diagram.
Venn Diagram of Union of Sets
Let us consider a universal set U such that A and B are the subsets of this universal set. The
union of two sets A and B is defined as the set of all the elements which lie in set A and set
B or both the elements in A and B altogether. The union of the set is denoted by the symbol
‘∪’.
In the given Venn diagram, the red-coloured portion represents the union of both sets A and
B.
Thus, the union of two sets A and B is given by a set C, which is also a subset of the
universal set U such that C consists of all those elements or members which are either in set
A or set B or in both A and B i.e.,
C = A ∪ B = {x : x ∈ A or x ∈ B}
A Union B Formula
The union of set A and set B is equal to the set containing all the elements in A and B. This
is represented as A U B and can be read as “A union B” or “A or B”.
A union B formula is generally used to calculate the unions of set A and set B. The formula
for A union B indicates that each element present in A or B (leaving duplicates) is present in
A U B. From the definition of the union of sets, the formula for A union B formula can be
written as:
A U B = {x : x ∈ A or x ∈ B}
Formula for Number of Elements in A union B
Consider two sets, A and B, such that the number of elements in the union of A and B can be
calculated as follows.
Here,
n(A ∩ B) = The number of elements that are common to both A and B; is called the
cardinality of set A ∩ B, i.e. A intersection B
i) Commutative Law: The union of two or more sets follows the commutative law i.e., if
we have two sets A and B then,
A∪B=B∪A
B∪A = {b, c, d, a}
Since, in both the union, the group of elements is same. Therefore, it satisfies commutative
law.
A∪B=B∪A
ii) Associative Law: The union operation follows the associative law i.e., if we have three
sets A, B and C then
(A ∪ B) ∪ C = A ∪ (B ∪ C)
Example: A = {a, b} and B = {b, c, d} and C = {a, c, e}
iii) Identity Law: The union of an empty set with any set A gives the set itself i.e.,
A∪∅=A
iv) Idempotent Law: The union of any set A with itself gives the set A i.e.,
A∪A=A
Suppose, A = {1, 2, 3, 4, 5}
v) Domination Law: The union of a universal set U with its subset A gives the universal set
itself.
A∪U=U
Hence, proved.
Go through the solved examples given below to understand the concept in a better way.
Solved Examples
Example 1:
Let U be a universal set consisting of all the natural numbers until 20 and set A and B
be a subset of U defined as A = {2, 5, 9, 15, 19} and B = {8, 9, 10, 13, 15, 17}. Find A ∪ B.
Solution:
Given,
U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
Example 2:
If set A contains 13 elements, set B contains 8 elements and the intersection of these two
sets contains 5 elements, then find the number of elements in A union B.
Solution:
Given,
We know that,
= 13 + 8 – 5
= 21 – 5
= 16
The intersection of sets A and B is the set of all elements which are common to both A and
B.
Suppose A is the set of even numbers less than 10 and B is the set of the first five multiples
of 4, then the intersection of these two can be identified as given below:
A = {2, 4, 6, 8}
A intersection B Formula
The formula for the intersection of sets can be given based on the definition. That means, the
intersection of two sets A and B is the set containing elements that are common to both A
and B. This can be expressed as:
A ∩ B = {x : x ∈ A and x ∈ B}
The intersection of two given sets, say X and Y, is the most extensive set containing all the
elements common to X and Y. The intersection of two sets can be a set again with at least
one element or it can be an empty set, i.e. no elements in the intersection set. Suppose A and
B are two sets such that A ∩ B = φ, then A and B are called disjoint sets. That means, there
are no elements at the intersection of A and B.
It is possible to find the intersection of more than two sets. In this section, you will learn how
to find the intersection of three sets. Suppose A, B and C are three sets, then the intersection
of these three sets is the set of all elements that are common to A, B and C. This can be
represented as A ∩ B ∩ C. This can be better understood with the help of the example given
below.
For example, A = {6, 8, 10, 12, 14, 16}, B = {9, 12, 15, 18, 21, 24} and C = {4, 8, 12, 16, 20,
24, 28}.
Therefore, A ∩ B ∩ C = {12}
The intersection of two sets can be represented using the Venn diagram as shown below.
In the above diagram, the shaded portion represents the intersection of two sets A and B.
Similarly, we can draw a Venn diagram for the intersection of 3 sets as shown below.
In the above diagram, we can see that the centermost region denotes the intersection of three
sets A, B and C.
Therefore, A ∩ B = B ∩ A.
Now,
(A ∩ B) ∩ C = {3, 4} ∩ {5, 6, 7, 8} = { } = φ
And
A ∩ (B ∩ C) = {1, 2, 3, 4} ∩ {5, 6} = { } = φ
Therefore, (A ∩ B) ∩ C = A ∩ (B ∩ C)
Let U = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20} and A = {4, 8, 12, 16, 20}.
U ∩ A = {2, 4, 6, 8, 10, 12, 14, 16, 18, 20} ∩ {4, 8, 12, 16, 20} = {4, 8, 12, 16, 20} = A
Let us take three sets A = = {2, 4, 6, 8}, B = {2, 3, 5, 7} and C = {3, 4, 5, 6}.
Therefore, A ∩ (B U C) = (A ∩ B) U (A ∩ C)
Example 1: If A = { 3, 5, 7, 9, 11}, B = {7, 9, 11, 13}, and C = {11, 13, 15}, then find B ∩
C and A ∩ B ∩ C.
Solution:
Given,
A = { 3, 5, 7, 9, 11}
A ∩ B ∩ C = {11}
(i) A ∩ (B ∪ C)
(ii) (A ∩ B) ∪ (A ∩ C)
Solution:
Venn diagram of A ∩ (B ∪ C)
Venn diagram of (A ∩ B) ∪ (A ∩ C)
The union of two sets A and B is the set of all those elements which are either in A or in B,
whereas the intersection of two sets A and B is the set of all elements which are common.
We can define the formulas for both union and intersection of given sets based on the
cardinality of sets as given below.
n (A ∪ B) = n (A) + n (B).
If A ∩ B ≠ φ, then
n (A ∪ B) = n (A) + n (B) – n (A ∩ B)
Practice Problems
1. Consider three sets A = {1, 2, 3}, B = {2, 3, 5} and C = {4, 5, 6}. Find (A ∩ B) ∩ C.
What is ∩ called?
The symbol ∩ denotes the intersection of sets. For example, the intersection of two sets X
and Y can be represented as X ∩ Y.
Q3
Is A ∩ B is equal to B ∩ A?
Yes, A ∩ B is equal to B ∩ A. This represents the commutative law of the intersection of
sets.
A universal set (usually denoted by U) is a set which has elements of all the related sets,
without any repetition of elements. Say if A and B are two sets, such as A = {1,2,3} and B =
{1,a,b,c}, then the universal set associated with these two sets is given by U = {1,2,3,a,b,c}.
In Mathematics, the collection of elements or group of objects is called a Set. There are
various types of sets like Empty set, Finite set, Infinite set, Equivalent set, Subset, Superset
and Universal set. All these sets have their own importance in Mathematics. There is a lot of
usage of sets in our day-to-day life, but normally they are used to represent bulk data or
collection of data in a database. For example, our hand is a set of fingers, where each finger
is different from the other one. The notation of set is usually given by curly brackets, {} and
each element in the set is separated by commas like {4, 7, 9}, where 4, 7, and 9 are the
elements of sets.
Universal set contains a group of objects or elements which are available in all the sets and is
represented in a Venn diagram.
Universal Set Definition
A universal set is a set which contains all the elements or objects of other sets, including its
own elements. It is usually denoted by the symbol ‘U’.
Suppose Set A consists of all even numbers such that, A = {2, 4, 6, 8, 10, …} and set B
consists of all odd numbers, such that, B = {1, 3, 5, 7, 9, …}. The universal set U consists of
all natural numbers, such that, U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10,….}. Therefore, as we know,
all the even and odd numbers are a part of natural numbers. Therefore, Set U has all the
elements of Set A and Set B.
There is no formula to find the universal set, we just have to represent all the elements in a
single which is collectively called a universal set.
Fact: There is no standard notation for Universal set symbol, it can also be denoted by any
other entity like ‘V’ or ‘ξ’.
Example: Let us say, there are three sets named as A, B and C. The elements of all sets A,
B and C is defined as;
A={1,3,6,8}
B={2,3,4,5}
C={5,8,9}
Find the universal set for all the three sets A, B and C.
Answer: By the definition we know, the universal set includes all the elements of the given
sets. Therefore, Universal set for sets A, B and C will be,
U={1,2,3,4,5,6,8,9}
Explanation: From the above example, we can see that the elements of sets A, B and C are
altogether available in Universal set ‘U’. Also, if you observe, no elements in the universal
set are repeated and all the elements are unique.
Note: If Universal set contains Sets A, B and C, then these sets are also called subsets of
Universal set. Denoted by;
A ⊂ U (A subset of U)
B ⊂ U (B subset of U)
C ⊂ U (C subset of U)
For Venn diagram representation of the universal set, we can take the example as;
We can understand the concept of Universal set also by taking an example of the real world.
In this world, we have set of a human being, set of animals and also set of all living things,
which we can consider as a subset of U. But we cannot consider a set of trees as a subset of
U.
There is a complement of set for every set. The empty set is defined as the complement of
the universal set. That means where Universal set consists of a set of all elements, the empty
set contains no elements of the subsets. The empty set is also called a Null set and is denoted
by ‘{}’.
Universal set and Union of set
Students sometimes get confused between universal set and union of the set. They think both
are the same but that is not true.
The universal set is a set which consists of all the elements or objects, including its own
elements. It is represented by just a symbol ‘U’. But the union of sets is an operation
performed on two sets, say A and B, which results in a set that has all elements belonging
either to set A and set B or both. The operand of union of set is given by ‘∪’.
For example, Set A = {a,b,c} and set B={c,d,e} and U={1,2}. Therefore, the universal set for
set A, B and U itself will be;
U ={a,b,c,d,e,1,2}
You can see, U is also a set which collectively shows all the elements of A, B and of itself.
A∪B = {a,b,c,d,e}
If U is a universal set and A be any subset of U then the complement of A is the set of all
members of the universal set U which are not the elements of A.
𝐴′ = 𝑥 : 𝑥 ∈ 𝑈 𝑎𝑛𝑑 𝑥 ∉ 𝐴
Alternatively it can be said that the difference of the universal set U and the subset A gives
us the complement of set A.
To make it more clear consider a universal set U of all natural numbers less than or equal to
20.
Let the set A which is a subset of U be defined as the set which consists of all the prime
numbers.
Now the complement of this set A consists of all those elements which is present in the
universal set but not in A. Therefore, A’ is given by:
A’={{1,4,6,8,9,10,12,14,15,16,18,20}}
Example: Let U be the universal set which consists of all the integers greater than 5 but
less than or equal to 25. Let A and B be the subsets of U defined as:
Find the complement of sets A and B and the intersection of both the complemented
sets.
U = {{6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25}}
Therefore,
A’ = {6,7,8,10,11,12,13,14,15,17,18,19,20,21,22,23,24}
B’ = {6,8,10,11,12,13,14,15,17,19,20,21,22,23,25}
Rightarrow A’∩ B’= {6, 8, 10, 11, 12, 13, 14, 15, 17, 19, 20, 21, 22, 23}
We can see from the above discussions that if a set A is a subset of the universal set U then
the complement of set A, i.e. A’ is also a subset of U.
If we look at the whole area of both, regardless of the hatch style, the sum total of all hatched
areas, we get the illustration above right which corresponds to the inclusive OR function of
A, B. The Boolean expression is A+B. This is shown by the 45 o hatched area. Anything
outside of the hatched area corresponds to (A+B)-not as shown above. Let’s move on to next
part of the fourth example
The other way of looking at a Venn diagram with overlapping circles is to look at just the
part common to both A and B, the double hatched area below left. The Boolean expression
for this common area corresponding to the AND function is AB as shown below right. Note
that everything outside of double hatched AB is AB-not.
Note that some of the members of A, above, are members of (AB)’. Some of the members
of B are members of (AB)’. But, none of the members of (AB)’ are within the doubly
hatched area AB.
We have repeated the second example above left. Your fifth example, which you previously
sketched, is provided above right for comparison. Later we will find the occasional element,
or group of elements, totally contained within another group in a Karnaugh map.
Solution:
Starting above top left we have red horizontal shaded A’ (A-not), then, top right, B. Next,
lower left, we form the AND function A’B by overlapping the two previous regions. Most
people would use this as the answer to the example posed. However, only the double
hatched A’B is shown far right for clarity. The expression A’Bis the region where
both A’ and B overlap. The clear region outside of A’B is (A’B)’, which was not part of the
posed example.
Example:
Find B’+A
Solution:
Above right we start out with B which is complemented to B’. Finally we overlay A on top
of B’. Since we are interested in forming the OR function, we will be looking for all hatched
area regardless of hatch style. Thus, A+B’ is all hatched area above right. It is shown as a
single hatch region below left for clarity.
Example:
Find (A+B’)’
Solution:
The green 45o A+B’ hatched area was the result of the previous example. Moving on to a
to,(A+B’)’ ,the present example, above left, let us find the complement of A+B’, which is
the white clear area above left corresponding to (A+B’)’. Note that we have repeated, at
right, the AB’ double hatched result from a previous example for comparison to our result.
The regions corresponding to (A+B’)’ and AB’ above left and right respectively are
identical. This can be proven with DeMorgan’s theorem and double negation.
This brings up a point. Venn diagrams don’t actually prove anything. Boolean algebra is
needed for formal proofs. However, Venn diagrams can be used for verification and
visualization. We have verified and visualized DeMorgan’s theorem with a Venn diagram.
Example:
What does the Boolean expression A’+B’ look like on a Venn Diagram?
Solution: above figure
Start out with red horizontal hatched A’ and blue vertical hatched B’ above. Superimpose the
diagrams as shown. We can still see the A’ red horizontal hatch superimposed on the other
hatch. It also fills in what used to be part of the B (B-true) circle, but only that part of
the B open circle not common to the A open circle. If we only look at the B’ blue vertical
hatch, it fills that part of the open A circle not common to B. Any region with any hatch at
all, regardless of type, corresponds to A’+B’. That is, everything but the open white space in
the center.
Example:
What does the Boolean expression (A’+B’)’ look like on a Venn Diagram?
Looking at the white open space in the center, it is everything NOT in the previous solution
of A’+B’, which is (A’+B’)’.
Example:
We show a three variable Venn diagram above with regions A (red horizontal), B (blue
vertical), and, C(green 45o). In the very center note that all three regions overlap representing
Boolean expression ABC. There is also a larger petal shaped region where A and B overlap
corresponding to Boolean expression AB. In a similar manner A and C overlap producing
Boolean expression AC. And B and C overlap producing Boolean expression BC.
Looking at the size of regions described by AND expressions above, we see that region size
varies with the number of variables in the associated AND expression.
Boolean algebra is used to analyse and simplify the digital (logic) circuits. It uses only
the binary numbers i.e. 0 and 1. It is also called as Binary Algebra or logical Algebra.
Boolean algebra was invented by George Boole in 1854.
Boolean Laws
Commutative law
Commutative law states that changing the sequence of the variables does not have any
effect on the output of a logic circuit.
Associative law
This law states that the order in which the logic operations are performed is irrelevant
as their effect is the same.
Distributive law
AND law
These laws use the AND operation. Therefore they are called as AND laws.
OR law
These laws use the OR operation. Therefore they are called as OR laws.
Inversion law
This law uses the NOT operation. The inversion law states that double inversion of a
variable results in the original variable itself.
Theorems
De Morgan has suggested two theorems which are extremely useful in Boolean
Algebra. The two theorems are discussed below.
Theorem 1
The left hand side (LHS) of this theorem represents a NAND gate with
inputs A and B, whereas the right hand side (RHS) of the theorem represents an OR
gate with inverted inputs.
This OR gate is called as Bubbled OR.
Table showing verification of the De Morgan's first theorem −
Theorem 2
The LHS of this theorem represents a NOR gate with inputs A and B,
whereas the RHS represents an AND gate with inverted inputs.
This AND gate is called as Bubbled AND.
Table showing verification of the De Morgan's second theorem −
Week 13 – 15: Understand basic digital functions
5.1 How YES/NO, TRUE/FALSE, ON/OF can be coded by ‘1’ and ‘0’
A bit (binary digit) is the smallest unit of data that a computer can process and store. A
bit is always in one of two physical states, similar to an on/off light switch. The state is
represented by a single binary value, usually a 0 or 1. However, the state might also be
represented by yes/no, on/off or true/false. Bits are stored in memory through the use
of capacitors that hold electrical charges. The charge determines the state of each bit,
which, in turn, determines the bit's value.
Although a computer might be able to test and manipulate data at the bit level, most
systems process and store data in bytes. A byte is a sequence of eight bits that are
treated as a single unit. References to a computer's memory and storage are always in
terms of bytes. For example, a storage device might be able to store 1 terabyte (TB) of
data, which is equal to 1,000,000 megabytes (MB). To bring this into perspective, 1
MB equals 1 million bytes, or 8 million bits. That means a 1 TB drive can store 8
trillion bits of data.
Logic gates are the basic building blocks of any digital system. It is an electronic
circuit having one or more than one input and only one output. The relationship
between the input and the output is based on certain logic. Based on this, logic
gates are named as AND gate, OR gate, NOT gate etc.
AND Gate
A circuit which performs an AND operation is shown in figure. It has n input (n >=
2) and one output.
The AND gate is one of the digital system's primary or fundamental logic gates. A
logic gate is a physical device that performs a logical operation in one or more logical
fain-in or inputs and produces a logical output. The output of a "AND Gate" only
returns "HIGH" when all the inputs are "HIGH".
Figure 1.4 Logic diagram of AND gate
The AND gate truth table is for the two fan-in or inputs, A and B. It has only
one output as Y. The output is logic '0' if any inputs A and B are LOW (logic
'0'). However, the output is 1 only when all the inputs are 1. The AND gate
truth table is as follows:
OR Gate
The OR gate will have two or more inputs but only one output. A logical OR gate
function effectively finds the maximum between two binary digits, such as the
complementary AND function finds the minimum.
The OR gate truth table is a table that displays the output state based on the various
combinations of input states. It demonstrates how an OR logic gate works. The truth
table lists the output of a particular digital logic circuit for all the possible
combinations of its inputs. For example, the truth table of a 2 input OR gate can be
represented as:
NOT Gate
NOT gate is also known as Inverter. It has one input A and one output Y.
Figure 1.6 Logic diagram of NOT gate
NAND Gate
XNOR Gate
diagram of XNOR