Uploaded by Versatile loggg

discrete assignment no 2

advertisement
COMSATS University Islamabad, Abbottabad Campus
Department of Computer Science
Assignment 2 – SP 2023
Course: Discrete Structures
Class:BSCS-1B
Max Marks: 10
Name:
UZAIR MALIK
Instructor: Ms. Ayesha Irshad
Date: 1st May, 2023
Time allowed: 5 Days
Reg. #: __SP23-BCS-065
Q1. How do you define the cardinality of a set, and what is its significance in
set theory?
Answer:
1) Sets:Definition:-
Well defined collection of distinct objects(:-elements)
2) Understanding Sets:Consider a set of natural numbers ;
N={1,2,3,4,5,6,7,8…….}--curly braces are used for rep of sets
|
|
\/
Shows element(there are n Number of elements)
So now these n Numbers (collection)of elements that are present in the Curley
braces are known as sets
3)Cardinality
of Sets:-
definition:Total number of elements present in a set is called as cardinality of sets
Explanation:1|Page
In mathematics, the cardinality of a set is a measure of the "size" of the set. It
is a mathematical concept that describes the number of elements in a set. The cardinality of a
set is usually denoted by |A|, where A is the set.
Finite sets :For finite sets, the cardinality is simply the number of elements in the set.
For example,
the cardinality of the set {2, 4, 6, 8, 10} is 5.
Infinite sets:For infinite sets, the concept of cardinality becomes more complex. Two sets are said to have
the same cardinality if there is a one-to-one correspondence between their elements.
In other words, if there exists a way to pair up every element of set A with a unique element
of set B, and vice versa, then A and B have the same cardinality.
For example,
the set of natural numbers (1, 2, 3, ...) has the same cardinality as the set of even numbers (2,
4, 6, ...), since there is a one-to-one correspondence between these sets (namely, the function
f(x) = 2x).
Cardinality is a fundamental concept in set theory and has important applications in other
areas of mathematics, such as number theory and topology.
Significance of cardinality:1. Counting:
Cardinality provides a way of counting the number of elements in a set. For finite
sets, the cardinality is simply the number of elements.
For example,
if we have a set of five apples, the cardinality of the set is 5. This allows us to reason
about the sizes of sets and perform operations like addition and subtraction.
2. Comparing sets:
Cardinality provides a way to compare the sizes of different sets. If two sets have
the same cardinality, we can say that they have the same "size" or "number of
elements". This allows us to reason about which sets are larger or smaller and to
compare their properties.
2|Page
3. Infinite sets:
The concept of cardinality allows us to reason about infinite sets, which cannot be
counted in the usual way.
For example,
we can say that the set of all even numbers has the same cardinality as the set of all
integers, even though the set of even numbers is a proper subset of the set of integers.
This concept is crucial in understanding the properties of infinite sets and in developing
mathematical theories that involve them.
4. Set operations:
Cardinality plays an important role in set operations like union, intersection, and
complement.
For example,
if we have two finite sets A and B, we can determine the cardinality of their union by
adding the cardinalities of A and B and subtracting the cardinality of their
intersection. Similarly, we can determine the cardinality of the complement of a set by
subtracting its cardinality from the cardinality of the universal set. These operations
allow us to reason about the properties of sets and to perform operations on them.
Q2. How do you perform set operations such as union, intersection, and
complement, and what are some real-world examples of when these operations
might be useful?
Answer:-
Set Operations:Definition:the operations that are performed on two or more sets to obtain a single set containing a
combination of elements from both all the sets being operated upon.
Types Of Set Operations:-
3|Page
There are basically three types of operation on sets in Mathematics; they are:
1)The Union of Sets (∪) :2)The Intersection of Sets (∩) :3)Complement Of Sets :-
Set operations are used to combine or manipulate sets in different ways. Here are the basic
definitions of three common set operations:
Union:
The union of two sets A and B is the set of all elements that are in either A or B or both. The
union of A and B is denoted by A ∪ B.
To perform the union operation, you can list all the elements that are in either A or B, but
without duplicating elements that are in both A and B. For example, if A = {1, 2, 3} and B =
{2, 3, 4}, then the union of A and B is A ∪ B = {1, 2, 3, 4}.
EXAMPLE:
Let U = {a, b, c, d, e, f, g}
A = {a, c, e, g},
Then A  B = {x U | x A or x  B} ={a, c, d, e, f, g}
B = {d, e, f, g}
VENN DIAGRAM FOR UNION:
A  B is shaded
Intersection:
The intersection of two sets A and B is the set of all elements that are in both A and B. The
intersection of A and B is denoted by A ∩ B.
To perform the intersection operation, you can list all the elements that are in both A and B.
For example, if A = {1, 2, 3} and B = {2, 3, 4}, then the intersection of A and B is A ∩ B =
{2, 3}.
EXAMPLE:
4|Page
Let U = {a, b, c, d, e, f, g}
A = {a, c, e, g},
B = {d, e, f, g}
Then A  B = {e, g} VENN DIAGRAM FOR INTERSECTION: U
VENN DIAGRAM FOR INTERSECTION:
A  B is shaded
Complement:
The complement of a set A with respect to a universal set U is the set of all elements that are
in U but not in A. The complement of A is denoted by A'.
To perform the complement operation, you can list all the elements that are in U but not in A.
For example, if U is the set of all integers and A = {1, 2, 3}, then the complement of A with
respect to U is A' = {..., -2, -1, 0, 4, 5, ...}.
EXAMPLE:
Let U = {a, b, c, d, e, f, g]
A = {a, c, e, g}
Then A c = {b, d, f}
VENN DIAGRAM FOR COMPLEMENT:
Ac is shaded
Note that these set operations can be combined to perform more complex operations on sets.
For example, you can find the relative complement (or set difference) of A with respect to B
by taking the elements in A that are not in B: A \ B = {x | x ∈ A and x ∉ B}.
5|Page
some real-world examples
Set operations are used in various fields to solve real-world problems. Here are
some examples:

Union:
Suppose a store wants to determine its total customer base. They have two
lists: one of online customers and another of in-store customers. The union of these
two lists would give them the total customer base.

Intersection:
In an election, the candidate who receives the most votes wins. To determine
the winner, we need to find the intersection of the sets of eligible voters and those
who voted for each candidate.

Complement:
A survey might be conducted to find out how many people own cars.
The complement of this set with respect to the universal set of all adults in a given
city would give the number of people who don't own cars.
6|Page
Download