SlideShare a Scribd company logo
1 of 58
Download to read offline
88
Matrix Operations
β–· 1 β–· Computational Problem Solving
88
A matrix (plural: matrices) is simply an β€˜array’ of numbers, e.g.
But the power of matrices comes from being able to multiply matrices by vectors
and matrices by matrices and β€˜invert’ them: we can:
1. represent linear transformations using matrices (e.g. rotations, reflections
and enlargements)
2. Use them to solve linear simultaneous equations.
The first of these means matrices are particularly useful in 3D
graphics/animation, since they allow us to rotate the camera and project 3D
data onto a 2D viewing plane. But matrices are used everywhere, including
robotics, computer vision, optimisation, classical and quantum mechanics,
electromagnetism, optics, graph theory, statistics, ...
On a simple level, a matrix is simply a way to organise values into rows and columns,
and represent these multiple values as a single structure.
β–· 2 β–· Introduction to matrices
88
The zero matrix, 𝑍 or 𝟎 is the matrix with zero as each element.
The identity matrix is the matrix with ones on its main diagonal.
The 2x2 identity matrix is 𝐼 =
1 0
0 1
And has the property that 𝐼𝐴 = 𝐴𝐼 = 𝐴
In general, matrix multiplication is not commutative, i.e. 𝐴𝐡 β‰  𝐡𝐴
It is, however, associative, i.e. 𝐴 𝐡𝐢 = 𝐴𝐡 𝐢
β–· 3 β–· Introduction to matrices
88
The dimension of a matrix is its size, in terms of its number of rows and columns.
2 ο‚΄ 3
3 ο‚΄ 1
1 ο‚΄ 3
A matrix can have square or curvy brackets*.
Matrix Column Vector
(The vector you know
and love)
Row Vector
So a matrix with one column is simply a vector in the usual sense.
β–· 4 β–· Introduction to matrices
88
If we wish a variable to represent a matrix, we use bold, capital letters.
𝑨 =
1
6
βˆ’3
π‘ͺ = π‘·βˆ’πŸπ‘»π‘·
Each value within a matrix is known as an element.
If A is a matrix, then we can refer to the element in the ith row and jth
column as π‘Žπ‘–,𝑗.
𝑐1,2 = 3 𝑐2,1 = 4 𝑐1,3 = βˆ’7
β–· 5 β–· Introduction to matrices
88
Simply add/subtract the corresponding elements of each matrix.
They must be of the same dimension.
β–· 6 β–· Adding/Subtracting Matrices
88 β–· 7 β–· Vectors
A row vector is a 1 Γ— 𝑛 matrix and a column vector is a
𝑛 Γ— 1 vector. Vectors have similar properties to matrices
(in terms of addition and subtraction) although have their
own form of multiplication.
There are two ways to multiply vectors – dot product and
cross product. We only look at dot product which is (for a
3D vector)
π‘Ž
𝑏
𝑐
β‹…
π‘₯
𝑦
𝑧
= π‘Žπ‘₯ + 𝑏𝑦 + 𝑐𝑧
For example:
1
4
β‹…
2
βˆ’1
= 1 Γ— 2 + 4 Γ— βˆ’1 = 2 βˆ’ 4 = βˆ’2
88
A scalar is a number which can β€˜scale’ the elements inside a matrix/vector.
1
2
3
β–· 8 β–· Scalar Multiplication
88
This is where things get slightly more complicated...
1 0 3 -2
2 8 4 3
7 -1 0 2
5 1
1 7
0 3
8 -3
-11
We start with this row and
column, and sum the products
of each pair.
(1 x 5) + (0 x 1) + (3 x 0) + (-2 x
8) = -11
This is known as finding the
β€œdot/scalar product” of the two
vectors.
16
Now repeat for the next row of the left matrix...
42 61
50 -6
β–· 9 β–· Matrix Multiplication
88
=
1 2 3
1
2
3
= 14
1
2
3
1 2 3 =
1 2 3
2 4 6
3 6 9
a
b
c
d
e
f
β–· 10 β–· Matrix Multiplication
88
Matrix multiplications are not always valid: the dimensions have to agree.
Note that only square matrices (i.e. same width as height) can be raised to a power.
Dimensions of A Dimension of B Dimensions of AB (if valid)
2 ο‚΄ 3 3 ο‚΄ 4 2 ο‚΄ 4
1 ο‚΄ 3 2 ο‚΄ 3 Not valid.
6 ο‚΄ 2 2 ο‚΄ 4 6 ο‚΄ 4
1 ο‚΄ 3 3 ο‚΄ 1 1 ο‚΄ 1
7 ο‚΄ 5 7 ο‚΄ 5 Not valid.
10 ο‚΄ 10 10 ο‚΄ 9 10 ο‚΄ 9
3 ο‚΄ 3 3 ο‚΄ 3 3 ο‚΄ 3
β–· 11 β–· Matrix Multiplication
88
The transpose of a matrix is formed by swapping the columns and row.
For example, if 𝐴 =
π‘Ž 𝑏
𝑐 𝑑
, then 𝐴𝑇
=
π‘Ž 𝑐
𝑏 𝑑
The determinant of a 2x2 matrix is π‘Žπ‘‘ βˆ’ 𝑏𝑐, written as det 𝐴 = π‘Žπ‘‘ βˆ’ 𝑏𝑐. The inverse is:
π΄βˆ’1
=
1
π‘Žπ‘‘ βˆ’ 𝑏𝑐
𝑑 βˆ’π‘
βˆ’π‘ π‘Ž
We can use this to solve simultaneous equations
i.e.
π‘Žπ‘₯ + 𝑏𝑦 = 𝑒
𝑐π‘₯ + 𝑑𝑦 = 𝑓
Becomes 𝐴π‘₯ = 𝑏 or
π‘Ž 𝑏
𝑐 𝑑
π‘₯
𝑦 =
𝑒
𝑓
Which means that: π‘₯ = π΄βˆ’1
𝑏, or
π‘₯
𝑦 =
π‘Ž 𝑏
𝑐 𝑑
βˆ’1 𝑒
𝑓
β–· 12 β–· Matrix transpose / Inverse
88 13
88
Graphs and Trees
β–· 14 β–· Computational Problem Solving
88 β–· 15 β–· Applications
Graph theory is important to find:
a) Shortest distance between two points
b) Search engine optimisation
c) Communications
d) Travelling salesperson problem
e) Graph colouring (used for parallel computing)
f) Data science
88 β–· 16 β–· Introduction
Graph theory is not about the sort of graphs you did at school!
88 β–· 17 β–· Applications
88 β–· 18 β–· What is a graph?
1. A graph is a set of vertices (V) and
edges (E)
2. Each edge in E has two endpoints
which connect two elements of V
(Possibly the same element)
3. In an undirected graph, edges have
no specific direction, and can be
considered to connect a to b or b to
a
4. In a directed graph, edges do have a
specific direction
5. The number of endpoints at a vertex
is called the degree of that vertex
88 β–· 19 β–· Representing Graphs
We can represent a graph with a
diagram.
The vertices are blobs
Undirected edges are lines
a
b
c
e
d
g
f
88 β–· 20 β–· Representing Graphs
We can represent a graph with a
diagram.
The vertices are blobs
Undirected edges are lines
Directed edges are arrows
a
b
c
e
d
g
f
88
Definition
β–· 21 β–· Terminology
The degree of a vertex in an undirected graph is the
number of edges incident to it, except that a loop
contributes twice to the degree.
The degree of a vertex 𝑣 is denoted by deg(𝑣)
deg π‘Ž = 2
deg 𝑏 = 4
deg 𝑔 = 0
For any graph 𝐺 the sum of the degrees for all vertices equals to the number of edges
multiplied by two.
That is, 2π‘š = Οƒπ‘£βˆˆπ‘‰ deg(𝑣) where π‘š is the number of edges in the graph 𝐺 = (𝑉, 𝐸)
88
My Turn Your Turn
β–· 22 β–· Degrees of Vertices Example
Find the number of vertices, the number of edges and
the degree of each vertex in the given undirected
graph. Identify all isolated and pendant vertices.
𝑣 = 6
𝑒 = 6
deg π‘Ž = 2
deg 𝑏 = 4
deg 𝑐 = 1
deg 𝑑 = 0
deg 𝑒 = 2
deg 𝑓 = 3
𝑐 is pendant (vertex has degree 1) and 𝑑
is isolated (vertex has degree 0).
Find the number of vertices, the number of edges and
the degree of each vertex in the given undirected
graph. Identify all isolated and pendant vertices.
𝑣 = 5
𝑒 = 12
deg π‘Ž = 5
deg 𝑏 = 6
deg 𝑐 = 5
deg 𝑑 = 5
deg 𝑒 = 3
There are no isolated or pendent vertices as
none of the vertices have degree 0 or 1
88 β–· 23 β–· Handshaking Lemma
Every edge has two endpoints
The sum of all the endpoints in a
graph must be even.
If there are n edges, there must be
2𝑛 endpoints
This is known as the "Handshaking
Theorem"
The sum of all the endpoints in a
graph is equal to the sum of all the
vertex degrees
The sum of all vertex degrees must
be even
෍
π‘£βˆˆπ‘‰
deg 𝑣 = 2|𝐸|
෍
π‘£βˆˆπ‘‰
deg 𝑣
= deg 1 + deg 2 + deg 3 + deg 4 + deg 5 + deg(6)
= 2 + 3 + 2 + 3 + 3 + 1 = 14
2 𝐸 = 2 Γ— 7 = 14 (7 edges in the graph)
88
Definition
β–· 24 β–· Definition of Graph Using Sets
We can represent graphs with sets
G = (V, E)
V = set of vertices, e.g {a,b,c,d,e}
E = set of edges
β€’ e.g. Undirected: E = { {a,b}, {b,c}, {d,e} }
β€’ e.g. Directed: E = { (a,b), (b,c), (d,e) }
88
Definition
β–· 25 β–· Simple graphs
A graph in which each edge connects two different
vertices and where no two edges connect the same pair of
vertices is called a simple graph
A simple graph: And not simple:
What makes the simple graph different to a non-simple graph?
88
Definition
β–· 26 β–· Simple Graph
Simple Graph
β€’ Simple graphs are UNDIRECTED
β€’ Edges connect two different vertices
β€’ So no loops on vertices
β€’ Maximum of one edge between any pair of vertices
Simple Directed Graph
β€’ Same – but edges are directed
NOTE: To avoid confusion this
module will standardise on
the common definition of a
simple graph as UNDIRECTED
(as found in Rosen)
88
Definition Characteristics
Examples Non-Examples
β–· 27 β–· Frayer Diagram
Simple
Graph
a simple graph is an unweighted, undirected graph
containing no loops or multiple edges. It can be either
connected or disconnected
88
β€’ An undirected graph is connected if there is at least one path
between any two vertices
β€’ A directed graph is strongly connected if there is at least one path
between any two vertices that follows all the directions of the edges
β€’ A directed graph is weakly connected is there is at least one path
between any two vertices that ignores all the directions of the edges
88
β€’ A bridge is an edge which, if removed, would cause the graph to
become disconnected
a c
b
d
f
e
88
β€’ A graph that is not connected has two or more connected
components.
β€’ These components are disjoint
β€’ The union of all components is the original graph
a c
b
d
f
e
88
Definition
β–· 31 β–· Adjacency List
A table with 1 row per vertex, listing its adjacent vertices.
a b
d
c
f
e
Vertex
Adjacent
Vertices
a
b
b, c
a, c, e, f
c a, b, f
d
e b
f c, b
88
Definition
β–· 32 β–· Adjacency Matrix
A way to represent simple graphs
β€’ possibly with self-loops.
Matrix A=[aij], where aij is 1 if {vi, vj} is an edge of G, and is
0 otherwise.
Can extend to pseudographs by letting each matrix
elements be the number of links (possibly >1) between the
nodes.
88
Examples
β–· 33 β–· Adjacency Matrix – Undirected
0
1
7
2
5
3
4
6
88
Examples
β–· 34 β–· Adjacency Matrix – Directed
1
2
3
4
88
My Turn Your Turn
β–· 35 β–· Adjacency Matrix Example
0
0
1
0
0
0
6
0
0
1
0
1
1
5
1
1
0
1
0
0
4
0
0
1
0
1
0
3
0
1
0
1
0
1
2
0
1
0
0
1
0
1
6
5
4
3
2
1
0
2
0
1
1
5
2
0
0
1
1
4
0
0
0
0
0
3
1
1
0
0
2
2
1
1
0
2
0
1
5
4
3
2
1
1 2
3
4
5
88 β–· 36 β–· Graph representation
Adjacency matrices:
Incidence matrices:
0 1 1 0
1 0 0 1
1 0 0 1
0 1 1 0
π‘Ž 𝑏 𝑐 𝑑
π‘Ž
𝑏
𝑐
𝑑
88
β€’ The complete graph Kn
β€’ For any nοƒŽN, a complete graph on n vertices, Kn, is a simple graph
with n nodes in which every node is adjacent to every other node:
ο€’u,vοƒŽV: uο‚Ήvο‚«{u,v}οƒŽE.
β€’ A set of n vertices – all connected to each other
K1 K2
K3
K4
K5 K6
Note that Kn has edges.
2
)
1
(
1
1
βˆ’
=
οƒ₯
βˆ’
=
n
n
i
n
i
88
β€’ The cycle graph Cn
β€’ A set of n vertices (n β‰₯3) { c1, c2, c3, … , cn }
β€’ A set of edges { {c1,c2}, {c2,c3}, {c3, c4}, …, {cn-1, cn} }
C3 C4 C5 C6 C7
C8
How many edges are there in Cn?
88
β€’ The wheel graph Wn
β€’ A set of n+1 vertices (n β‰₯4) { v, c1, c2, c3, … , cn }
β€’ A set of edges { {c1,c2}, {c2,c3}, {c3, c4}, …, {cn-1, cn} }
βˆͺ
{ {v,c1}, {v,c2}, {v,c3}, …, {v, cn} }
β€’ For any nο‚³3, a wheel Wn, is a simple graph obtained by taking the cycle Cn
and adding one extra vertex vhub and n extra edges {{vhub,v1},
{vhub,v2},…,{vhub,vn}}.
W3 W4 W5 W6 W7
W8
How many edges are there in Wn?
88
β€’ The n-cube Qn
β€’ A set of 2n vertices
β€’ Each vertex represents a bit string
β€’ A set of edges
β€’ Each edge connects two vertices that differ by one bit
Q0
Q1 Q2 Q3
Q4
Number of vertices: 2n. Number of edges:Exercise to try!
88
β€’ To draw the n-cube Qn
β€’ Start with Q1
β€’ Duplicate it
β€’ Prefix the original vertices with "0"
β€’ Prefix the duplicate vertices with "1"
β€’ Connect the corresponding vertices
00 01
10 11
88
β€’ To draw the n-cube Qn
β€’ Start with Q2
β€’ Duplicate it
β€’ Prefix the original vertices with "0"
β€’ Prefix the duplicate vertices with "1"
β€’ Connect the corresponding vertices
000 001
010 011
100 101
110 111
88
β€’ A graph is bipartite if its vertices can be divided into two subsets, so
that every edge connects a vertex in one subset to a vertex in the
other.
β€’ Here the subsets are {a,b,c} and {d,e}
a b c
d e
88
β€’ A graph is bipartite if its vertices can be divided into two subsets, so
that every edge connects a vertex in one subset to a vertex in the
other.
β€’ Here the subsets are {a,b,c} and {d,e}
a b c
d e
88
β€’ A bipartite graph is complete if every edge in one subset is connected
to every edge in the other
β€’ The complete bipartite graph of m vertices in one subset and n
vertices in the other is denoted Km,n
a b c
d e
This is the complete
bipartite graph K3,2
K4,3
Km,n has _____ nodes
and _____ edges.
88
β€’ Diagrams can be drawn anyhow
β€’ Vertices can go anywhere
β€’ Lines can cross (and in some cases, must cross)
β€’ With practice, you'll discover how to improve neatness.
88 β–· 47 β–· Special simple graphs
A complete graph on 𝑛 vertices 𝐾𝑛
A cycle 𝐢𝑛 𝑛 β‰₯ 3
A wheel π‘Š
𝑛
88 β–· 48 β–· Bipartite graphs
A simple graph 𝐺 is called bipartite if its vertex set 𝑉 can
be partitioned into two disjoint sets 𝑉1 and 𝑉2 such that
every edge in the graph connects a vertex in 𝑉1 and a
vertex in 𝑉2
πΎπ‘š,𝑛: a complete bipartite graph with 𝑉1 = π‘š and
𝑉2 = 𝑛
88 β–· 49 β–· Graph isomorphism
Informally (you will see a formal definition of graph
isomorphism later during the course):
There is a useful terminology for graphs with the same
structure
88 β–· 50 β–· Graph isomorphism
Which graphs are isomorphic?
88
Classification
Simple ?
Connected ?
Directed ?
Multigraph ?
Kn ?
Cn ?
Bipartite ?
Km,n ?
Classification
Simple βœ“
Connected βœ“
Directed 
Multigraph 
Kn βœ“ K3
Cn βœ“ C3
Bipartite 
Km,n 
a c
b
88
Classification
Simple ?
Connected ?
Directed ?
Multigraph ?
Kn ?
Cn ?
Bipartite ?
Km,n ?
Classification
Simple 
Connected βœ“Strong
Directed βœ“
Multigraph 
Kn 
Cn 
Bipartite 
Km,n 
a b
NOTE: To avoid confusion this
module will standardise on
the common definition of a
simple graph as UNDIRECTED
(as found in Rosen)
88
Classification
Simple ?
Connected ?
Directed ?
Multigraph ?
Kn ?
Cn ?
Bipartite ?
Km,n ?
Classification
Simple ?
Connected ?
Directed ?
Multigraph ?
Kn ?
Cn ?
Bipartite ?
Km,n ?
Classification
Simple 
Connected 
Directed 
Multigraph 
Kn 
Cn 
Bipartite 
Km,n 
a c
b
88
Classification
Simple ?
Connected ?
Directed ?
Multigraph ?
Kn ?
Cn ?
Bipartite ?
Km,n ?
Classification
Simple 
Connected βœ“ Weak
Directed βœ“
Multigraph 
Kn 
Cn 
Bipartite 
Km,n 
a b
c
d e
88
Classification
Simple ?
Connected ?
Directed ?
Multigraph ?
Kn ?
Cn ?
Bipartite ?
Km,n ?
Classification
Simple βœ“
Connected 
Directed 
Multigraph 
Kn 
Cn 
Bipartite 
Km,n 
a c
b
88
Classification
Simple ?
Connected ?
Directed ?
Multigraph ?
Kn ?
Cn ?
Bipartite ?
Km,n ?
Classification
Simple βœ“
Connected βœ“
Directed 
Multigraph 
Kn 
Cn 
Bipartite βœ“
Km,n βœ“K2,4
a
c d e f
b
88
Classification
Simple ?
Connected ?
Directed ?
Multigraph ?
Kn ?
Cn ?
Bipartite ?
Km,n ?
Classification
Simple βœ“
Connected βœ“
Directed 
Multigraph 
Kn 
Cn βœ“ C4
Bipartite βœ“
Km,n βœ“ K2,2
a c
b d
88
Classification
Simple ?
Connected ?
Directed ?
Multigraph ?
Kn ?
Cn ?
Bipartite ?
Km,n ?
Classification
Simple βœ“
Connected βœ“
Directed 
Multigraph 
Kn 
Cn βœ“ C4
Bipartite βœ“
Km,n βœ“ K2,2
a c
b d

More Related Content

Similar to Lecture_1_matrix_operations.pdf

Matrix Algebra : Mathematics for Business
Matrix Algebra : Mathematics for BusinessMatrix Algebra : Mathematics for Business
Matrix Algebra : Mathematics for BusinessKhan Tanjeel Ahmed
Β 
Graphs in datastructures
Graphs in datastructuresGraphs in datastructures
Graphs in datastructuresLikhithaGunturi
Β 
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringGraph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringSaurabh Kaushik
Β 
Brief review on matrix Algebra for mathematical economics
Brief review on matrix Algebra for mathematical economicsBrief review on matrix Algebra for mathematical economics
Brief review on matrix Algebra for mathematical economicsfelekephiliphos3
Β 
Matrices and determinants
Matrices and determinantsMatrices and determinants
Matrices and determinantssom allul
Β 
Mathematics fundamentals
Mathematics fundamentalsMathematics fundamentals
Mathematics fundamentalsSardar Alam
Β 
Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...
Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...
Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...Abdullaا Hajy
Β 
Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...
Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...
Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...Rwan Kamal
Β 
University of duhok
University of duhokUniversity of duhok
University of duhokRwan Kamal
Β 
matrix-algebra-for-engineers (1).pdf
matrix-algebra-for-engineers (1).pdfmatrix-algebra-for-engineers (1).pdf
matrix-algebra-for-engineers (1).pdfShafaqMehmood2
Β 
ALLIED MATHEMATICS -I UNIT III MATRICES.ppt
ALLIED MATHEMATICS -I UNIT III MATRICES.pptALLIED MATHEMATICS -I UNIT III MATRICES.ppt
ALLIED MATHEMATICS -I UNIT III MATRICES.pptssuser2e348b
Β 
Engg maths k notes(4)
Engg maths k notes(4)Engg maths k notes(4)
Engg maths k notes(4)Ranjay Kumar
Β 
Direct Methods to Solve Lineal Equations
Direct Methods to Solve Lineal EquationsDirect Methods to Solve Lineal Equations
Direct Methods to Solve Lineal EquationsLizeth Paola Barrero
Β 
Direct Methods to Solve Linear Equations Systems
Direct Methods to Solve Linear Equations SystemsDirect Methods to Solve Linear Equations Systems
Direct Methods to Solve Linear Equations SystemsLizeth Paola Barrero
Β 
Introduction To Matrix
Introduction To MatrixIntroduction To Matrix
Introduction To MatrixAnnie Koh
Β 

Similar to Lecture_1_matrix_operations.pdf (20)

Matrix Algebra : Mathematics for Business
Matrix Algebra : Mathematics for BusinessMatrix Algebra : Mathematics for Business
Matrix Algebra : Mathematics for Business
Β 
Unit 9 graph
Unit   9 graphUnit   9 graph
Unit 9 graph
Β 
Graphs in datastructures
Graphs in datastructuresGraphs in datastructures
Graphs in datastructures
Β 
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph ColouringGraph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Graph Theory,Graph Terminologies,Planar Graph & Graph Colouring
Β 
Brief review on matrix Algebra for mathematical economics
Brief review on matrix Algebra for mathematical economicsBrief review on matrix Algebra for mathematical economics
Brief review on matrix Algebra for mathematical economics
Β 
6. Graphs
6. Graphs6. Graphs
6. Graphs
Β 
Matrix
MatrixMatrix
Matrix
Β 
Matrices and determinants
Matrices and determinantsMatrices and determinants
Matrices and determinants
Β 
Mathematics fundamentals
Mathematics fundamentalsMathematics fundamentals
Mathematics fundamentals
Β 
Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...
Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...
Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...
Β 
Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...
Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...
Matrices and its Applications to Solve Some Methods of Systems of Linear Equa...
Β 
University of duhok
University of duhokUniversity of duhok
University of duhok
Β 
matrix-algebra-for-engineers (1).pdf
matrix-algebra-for-engineers (1).pdfmatrix-algebra-for-engineers (1).pdf
matrix-algebra-for-engineers (1).pdf
Β 
ALLIED MATHEMATICS -I UNIT III MATRICES.ppt
ALLIED MATHEMATICS -I UNIT III MATRICES.pptALLIED MATHEMATICS -I UNIT III MATRICES.ppt
ALLIED MATHEMATICS -I UNIT III MATRICES.ppt
Β 
Engg maths k notes(4)
Engg maths k notes(4)Engg maths k notes(4)
Engg maths k notes(4)
Β 
Direct Methods to Solve Lineal Equations
Direct Methods to Solve Lineal EquationsDirect Methods to Solve Lineal Equations
Direct Methods to Solve Lineal Equations
Β 
Direct methods
Direct methodsDirect methods
Direct methods
Β 
Direct Methods to Solve Linear Equations Systems
Direct Methods to Solve Linear Equations SystemsDirect Methods to Solve Linear Equations Systems
Direct Methods to Solve Linear Equations Systems
Β 
Direct methods
Direct methodsDirect methods
Direct methods
Β 
Introduction To Matrix
Introduction To MatrixIntroduction To Matrix
Introduction To Matrix
Β 

More from AmirMohamedNabilSale

More from AmirMohamedNabilSale (18)

LecccccccccccccProgrammingLecture-09.pdf
LecccccccccccccProgrammingLecture-09.pdfLecccccccccccccProgrammingLecture-09.pdf
LecccccccccccccProgrammingLecture-09.pdf
Β 
p1.pdf
p1.pdfp1.pdf
p1.pdf
Β 
9.b-CMPS 403-F20-Session 9-Intro to ML II.pdf
9.b-CMPS 403-F20-Session 9-Intro to ML II.pdf9.b-CMPS 403-F20-Session 9-Intro to ML II.pdf
9.b-CMPS 403-F20-Session 9-Intro to ML II.pdf
Β 
6.c-CMPS 403-F19-Session 6-Resolution.pdf
6.c-CMPS 403-F19-Session 6-Resolution.pdf6.c-CMPS 403-F19-Session 6-Resolution.pdf
6.c-CMPS 403-F19-Session 6-Resolution.pdf
Β 
3.b-CMPS 403-F20-Session 3-Solving CSP I.pdf
3.b-CMPS 403-F20-Session 3-Solving CSP I.pdf3.b-CMPS 403-F20-Session 3-Solving CSP I.pdf
3.b-CMPS 403-F20-Session 3-Solving CSP I.pdf
Β 
2.a-CMPS 403-F20-Session 2-Search Problems.pdf
2.a-CMPS 403-F20-Session 2-Search Problems.pdf2.a-CMPS 403-F20-Session 2-Search Problems.pdf
2.a-CMPS 403-F20-Session 2-Search Problems.pdf
Β 
LectureNote2.pdf
LectureNote2.pdfLectureNote2.pdf
LectureNote2.pdf
Β 
ML_1.pdf
ML_1.pdfML_1.pdf
ML_1.pdf
Β 
232021-211025052822.pdf
232021-211025052822.pdf232021-211025052822.pdf
232021-211025052822.pdf
Β 
9a52019-211025074532.pdf
9a52019-211025074532.pdf9a52019-211025074532.pdf
9a52019-211025074532.pdf
Β 
random-211016153637.pdf
random-211016153637.pdfrandom-211016153637.pdf
random-211016153637.pdf
Β 
Linux.pdf
Linux.pdfLinux.pdf
Linux.pdf
Β 
Linux_Commands.pdf
Linux_Commands.pdfLinux_Commands.pdf
Linux_Commands.pdf
Β 
AI in covid 19 (1).pptx
AI in covid 19 (1).pptxAI in covid 19 (1).pptx
AI in covid 19 (1).pptx
Β 
COVID-19 PowerPoint.pptx
COVID-19 PowerPoint.pptxCOVID-19 PowerPoint.pptx
COVID-19 PowerPoint.pptx
Β 
Edu week2022.pptx
Edu week2022.pptxEdu week2022.pptx
Edu week2022.pptx
Β 
ML_DT.pdf
ML_DT.pdfML_DT.pdf
ML_DT.pdf
Β 
2.pdf
2.pdf2.pdf
2.pdf
Β 

Recently uploaded

Topic 9- General Principles of International Law.pptx
Topic 9- General Principles of International Law.pptxTopic 9- General Principles of International Law.pptx
Topic 9- General Principles of International Law.pptxJorenAcuavera1
Β 
Pests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPirithiRaju
Β 
Behavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdfBehavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdfSELF-EXPLANATORY
Β 
(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)
(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)
(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)riyaescorts54
Β 
Pests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdfPests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdfPirithiRaju
Β 
Neurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trNeurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trssuser06f238
Β 
Four Spheres of the Earth Presentation.ppt
Four Spheres of the Earth Presentation.pptFour Spheres of the Earth Presentation.ppt
Four Spheres of the Earth Presentation.pptJoemSTuliba
Β 
BUMI DAN ANTARIKSA PROJEK IPAS SMK KELAS X.pdf
BUMI DAN ANTARIKSA PROJEK IPAS SMK KELAS X.pdfBUMI DAN ANTARIKSA PROJEK IPAS SMK KELAS X.pdf
BUMI DAN ANTARIKSA PROJEK IPAS SMK KELAS X.pdfWildaNurAmalia2
Β 
Pests of safflower_Binomics_Identification_Dr.UPR.pdf
Pests of safflower_Binomics_Identification_Dr.UPR.pdfPests of safflower_Binomics_Identification_Dr.UPR.pdf
Pests of safflower_Binomics_Identification_Dr.UPR.pdfPirithiRaju
Β 
Dubai Calls Girl Lisa O525547819 Lexi Call Girls In Dubai
Dubai Calls Girl Lisa O525547819 Lexi Call Girls In DubaiDubai Calls Girl Lisa O525547819 Lexi Call Girls In Dubai
Dubai Calls Girl Lisa O525547819 Lexi Call Girls In Dubaikojalkojal131
Β 
Bioteknologi kelas 10 kumer smapsa .pptx
Bioteknologi kelas 10 kumer smapsa .pptxBioteknologi kelas 10 kumer smapsa .pptx
Bioteknologi kelas 10 kumer smapsa .pptx023NiWayanAnggiSriWa
Β 
Call Girls in Majnu Ka Tilla Delhi πŸ”9711014705πŸ” Genuine
Call Girls in Majnu Ka Tilla Delhi πŸ”9711014705πŸ” GenuineCall Girls in Majnu Ka Tilla Delhi πŸ”9711014705πŸ” Genuine
Call Girls in Majnu Ka Tilla Delhi πŸ”9711014705πŸ” Genuinethapagita
Β 
Pests of soyabean_Binomics_IdentificationDr.UPR.pdf
Pests of soyabean_Binomics_IdentificationDr.UPR.pdfPests of soyabean_Binomics_IdentificationDr.UPR.pdf
Pests of soyabean_Binomics_IdentificationDr.UPR.pdfPirithiRaju
Β 
Speech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxSpeech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxpriyankatabhane
Β 
User Guide: Pulsarβ„’ Weather Station (Columbia Weather Systems)
User Guide: Pulsarβ„’ Weather Station (Columbia Weather Systems)User Guide: Pulsarβ„’ Weather Station (Columbia Weather Systems)
User Guide: Pulsarβ„’ Weather Station (Columbia Weather Systems)Columbia Weather Systems
Β 
Citronella presentation SlideShare mani upadhyay
Citronella presentation SlideShare mani upadhyayCitronella presentation SlideShare mani upadhyay
Citronella presentation SlideShare mani upadhyayupadhyaymani499
Β 
Microteaching on terms used in filtration .Pharmaceutical Engineering
Microteaching on terms used in filtration .Pharmaceutical EngineeringMicroteaching on terms used in filtration .Pharmaceutical Engineering
Microteaching on terms used in filtration .Pharmaceutical EngineeringPrajakta Shinde
Β 
REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...
REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...
REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...Universidade Federal de Sergipe - UFS
Β 
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptxRESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptxFarihaAbdulRasheed
Β 
Call Girls in Munirka Delhi πŸ’―Call Us πŸ”8264348440πŸ”
Call Girls in Munirka Delhi πŸ’―Call Us πŸ”8264348440πŸ”Call Girls in Munirka Delhi πŸ’―Call Us πŸ”8264348440πŸ”
Call Girls in Munirka Delhi πŸ’―Call Us πŸ”8264348440πŸ”soniya singh
Β 

Recently uploaded (20)

Topic 9- General Principles of International Law.pptx
Topic 9- General Principles of International Law.pptxTopic 9- General Principles of International Law.pptx
Topic 9- General Principles of International Law.pptx
Β 
Pests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdfPests of castor_Binomics_Identification_Dr.UPR.pdf
Pests of castor_Binomics_Identification_Dr.UPR.pdf
Β 
Behavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdfBehavioral Disorder: Schizophrenia & it's Case Study.pdf
Behavioral Disorder: Schizophrenia & it's Case Study.pdf
Β 
(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)
(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)
(9818099198) Call Girls In Noida Sector 14 (NOIDA ESCORTS)
Β 
Pests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdfPests of jatropha_Bionomics_identification_Dr.UPR.pdf
Pests of jatropha_Bionomics_identification_Dr.UPR.pdf
Β 
Neurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 trNeurodevelopmental disorders according to the dsm 5 tr
Neurodevelopmental disorders according to the dsm 5 tr
Β 
Four Spheres of the Earth Presentation.ppt
Four Spheres of the Earth Presentation.pptFour Spheres of the Earth Presentation.ppt
Four Spheres of the Earth Presentation.ppt
Β 
BUMI DAN ANTARIKSA PROJEK IPAS SMK KELAS X.pdf
BUMI DAN ANTARIKSA PROJEK IPAS SMK KELAS X.pdfBUMI DAN ANTARIKSA PROJEK IPAS SMK KELAS X.pdf
BUMI DAN ANTARIKSA PROJEK IPAS SMK KELAS X.pdf
Β 
Pests of safflower_Binomics_Identification_Dr.UPR.pdf
Pests of safflower_Binomics_Identification_Dr.UPR.pdfPests of safflower_Binomics_Identification_Dr.UPR.pdf
Pests of safflower_Binomics_Identification_Dr.UPR.pdf
Β 
Dubai Calls Girl Lisa O525547819 Lexi Call Girls In Dubai
Dubai Calls Girl Lisa O525547819 Lexi Call Girls In DubaiDubai Calls Girl Lisa O525547819 Lexi Call Girls In Dubai
Dubai Calls Girl Lisa O525547819 Lexi Call Girls In Dubai
Β 
Bioteknologi kelas 10 kumer smapsa .pptx
Bioteknologi kelas 10 kumer smapsa .pptxBioteknologi kelas 10 kumer smapsa .pptx
Bioteknologi kelas 10 kumer smapsa .pptx
Β 
Call Girls in Majnu Ka Tilla Delhi πŸ”9711014705πŸ” Genuine
Call Girls in Majnu Ka Tilla Delhi πŸ”9711014705πŸ” GenuineCall Girls in Majnu Ka Tilla Delhi πŸ”9711014705πŸ” Genuine
Call Girls in Majnu Ka Tilla Delhi πŸ”9711014705πŸ” Genuine
Β 
Pests of soyabean_Binomics_IdentificationDr.UPR.pdf
Pests of soyabean_Binomics_IdentificationDr.UPR.pdfPests of soyabean_Binomics_IdentificationDr.UPR.pdf
Pests of soyabean_Binomics_IdentificationDr.UPR.pdf
Β 
Speech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxSpeech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptx
Β 
User Guide: Pulsarβ„’ Weather Station (Columbia Weather Systems)
User Guide: Pulsarβ„’ Weather Station (Columbia Weather Systems)User Guide: Pulsarβ„’ Weather Station (Columbia Weather Systems)
User Guide: Pulsarβ„’ Weather Station (Columbia Weather Systems)
Β 
Citronella presentation SlideShare mani upadhyay
Citronella presentation SlideShare mani upadhyayCitronella presentation SlideShare mani upadhyay
Citronella presentation SlideShare mani upadhyay
Β 
Microteaching on terms used in filtration .Pharmaceutical Engineering
Microteaching on terms used in filtration .Pharmaceutical EngineeringMicroteaching on terms used in filtration .Pharmaceutical Engineering
Microteaching on terms used in filtration .Pharmaceutical Engineering
Β 
REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...
REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...
REVISTA DE BIOLOGIA E CIÊNCIAS DA TERRA ISSN 1519-5228 - Artigo_Bioterra_V24_...
Β 
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptxRESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
RESPIRATORY ADAPTATIONS TO HYPOXIA IN HUMNAS.pptx
Β 
Call Girls in Munirka Delhi πŸ’―Call Us πŸ”8264348440πŸ”
Call Girls in Munirka Delhi πŸ’―Call Us πŸ”8264348440πŸ”Call Girls in Munirka Delhi πŸ’―Call Us πŸ”8264348440πŸ”
Call Girls in Munirka Delhi πŸ’―Call Us πŸ”8264348440πŸ”
Β 

Lecture_1_matrix_operations.pdf

  • 1. 88 Matrix Operations β–· 1 β–· Computational Problem Solving
  • 2. 88 A matrix (plural: matrices) is simply an β€˜array’ of numbers, e.g. But the power of matrices comes from being able to multiply matrices by vectors and matrices by matrices and β€˜invert’ them: we can: 1. represent linear transformations using matrices (e.g. rotations, reflections and enlargements) 2. Use them to solve linear simultaneous equations. The first of these means matrices are particularly useful in 3D graphics/animation, since they allow us to rotate the camera and project 3D data onto a 2D viewing plane. But matrices are used everywhere, including robotics, computer vision, optimisation, classical and quantum mechanics, electromagnetism, optics, graph theory, statistics, ... On a simple level, a matrix is simply a way to organise values into rows and columns, and represent these multiple values as a single structure. β–· 2 β–· Introduction to matrices
  • 3. 88 The zero matrix, 𝑍 or 𝟎 is the matrix with zero as each element. The identity matrix is the matrix with ones on its main diagonal. The 2x2 identity matrix is 𝐼 = 1 0 0 1 And has the property that 𝐼𝐴 = 𝐴𝐼 = 𝐴 In general, matrix multiplication is not commutative, i.e. 𝐴𝐡 β‰  𝐡𝐴 It is, however, associative, i.e. 𝐴 𝐡𝐢 = 𝐴𝐡 𝐢 β–· 3 β–· Introduction to matrices
  • 4. 88 The dimension of a matrix is its size, in terms of its number of rows and columns. 2 ο‚΄ 3 3 ο‚΄ 1 1 ο‚΄ 3 A matrix can have square or curvy brackets*. Matrix Column Vector (The vector you know and love) Row Vector So a matrix with one column is simply a vector in the usual sense. β–· 4 β–· Introduction to matrices
  • 5. 88 If we wish a variable to represent a matrix, we use bold, capital letters. 𝑨 = 1 6 βˆ’3 π‘ͺ = π‘·βˆ’πŸπ‘»π‘· Each value within a matrix is known as an element. If A is a matrix, then we can refer to the element in the ith row and jth column as π‘Žπ‘–,𝑗. 𝑐1,2 = 3 𝑐2,1 = 4 𝑐1,3 = βˆ’7 β–· 5 β–· Introduction to matrices
  • 6. 88 Simply add/subtract the corresponding elements of each matrix. They must be of the same dimension. β–· 6 β–· Adding/Subtracting Matrices
  • 7. 88 β–· 7 β–· Vectors A row vector is a 1 Γ— 𝑛 matrix and a column vector is a 𝑛 Γ— 1 vector. Vectors have similar properties to matrices (in terms of addition and subtraction) although have their own form of multiplication. There are two ways to multiply vectors – dot product and cross product. We only look at dot product which is (for a 3D vector) π‘Ž 𝑏 𝑐 β‹… π‘₯ 𝑦 𝑧 = π‘Žπ‘₯ + 𝑏𝑦 + 𝑐𝑧 For example: 1 4 β‹… 2 βˆ’1 = 1 Γ— 2 + 4 Γ— βˆ’1 = 2 βˆ’ 4 = βˆ’2
  • 8. 88 A scalar is a number which can β€˜scale’ the elements inside a matrix/vector. 1 2 3 β–· 8 β–· Scalar Multiplication
  • 9. 88 This is where things get slightly more complicated... 1 0 3 -2 2 8 4 3 7 -1 0 2 5 1 1 7 0 3 8 -3 -11 We start with this row and column, and sum the products of each pair. (1 x 5) + (0 x 1) + (3 x 0) + (-2 x 8) = -11 This is known as finding the β€œdot/scalar product” of the two vectors. 16 Now repeat for the next row of the left matrix... 42 61 50 -6 β–· 9 β–· Matrix Multiplication
  • 10. 88 = 1 2 3 1 2 3 = 14 1 2 3 1 2 3 = 1 2 3 2 4 6 3 6 9 a b c d e f β–· 10 β–· Matrix Multiplication
  • 11. 88 Matrix multiplications are not always valid: the dimensions have to agree. Note that only square matrices (i.e. same width as height) can be raised to a power. Dimensions of A Dimension of B Dimensions of AB (if valid) 2 ο‚΄ 3 3 ο‚΄ 4 2 ο‚΄ 4 1 ο‚΄ 3 2 ο‚΄ 3 Not valid. 6 ο‚΄ 2 2 ο‚΄ 4 6 ο‚΄ 4 1 ο‚΄ 3 3 ο‚΄ 1 1 ο‚΄ 1 7 ο‚΄ 5 7 ο‚΄ 5 Not valid. 10 ο‚΄ 10 10 ο‚΄ 9 10 ο‚΄ 9 3 ο‚΄ 3 3 ο‚΄ 3 3 ο‚΄ 3 β–· 11 β–· Matrix Multiplication
  • 12. 88 The transpose of a matrix is formed by swapping the columns and row. For example, if 𝐴 = π‘Ž 𝑏 𝑐 𝑑 , then 𝐴𝑇 = π‘Ž 𝑐 𝑏 𝑑 The determinant of a 2x2 matrix is π‘Žπ‘‘ βˆ’ 𝑏𝑐, written as det 𝐴 = π‘Žπ‘‘ βˆ’ 𝑏𝑐. The inverse is: π΄βˆ’1 = 1 π‘Žπ‘‘ βˆ’ 𝑏𝑐 𝑑 βˆ’π‘ βˆ’π‘ π‘Ž We can use this to solve simultaneous equations i.e. π‘Žπ‘₯ + 𝑏𝑦 = 𝑒 𝑐π‘₯ + 𝑑𝑦 = 𝑓 Becomes 𝐴π‘₯ = 𝑏 or π‘Ž 𝑏 𝑐 𝑑 π‘₯ 𝑦 = 𝑒 𝑓 Which means that: π‘₯ = π΄βˆ’1 𝑏, or π‘₯ 𝑦 = π‘Ž 𝑏 𝑐 𝑑 βˆ’1 𝑒 𝑓 β–· 12 β–· Matrix transpose / Inverse
  • 13. 88 13
  • 14. 88 Graphs and Trees β–· 14 β–· Computational Problem Solving
  • 15. 88 β–· 15 β–· Applications Graph theory is important to find: a) Shortest distance between two points b) Search engine optimisation c) Communications d) Travelling salesperson problem e) Graph colouring (used for parallel computing) f) Data science
  • 16. 88 β–· 16 β–· Introduction Graph theory is not about the sort of graphs you did at school!
  • 17. 88 β–· 17 β–· Applications
  • 18. 88 β–· 18 β–· What is a graph? 1. A graph is a set of vertices (V) and edges (E) 2. Each edge in E has two endpoints which connect two elements of V (Possibly the same element) 3. In an undirected graph, edges have no specific direction, and can be considered to connect a to b or b to a 4. In a directed graph, edges do have a specific direction 5. The number of endpoints at a vertex is called the degree of that vertex
  • 19. 88 β–· 19 β–· Representing Graphs We can represent a graph with a diagram. The vertices are blobs Undirected edges are lines a b c e d g f
  • 20. 88 β–· 20 β–· Representing Graphs We can represent a graph with a diagram. The vertices are blobs Undirected edges are lines Directed edges are arrows a b c e d g f
  • 21. 88 Definition β–· 21 β–· Terminology The degree of a vertex in an undirected graph is the number of edges incident to it, except that a loop contributes twice to the degree. The degree of a vertex 𝑣 is denoted by deg(𝑣) deg π‘Ž = 2 deg 𝑏 = 4 deg 𝑔 = 0 For any graph 𝐺 the sum of the degrees for all vertices equals to the number of edges multiplied by two. That is, 2π‘š = Οƒπ‘£βˆˆπ‘‰ deg(𝑣) where π‘š is the number of edges in the graph 𝐺 = (𝑉, 𝐸)
  • 22. 88 My Turn Your Turn β–· 22 β–· Degrees of Vertices Example Find the number of vertices, the number of edges and the degree of each vertex in the given undirected graph. Identify all isolated and pendant vertices. 𝑣 = 6 𝑒 = 6 deg π‘Ž = 2 deg 𝑏 = 4 deg 𝑐 = 1 deg 𝑑 = 0 deg 𝑒 = 2 deg 𝑓 = 3 𝑐 is pendant (vertex has degree 1) and 𝑑 is isolated (vertex has degree 0). Find the number of vertices, the number of edges and the degree of each vertex in the given undirected graph. Identify all isolated and pendant vertices. 𝑣 = 5 𝑒 = 12 deg π‘Ž = 5 deg 𝑏 = 6 deg 𝑐 = 5 deg 𝑑 = 5 deg 𝑒 = 3 There are no isolated or pendent vertices as none of the vertices have degree 0 or 1
  • 23. 88 β–· 23 β–· Handshaking Lemma Every edge has two endpoints The sum of all the endpoints in a graph must be even. If there are n edges, there must be 2𝑛 endpoints This is known as the "Handshaking Theorem" The sum of all the endpoints in a graph is equal to the sum of all the vertex degrees The sum of all vertex degrees must be even ෍ π‘£βˆˆπ‘‰ deg 𝑣 = 2|𝐸| ෍ π‘£βˆˆπ‘‰ deg 𝑣 = deg 1 + deg 2 + deg 3 + deg 4 + deg 5 + deg(6) = 2 + 3 + 2 + 3 + 3 + 1 = 14 2 𝐸 = 2 Γ— 7 = 14 (7 edges in the graph)
  • 24. 88 Definition β–· 24 β–· Definition of Graph Using Sets We can represent graphs with sets G = (V, E) V = set of vertices, e.g {a,b,c,d,e} E = set of edges β€’ e.g. Undirected: E = { {a,b}, {b,c}, {d,e} } β€’ e.g. Directed: E = { (a,b), (b,c), (d,e) }
  • 25. 88 Definition β–· 25 β–· Simple graphs A graph in which each edge connects two different vertices and where no two edges connect the same pair of vertices is called a simple graph A simple graph: And not simple: What makes the simple graph different to a non-simple graph?
  • 26. 88 Definition β–· 26 β–· Simple Graph Simple Graph β€’ Simple graphs are UNDIRECTED β€’ Edges connect two different vertices β€’ So no loops on vertices β€’ Maximum of one edge between any pair of vertices Simple Directed Graph β€’ Same – but edges are directed NOTE: To avoid confusion this module will standardise on the common definition of a simple graph as UNDIRECTED (as found in Rosen)
  • 27. 88 Definition Characteristics Examples Non-Examples β–· 27 β–· Frayer Diagram Simple Graph a simple graph is an unweighted, undirected graph containing no loops or multiple edges. It can be either connected or disconnected
  • 28. 88 β€’ An undirected graph is connected if there is at least one path between any two vertices β€’ A directed graph is strongly connected if there is at least one path between any two vertices that follows all the directions of the edges β€’ A directed graph is weakly connected is there is at least one path between any two vertices that ignores all the directions of the edges
  • 29. 88 β€’ A bridge is an edge which, if removed, would cause the graph to become disconnected a c b d f e
  • 30. 88 β€’ A graph that is not connected has two or more connected components. β€’ These components are disjoint β€’ The union of all components is the original graph a c b d f e
  • 31. 88 Definition β–· 31 β–· Adjacency List A table with 1 row per vertex, listing its adjacent vertices. a b d c f e Vertex Adjacent Vertices a b b, c a, c, e, f c a, b, f d e b f c, b
  • 32. 88 Definition β–· 32 β–· Adjacency Matrix A way to represent simple graphs β€’ possibly with self-loops. Matrix A=[aij], where aij is 1 if {vi, vj} is an edge of G, and is 0 otherwise. Can extend to pseudographs by letting each matrix elements be the number of links (possibly >1) between the nodes.
  • 33. 88 Examples β–· 33 β–· Adjacency Matrix – Undirected 0 1 7 2 5 3 4 6
  • 34. 88 Examples β–· 34 β–· Adjacency Matrix – Directed 1 2 3 4
  • 35. 88 My Turn Your Turn β–· 35 β–· Adjacency Matrix Example 0 0 1 0 0 0 6 0 0 1 0 1 1 5 1 1 0 1 0 0 4 0 0 1 0 1 0 3 0 1 0 1 0 1 2 0 1 0 0 1 0 1 6 5 4 3 2 1 0 2 0 1 1 5 2 0 0 1 1 4 0 0 0 0 0 3 1 1 0 0 2 2 1 1 0 2 0 1 5 4 3 2 1 1 2 3 4 5
  • 36. 88 β–· 36 β–· Graph representation Adjacency matrices: Incidence matrices: 0 1 1 0 1 0 0 1 1 0 0 1 0 1 1 0 π‘Ž 𝑏 𝑐 𝑑 π‘Ž 𝑏 𝑐 𝑑
  • 37. 88 β€’ The complete graph Kn β€’ For any nοƒŽN, a complete graph on n vertices, Kn, is a simple graph with n nodes in which every node is adjacent to every other node: ο€’u,vοƒŽV: uο‚Ήvο‚«{u,v}οƒŽE. β€’ A set of n vertices – all connected to each other K1 K2 K3 K4 K5 K6 Note that Kn has edges. 2 ) 1 ( 1 1 βˆ’ = οƒ₯ βˆ’ = n n i n i
  • 38. 88 β€’ The cycle graph Cn β€’ A set of n vertices (n β‰₯3) { c1, c2, c3, … , cn } β€’ A set of edges { {c1,c2}, {c2,c3}, {c3, c4}, …, {cn-1, cn} } C3 C4 C5 C6 C7 C8 How many edges are there in Cn?
  • 39. 88 β€’ The wheel graph Wn β€’ A set of n+1 vertices (n β‰₯4) { v, c1, c2, c3, … , cn } β€’ A set of edges { {c1,c2}, {c2,c3}, {c3, c4}, …, {cn-1, cn} } βˆͺ { {v,c1}, {v,c2}, {v,c3}, …, {v, cn} } β€’ For any nο‚³3, a wheel Wn, is a simple graph obtained by taking the cycle Cn and adding one extra vertex vhub and n extra edges {{vhub,v1}, {vhub,v2},…,{vhub,vn}}. W3 W4 W5 W6 W7 W8 How many edges are there in Wn?
  • 40. 88 β€’ The n-cube Qn β€’ A set of 2n vertices β€’ Each vertex represents a bit string β€’ A set of edges β€’ Each edge connects two vertices that differ by one bit Q0 Q1 Q2 Q3 Q4 Number of vertices: 2n. Number of edges:Exercise to try!
  • 41. 88 β€’ To draw the n-cube Qn β€’ Start with Q1 β€’ Duplicate it β€’ Prefix the original vertices with "0" β€’ Prefix the duplicate vertices with "1" β€’ Connect the corresponding vertices 00 01 10 11
  • 42. 88 β€’ To draw the n-cube Qn β€’ Start with Q2 β€’ Duplicate it β€’ Prefix the original vertices with "0" β€’ Prefix the duplicate vertices with "1" β€’ Connect the corresponding vertices 000 001 010 011 100 101 110 111
  • 43. 88 β€’ A graph is bipartite if its vertices can be divided into two subsets, so that every edge connects a vertex in one subset to a vertex in the other. β€’ Here the subsets are {a,b,c} and {d,e} a b c d e
  • 44. 88 β€’ A graph is bipartite if its vertices can be divided into two subsets, so that every edge connects a vertex in one subset to a vertex in the other. β€’ Here the subsets are {a,b,c} and {d,e} a b c d e
  • 45. 88 β€’ A bipartite graph is complete if every edge in one subset is connected to every edge in the other β€’ The complete bipartite graph of m vertices in one subset and n vertices in the other is denoted Km,n a b c d e This is the complete bipartite graph K3,2 K4,3 Km,n has _____ nodes and _____ edges.
  • 46. 88 β€’ Diagrams can be drawn anyhow β€’ Vertices can go anywhere β€’ Lines can cross (and in some cases, must cross) β€’ With practice, you'll discover how to improve neatness.
  • 47. 88 β–· 47 β–· Special simple graphs A complete graph on 𝑛 vertices 𝐾𝑛 A cycle 𝐢𝑛 𝑛 β‰₯ 3 A wheel π‘Š 𝑛
  • 48. 88 β–· 48 β–· Bipartite graphs A simple graph 𝐺 is called bipartite if its vertex set 𝑉 can be partitioned into two disjoint sets 𝑉1 and 𝑉2 such that every edge in the graph connects a vertex in 𝑉1 and a vertex in 𝑉2 πΎπ‘š,𝑛: a complete bipartite graph with 𝑉1 = π‘š and 𝑉2 = 𝑛
  • 49. 88 β–· 49 β–· Graph isomorphism Informally (you will see a formal definition of graph isomorphism later during the course): There is a useful terminology for graphs with the same structure
  • 50. 88 β–· 50 β–· Graph isomorphism Which graphs are isomorphic?
  • 51. 88 Classification Simple ? Connected ? Directed ? Multigraph ? Kn ? Cn ? Bipartite ? Km,n ? Classification Simple βœ“ Connected βœ“ Directed  Multigraph  Kn βœ“ K3 Cn βœ“ C3 Bipartite  Km,n  a c b
  • 52. 88 Classification Simple ? Connected ? Directed ? Multigraph ? Kn ? Cn ? Bipartite ? Km,n ? Classification Simple  Connected βœ“Strong Directed βœ“ Multigraph  Kn  Cn  Bipartite  Km,n  a b NOTE: To avoid confusion this module will standardise on the common definition of a simple graph as UNDIRECTED (as found in Rosen)
  • 53. 88 Classification Simple ? Connected ? Directed ? Multigraph ? Kn ? Cn ? Bipartite ? Km,n ? Classification Simple ? Connected ? Directed ? Multigraph ? Kn ? Cn ? Bipartite ? Km,n ? Classification Simple  Connected  Directed  Multigraph  Kn  Cn  Bipartite  Km,n  a c b
  • 54. 88 Classification Simple ? Connected ? Directed ? Multigraph ? Kn ? Cn ? Bipartite ? Km,n ? Classification Simple  Connected βœ“ Weak Directed βœ“ Multigraph  Kn  Cn  Bipartite  Km,n  a b c d e
  • 55. 88 Classification Simple ? Connected ? Directed ? Multigraph ? Kn ? Cn ? Bipartite ? Km,n ? Classification Simple βœ“ Connected  Directed  Multigraph  Kn  Cn  Bipartite  Km,n  a c b
  • 56. 88 Classification Simple ? Connected ? Directed ? Multigraph ? Kn ? Cn ? Bipartite ? Km,n ? Classification Simple βœ“ Connected βœ“ Directed  Multigraph  Kn  Cn  Bipartite βœ“ Km,n βœ“K2,4 a c d e f b
  • 57. 88 Classification Simple ? Connected ? Directed ? Multigraph ? Kn ? Cn ? Bipartite ? Km,n ? Classification Simple βœ“ Connected βœ“ Directed  Multigraph  Kn  Cn βœ“ C4 Bipartite βœ“ Km,n βœ“ K2,2 a c b d
  • 58. 88 Classification Simple ? Connected ? Directed ? Multigraph ? Kn ? Cn ? Bipartite ? Km,n ? Classification Simple βœ“ Connected βœ“ Directed  Multigraph  Kn  Cn βœ“ C4 Bipartite βœ“ Km,n βœ“ K2,2 a c b d