What is Discrete Mathematics

It is the part of mathematics that deals with discrete objects, this meaning objects that are not continuous. It is concerned with the study of structures and algorithms used to represent and manipulate discrete objects.

Discrete Objects are distinct or separate from each other, things like integers, or rational numbers.

Discrete mathematics has a lot of applications that encompasses many different areas of study, with a very large application to computer science. It is used in programming languages, cryptography, data structures, and more.

Graph Theory is used to model and analyze networks such as social networks, communicate networks, and communication networks

Boolean Algebra studies logical operations such as and or & not see [Here](../CM 1005 Fundamentals of Computer Science/Week 1) for the computer science fundamentals week one explanation on some of those concepts

  • Boolean Algebra is used to design and analyze/create digital circuits, and it is important for computer science.

Data Structures are used to store and manipulate data that is efficient and effective. It is an important aspect of computer science, and you use discrete mathematics in order to create and analyze these data structures.


This Course Introduces

  • Sets
  • Functions
  • Relations
  • Graphs
  • Trees
  • Logic
  • Combinatorics
  • Mathematical proofs and ecursive relations.

The definition of a Set

Set Theory is a branch of mathematics that deals with the properties of well-defined collections of objects

It was introduced by one “George Cantor”, a German mathematics, and set theory forms that basis of several other fields of study such as counting theory, relations, graph theory, and finite state machines

Outline:

  • Definition of a set
  • Set Notation:
    • Element of a set
    • Carnality of a set
    • Subset of a set

Set- mathematicians use the term set to refer to a collection of any kind of object: people, ideas or numbers, for example

A set is a weel defined collection of any kind of objects:

  • E = {2, 6, 4, 8} - this is an example of a set E that is the set of all positive even integers less than 10
  • C = {red, green, blue} this is an example of a set C that is the set of different colors

The following is also the given notation, you would have the variable that the set is equal to, and then you would have curly brackets encompassing the given elements of the set

An empty set can be a circle with a strike through: ∅

Definition: A set if an unordered collection of unique objects.

Pasted image 20261010125901.png

Given that there can be NO DUPLICATES, and that the order of the values inside of a set does NOT matter, then all three of the above hand sets are all actually equal to one another

Elements of a set:

  • In mathematics we use the ∈ (element of) to show that an object belongs to a set. Basically you use ∈ in order to refer to elements of a set.
  • You then in tandem use ∉ to show that an element does NOT belong in a set.

Pasted image 20261010130659.png

Cardinality of a set (Card)

Definition: Given a set S, the cardinality of a S is the number of element contained in S. We write the cardinality of S as |S|. This is basically the number of unique elements that are contained within of a single set

Pasted image 20261010130909.png

Subset of a set: ⊆

Definition:

  • A is a subset of B if and only if the EVERY element of A is also an element of B. In this case you would write this as A ⊆ B
  • Basically, a given set is a subset of another set if the ladder set contains all of the elements of the former set

So A = {1, 2, 3, 4, 5} & B = {1, 2, 3, 4, 5, 6, 7, 8} , in this case because all of the elements of A are also in B, then A ⊆ B

That is: A ⊆ B <-> if x ∈ A then x ∈ B(for all X)

  • In English this is basically saying that A is a subset of B is equal to if x is an element of A then x is an element of B (for all x)
  • Basically, if x, or whatever element x may be, is in fact an element of A, and we know that A is a subset of be, then that means that the same element X is also going to be an element of B as well

Pasted image 20261010131649.png

Common Logic:

The Empty Set is a subset of ANY set so basically {} ∈ S where S is basically any set Possible, this is logically because a set does not have a finite limit of space, and therefore can always contain something else, or nothing else really. I do not know why this is useful, but I guess so

Any set is a subset of itself: (S ⊆ S), this is because a single set obviously contains all of the same elements that it itself contains.

Special Sets:

N = set of natural numbers = {1, 2, 3, 4, 5, …}
Z = set of integers = {-3, -2, -1, 0, 1, 2, 3}
Q = set of all rational numbers (of form a/b where a and b are elements of Z and b!= 0)
R = set of all real numbers

Logically speaking then: N ⊆ Z ⊆ Q ⊆ R


The listing Method and Rule of Inclusion

Listing Method:

  • Representing a set S using the listing method consists of listing all of the elements of S.
  • This would look something like S1 = {a, e, i, o, u} (this is the listing method)
  • You basically write it like how you might define a given set in python

Set Builder Notation

This is basically where you can look at if there is a given pattern of existence for your set. So take for example S2 = a set of all even integers you know that all even integers are basically just multiples of two, so you can describe the set as:

S2 = {2*n | n ∈ Z} 
==
S2 = {-6, -4, -2, 0, 2, 4, 6}

Basically you set up the second set with a mathematical definition for how you would end up getting the given set. Notice that the Z is the previously mentioned set of all integers. This means that the | n ∈ Z part means that each value of n is an element of the set Z

Another example would be: S3 = a set of all odd integers, and can be described as:

S3 = {2*n + 1 | n ∈ Z}
S3 = {-5, -3, -1, 1, 3, 5}

The same principle applies, you basically give an expression that can then be used to define the entire set.

Uses for the Set Builder Notation:

Say you wanted to give a good representation for the Set of Q which as defined before hand is the set of all rational numbers of form a/b where a ∈ Z || b ∈ Z where b != 0.

Due to the fact that this not in fact a finite set, you cannot represent it using the list method, so instead you can use the set builder method:

Q = {m/n | n,m ∈ Z and m != 0}

You can also actually use the Set Builder notation for non numerical sets as well. This would include things like S1 = Bag = {pen, book, laptop, ...} and this is the list notation. However you can use the set builder notation as well, and it would be something like Bag = {x | x is in my bag}

EXAMPLE TRANSLATIONS

Set Builder -> List
S1 = {3n | n ∈ N and n < 6} = {3*1, 3*2, 3*3, 3*4, 3*5} = {3, 6, 9, 12, 15}

S2 = {2^n | n ∈ Z and 0 <= n <= 4} = {1, 2, 4, 8, 16}

List -> Set Builder
S3 = {1/2, 1/4, 1/6, 1/8, 1/10} = {1/(2*n) | n ∈ Z and 0 < n <= 5}

S4 = {1, 2, 4, 8, 16, 32, 64, 128} = {2^n | n ∈ Z and 0 <= n <= 7}

Pasted image 20261010135431.png

The power-set of a set

A set can have another set as it’s element. Think of this basically just like nested lists inside of a programming language.

A = {1, 2, 3, 4, 5, 6, 7, 8, 9}
B = {{1, 2, 3, 4}, {5, 6}, {7, 8, 9}}

Basically for this example, you can say that x ∈ B then it must also be x ⊆ A, so in theory the inner sets are elements of B, and because they encompass the same values, are also therefore subsets of A

  • So something like { 1, 2, 3, 4 ⊆ A but {1, 2, 3, 4 ∈ B

Powerset of a Set:

Definition: given a set of S, the powerset of S, P(S), is the set containing all the subsets of S.

This does mean ALL of the subsets, it cannot only have a few subsets of S and still be considered a powerset, it must in fact contain every single possible combination of the subsets: usually denoted I assume as n! where n is the |S|: I lied, it was as I had first thouht

S1 = {1, 2, 3}

P(S1) = {{} or ∅, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, {1, 2, 3}}

Exercise one:

Given a set of S = {a, b}

Write Down P(S):

  • P(S)= {{a}, {b}, {a, b}, ∅}

Is {a} a subset of an element of P(s):

  • Clearly an element, for it to be a subset it would have to be {{a}}

Is the empty set an element or a subset of P(S):

  • It would be considered technically both I believe, it is an element because it exists in every single set, we know this because ∅ ∈ S, but given the definition then of what a power set it, I suppose it would probably not be considered a subset for the sheer fact that it isnt outright included in every single element of P(S)
  • UPDATE: he said it was both so i was right

Logically P(∅) is basically just the empty set so {∅} or {{}} , and so the P(P(∅)) = {∅, {∅}} or {{}, {{}}}

Cardinality of a powerset:

Given a set S, then |P(S)| =

Examples:

  • S = {1, 2, 3}. |S| = 3, so |P(S)| = meaning that there is a total of 8 different elements inside of the powerset of the set: S

Given a set A, if |A| = n, find |P(P(P(A)))|

  • Basically you now that each one of this is going to be an exponent of two, so you go like this: you basically just keep on going another exponential moment for each of the given power sets that you are looking for.

Set Operations

This follows the following:

  • Set Intersection
  • Set Union
  • Set difference
  • Symmetric Difference

Union (A U B)

Definition: Given two sets A and B the union of A and B, A U B, contains ALL of the elemnts in EITHER A or B

A U B = {x | x ∈ A or x ∈ B}, basically you combine the the two of the sets, and this follows basic set rules in the idea that you do not have things like repeating values.

EXAMPLE

A = {2, 4, 6, 8} = {2n | n ∈ Z where 0 < n < 4}
B = {1, 3, 5, 7, 9} = {2n - 1 | n ∈ Z where 0 < n <= 5}

A U B = {1, 2, 3, 4, 5, 6, 7, 8, 9}

Membership table (A U B)

  • Membership tables show all the combinations of sets an element can belong to:
    • 1 means the element belongs to the set
    • 0 means it does not belong to the set
ABA U B
000
011
101
111

This basically follows the or / || logic or I guess it would be v for the boolean algebra. This basically means that if the element belongs in either A or in B then it would also belong inside of the union of A U B

Intersection ( A ∩ B)

Definition: Given two sets A and B, the intersection of A and B, A ∩ B contains all of the elements that reside in A AND B

A ∩ B = {x | x ∈ A and x ∈ B}

This basically means what two given elements do the two different sets have in common, this is kind of like the ^ / and / && operator inside of boolean algebra

EXAMPLE
A = {2, 4, 3, 6, 7}
B = {1, 3, 5, 7, 9}

A ∩ B = {3, 7}

The two sets only have the elements 3 and 7 in common, and so their sets only contain those two elements.

Membership table for ∩

ABA ∩ B
100
111
000
010

Set Difference ( A - B)

Definition: Given two sets A and B, the set difference, A-B contains the elements that are in A but ARE NOT IN B

A-B = {x | x ∈ A and x ∉ B}

EXAMPLE

A = {2, 4, 3, 6, 7}
B = {1, 2, 4, 5, 7}

A-B = {2, 6}

The only elements that A has that B does not have are 2 and 6, even though the values of 1 and 5 are unique to be because they are not in a, this does not matter. If we had something like B-A then the answer would be {1, 5}

Membership Table (A - B)

ABA - B
101
110
000
010

This one really feels like the -> operator in the boolean algebra logic, which technically was ”<=” under the hood but that was only for the context of a one or a zero pretty much, but still, pretty sure this translates over to the If A then B / A -> B operator from boolean algebra

Symmetric Difference (A ⊕ B)

Definition: Given two sets A and B, the symmetric difference, A ⊕ B, contains the elements that are in A or in B, but NOT IN BOTH

A ⊕ B = {x | (x ∈ A or x ∈ V) and x ∉ A ∩ B}

This basically is the XOR or exclusive OR operator inside of boolean algebra, and consists of the idea that these are the elements that are exclusive to both A and B, the above statement says that x is an element of A or of B, but it is not an element of the intersection of A and B

This technically means:
A ⊕ B = (A U B) - (A ∩ B)

This basically means that the symmetric difference of A and B is equal to the union of A and B (which is equal to all of elements in A and B combined) minus the intersection of A and B, which is all of the elements that A and B have shared. This therefore is basically (Total Unique Elements) - (Any elements shared in common) which results in only elements that are unique to both sets

Example:

A = {2, 4, 3, 6, 7}
B = {1, 3, 4, 5, 7}

(A U B) = {1, 2, 3, 4, 5, 6, 7}
(A ∩ B) = {3, 4, 7}

(A⊕B) = (A U B) - (A ∩ B) = {1, 2, 5, 6}

Membership Table of A ⊕ B:

ABA ⊕ B
101
110
000
011

This one is basically exactly like the XOR conditional in boolean algebra

Pasted image 20261010150729.png

WORK:

Read the following extracts from the Koshy textbook. These pages will cover the following topics: the definition of a set; elements of a set; cardinality of a set; listing method; set builder method; subsets of a set; and powersets.

Once you’ve finished reading, attempt the following questions from Exercises 2.1 on pp.76: 1–27, 30–36 and 41–44.

Notes on Book:

Problems in this give chapter:
  • Find the number of positive integers ≤ N and divisible by a, b, or c.
  • How many subsets does a finite set with n elements have?
  • How would you define the set of legally paired parentheses?
  • How many sequences of legally paired parentheses can be formed using n pairs of left and right parentheses?

A Set is a collection of well-defined objects, called elements or members of the set.

There should be no ambiguity if an object belongs or does not belong to a set. So something like the vowels of the English alphabet make a defined set, but something like beautiful american cities does not.

Sets are denoted by capital letters and then their Elements are denoted by lowercase letters

If an object x is an element of a set A, then you would write x ∈ A or x ∉ A if the element is not part of the set. So for a set of New England states called A : Connecticut ∈ A, whereas Michigan ∉ A

Two methods to define a set

Listing method you can define a set outright with all of the given elements, so something like:

Set-Builder Notation defines the set as an instruction for a given amount of parameters, infinite or finite, there is more about this earlier in the notes, it follows the idea of S {x|P(x)} where P(x) is a predicate indicating the property the object x has

B = {1, 3, 5, 7, 9}

B = {x | 2x-1 for 0 < x <= 5}

The order of a set does not matter and as long as a set contains the same elements as another set they are equal, even if the items are listed in two different orders

Pasted image 20261011164317.png

This is basically a logical fallacy if you think about it, Does there exist a set that contains itself? Well logically if the set does contain itself, then it would break the rule that would define it, the rule of X ∉ X. However, by this logic, if it does not contain itself, then it fits the rule of X ∉ X and must contain itself. It does not make sense because it is paradoxical.

Subsets

If every element of a given set A is also an element of B, then A is a subset of B, this is then denoted by the symbol of A ⊆ B

In symbols (A ⊆ B) ↔ (∀x)(x ∈ A → x ∈ B) this is basically saying that if and only if A is in fact a subset of B, then for every single value of x if x is an element of A then x must also be an element of B

This is logical if you think about it, its basically the fancy way of saying that if one set is a subset of another set that means all of the elements in the subset must also be in the containing set

Containment is basically the idea that B contains A, and this is written using the symbol B ⊇ A

Therefore all that you need to do in order to show that a set is not a given subset of another set is to showcase that the supposed subset contains a value that cannot be found in the supposed containing set, this is then denoted as A ⊄ B

Equality of Sets

Two sets A and B are equal A = B whenever they contain the same elements. This means that:

A = B if (A ⊆ B) ^ (B ⊆ A)

If A ⊆ B and A ≠ B, then A is a **proper subset** of B, denoted by A ⊂ B

This basically is saying that the difference between A ⊂ B and A ⊆ B is that one of them is basically saying that the two sets are actually equal to each other, while the other one is saying that they are not equal, but set B still contains set A in both cases.

The set containing no elements is empty or null and is denoted with the symbol: ∅

Pasted image 20261011170110.pngPasted image 20261011170220.png

Powersets:

These are just sets that contain other sets, in reality it isnt that simple, a powerset of another set has to contain all possible combinations of the elements within of a given set. The number of these combinations can be calculated using the formula of where n is equal to the number of elements in a set.

Pasted image 20261011170540.png

Pasted image 20261011170616.png