DM
DM
Mathematical Logic
1. Propositional Logic
Propositional logic deals with propositions (statements) that are either true (T) or false (F).
It uses logical operators to build complex expressions.
Logical Operators
2. Law of Logic
1. Tautology: A compound statement that is always true, regardless of the truth values
of the individual propositions.
o Example: P ∨ ¬P (This is always true).
2. Contradiction: A compound statement that is always false.
o Example: P ∧ ¬P (This is always false).
3. Contingency: A compound statement that is neither always true nor always false.
o Example: P ∨ Q (Its truth depends on the values of P and Q).
4. Logical Equivalence: Two statements are logically equivalent if their truth tables are
identical.
o Example: (P → Q) is equivalent to (¬P ∨ Q).
3. Algebra of Propositions
devadrshhh
• Basic Laws:
o Commutative Law: P ∨ Q = Q ∨ P and P ∧ Q = Q ∧ P
o Associative Law: (P ∨ Q) ∨ R = P ∨ (Q ∨ R)
o Distributive Law: P ∧ (Q ∨ R) = (P ∧ Q) ∨ (P ∧ R)
• De Morgan's Laws:
o ¬(P ∧ Q) = ¬P ∨ ¬Q
o ¬(P ∨ Q) = ¬P ∧ ¬Q
Solving Logic:
4. Validity of Arguments
Logical Implication
5. Quantifiers
1. Universal Quantifier (∀): States that a property is true for all elements.
o Example: ∀x (P(x)) means "P(x) is true for all x."
2. Existential Quantifier (∃): States that a property is true for at least one element.
o Example: ∃x (P(x)) means "There exists at least one x for which P(x) is true."
Set Theory
• Basic Concepts:
o A set is a collection of distinct objects.
o Elements are the individual objects in a set.
o Notation: Sets are denoted by curly braces {}.
o Membership: ∈ denotes membership, ∉ denotes non-membership.
o Cardinality: The number of elements in a set, denoted by |A|.
• Types of Sets:
o Finite Set: Contains a finite number of elements.
o Infinite Set: Contains an infinite number of elements.
o Empty Set (∅): Contains no elements.
devadrshhh
oUniversal Set (U): The set of all elements under consideration.
oSubset: A set A is a subset of B (A ⊆ B) if every element of A is also in B.
• Set Operations:
o Union (∪): The set of elements in A or B or both.
o Intersection (∩): The set of elements common to both A and B.
o Difference (-): The set of elements in A but not in B.
o Complement (Aᶜ): The set of elements not in A.
• Venn Diagrams: Visual representations of sets and their relationships.
Relations
• Cartesian Product: The set of all ordered pairs (a, b) where a ∈ A and b ∈ B.
• Relation: A subset of the Cartesian product.
• Types of Relations:
o Reflexive: Every element is related to itself.
o Symmetric: If (a, b) ∈ R, then (b, a) ∈ R.
o Transitive: If (a, b) ∈ R and (b, c) ∈ R, then (a, c) ∈ R.
o Anti-symmetric: If (a, b) ∈ R and (b, a) ∈ R, then a = b.
• Equivalence Relation: A relation that is reflexive, symmetric, and transitive.
• Equivalence Class: A set of elements that are related to each other under an
equivalence relation.
Functions
Introduction to Graphs
This document explores the fundamental concepts of graphs, their properties, and various
types.
Definition:
• V: A set of vertices (also called nodes). These represent entities or objects in the system.
• E: A set of edges that connect pairs of vertices. Edges represent relationships or connections
between the vertices.
devadrshhh
Properties of Graphs:
Types of Graphs:
• Simple Graph: No loops (edges starting and ending at the same vertex) or multiple edges
between vertices.
• Regular Graph: All vertices have the same degree. (e.g., 3-regular graph: all vertices have
degree 3).
• Null Graph: Contains no edges.
• Subgraph: A graph formed by a subset of vertices and edges from another graph.
• Isomorphic Graphs: Two graphs with the same structure (number of vertices, edges, and
degree distribution) but different visual representations.
Definitions:
• Walk: A sequence of vertices and edges where repetition is allowed. (e.g., v1 -> v2 -> v3)
• Path: A walk with no repeated vertices.
• Trail: A walk with no repeated edges.
• Circuit: A trail that starts and ends at the same vertex.
• Cycle: A path that starts and ends at the same vertex without repeating any edges or
vertices (except the starting/ending vertex).
• Complete Graph (Kn): A graph where every pair of vertices is connected by an edge. Kn for n
vertices has n(n-1)/2 edges.
• Hand-Shaking Theorem: The sum of degrees of all vertices in a graph is twice the number of
edges. Formula: Σdeg(v) = 2|E|.
Connected Graph: A graph where there exists a path between every pair of vertices.
Euler Graph: A graph that contains an Euler circuit: a circuit that traverses each edge
exactly once. Condition: All vertices have an even degree.
Hamiltonian Graph: A graph that contains a Hamiltonian cycle: a cycle that visits each
vertex exactly once.
Travelling Salesman Problem (TSP): An optimization problem to find the shortest route
that visits every vertex exactly once and returns to the starting point.
Operations on Graphs:
devadrshhh
• Union: Combines two graphs by merging their vertices and edges.
• Intersection: The common vertices and edges of two graphs.
• Complement: A graph where edges are added between vertices not originally connected.
• Homeomorphism: Two graphs that can be transformed into each other by inserting or
removing vertices of degree 2.
Planar Graph: A graph that can be drawn on a plane without edges crossing.
Matrix Representation:
• Adjacency Matrix: A matrix A where A[i][j] = 1 if there's an edge between vertices i and j;
otherwise, A[i][j] = 0.
• Incidence Matrix: A matrix where rows represent vertices, and columns represent edges. 1
indicates a vertex is incident to an edge.
Bi-Partite Graph: A graph whose vertices can be divided into two disjoint sets U and V,
such that every edge connects a vertex in U to one in V.
Graph Colouring: Assigning colors to vertices such that no two adjacent vertices share the
same color.
Basic Theorems:
• Tree: A tree is an undirected graph that is connected and contains no cycles. It is a special
type of graph with a hierarchical structure, where there is exactly one path between any two
nodes.
• Properties of Trees:
o A tree with nnn vertices has exactly n−1n-1n−1 edges.
o Any two nodes are connected by exactly one path.
devadrshhh
o Removing any edge in a tree will disconnect the tree into two components.
• Pendant Vertex: A pendant vertex (or leaf) is a vertex that is connected to exactly one other
vertex. It is an endpoint in the tree.
• Distance: The distance between two vertices in a tree is the number of edges in the shortest
path between them.
• Eccentricity: The eccentricity of a vertex is the greatest distance from that vertex to any
other vertex in the tree.
• Center of a Tree: The center of a tree is the set of vertices that are closest to all other
vertices, typically characterized by the smallest maximum distance (or eccentricity) to other
vertices. The center is typically one or two vertices, and it minimizes the maximum distance
to all other nodes.
• Rooted Tree: A rooted tree is a tree in which one vertex is designated as the "root," and all
other vertices are reachable from it by a unique path. The root serves as the starting point
for traversals and other tree operations.
• Binary Tree: A binary tree is a type of tree where each node has at most two children,
referred to as the left and right children.
o Properties:
▪ In a full binary tree, each node has either two or zero children.
▪ In a complete binary tree, all levels are filled except possibly for the last one,
and all nodes are as far left as possible.
▪ In a perfect binary tree, all internal nodes have two children, and all leaf
nodes are at the same level.
▪ A binary search tree (BST) is a type of binary tree where for every node, the
left child contains smaller values, and the right child contains larger values
than the parent.
• Minimum Spanning Tree (MST): A minimum spanning tree of a weighted graph is a spanning
tree that connects all vertices with the smallest possible sum of edge weights.
• Prim's Algorithm:
o A greedy algorithm that grows the MST one vertex at a time. It starts with a single
vertex and repeatedly adds the shortest edge that connects a vertex in the tree to a
vertex outside the tree.
o Steps:
1. Start with an arbitrary vertex.
devadrshhh
2. Find the minimum weight edge connecting a vertex in the tree to a vertex
outside the tree.
3. Repeat until all vertices are included in the tree.
• Kruskal's Algorithm:
o A greedy algorithm that considers all edges in increasing order of their weight and
adds them to the MST if they do not form a cycle.
o Steps:
1. Sort all edges in non-decreasing order of their weights.
2. Add edges to the MST, ensuring no cycles are formed.
3. Stop when there are n−1n-1n−1 edges in the MST, where nnn is the number
of vertices.
• Problem-Based: These algorithms can be applied to various problems such as finding the
shortest paths, designing networks, or optimizing connections.
• Cut-Set: A cut-set in a graph is a set of edges whose removal would disconnect the graph
into two or more components.
• Cut-Vertex: A cut-vertex (or articulation point) is a vertex whose removal increases the
number of connected components in the graph. In other words, removing a cut-vertex
disconnects the graph.
• Connectivity of a Graph: A graph is said to be connected if there is a path between any two
vertices. A graph is disconnected if there are pairs of vertices that do not have a path
between them.
o K-Connectivity: A graph is kkk-connected if it remains connected after the removal
of any k−1k-1k−1 vertices.
• Weighted Graph: A weighted graph is a graph where each edge has an associated numerical
value (weight), which can represent distances, costs, or other metrics. Weighted graphs are
often used in algorithms like Dijkstra’s shortest path or Prim’s and Kruskal’s MST algorithms.
devadrshhh