Page:
Unit-I Lesson – 1 Matrix, Determinants and Inverse Contents: 1.0 Aims and objectives 1.1 Introduction 1.2 Matrices
.c om
1.2.1 Applications of matrices 1.2.2 Definition of a Matrix 1.2.3 Matrix types
m
1.3 Determinant 1.3.1 Definition
ru
1.3.2 Properties of determinants
fo
1.3.3 Determinant of a 3 x 3 matrix by Matrix Enhancement
ld
1.3.4 Leibnitz formula to compute determinant of a Matrix 1.3.5 Laplace's formula to compute determinant of a Matrix
1.4.1 Cofactors
tu
1.4.2 Adjoint of a Matrix
w
or
1.4 Inverse of a Matrix
w .jn
1.4.3 Inverse of a Matrix – Definition 1.4.4 Properties of invertible matrices 1.4.5 Matrix inverses in real-time simulations
w w
1.4.6 Analytic solution
1.5 Problems and Solutions 1.6 Let Us Sum Up 1.7 Lesson End Activities 1.8 References
2
Page:
3
1.0 Aims and objectives In this lesson, we have discussed the representation of data using matrices and the representation of expressions using determinant. Matrix inversion, a convenient way to solve system of linear equations, is also discussed in this lesson.
After reading this lesson, you should able to understand Matrix and its usage in data representation.
·
Determinant and the various methods of computing it.
·
Cofactors and Adjoint of a matrix.
·
How to find matrix Inverse? And to solve linear equations using inverse.
·
Properties of determinant and invertible matrices.
·
Applications of Matrix inverses in real-time simulations
fo
ru
m
.c om
·
1.1 Introduction
ld
J. J. Sylvester coined the term “matrix” in 1848. A matrix is a rectangular table of
or
elements. Matrices are used to describe linear equations, keep track of the coefficients of
w
linear transformation and to record data that depend on multiple parameters. The
tu
determinant notation is now employed in almost every branch of applied science. Matrix inversion plays a significant role in computer graphics and to solve system of
w w
w .jn
linear equations.
Page:
4
1.2 Matrices
.c om
The study of matrices is quite old. A 3-by-3 magic square appears in Chinese literature dating from as early as 650 BC. Matrices have a long history of application in solving linear equations. After the development of the theory of determinants by Seki Kowa and Leibniz in the late 17th century, Cramer developed the theory further in the 18th century, presenting Cramer's rule in 1750. Carl Friedrich Gauss and Wilhelm Jordan developed Gauss-Jordan elimination in the 1800s. Cayley, Hamilton, Grassmann, Frobenius and von Neumann are among the famous mathematicians who have worked on matrix theory. Olga Taussky-Todd (1906-1995) used matrix theory to investigate an aerodynamic phenomenon called fluttering or aeroelasticity during WWII.
ru
m
In mathematics, a matrix (plural matrices) is a rectangular table of elements (or entries), which may be numbers or, more generally, any abstract quantities that can be added and multiplied. Matrices are used to describe linear equations, keep track of the coefficients of linear transformation and to record data that depend on multiple parameters. Matrices can be added, multiplied, and decomposed in various ways, making them a key concept in linear algebra and matrix theory.
fo
1.2.1 Applications of matrices Ø
or
ld
Encryption Matrices can be used to encrypt numerical data. Multiplying the data matrix with a key matrix does encryption. Simply multiplying the encrypted matrix with the inverse of the key does decryption.
Ø
w .jn
tu
w
Computer graphics 4×4 transformation matrices are commonly used in computer graphics. The upper left 3×3 portion of a transformation matrix is composed of the new X, Y, and Z-axes of the post-transformation coordinate space.
1.2.2 Definition of a Matrix
w w
If m and n are positive integers, then an m ´ n matrix (read “m b y n”) is a rectangular array æ a11 a12 a13 . . a1n öü ç ÷ï ç a 21 a 22 a 23 . . a 2 n ÷ï ça a32 a33 . . a3n ÷ïï ç 31 ÷ý m rows . . . . . ÷ï ç . ç . . . . . . ÷÷ï ç ï ça a n 2 a n 3 . . a nn ÷øïþ n1 è14 4444244444 3 n columns
in which each entry, ai,j, of the matrix is a real number. An m ´ n matrix has m rows (horizontal lines) and n columns (vertical lines).
Page:
5
A matrix having m rows and n columns is said to be of order m ´ n. If m = n, the matrix is square of order n. For a square matrix, the entries a11, a22, a33,…, ann are the main diagonals. A matrix that has only one row is a row matrix, and a matrix that has only one column is a column matrix. 1.2.3 Matrix types
.c om
1) Diagonal Matrix A square matrix A is said to be a diagonal matrix if aij= 0 when i ¹ j. In a diagonal matrix all the entries except the entries along the main diagonal is zero.
ru
m
2) Triangular matrix A square matrix in which all the entries above the main diagonal are zero is called a lower triangular matrix. If all the entries below the main diagonal are zero, it is called an upper triangular matrix.
ld
fo
3) Scalar Matrix A scalar matrix is a diagonal matrix in which all the entries along the main diagonal are equal.
w
or
4) Identity Matrix or Unit Matrix An Identity Matrix or Unit Matrix is a scalar matrix in which entries along the main diagonal are equal to 1.
tu
5) Zero or Null or Void Matrix In which all the entries are zero.
w w
w .jn
6) Equality of matrices The matrices A=[aij]mxn and B=[bij]pxq are equal if m = p, n = q and aij = bij for every i and j. 1.3 Determinant
Many complicated expressions of electrical and mechanical systems can be conveniently handled by expressing them in “determinant form”. 1.3.1 Definition In algebra, a determinant is a function depending on n that associates a scalar, det(A) or D, to every n × n square matrix A. The fundamental geometric meaning of a determinant is as the scale factor for volume when A is regarded as a linear transformation. Determinants are important both in calculus, where they enter the substitution rule for several variables, and in multilinear algebra.
Page:
6
(or) The mathematical expression a1 b2 -a2 b1 can be expressed as
a1
b1
a 2 b2 The above form is called a determinant of the second order. Each of the numbers a1, b1 , a2, b2 is called an element of the determinant. Thus
.c om
2 5 = (2)(9) - (3)(5) = 18 - 15 = 3. 3 9
3
1
ru
or
ld
Thus
fo
a 2 b2 c2 a 3 b3 c3 is called a determinant of the third order.
m
Similarly, the arrangement of nine elements as a 1 b 1 c1
3
tu
w
2 2 - 1 = 3(4 - 3) - 1(4 + 1) + 3(-6 - 2) = 3 - 5 - 24 = -26 1 -3 2
w .jn
In general, a determinant of the nth order is denoted by
a1 a2
b1 b2
. . l1 . . l2
w w
- - - - - - - -(1) . . . . . . . . . . a n bn . . l n The determinant in (1) have n rows and n columns; thus having n2 elements. The diagonal through the left hand top corner which contains the elements a1 , b2 , c3 , ---, ln is called the leading or principal diagonal.
Page:
7
1.3.2 Properties of determinants Ø Changing the rows into columns or columns into rows does not affect the value of a determinant. Ø Interchanging a pair of rows (or columns) of matrix A, changes the sign of det(A). Ø If matrix A has a pair of identical rows (or columns) then det(A)=0
.c om
Ø If each element in a row (or column) of matrix A is multiplied by k, then det(A) is multiplied by k. Note: Remember that when a matrix is multiplied by a scalar k, every element must be multiplied by k.
m
Ø If the elements of one row (or column) of matrix A are multiples of the elements of another row(or column), then det(A)=0.
fo
ru
Ø If each element of one row (or column) of matrix A is replaced by a new element consisting of the original element plus a multiple of the corresponding element from another row (or column), then the value of det(A) is unchanged.
ld
Ø det(A)=det(AT )
or
Ø det(AB)=det(A) det(B)
w
1.3.3 Determinant of a 3 x 3 matrix by Matrix Enhancement
w w
w .jn
tu
A (3 x 3) matrix A may be ‘enhanced’ by the repetition of each of four ‘corner’ elements as shown below a13 æ a11 a12 a13 ö a11 ç ÷ ç a 21 a 22 a 23 ÷ a33 çè a31 a32 a33 ÷ø a31 From the enhanced matrix we can now define three positive diagonals, shown below by solid lines and three negative diagonals, shown below by broken lines. a13
a33
a11 a 21 a31
a12 a 22 a32
a13 a 23 a33
a11 a31
a13 a33
a11 a 21 a31
a12 a 22 a32
a13 a 23 a33
a11 a31
Multiplying along the diagonals, we can calculate the determinant as the sum of the three positive diagonals less the three negative diagonals. The complete expression is then a13 a21 a32 + a11 a22 a33 + a12 a23 a31 – a33 a21 a12 – a31 a22 a13 – a32 a23 a11. The above expression gives Leibniz formula for a (3 x 3) matrix.
Page:
8
Example 1 Calculate the determinant of the method.
æ1 2 2 ö ç ÷ ç1 1 1 ÷ matrix by Matrix Enhancement ç1 - 1 3 ÷ è ø
The enhanced matrix becomes
2 1
2
2 1
.c om
1 1 1 3 1 -1 3 1
m
and its determinant will be = (2).(1).(-1) +(1).(1).(3)+ (2).(1).(1) - (3).(1).(2) - (1).(1).(2) – (-1).(1).(1) = -2+3+2-6-2+1 = -4
ld
fo
ru
1.3.4 Leibniz formula to compute determinant of a Matrix
w
or
Here the sum is computed over all permutations σ of the numbers {1,2,...,n} and sgn(σ) denotes the signature of the permutation σ: +1 if σ is an even permutation and - 1 if it is odd.
tu
This formula contains n! (factorial) summands, and it is therefore impractical to use it to calculate determinants for large n.
w w
w .jn
For small matrices, one obtains the following formulas:
9
m
.c om
Page:
if A is a 1-by-1 matrix, then
·
if A is a 2-by-2 matrix, then
·
for a 3-by-3 matrix A, the formula is more complicated:
tu
w
or
ld
fo
ru
·
w .jn
which takes the shape of the Sarrus' scheme. 1.3.5 Laplace's formula to compute determinant of a Matrix
w w
It is also possible to expand a determinant along a row or column using Laplace's formula, which is efficient for relatively small matrices. To do this along row i, say, we write n
n
det(A) = å a i , j C i , j =å a i , j (-1) i + j M i , j j=1
j=1
where the Ci,j represent the matrix cofactors, i.e. Ci,j is ( - 1) i + j times the minor Mi,j, which is the determinant of the matrix that results from A by removing the i-th row and the j-th column. Example 2
Page:
10
fo
ru
m
.c om
Suppose we want to compute the determinant of
or
ld
We can go ahead and use the Leibniz formula directly:
w
det (A) = (-2 . 1 . - 1) + (-3. - 1 .0) + (2 . 3 .2) - (-3.1. 2) - (-2 . 3 . 0) - (2. - 1 . - 1) = 2 + 0 + 12 - (-6) - 0 - 2 = 18.
w .jn
tu
Alternatively, we can use Laplace's formula to expand the determinant along a row or column. It is best to choose a row or column with many zeros, so we will expand along the second column:
w w
æ-1 3 ö æ - 2 - 3ö ÷÷ + (-1) 2+ 2 .1. det çç ÷÷ det(A ) = (-1)1+ 2 .2. det çç è 2 - 1ø è 2 - 1ø = (-2) .((-1).(-1) - 2 . 3) + 1 . ((-2).(-1) - 2 . (-3)) = (-2) (-5) + 8 = 18.
In order to compute the determinant of a given matrix, we are using the Laplace’s Formula.
Page:
11
1.4 Inverse of a Matrix 1.4.1 Cofactors The cofactor of the element ai,j equals (-1)i+j det(B) where B is the matrix formed by deleting row i and column j from A.
b1 b2 b3
c1 c2 c3
is the
.c om
Therefore the cofactor of an element of a 3 x 3 determinant
a1 a2 a3
2 x 2 determinant obtained by deleting the row and column containing that element and multiplying by +1 or –1 according to the pattern:
ru
m
+ - + - + + - +
ld
fo
A cofactor is always designated by the capital letter corresponding to the element to which it belongs. The nine cofactors are as given below:
b2 b3
c2 c3
a2 a3
c2 c3
a2 a3
b2 b3
b1
c1
b3
c3
or
w
The cofactor of(a 1 ) = A1 =
w .jn
tu
The cofactor of(b1 ) = B1 = The cofactor of(c 1 ) = C1 =
w w
The cofactor of(a 2 ) = A2 = -
The cofactor of(b 2 ) = B2 = The cofactor of(c 2 ) = C 2 = -
a 1 c1 a 3 c3 a 1 b1 a3
b3
The cofactor of(a 3 ) = A 3 =
The cofactor of(b 3 ) = B3 = The cofactor of(c 3 ) = C 3 =
b1 b2
c1 c2
a1 a2 a1 a2
c1 c2 b1 b2
Page:
12
1.4.2 Adjoint of a Matrix
æ A1 ç The adjoint of the matrix A is ç B 1 çC è 1
A2 B2 C2
A3 ö ÷ B 3 ÷ where A1, A2,.., C3 are cofactors of A. C 3 ÷ø
ru
1.4.3 Inverse of a Matrix - Definition
m
æD 0 0 ö ç ÷ i.e. A adj( A) = ç 0 D 0 ÷ = D I ç 0 0 D÷ è ø where I is the 3 ´ 3 unit matrix.
.c om
The standard notation for ‘the adjoint of matrix A’ is adj(A). Notice that adj(A) is the transpose of the matrix formed by replacing each element of A by its cofactor. The product A adj(A) is always a diagonal matrix.
ld
fo
In linear algebra, an n-by-n (square) matrix A is called invertible o r non-singular if there exists an n-by-n matrix B such that
or
AB = BA = In
w w
w .jn
tu
w
where In denotes the n-by-n identity matrix and the multiplication used is ordinary matrix multiplication. If this is the case, then the matrix B is uniquely determined by A and is called the inverse of A, denoted by A-1 . It follows from the theory of matrices that if
AB = IAAN
Page:
matrices A a n d
I
B,
then
also B A
=
.c om
square
.
m
for
13
ld
Remark: The symbol A-1 is read “A inverse�.
fo
ru
Matrix inversion is the process of finding the matrix B that satisfies the prior equation for a given invertible matrix A.
w w
w .jn
tu
w
or
If a matrix A has an inverse, then A is invertible (or nonsingular); otherwise, A is singular. A nonsquare matrix cannot have an inverse. Moreover not all square matrices possess inverse. If, however, a matrix does possess an inverse, then that inverse is unique.
Page:
14
1.4.4 Properties of invertible matrices
ld
fo
ru
m
.c om
Let A be a square n by n matrix over a field K (for example the field R of real numbers). Then the following statements are equivalent: · A is invertible. · A is row-equivalent to the n-by-n identity matrix In . · A is column-equivalent to the n-by-n identity matrix In . · A has n pivot positions. · det A 0. · rank A = n. · The equation Ax = 0 has only the trivial solution x = 0 (i.e., Null A = {0}) · The equation Ax = b has exactly one solution for each b in Kn . · The columns of A are linearly independent. · The columns of A span Kn (i.e. Col A = Kn ). · The columns of A form a basis of Kn . · The linear transformation mapping x to Ax is a bijection from Kn to Kn . · There is an n by n matrix B such that AB = In . · The transpose AT is an invertible matrix. · The matrix times its transpose, AT × A is an invertible matrix. · The number 0 is not an eigenvalue of A.
or
1.4.5 Matrix inverses in real-time simulations - Applications
w w
w .jn
tu
w
Matrix inversion plays a significant role in computer graphics, particularly in 3D graphics rendering 3D simulations. Examples include screen-to-world ray casting, worldto-subspace-to-world object transformations, and physical simulations. The problem is usually the numerical complexity of calculating the inverses of 3×3 and 4×4 matrices. Compared to matrix multiplication or creation of rotation matrices, matrix inversion is several orders of magnitude slower. There are existing solutions which use hand-crafted assembly language routines and SIMD processor extensions (SSE, SSE2, Altivec) that address this problem and which achieve a performance improvement of as much as five times. 1.4.6 Analytic solution adj( A ) =I D adj( A ) In other words A -1 , the inverse of A is D We know that A adj( A ) = D I i.e. A
Page:
1.5 Problems and Solutions
æa bö æ 2 2ö ÷÷ and çç ÷÷. 1) Find the inverse of çç èc dø è 3 5ø Solution :
tu
æ 5 1 æ 5 - 2ö ç 4 ÷=ç = çç 4 è - 3 2 ÷ø ç - 3 ç è 4
w .jn w w
A -1
1 adj A |A|
ru fo ld
w
æ 2 3ö ÷÷ A T = çç è 2 5ø æ 5 - 2ö ÷÷ adj A = çç è- 3 2 ø
or
æ 2 2ö ÷÷ Let A = çç è 3 5ø \| A | = 10 - 6 = 4
ii)
Q A -1 =
m
æa cö ÷÷ A T = çç èb dø æ d - bö ÷÷ adj A = çç è- c a ø 1 æ d - bö ç ÷ A -1 = ad - bc çè - c a ÷ø
.c om
æa bö ÷÷ Let A = çç èc dø \| A | = ad - cb
i)
1ö - ÷ 2÷ 1 ÷ ÷ 2 ø
15
Page:
16
æ1 0 -1ö ç ÷ 2) Find the inverse of ç 3 4 5 ÷. ç0 - 6 - 7÷ è ø Solution :
.c om
i)
æ1 0 -1ö ç ÷ Let A = ç 3 4 5 ÷ ç0 - 6 - 7÷ è ø Based on the first row | A | = 1(-28 + 30) - 0(-21 - 0) + (-1)(-18 - 0)
3
Cofactor of 0 = B1 = -
ru
4 5 = - 28 + 30 = 2 -6 -7 5
= - (-21 - 0) = 21
0 -7
fo
Cofactor of 1 = A 1 =
m
= 1(2) - 0 - 1(-18) = 2 + 18 = 20 Find the cofactor of the elements.
3 4 = -18 - 0 = -18 0 -6
Cofactor of 3 = A 2 = -
0 -1 = - (0 - 6) = 6 -6 -7
w
or
ld
Cofactor of - 1 = C1 = +
1 -1 = - 7 + 0 = -7 0 -7
w .jn
tu
Cofactor of 4 = B 2 = + Cofactor of 5 = C 2 = -
1 0 =-6+0 = 6 0 -6 0 -1 =0+4 = 4 4 5
w w
Cofactor of 0 = A 3 = +
Cofactor of - 6 = B 3 = -
1 -1 3
Cofactor of - 7 = C 3 = + æ A1 ç adj A = ç B1 çC è 1
A2 B2 C2
5
= 5 + 3 = -8
1 0 =4-0 = 4 3 4
A3 ö æ 2 6 4ö 6 4ö æ 2 ÷ ç ÷ ÷ 1 1 ç -1 B 3 ÷ = ç 21 - 7 - 8 ÷ \ A = adj A = ç 21 - 7 - 8 ÷ |A| 20 ç ÷ C 3 ÷ø çè - 18 6 4 ÷ø è - 18 6 4 ø
Page:
17
æ 5 0 0ö ç ÷ 3) If 10 A - 50 I = 0 and A = ç 0 5 0 ÷ find A -1 . ç 0 0 5÷ è ø Solution : Consider 10A - 5I = 0 Post multiplying by A -1 10 A A -1 - 50 I A -1 = 0
.c om
10 I - 50 A -1 = 0
or
ld
fo
ru
m
50 A -1 = 10 I 1 A -1 = [10 I] 50 æ1 ö 0 0÷ ç ç5 ÷ 1 1 -1 ç A = I= 0 0÷ ç ÷ 5 5 ç 1÷ ç0 0 ÷ 5ø è æ 1 2 2ö ç ÷ 4) Show that A = ç 2 1 2 ÷ satisfies the equation A 2 - 4A - 5I = 0 where I is the identity matrix ç 2 2 1÷ è ø
tu
w
and "0" denotes the zero matrix and hence find the inverse of A.
w .jn
Solution :
w w
æ 1 2 2ö ç ÷ Let A = ç 2 1 2 ÷ ç 2 2 1÷ è ø æ 1 2 2 öæ 1 2 2 ö ç ÷ç ÷ 2 A = A.A = ç 2 1 2 ÷ç 2 1 2 ÷ ç 2 2 1 ÷ç 2 2 1 ÷ è øè ø æ 1 + 4 + 4 2 + 2 + 4 2 + 4 + 2ö ç ÷ = ç 2 + 2 + 4 4 + 1 + 4 4 + 2 + 2÷ ç 2 + 4 + 2 4 + 2 + 2 4 + 4 + 1÷ è ø æ9 8 8ö ç ÷ = ç8 9 8÷ ç8 8 9÷ è ø
Page:
= A 2 - 4A - 5I
ru
æ0 0 0ö ç ÷ = ç0 0 0÷ ç0 0 0÷ è ø Hence the given matrix satisfies the eq. A 2 - 4A - 5I = 0.
.c om
2 2ö æ5 0 0ö ÷ ç ÷ 1 2÷ - ç0 5 0÷ 2 1 ÷ø çè 0 0 5 ÷ø 8 8ö æ5 0 0ö ÷ ç ÷ 4 8÷ - ç0 5 0÷ 8 4 ÷ø çè 0 0 5 ÷ø 0 0ö ÷ 5 0÷ 0 5 ÷ø
m
æ9 8 8ö æ1 ç ÷ ç = ç 8 9 8 ÷ - 4ç 2 ç8 8 9÷ ç 2 è ø è æ9 8 8ö æ 4 ç ÷ ç = ç8 9 8÷ - ç8 ç8 8 9÷ ç8 è ø è æ5 0 0ö æ5 ç ÷ ç = ç0 5 0÷ - ç0 ç0 0 5÷ ç0 è ø è
A 2 - 4A - 5I = 0
A - 4I - 5A -1 = 0
tu
A 2 A -1 - 4AA -1 - 5IA -1 = 0
w
[A 2 - 4A - 5I]A -1 = 0.A -1
or
Post multiplying both sides by A -1 .
ld
fo
To find A -1
w w
w .jn
1 A -1 = [A - 4I] 5 éæ 1 2 2 ö æ 4 0 0 öù 2 ö æ- 3 2 ÷ ç ÷ú 1 ç ÷ 1 êç = êç 2 1 2 ÷ - ç 0 4 0 ÷ú = ç 2 - 3 2 ÷ 5 ç 5 ç ÷ êëè 2 2 1 ÷ø çè 0 0 4 ÷øúû è 2 2 - 3ø 2 ö æ-3 2 ç ÷ 5 5 ÷ æ - 0.6 0.4 0.4 ö ç 5 ÷ 2 -3 2 ÷ ç -1 ç A = = ç 0.4 - 0.6 0.4 ÷ ç 5 5 5 ÷ ç 0.4 - 0.6 ÷ø ç 2 2 - 3 ÷ è 0.4 ç ÷ 5 5 ø è 5
18
Page:
19
1.6 Let Us Sum Up Matrix A matrix (plural matrices) is a rectangular table of elements (or entries). A matrix having m rows and n columns is said to be of order m ´ n. If m = n, the matrix is square of order n. For a square matrix, the entries a11, a22, a33,‌, ann are the main diagonals.
.c om
A matrix that has only one row is a row matrix, and a matrix that has only one column is a column matrix Diagonal Matrix A square matrix A is said to be a diagonal matrix if aij= 0 when i š j. In a diagonal matrix all the entries except the entries along the main diagonal is zero.
fo
ru
m
Triangular matrix A square matrix in which all the entries above the main diagonal are zero is called a lower triangular matrix. If all the entries below the main diagonal are zero, it is called an upper triangular matrix.
or
ld
Scalar Matrix A scalar matrix is a diagonal matrix in which all the entries along the main diagonal are equal.
tu
w
Identity Matrix or Unit Matrix An Identity Matrix or Unit Matrix is a scalar matrix in which entries along the main diagonal are equal to 1.
w .jn
Zero or Null or Void Matrix In which all the entries are zero.
w w
Equality of matrices The matrices A=[aij]mxn and B=[bij]pxq are equal if m = p, n = q and aij = bij for every i and j. Cofactor
The cofactor of the element ai,j equals (-1)i+j det(B) where B is the matrix formed by deleting row i and column j from A. Inverse of matrix A -1 =
adj(A) det(A)
Page:
1.7 Lesson End Activities
a h g 1) Find the value of h b f g 5
3
f
c
3
2) Evaluate 2 6 - 3 8 -3 2 b
3) Without expanding, verify that a 2 b 2 bc ca
c
1 a2
c2 = 1 b2 ab 1 c 2 4
3
b3 c3
m
5
a3
.c om
a
ru
4) Find the cofactor of ' a' in the determinant 2 6 a 8 -7 2
ld
æ 2 0 7ö ç ÷ ç -1 4 5÷ ç 3 1 2÷ è ø
tu
w
æ -1 - 2 - 2ö ç ÷ ç 2 1 - 2÷ ç 2 -2 1 ÷ è ø
w .jn
a=
b)
or
æ1 2 3 ö ç ÷ a) ç1 3 5 ÷ ç1 5 12 ÷ è ø 6) Show that the adjoint of
fo
5) Compute the adjoint of
w w
æ - 4 - 3 - 3ö ç ÷ is 3A and that the adjoint of A = ç 1 0 1 ÷ is A itself. ç4 4 3÷ è ø 1ö æ1 1 ç ÷ 6) Find the inverse of A = ç1 1 - 1÷ ç1 - 2 3 ÷ è ø 7) Define the inverse of a matrix and prove that, if a matrix has an inverse, it has only one inverse.
20
Page:
1.8. References Frank Ayres,Jr,”Matrices”.
2)
Prof. A.Singaravelu,”Engineering Mathematics – I”.
3)
Dr. M.K Venkataraman,” Engineering Mathematics Vol. II”.
4)
Prof. P.Kandasamy, K.Thilagavathy, and K.Gunavathy,” Engineering Mathematics”
5)
Wikipedia, the free encyclopedia.
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
1)
21
Page:
22
Unit-I Lesson – 2 Rank of a Matrix
m
fo
2.0 Aims and objectives
ru
2.0 Aims and objectives 2.1 Introduction 2.2 Rank of a Matrix 2.2.1 Rank-Definitions 2.2.2 Properties 2.2.3 Computations of the rank – Method 1 2.2.4 Solved Problems 2.3 Elementary row operations 2.3.1 Row-Echelon Form 2.3.2 Computations of the rank – Method 2 2.3.3 Applications of the Rank 2.4 Let Us Sum Up 2.5 Lesson End Activities 2.6 References
.c om
Contents:
or
ld
In this lesson, we have discussed the rank of a matrix and its computation methods. Elementary row operations in matrices are also discussed in this lesson.
tu
Rank and its properties Rank computation methods. Elementary row operations and Row-Echelon Form. Applications of calculating the rank.
w .jn
· · · ·
w
After reading this lesson, you should able to understand
w w
2.1 Introduction
The maximum number of independent rows (and therefore columns) that can be found in a matrix is called the rank of a matrix. One useful application of calculating the rank of a matrix is the computation of the number of solutions of a system of linear equations. The system is inconsistent or having at least one solution or unique solution can be found using its rank. In control theory, the rank of a matrix can be used to determine whether a linear system is controllable, or observable.
Page:
23
2.2 Rank of a Matrix 2.2.1 Rank-Definitions Definition 1
.c om
If a matrix has more rows than columns it must necessarily have linear dependence in the rows. Conversely, if it has more columns than rows there will be linear dependence in the columns. We define the rank of a matrix, r(A), as the maximum number of independent rows(and therefore columns) that can be found in the matrix. It is formally, written as follows Rule: If we have a set of m equations in n unknowns written as Ax = b there will be a unique solution if and only if r(A)=n.
m
Rule: A square matrix (A) of dimension n will have an inverse if and only if r(A)=n.
ru
Alternatively the rank of a matrix can be defined as follows.
fo
Definition 2
w w
w .jn
tu
w
or
ld
A matrix A is said to be of rank r when (i) at least one minor of A of order r is not zero and (ii) every minor of A of order r+1 is zero. (or) The rank of a matrix is the largest order of any non-vanishing minor of the matrix.
The rank of an m ´ n
matrix is at most
min(m,n). A matrix that has as large a rank as possible is said to have full rank; otherwise, the matrix is rank deficient.
Page:
24
2.2.2 Properties · · · ·
only the zero matrix has rank 0 the rank of A is at most min(m,n) In the case of a square matrix A (i.e., m = n), then A is invertible if and only if A has rank n (that is, A has full rank). If B is any n-by-k matrix, then the rank of AB is at most the minimum of the rank of A and the rank of B.
æ 0 0ö æ 0 0ö çç ÷÷ çç ÷÷ è1 0ø è0 1ø Both factors have rank 1, but the product has rank 0.
m
If B is an n-by-k matrix with rank n, then AB has the same rank as A. If C is an l-by-m matrix with rank m, then CA has the same rank as A. The rank of A is equal to r if and only if there exists an invertible m-by-m matrix X and an invertible n-by-n matrix Y such that
ld
fo
ru
· · ·
.c om
As an example of the "<" case, consider the product
where Ir denotes the r-by-r identity matrix.
or
The rank of a matrix plus the nullity of the matrix equals the number of columns of the matrix (this is the "rank theorem" or the "rank- nullity theorem").
w
·
tu
2.2.3 Computations of the rank – Method 1
w .jn
[Computations of the rank of a matrix from its determinant value] Example 1
w w
Determine the rank of the following matrix 2 3ö æ 1 ç ÷ A=ç 2 3 1÷ ç - 2 - 3 - 1÷ è ø
2 3ö æ 1 ç ÷ | A |= ç 2 3 1 ÷ r3 ¬ r3 + r2 ç - 2 - 3 - 1÷ è ø =0 2 3 But there is at least one non-zero minor of order 2, namely which is = -7. 3 1 Hence r(A) =2.
Page:
Other non- vanishing determinants of order 2 might be written but a single one is a sufficient to establish that the rank is 2. Example 2.
Let
æ1 2 3ö ç ÷ A = ç2 3 1÷ ç 3 1 2÷ è ø
.c om
|A| =1(6-1)-2(4-3)+3(2-9) = 5 – 2 – 21 = -18 ¹ 0
w w
w .jn
tu
w
or
ld
fo
ru
m
It is square matrix with det(A)¹0. Hence r(A) = 3
25
Page:
Example 3.
Let
6 ö æ2 4 ç ÷ A = ç4 2 3 ÷ ç 6 - 6 - 9÷ è ø
|A| = 0 Also each of the second order minor is also = 0.
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
But the matrix is non- zero, hence r(A) = 1.
26
Page:
2.2.4 Solved Problems
æ 1 2 3ö ç ÷ 1) Find the rank of ç 2 4 5 ÷ ç 3 5 6÷ è ø Solution :
.c om
æ 1 2 3ö ç ÷ Let A = ç 2 4 5 ÷ ç 3 5 6÷ è ø 1 2 3
w .jn
tu
w
æ 3 2 - 1ö ç ÷ 2) Find the rank of ç 7 8 0 ÷ ç4 6 1 ÷ è ø Solution :
or
ld
Hence the rank of the matrix is 3.
ru
= -1 + 6 - 6 = -1 ¹ 0
fo
= 1(24 - 25) - 2(12 - 15) + 3(10 - 12) = 1(-1) - 2(-3) + 3(-2)
m
| A |= 2 4 5 3 5 6
w w
æ3 ç Let A = ç 7 ç4 è 3 | A |= 7
2 - 1ö ÷ 8 0÷ 6 1 ÷ø 2 -1 8 0
4 6
1
= 3(8 ´ 1 - 0 ´ 6) - 2(7 ´ 1 - 0 ´ 4) + (-1)(7 ´ 6 - 8 ´ 4) = 1(8) - 2(7) + 3(10) = 24 - 14 - 10 =0 Therfore the rank of the matrix is not 3.
27
Page:
28
æ 3 2ö ÷÷ Consider the submatrix çç è7 8ø 3 2 = 24 - 14 = 10 ¹ 0. 7 8 \ the rank of the matrix, r(A), is 2.
.c om
æ - 2 1 3 4ö ç ÷ 3) Find the rank of ç 0 1 1 2 ÷ ç 1 3 4 7÷ è ø Solution :
m
æ - 2 1 3 4ö ç ÷ Let A = ç 0 1 1 2 ÷ ç 1 3 4 7÷ è ø
ru
Four square submatrices of order 3 exist
or
ld
fo
æ1 3 4ö æ - 2 3 4ö æ - 2 1 4ö æ - 2 1 3ö ç ÷ ç ÷ ç ÷ ç ÷ ç 1 1 2 ÷ , ç 0 1 2 ÷ , ç 0 1 2 ÷ and ç 0 1 1 ÷ by deleting first, second, third and ç3 4 7÷ ç 1 4 7÷ ç 1 3 7÷ ç 1 3 4÷ è ø è ø è ø è ø fourth column respectively. Consider the first 3 ´ 3 matrix.
tu
w
1 3 4 | A |= 1 1 2 3 4 7
w .jn
= 1(1 ´ 7 - 4 ´ 2) - 3(1 ´ 7 - 3 ´ 2) + 4(1 ´ 4 - 3 ´ 1) = 1(8) - 2(7) + 3(10) = 24 - 14 - 10
w w
=0 Therfore the rank of the matrix is not 3. Consider the second 3 ´ 3 matrix. -2 3 4 | A |= 0 1 2 1 4 7 = (-2)(1 ´ 7 - 4 ´ 2) - 3(0 ´ 7 - 1 ´ 2) + 4(0 ´ 4 - 1 ´ 1) = (-2)(-1) - 3(-2) + 4(-1) = 2 + 6 - 4 ¹ 0 Therfore the rank of the matrix, r(A), is 3.
Page:
2 3 ö æ 1 ç ÷ 4) Find the rank of ç 2 4 6 ÷ ç - 3 - 6 - 9÷ è ø Solution :
.c om
2 3 ö æ 1 ç ÷ Let A = ç 2 4 6 ÷ ç - 3 - 6 - 9÷ è ø 1 2 3 | A |= 2 4 6 -3 -6 -9
= 1(4 ´ (-9) - (-6) ´ 6) - 2(2 ´ (-9) - (-3) ´ 6) + 3(2 ´ (-6) - (-3) ´ 4)
ru
Therfore the rank of the matrix is not 3. The submatrices of the given matrix are
m
= 1(0) - 2(0) + 3(0) = 0
w
or
ld
fo
æ 1 2ö æ 1 3ö æ 2 3ö çç ÷÷ , çç ÷÷ , çç ÷÷ , è 2 4ø è 2 6ø è 4 6ø 2 ö æ 1 3 ö æ 2 3 ö æ 1 çç ÷÷ , çç ÷÷ , çç ÷÷ , è - 3 - 6ø è - 3 - 9ø è - 6 - 9ø 4 ö æ 2 6 ö 6 ö æ 2 æ 4 çç ÷÷ , çç ÷÷ and çç ÷÷ . è - 3 - 6ø è - 3 - 9ø è - 6 - 9ø
w w
w .jn
tu
The determinant of all the above submatrices are all equal to 0(zero). Since the determinant of all the second order mionors are zero, the rank is not 2. But the matix A is non - zero, so its rank, r(A), is 1.
29
Page:
30
2.3 Elementary row operations The following three operations correspond to Elementary row operations. 1. Interchange two rows. 2. Multiply a row by a nonzero constant. 3. Add a multiple of a row to another row.
fo
ru
m
Example : Elementary Row Operations i) Interchange the first and second rows. Original Matrix New Row - equivalent Matrix 1 3 4ö R1 æ 0 1 3 4ö æ0 ç ÷ ç ÷ R 2 ç -1 2 0 3÷ ç -1 2 0 3÷ ç 2 - 3 4 1÷ ç 2 - 3 4 1÷ è ø è ø
.c om
An elementary row operation on an augmented matrix of a given system of linear equations produces a new augmented matrix corresponding to a new (but equivalent) system of linear equations. Two matrices are row-equivalent if one can be obtained from the other by a sequence of elementary row operations.
w w
w .jn
tu
w
or
ld
ii) Multiply the first row by 1 2 . Original Matrix New Row - equivalent Matrix 1 R ® 1 - 2 3 - 1ö æ 2 - 4 6 - 2ö æ 2 1 ç ÷ ç ÷ ç1 3 - 3 0 ÷ ç1 3 - 3 0 ÷ ç5 - 2 1 ç5 - 2 1 2 ÷ø 2 ÷ø è è iii) Add - 2 times the first row to the third row. Original Matrix New Row - equivalent Matrix æ 2 - 4 6 - 2ö æ 2 - 4 6 - 2ö ç ÷ ç ÷ -3 0 ÷ ç1 3 - 3 0 ÷ ç1 3 ç5 - 2 1 2 ÷ø - 2R 1 + R 3 ® çè 1 6 - 11 6 ÷ø è
2.3.1 Row-Echelon Form A matrix in row-echelon form has the following properties. 1. All rows consisting entirely of zeros occur at the bottom of the matrix. 2. For each row that does not consist entirely of zeros, the first nonzero entry is 1 (a leading 1). 3. For two successive (nonzero) rows, the leading 1 in the higher row is farther to the left than the leading 1 in the lower row. A matrix in row-echelon form is in reduced row-echelon form if every column that has a leading 1 has zeros in every position above and below its leading 1.
Page:
31
Row-Echelon Form- Examples
B.
æ1 - 5 ç ç0 0 C. ç 0 0 ç ç0 0 è
æ1 ç ç0 D. ç 0 ç ç0 è
2 -1 1 0
3 1
0
0
3ö ÷ - 2÷ 4÷ ÷ 1 ÷ø
æ1 2 -1 4 ö ç ÷ 3 ÷ ç0 1 0 ç0 0 1 - 2÷ è ø 0 0 - 1ö ÷ 1 0 2÷ 0 1 3÷ ÷ 0 0 0 ÷ø
.c om
æ1 2 -1 4 ö ç ÷ A. ç 0 1 0 3 ÷ ç0 0 1 - 2÷ è ø
æ1 2 - 3 4 ö ç ÷ E. ç 0 2 1 - 1 ÷ ç 0 0 1 - 3÷ è ø
m
The matrices on (B) and (D) also happen to be in reduced row - echelon form. The following matrices are not in row - echelon form. æ1 2 -1 2 ö ç ÷ 0 ÷ ç0 0 0 ç0 1 2 - 4÷ è ø
fo
ru
F.
ld
Rank:
w w
w .jn
tu
w
or
The number of non-zero rows in a Row- Echelon Form of a matrix after the elementary row operations gives its rank.
Page:
32
2.3.2 Computations of the rank – Method 2 [Computations of the rank of a matrix by reducing them to the echelon form using elementary row operations]
fo
ru
m
æ 1 1 - 1ö ç ÷ Let A = ç 2 - 3 4 ÷ ç3 - 2 3 ÷ è ø æ 1 1 - 1ö ç ÷ R ¬ R 2 - 2R 1 ~ ç0 - 5 6 ÷ 2 ç 0 - 5 6 ÷ R 3 ¬ R 3 - 3R 1 è ø æ 1 1 - 1ö ç ÷ ~ ç0 - 5 6 ÷ R3 ¬ R3 - R 2 ç0 0 0 ÷ è ø
.c om
æ 1 1 - 1ö ç ÷ 1) Find the rank of the matrix ç 2 - 3 4 ÷ ç3 - 2 3 ÷ è ø Solution :
ld
The given matrix is reduced to its equivalent matrix by elementary row operations
or
and it is in the row - echelon form. The number of non - zero rows is 2.\ r(A) = 2.
tu
w
æ3 1 - 5 -1ö ç ÷ 2) Find the rank of the matrix ç 1 - 2 1 - 5 ÷ ç1 5 - 7 2 ÷ è ø Solution :
w w
w .jn
æ3 1 - 5 -1ö ç ÷ Let A = ç 1 - 2 1 - 5 ÷ ç1 5 - 7 2 ÷ è ø æ1 - 2 1 - 5ö ç ÷ ~ ç3 1 - 5 -1÷ R1 « R 2 ç1 5 - 7 2 ÷ è ø æ1 - 2 1 - 5 ö ç ÷ R ¬ R 2 - 3R 1 ~ ç 0 7 - 8 - 14 ÷ 2 ç 0 7 - 8 - 7 ÷ R 3 ¬ R 3 - R1 è ø æ1 - 2 1 - 5 ö ç ÷ ~ ç 0 7 - 8 - 14 ÷ R 3 ¬ R 3 - R 2 ç0 0 0 - 7 ÷ è ø
The number of non - zero rows in the reduced matrix is 3. \ r(A) = 3.
Page:
33
æ1 2 3 -1 ö ç ÷ 3) Find the rank of the matrix ç 2 4 6 - 2 ÷ ç3 6 9 - 3÷ è ø Solution : æ1 2 3 -1 ö ç ÷ Let A = ç 2 4 6 - 2 ÷ ç3 6 9 - 3÷ è ø
.c om
æ 1 2 3 - 1ö ç ÷ R ¬ R 2 - 2R 1 ~ ç0 0 0 0 ÷ 2 ç 0 0 0 0 ÷ R 3 ¬ R 3 - 3R 1 è ø The number of non - zero rows in the reduced matrix is 1. \ r(A) = 1.
m
2.3.3 Applications of the Rank
or
ld
fo
ru
One useful application of calculating the rank of a matrix is the computation of the number of solutions of a system of linear equations. The system is inconsistent if the rank of the augmented matrix is greater than the rank of the coefficient matrix. If, on the other hand, ranks of these two matrices are equal, the system must have at least one solution. The solution is unique if and only if the rank equals the number of variables. Otherwise the general solution has k free parameters where k is the difference between the number of variables and the rank.
w w
w .jn
tu
w
In control theory, the rank of a matrix can be used to determine whether a linear system is controllable, or observable.
Page:
34
2.4 Let Us Sum Up Rank of a matrix The rank of a matrix, r(A), is the maximum number of independent rows(and therefore columns) that can be found in the matrix. (or)
.c om
A matrix A is said to be of rank r when (i) at least one minor of A of order r is not zero and (ii) every minor of A of order r+1 is zero. (or)
m
The rank of a matrix is the largest order of any non-vanishing minor of the matrix.
ru
Elementary row operations
fo
The following three operations correspond to Elementary row operations.
or
ld
1) Interchange two rows. 2) Multiply a row by a nonzero constant. 3) Add a multiple of a row to another row
w
Row-Echelon Form
w w
3
All rows consisting entirely of zeros occur at the bottom of the matrix. For each row that does not consist entirely of zeros, the first nonzero entry is 1 (a leading 1). For two successive (nonzero) rows, the leading 1 in the higher row is farther to the left than the leading 1 in the lower row.
w .jn
1 2
tu
A matrix in row-echelon form has the following properties.
A matrix in row-echelon form is in reduced row-echelon form if every column that has a leading 1 has zeros in every position above and below its leading 1.
The number of non-zero rows in a Row- Echelon Form of a matrix after the elementary row operations gives its rank.
Page:
2.5 Lesson End Activities
Find the rank of the following matrices :
5)
w w
7)
w .jn
.c om m ru
tu
6)
æ1 2 3ö ç ÷ ç 2 3 4÷ ç 3 4 5÷ è ø æ 3 1 2 0ö ç ÷ ç1 0 -1 0÷ ç 2 1 3 0÷ è ø 4 ö æ 1 -2 3 ç ÷ 4 - 1 - 3÷ ç2 ç-1 2 7 6 ÷ø è æ 6 1 1 1ö ç ÷ ç16 1 - 1 5 ÷ ç 7 2 3 0÷ è ø
fo
4)
ld
3)
3 1 ö æ 2 ç ÷ 6 2 ÷ ç 4 ç - 6 - 9 - 3÷ è ø æ 3 -1 2ö ç ÷ ç - 6 2 4÷ ç - 3 1 2÷ è ø æ1 2 3ö ç ÷ ç1 4 2÷ ç 2 6 5÷ è ø
or
2)
w
1)
æ1 2 3ö ç ÷ ç 2 3 4÷ ç 0 2 2÷ è ø æ 2 3 4ö ç ÷ ç 3 1 2÷ ç -1 2 2÷ è ø
8)
9)
35
Page:
2.6 References 1. Frank Ayres,Jr,”Matrices”. 2. Prof. A.Singaravelu,”Engineering Mathematics – I”. 3. Dr. M.K Venkataraman,” Engineering Mathematics Vol. II”. Prof. P.Kandasamy, K.Thilagavathy, and K.Gunavathy,” Engineering Mathematics” Wikipedia, the free encyclopedia.
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
4.
36
Page:
37
Unit-I Lesson – 3 Eigenvaules and Eigenvectors Contents:
fo
ru
m
.c om
3.0 Aims and objectives 3.1 Introduction 3.2 Linear Transformation 3.2.1 Characteristic equation 3.2.2 Characteristic Matrix 3.2.3 Characteristic Polynomial 3.3 Eigenvalues and Eigenvector 3.3.1 Eigenvalues - Definition 3.3.2 Properties of eigenvaules 3.3.3 Eigenvectors - Definition 3.3.2 Properties of eigenvectors 3.4 Problems and Solutions 3.5 Let Us Sum Up 3.6 Lesson End Activities 3.7 References
ld
3.0 Aims and objectives
w
or
In this lesson, we have discussed about the Linear Transformation, Eigenvalues and Eigenvectors.
w .jn
Perform Linear Transformations. Find eigenvalues and eigenvectors. Know about the properties of eigenvalues and eigenvectors. Understand Cayley-Hamilton theorem and to find the inverse of a matrix. To solve problems using the properties of the eigenvalues and eigenvectors.
w w
· · · · ·
tu
After reading this lesson, you should able to
3.1 Introduction
Eigenvalues are a special set of scalars associated with a linear system of equations (i.e., a matrix equation) that are sometimes also known as characteristic roots, characteristic values (Hoffman and Kunze 1971), proper values, or latent roots (Marcus and Minc 1988, p. 144). The determination of the eigenvalues and eigenvectors of a system is extremely important in physics and engineering, where it is equivalent to matrix diagonalization and arises in such common applications as stability analysis, the physics of rotating bodies, and small oscillations of vibrating systems, to name only a few. Each eigenvalue is paired with a corresponding so-called eigenvector.
Page:
38
3.2 Linear Transformation Consider a system of n linear equations in n variables. y1 = a11 x1 + a12 x 2 + .... + a1n x n y 2 = a 21 x1 + a 22 x 2 + .... + a 2 n x n
.
------------------- > (1)
. .
.c om
y n = a n1 x1 + a n 2 x 2 + .... + a nn x n
m
The above set of equations is said to form a linear transformation i.e. the equations (1) transform the n variables x1 ,x2 ,x3 , …, xn into n variables y1 ,y2 ,…, yn . ------------------- > (2)
or
ld
fo
ru
Rewriting (1) as Y = A X Where æ a11 a12 . a1n ö æ x1 ö æ y1 ö ç ÷ ç ÷ ç ÷ ç a 21 a 22 . a 2 n ÷ çx2 ÷ çy ÷ A=ç , X = ç ÷ and Y = ç 2 ÷ ÷ . . . . ç ÷ ç ÷ ç ÷ çx ÷ çy ÷ ça ÷ a . a n2 nn ø è nø è nø è n1
w .jn
tu
w
The equation (2) is said to be a linear transformation of vector X into another vector Y; A is called the matrix of transformation and |A| is called the modulus of the transformation. If |A| = 0 the transformation is singular; otherwise non-singular. 3.2.1 Characteristic equation
w w
The characteristic equation of the matrix A is |A-lI| = 0. It is a polynomial equation in l. · A matrix A satisfies its own characteristic equation (Cayley-Hamilton theorem) 3.2.2 Characteristic Matrix The characteristic matrix of A is (A-lI) and is a function of the scalar l.
3.2.3 Characteristic Polynomial The characteristic polynomial, p(t), of a matrix A is p(t) = |A-lI|. ·
The characteristic polynomial of A n´n is of the form: ln -tr(A)* ln-1 + ... + -1n |A|. ·
The characteristic polynomial of A 2´2 is l2 - tr(A)* l + |A|
Page:
39
3.3 Eigenvalues and Eigenvector 3.3.1 Eigenvalues - Definition The eigenvalues of a matrix are the roots of its characteristic equation. They may also be referred to by any of the fourteen other combinations of: [characteristic, eigen, latent, proper, secular] + [number, root, value]. That is, the eigenvalues of matrix A are the roots of its characteristic equation: |A-lI| = 0.
.c om
The function eig(A) denotes a column vector containing all the eigenvalues of A with appropriate multiplicities. 3.3.2 Properties of eigenvaules
m
ru
fo
ld
or
w
tu
w w
· ·
The matrix A has exactly n eigenvalues (not necessarily distinct) [Complex]: tr(A) = sum(eig(A)) [Complex]: det(A) = prod(eig(A)) [A:m*m, C:n*n]: eig([A B; 0 C]) = [eig(A); eig(C)] det(A)=0 iff 0 is an eigenvalue of A The eigenvalues of a triangular or diagonal matrix are its diagonal elements. [ Hermitian]: The eigenvalues of A are all real. [ Unitary]: The eigenvalues of A have unit modulus. [ Nilpotent]: The eigenvalues of A are all zero. [ Idempotent]: The eigenvalues of A are all either 0 or 1. The eigenvalues of Ak are (eig(A))k Similar matrices have the same eigenvalues Sum of the eigen values is equal to the sum of the diagonal elements. The product of the eigen values of a matrix A is equal to its determinant value. A square matrix A and its transpose AT have the same eigen values. If l1 , l2, ….,ln, are eigen values of matrix A, then
w .jn
· · · · · · · · · · · · · ·
(i ) the inverse A -1 has the eigenvalues
1 1 1 , ,...., . λ1 λ 2 λn
(ii ) the matrix A + kI has the eigenvalues k + λ 1 , k + λ 2 ,..., k + λ n . (iii ) the matrix A - kI has the eigenvalues λ 1 - k ,..., λ n - k .
(iv) the matrix A 2 has the eigenvalues λ 21 , λ 22 ..., λ 2n .
(v) the matrix kA has the eigenvalues kλ 1 , kλ 2 ,..., kλ n . 3.3.3 Eigenvectors - Definition v l is an eigenvalue of An´n iff for some non-zero x, A x =l x. x is then called an eigenvector corresponding to l.
Page:
3.4 Problems and Solutions ü Non-symmetric matrices with non repeated eigenvalues 1) Find the eigenvalues and eigenvectors of the matrix æ4 1ö ÷÷ A = çç è 3 2ø
Solution
1 =0 2-l
m
4-l 3
.c om
The characteristic equation is | A - lI | = 0
ld
fo
ru
(4 – l) (2 – l) – 3 = 0 l2 – 6l+5 = 0 (l – 1) (l – 5) =0 \l = 1 or 5.
or
\ The eigenvalues are 1 and 5. Eigenvectors: When l =1, the equation
w
æ x1 ö Where X = çç ÷÷ becomes è x2ø
tu
(A - λI )X = 0
1
3
2-1
X1
0
= X2
0
w w
w .jn
4-1
3x1 + x2 = 0 3x1 + x2 = 0
(or)
x2 = –3x1
Since the value of x2 is –3 times of x1 , the general eigenvector corresponding æ k ö where k is a constant. For different values of k we get different çç ÷÷ è - 3k ø eigenvectors. Therefore, for k = 1 the eigenvector is æç 1 ö÷ ç - 3÷ è ø
to l = 1 is
40
Page:
x1 When l= 5, the equation (A - lI) X = 0, where X = æç ö÷ , becomes ç x2 ÷ è ø
1 ö æ x1 ö æ 0 ö æ4 - 5 çç ÷ç ÷=ç ÷ 2 - 5 ÷ø çè x 2 ÷ø çè 0 ÷ø è 3 æ - 1 1 ö æ x1 ö æ 0 ö çç ÷÷ çç ÷÷ = çç ÷÷ 3 3 è ø è x 2 ø è0ø
.c om
-x1 + x2 = 0 Þ x1 = x2
i.e.,
3x1 – 3x2 = 0 Þ x1 = x2
æ1ö çç ÷÷ è1ø
ru
For k = 1, the eigenvector will be
fo
æk ö çç ÷÷ èk ø
or
ld
\ The general eigenvector can be
m
By giving x2 = k, we have x1 =k and therefore for different values of k we get different eigenvectors.
w
Hence
tu
æ 1 ö When λ = 1 the eigenvector is çç ÷÷ è - 3ø
w w
w .jn
æ 1ö When l = 1 the eigen vector is çç ÷÷ è 1ø
41
Page:
42
2) Find the e igenvalues and eige nvectors o f æ 4 - 20 - 10 ö ç ÷ 4 ÷ ç - 2 10 ç 6 - 30 - 13 ÷ è ø Solution : Let A be the giv en matrix and | A - λI | = 0 be its charac teristic e quation .
4 - λ - 20 - 2 10 - λ - 30
6
=0
- 13 - λ
(4 - λ) [(10 - λ) (-13 - λ) + 120] + 20[26 + 2λ - 24] - 10[60 - 60 + 6l ] = 0 λ 3 - λ 2 - 2λ = 0
ru
i.e.,
- 10 4
m
i.e., i.e.,
- 10 ö ÷ 4 ÷ - 13 ÷ø
.c om
æ 4 - 20 ç A = ç - 2 10 ç 6 - 30 è
λ( λ 2 - λ - 2) = 0 λ = 0, (λ - 2)(λ + 1) = 0 λ = 0, λ = -1, λ = 2. \ the eigenv alues are λ = 0, - 1, 2. The equation (A - λ I) X = 0 gives the eigenvecto rs X for each eigenvaule s ( λ).
ld
or
w
- 10 ö ÷ 4 ÷ - 13 - λ ÷ø
tu
æ 4 - λ - 20 ç ç - 2 10 - λ ç 6 - 30 è
æ x1 ö æ 0 ö ç ÷ ç ÷ ç x 2 ÷ = ç0÷ ç x ÷ ç0÷ è 3ø è ø
w .jn
i.e.,
fo
i.e., i.e., i.e.,
( 4 - λ)x 1 - 20 x 2 - 10 x 3 = 0 - 2x 1 + (10 - λ) x 2 + 4 x 3 = 0 6x 1 - 30 x 2 - (13 + λ) x 3 = 0
- - - - - - - -- >
w w
For a given value of λ , the components x 1 , x 2 , x 3 of the eigenvecto r can be computed from the above set of equatio ns. Case (i) : When λ = 0, the above equation becomes 4 x 1 - 20 x 2 - 10 x 3 = 0 - 2x 1 + 10 x 2 + 4 x 3 = 0 6x 1 - 30 x 2 - 13 x 3 = 0
Page:
We have, by the cross rule method of the first two equations, x1 x2 x3 - 20
- 10
4
- 20
10
4
-2
10
i.e.,
ld or
5x 1 - 20 x 2 - 10 x3 = 0 - 2x 1 + 11x 2 + 4 x3 = 0 6x 1 - 30 x 2 - 12 x3 = 0
fo
Case (ii) : When λ = -1, the equations (1) becomes
ru
æ 20k ö ç ÷ The general eigenvector corresponding to λ = 0 is ç 4k ÷. ç 0 ÷ è ø æ5ö ç ÷ 1 By taking k = , we get the eigenvector X 1 = ç 1 ÷. 4 ç0÷ è ø
m
i.e.,
.c om
x3 x1 x2 = = - 80 + 100 20 - 16 40 - 40 x1 x 2 x3 = = =k 20 4 0 x1 = 20k, x 2 = 4k, x3 = 0
i.e.,
tu
w
From the first two equations, we have by the cross rule method x1 x2 x3
w .jn
- 20 11
i.e.,
w w
i.e.,
i.e.,
- 10 4
5 -2
- 20 11
x3 x1 x2 = = - 80 + 110 20 - 20 55 - 40 x1 x 2 x3 = = =k 30 0 15 x1 = 30k, x 2 = 0, x3 = 15k
æ 30k ö ç ÷ \ The general eigenvector corresponding to λ = -1 is ç 0 ÷. ç 15k ÷ è ø æ 2ö ç ÷ 1 By taking k = , we get the eigenvector X 2 = ç 0 ÷. 15 ç1÷ è ø
43
Page:
Case (iii) : When λ = 2 the equations (1) becomes 2 x 1 - 20 x 2 - 10 x3 = 0 - 2x 1 + 8 x 2 + 4 x3 = 0 6x 1 - 30 x 2 - 15 x3 = 0 From the first two equations, we have by the cross rule method x1 x2 x3 - 20 - 10 5 - 20
i.e., i.e.,
8
.c om
-2 x3 x1 x2 = = - 80 + 80 20 - 8 16 - 40 x x1 x 2 = = 3 =k 0 12 - 24 x1 = 0, x 2 = 12k, x3 = -24k
i.e.,
4
m
8
or
ld
fo
ru
æ 0 ö ç ÷ \ The general eigenvector corresponding to λ = 2 is ç 12k ÷. ç - 24k ÷ è ø æ 0 ö ç ÷ 1 By taking k = , we get the eigenvector X 2 = ç 1 ÷. 12 ç - 2÷ è ø
tu
w
The eigen vector correponding to λ = 0 is (5,1,0) The eigen vector correponding to λ = -1 is (2,0,1) The eigen vector correponding to λ = 2 is (0,1,-2)
w w
w .jn
The three eigenvectors are linearly independent.
44
Page:
45
Ø Non-symmetric matrices with repeated eigenvalues 3) Find the eigen values and eigen vectors of æ 6 -6 5 ö ç ÷ ç14 - 13 10 ÷ ç 7 -6 4 ÷ è ø Solution : Let A be the given matrix and | A - λI | = 0 be its characteri stic equation .
i.e.,
6-λ
-6
14 7
- 13 - λ -6
5 10 = 0 4-λ
m
i.e.,
-6 5 ö ÷ - 13 10 ÷ - 6 4 ÷ø
.c om
æ6 ç A = ç14 ç7 è
(6 - λ) [(-13 - λ) (4 - λ) + 60] + 6[14(4 - λ) - 70] + 5[-84 - 7(-13 - λ) ] = 0
fo
(6 - λ) (λ 2 + 9λ + 8) - 84 λ - 84 + 35 + 35λ = 0
ru
(6 - λ) [-52 + 13λ - 4λ + λ 2 + 60] + 6[56 - 14λ - 70] + 5[7 + 7λλ] = 0
or
ld
λ 3 + 3λ 2 + 3λ + 1 = 0 (λ + 1)(λ + 1)(λ + 1) = 0 λ = -1, - 1,-1
5 ö ÷ 10 ÷ 4 - λ ÷ø
æ x1 ö æ 0 ö ç ÷ ç ÷ ç x 2 ÷ = ç0÷ ç x ÷ ç0÷ è 3ø è ø
tu
-6 - 13 - λ -6
w .jn
i.e.,
æ6 - λ ç ç 14 ç 7 è
w
\ the eigenv alues are λ = -1, - 1, - 1. The equation (A - λ I) X = 0 gives the eigen vectors X for each eigenvaule s ( λ).
- - - - - - - -- >
w w
=0 (6 - λ)x 1 - 6 x 2 + 5 x 3 14x 1 - (13 + λ) x 2 + 10 x 3 = 0 7x 1 - 6 x 2 + ( 4 - λ) x 3 = 0
For a given value of λ , the components x 1 , x 2 , x 3 of the eigen vector can be computed from the above set of equations . When λ = -1, the above system of equations become 7 x 1 - 6 x 2 + 5x 3 = 0 14x 1 - 12 x 2 + 10 x 3 = 0 7x 1 - 6 x 2 + 5 x 3 = 0 Since the three equations are same, the eigen vectors can be obtained by giving arbitrary values to any two of the quantities x 1 , x 2 and x 3 .
Page:
The above equation can be written as 7 x 1 = 6 x 2 - 5x 3 (or)
x1 =
6 5 k1 - k 2 7 7
where x 2 = k 1 .x 3 = k 2 .
.c om
5 ö æ6 ç k1 - k 2 ÷ 7 ÷ ç7 \ the general eigenvector is ç k1 ÷ ç ÷ k 2 ç ÷ è ø Putting k 1 = 0, k 2 = 7, we get, x 1 = -5 i.e., first eigen vector is (-5,0,7). Putting k 2 = 0, k 1 = 7, we get,
x1 = 6 x1 = 0
ru
Putting k 1 = 5, k 2 = 6, we get,
m
i.e., second eigen vector is (6,7,0).
fo
i.e., third eigen vector is (0,5,6).
w w
w .jn
tu
w
or
ld
-5 0 7 These three vectors are linearly independent since 6 7 0 ¹ 0. 0 5 6
46
Page:
47
PROBLEMS USING PROPERTIES OF EIGENVALUES AND EIGENVECTORS 1) Find the sum and product of the eigen values of
æ 2 1 1ö ç ÷ A = ç 1 2 1÷ ç 0 0 1÷ è ø Sum of the eigen values = Sum of the leading diagonal elements
.c om
= 2+2+1=5
m
2 1 1 Product of the eigen values = 1 2 1 = 2(2) - 1(1) = 3 0 0 1
fo
ru
æ 3 10 5 ö ç ÷ 2) If 2 and 3 are the eigen values of A = ç - 2 - 3 - 4 ÷, find the eigen values of A -1 and A 3 . ç3 5 7÷ è ø
w
[Since l1 = 2, l2 =3]
tu
2+3+l3 = 7
or
Then l1 + l2 + l3 = 3 –3 + 7 = 7
ld
Let l1 , l2 , l3 , are the eigen values of A.
w .jn
l3 = 2
w w
1 1 1 \ the eigen values of A -1 are , , . 2 2 3 3 The eigen values of A are 2 3 ,2 3 ,33 æ -1 0 0ö ç ÷ 3) Given the matrix A = ç 2 - 3 0 ÷, find the eigen values of A 2 . ç 1 4 2÷ è ø [Property: The characteristic roots of a triangular matrix are the diagonal elements of the matrix.] Since the given matrix is a triangular matrix, the diagonal elements -1, -3, 2 of A will be the eigen values of A. \The eigenvalues of A2 are 12 , (-3)2 , (2)2 , i.e., 1, 4, 9.
Page:
3.5 Let Us Sum Up Linear transformation
.c om
The equation Y = A X , where æ a11 a12 . a1n ö æ x1 ö æ y1 ö ç ÷ ç ÷ ç ÷ ç a 21 a 22 . a 2 n ÷ çx2 ÷ çy ÷ A=ç , X = ç ÷ and Y = ç 2 ÷ ÷ . . . . ç ÷ ç ÷ ç ÷ çx ÷ çy ÷ ça ÷ a . a n2 nn ø è nø è nø è n1 is said to be a linear transformation of vector X into another vector Y. Characteristic equation
ru
m
The characteristic equation of the matrix A is |A-lI| = 0. It is a polynomial equation in l.
fo
Cayley-Hamilton theorem
ld
A matrix A satisfies its own characteristic equation
or
Characteristic Matrix
w
The characteristic matrix of A is (A-lI) and is a function of the scalar l.
tu
Characteristic Polynomial
·
w .jn
The characteristic polynomial, p(t), of a matrix A is p(t) = |A-lI|.
w w
The characteristic polynomial of A n´n is of the form: ln - tr(A)* ln-1 + ... + -1n |A|. · The characteristic polynomial of A 2´2 is l2 - tr(A)* l + |A| Eigenvalues The eigenvalues of matrix A are the roots of its characteristic equation: |A-lI| = 0.
Properties of eigenvaules · · · ·
The matrix A has exactly n eigenvalues (not necessarily distinct) det(A)=0 iff 0 is an eigenvalue of A The eigenvalues of a triangular or diagonal matrix are its diagonal elements. [ Hermitian]: The eigenvalues of A are all real.
48
Page:
[ Unitary]: The eigenvalues of A have unit modulus. [ Nilpotent]: The eigenvalues of A are all zero. [ Idempotent]: The eigenvalues of A are all either 0 or 1. The eigenvalues of Ak are (eig(A))k Similar matrices have the same eigenvalues Sum of the eigenvalues is equal to the sum of the diagonal elements. Product of eigenvalues is equal to it determinant value. Every square matrix and its transpose have the same eigenvalues.
·
If l1 , l2, ….,ln, are eigenvalues of matrix A, then
(i ) the inverse A -1 has the eigenvalues
.c om
· · · · · · · ·
1 1 1 , ,...., . λ1 λ 2 λn
m
(ii ) the matrix A + kI has the eigenvalues k + λ 1 , k + λ 2 ,..., k + λ n .
ru
(iii ) the matrix A - kI has the eigenvalues λ 1 - k ,..., λ n - k .
fo
(iv) the matrix A 2 has the eigenvalues λ 21 , λ 22 ..., λ 2n .
w w
w .jn
tu
w
or
ld
(v) the matrix kA has the eigenvalues kλ 1 , kλ 2 ,..., kλ n .
49
Page:
50
3.6 Lesson End Activities æ1 2 3 ö ç ÷ 1) Find the sum and product of the eigen values of A = ç 2 3 4 ÷ ( Use property). ç 3 6 7÷ è ø æ 3 1 4ö ç ÷ 2) Find the eigen values of the matrix A = ç 0 2 0 ÷ ( Use property). ç0 0 5÷ è ø
.c om
3) Define characteristic equation, eigen values and eigen vectors of a square matrix A. 4) State Cayley - Hamilton theorem.
ru
m
æ1 3ö ÷÷ 5) Find the eigen values and eigen vectors of A = çç è0 2ø 6) Find the eigen values and eigen vectors of the following matrices. * Non - symmetric matrices with non - repeated eigen values.
ld
fo
æ - 15 4 3 ö æ 3 1 4ö ç ÷ ç ÷ æ 2 - 1ö ÷÷ a) ç 10 - 12 6 ÷ b) ç 0 2 6 ÷ c) çç è- 8 4 ø ç 20 - 4 2 ÷ ç0 0 5÷ è ø è ø * Non - symmetric matrices with repeated eigen values. æ 2 1 1ö æ 2 1 0ö ç ÷ ç ÷ e) ç 1 2 1÷ f) ç 0 2 1 ÷ ç 0 0 1÷ ç 0 0 2÷ è ø è ø æ1 2 ö ÷÷. 7) Find A 8 , if A = çç è 2 - 1ø
w .jn
tu
w
or
æ2 1 1ö ç ÷ d) ç 2 3 2 ÷ ç 3 3 4÷ è ø
w w
æ 2 -1 1 ö ç ÷ 8) Obtain the inverse by finding the characteristic equation of ç - 1 2 - 1÷ . ç1 1 2÷ è ø 9) Find the characteristic equation of the following matrix and verify that it is satisfied by the matrix. æ1 2ö ÷÷ a) çç è0 2ø
æ 3 1 - 1ö ç ÷ b) ç 1 3 1 ÷ ç -1 1 3 ÷ è ø
2 - 2ö æ 7 ç ÷ 10) Using Cayley - Hamilton theorem find the inverse of the matrix ç - 6 - 1 2 ÷. ç 6 2 - 1 ÷ø è
Page:
3.7 References 1) Frank Ayres,Jr,”Matrices”. 2) Prof. A.Singaravelu,”Engineering Mathematics – I”. 3) Dr. M.K Venhataraman,” Engineering Mathematics Vol. II”. 4) Prof. P.Kandasamy, K.Thilagavathy, and K.Gunavathy,” Engineering Mathematics”.
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
5) Wikipedia, the free encyclopedia.
51
Page:
52
Unit II Lesson – 4 Set Theory Contents:
.c om
4.0 Aims and objectives 4.1 Introduction 4.2 Set and its elements 4.3 Set Description 4.4 Types of Sets 4.5 Venn-Euler Diagrams 4.6 Let Us Sum Up 4.7 Lesson End Activities 4.8 References
m
4.0 Aims and objectives
4.1 Introduction
w
or
ld
About set and methods of description. Know about the types of sets. Represent sets using Venn-Euler Diagrams and to solve problems.
tu
· · ·
fo
After reading this lesson, you should able to
ru
In this lesson, we have discussed about set theory and Venn-Euler Diagrams.
w w
w .jn
The concept of set theory, originated in 1895 by the German mathematician G.Cantor, is used in various disciplines. This chapter introduces the notation and terminology of set theory.
Page:
53
4.2 Set and its elements Definition:
A set is a collection of objects.
Examples: i) ii) iii) iv)
The odd integers between 10 and 20. The vowels in English alphabet Rivers in India The planets in the Solar system.
.c om
Elements of a set:
m
The objects of a set are called its elements or members conventionally, capital letters A, B, C, D, etc. are used to denote sets and lower case letters a, b, c, d, etc. are used to denote its members.
fo
ru
The symbol Î is used to indicate ‘belongs to’. The statement ‘p is an element of A’ is written as p Î A. The symbol Ï is used to indicate ‘does not belongs to’. The statement ‘q is not an element of A’ is written as q Ï A.
ld
Some standard sets
Remark
w .jn
tu
w
or
Some sets occur very often in the text and so we use special symbols for them. They are i) The set of Natural numbers i.e. N = { 1, 2, 3, 4, …} ii) The set of Integers (or countable numbers) i.e. I = { …,-3, -2, -1, 0, 1, 2, 3, …} iii) The set of Positive Integers i.e. I+ = { 1, 2, 3, …} iv) The set of rational numbers p i.e. Q = {x : x = , where p and q are integers and q ¹ 0 } q
w w
1) The quantitative attributes like honest persons, rich person, beautiful women, etc do not form sets.
4.3 Set Description There are two different ways for describing a set. They are 1) Roster method and 2) Set Builder method.
Page:
54
1) Roster Method In this method the members are represented as a list. For example, V = {a, e, i, o, u} denotes the set V whose elements are the letters a, e, i, o, u. Note that the elements of the set are separated by commas and enclosed in braces {}. 2) Set Builder method
.c om
Sometimes we cannot list the elements of a set explicitly. In this method, the set is defined by stating the properties which characterizing the members. For example, V = {x : x is a vowel in English alphabet} B = {x : x is an even integer, x > 0 }
m
4.4 Types of Sets
ru
Finite set
fo
A set having finite number of elements or members is known as finite set.
or
ld
Examples: 1) The set of months in a year. 2) The set of vowels in the English alphabet.
w
Infinite set
w .jn
Examples:
tu
A set having infinite number of elements or members is known as infinite set.
w w
3) The set of all natural numbers i.e. N = { 1, 2, 3, 4, …} 4) The set of integers, I = { …, -3, -2, -1, 0, 1, 2, 3, …} Null set
A set with no elements is called the empty set or null set and is denoted by Æ (read as phi) or {}. For example,
A = {x : x3 + 4 = 0, x is real }
Equality of sets Two sets A and B are said to be equal if every element of A is an element of B and also every element of B is an element of A. If the sets A and B are equal, they are denoted by A = B.
Page:
55
For example, i) If A = {4, 3, 2, 1} and B = {1, 3, 4, 2} then A=B, because both have same and equal number of elements. ii) If A = set of all integers whose square is 9, B = set of all roots of the equation, x2 – 9 = 0 and C = {-3, +3} then A = B. Equivalent Sets
m
The symbol , ~ or º is used to denote equivalent sets.
.c om
Let A and B are two sets. The sets A and B are said to be equivalent sets if and only if there exists a one-to-one correspondence between their elements. By one-toone correspondence we mean that for each element in A, there exists and match with one element in B and vice versa.
ru
Illustration
or
ld
fo
A = {x : x is a letter in the word BOAT} B = {x : x is a letter in the word CART} Thus A º B.
w
Subset
Theorem
w .jn
tu
Let A and B be two non-empty sets. If every element of A is also an element of B, then A is called a subset of B. This relationship is written as A Í B or B Ê A. If A is not a subset of B, i.e. if at least one element of A does not belong to B, we write A Ë B.
w w
i) ii) iii) iv)
For any set A, we have Æ Í A Í U. For every set A, we have A Í A. If A Í B and B Í C, then A Í C. A = B if and only if A Í B and B Í A.
If A Í B, then it is still possible that A = B. When A Í B but A¹ B, we say A as a proper subset of B. For example, suppose A = {1,3} B = {1, 2, 3} C = {1, 3, 2}. Then both A and B are subsets of C; but A is a proper subset of C, where as B is not a proper subset of C since B = C.
Page:
56
Power Set If A is any set, then the family of all the subsets of A is called power set of A and is denoted by P(A), i.e. P(A) = { B : BÌ A}. Obviously, Æ and A are both members of P(A). Illustrations i) ii) iii)
Let A = {b}, then P(A) = { Æ, {b}} Let A = Æ, then P(A) = {Æ} If A = {8, 9}, then P(A) = { Æ, {8}, {9},{8,9}}
.c om
Number of subsets
The number of subsets of a set with n elements is 2n -2 (leaving Ø and the full set) Ø,A are called improper subsets of A.
m
Number of proper subsets
ru
The number of proper subsets of a set with n elements is 2n – 1.
fo
Universal set
tu
w
or
ld
In every problem there is either a stated or implied universe of discourse. The universe of discourse includes all things under discussion at a given time. In the mathematical theory of sets, the universe of discourse is called the universal set. The letter U is typically used for the universal set. The universal set might well change from problem to problem.
w .jn
4.5 Venn-Euler Diagrams
w w
In most areas of mathematics, our reasoning can be aided and clarified by utilizing various kinds of drawings and diagrams. In set theory, we commonly use Venn diagrams, developed by the logician John Venn (1834-1923). In these diagrams, the universal set is represented by a rectangle, and other sets of interest within the universal set are depicted by oval regions, or sometimes by circles or other shapes. If the sets A and B are equal, then the same circle represents both A and B. If the sets A and B are disjoint, i.e. they have no elements in common, then circles representing A and B are drawn in such a way that they have no common area as shown in figure(a). However if few elements are common both in A and B, then sets A and B are in general represented as in figure(b).
Page:
57
4.6 Let Us Sum Up Set A set is an unordered collection of distinct and distinguishable objects. Roster Method In this method the members are represented as a list. Set Builder method
.c om
The set is defined by stating the properties which characterizing the members. Finite set
m
A set having finite number of elements or members is known as finite set.
ru
Infinite set
fo
A set having infinite number of elements or members is known as infinite set.
ld
Null set
or
A set with no elements is called the empty set or null set and is denoted by Æ.
w
Equality of sets
w .jn
tu
If every element of A is an element of B and also every element of B is an element of A then the sets A and B are equal, denoted by A = B. Equivalent Sets
w w
The sets A and B are said to be equivalent sets if and only if there exists a oneto-one correspondence between their elements. The symbol , ~ or º is used to denote equivalent sets.
Subset If every element of A is also an element of B, then A is called a subset of B. This relationship is written as A Í B or B Ê A. If A is not a subset of B, i.e. if at least one element of A does not belong to B, we write A Ë B.
Page:
58
Power Set If A is any set, then the family of all the subset of A is called power set of A and is denoted by P(A), i.e. P(A) = { B : BÌ A}. Obviously, Æ and A are both members of P(A). Number of subsets The number of subsets of a set with n elements is 2n .
.c om
Number of proper subsets The number of proper subsets of a set with n elements is 2n – 2. Universal set
ru
m
The universe of discourse is called the universal set. The letter U is used for the universal set.
fo
Venn-Euler Diagrams
w w
w .jn
tu
w
or
ld
In these diagrams, the universal set is represented by a rectangle, and other sets of interest within the universal set are depicted by oval regions, or sometimes by circles or other shapes.
Page:
59
4.7 Lesson End Activities 1. List the members of these sets. a) {x | x is a real number such that x2 = 1} b) {x | x is a positive integer less than 12} c) {x | x is the square of an integer and x < 100} d) {x | x is an integer such that x2 — 2}
m
3. Determine whether each of these pairs of sets are equal. a) {1,3,3,3,5,5,5,5,5}, {5,3, 1} b) {{1}}, {1,{1}} c) Æ,{Æ}
.c om
2. Use set builder notation to give a description of each of these sets. a) {0,3,6,9, 12} b) {-3,-2,-1,0,1,2,3} c) {m, n, o, p}
fo
ru
4. Suppose that A = {2, 4, 6}, B = {2, 6}, C = {4, 6}, and D ={4, 6, 8}. Determine which of these sets are subsets of which other of these sets.
tu
w
or
{x Î R | x is an integer greater than 1} {x Î R | x is the square of an integer} {2,{2}} {{2},{{2}}} {{ 2 }, {2, { 2 } } } {{{2}}}
w .jn
a) b) c) d) e) f)
ld
5. For each of the following sets, determine whether 2 is an element of that set.
6. For each of the sets in Exercise 5, determine whether {2} is an element of that set.
w w
7. Use a Venn diagram to illustrate the relationship A Í B and B Í C. 8. Suppose that A, B, and C are sets such that A Í B and B Í C. Show that A Í C. 9. Find two sets A and B such that A Î B and A Í B. 10. What is the cardinality of each of these sets? a) {a} b) {{a}} c) {a,{a}} d) {a,{a},{a,{a}}} 11.What is the cardinality of each of these sets? a) Æ b) {Æ} c) {Æ, {Æ}} d) {Æ,{Æ},{Æ,{Æ}}}
Page:
12 Find the power set of each of these sets. a) {a) b) {a,b} c) {Æ, {Æ}} 13. Can you conclude that A = B if A and B are two sets with the same power set?
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
14. How many elements does each of these sets have? a) P({a, b,{a, b}}) b) P({8,a,{a},{{a}}}) c) P(P(Æ))
60
Page:
4.8 References 1) J K Sharma, ”Discrete Mathematics” 2) Kenneth H.Rosen, “Discrete Mathematics and its Applications” 3) Seymour Lipschutz and Marc Lipson, “Discrete Mathematics” 4) Charles D.Miller and Others, “Mathematical Ideas”
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
5) Wikipedia, the free encyclopedia.
61
Page:
62
Unit II Lesson – 5 Set operations and laws of set theory
Contents:
w
5.0 Aims and objectives
or
ld
fo
ru
m
.c om
5.0 Aims and objectives 5.1 Introduction 5.2 Set operations and laws of set theory. 5.2.1 Union of sets 5.2.2 Intersection 5.2.3 Disjoint 5.2.4 Difference of two sets 5.2.5 Complement of a set 5.3 Algebra of sets and Duality 5.3.1 Set Identities 5.3.2 Duality 5.3.3 Proofs using set builder notation, membership tables and Venn diagrams 5.4 Partitions of sets 5.5 Minsets 5.6 Let Us Sum Up 5.7 Lesson End Activities
w .jn
tu
In this lesson, we have discussed about set operations, laws of set theory, algebra of sets and duality. After reading this lesson, you should able to Do set operations like Union, Intersection, and Disjoint. Find the set differences and set complements. Know about the set identities and different methods to prove them. Know about the duality and finding the duality of an equation. Partition the sets and to generate minsets.
w w
· · · · ·
5.1 Introduction In this section we will discuss the various operators that are used to combine two or more sets and how to work with sets using set algebra and duality. .
Page:
63
5.2 Set operations and laws of set theory. Two or more sets can be combined in many different ways. In this section we will discuss the various operators that are used for this purpose. 5.2.1 Union of sets Let A and B be sets. The union of A and B, denoted by A È B, is the set that contains those elements that are either in A or in B, or in both.
.c om
An element x belongs to the union of the sets A and B if and only if x belongs to A or x belongs to B. Symbolically, A È B = { x : x Î A or x Î B } Illustration
m
If A = {1,2,3,4} and B={2,8,9}, then A È B = {1,2,3,4,8,9}
ru
5.2.2 Intersection
ld
fo
Let A and B b e sets. The intersection of A and B, denoted by A Ç B, is the set that containing those elements in both A and B.
w
or
An element x belongs to the intersection of the sets A and B if and only if x belongs to A and x belongs to B. Symbolically, A Ç B = {x : x Î A and x Î B }
tu
5.2.3 Disjoint
w w
Example 1
w .jn
Let A and B be sets. If intersection of the sets A and B is an empty set, then these two sets are said to be disjoint. Symbolically, AÇB=Æ
Let A = {1,3,5,7,9} and B = {2,4,6,8,10}. Since A Ç B = Æ, A and B are disjoint.
5.2.4 Difference of two sets Let A and B be sets. The difference of A and B denoted by A – B or A\B, is the set having those elements that are in A but not in B. An element x belongs to the difference of the sets A and B if and only if x belongs to A and x does not belong to B. Symbolically, A\B = A – B = { x : x Î A and x Ï B }
Page:
64
Properties of Difference of two sets 1) 2) 3) 4) 5) 6)
A–A= Æ A–Æ =A A–BÍA A – B, A Ç B and B-A are mutually disjoint (A – B) Æ B = Æ Ç (A – B) Ç A = A
.c om
5.2.5 Complement of a set Let U be the universal set and A be any set. The complement of A, denoted by A’, is the complement of A with respect to U.
tu
w
or
ld
fo
ru
m
An element x belongs to A’ if and only if x Ï A. This tells us that A’ = {x : x Ï A} In fig. 5.1 the shaded area outside the circle representing A is the area representing A’.
w .jn
Example 2
1. If N = { 1,2,3,4,…} is the universal set and let A = {1,3,5,7, …}, then A’ = N – A = { 2,4,6,8,…}
w w
2. U’ = Æ and Æ ’ = U
Properties 1. A È A’ = U 2. A Ç A’ = Æ 3. U’ = Æ 4. Æ’ = U 5. (A’)’ = A 6. (A – B) = A Ç B’ 7. If A Í B, then A È (B – A) = B 8. (A È B)’ = A’ Ç B’ 9. (A Ç B)’ = A’ È B’
Page:
65
5.3 Algebra of sets and Duality 5.3.1 Set Identities Sets under the operation of Union, Intersection, and Complement satisfy various laws or identities. The table 5.1 lists the most important set identities. These identities can be proved by different methods. We will prove some of these identities in this lesson and the proof of the remaining identities will be left as exercises. Table: 5.1 Set Identities Name Identity laws
Domination laws
m
Idempotent laws
w
or
ld
B) È C B) Ç C B) È (A Ç C) B) Ç (A È C)
Associative laws Distributive laws De Morgan’s laws Absorption laws Complement laws
w w
w .jn
fo
ru
Complementation law Commutative laws
tu
AÈÆ=A AÇU=A AÈU=U AÇÆ=Æ AÈA=A AÇA=A (A’)’ = A AÈB=BÈA AÇB=BÇA A È (B È C) = (A È A Ç (B Ç C) = (A Ç A Ç (B È C) = (A Ç A È (B Ç C) = (A È (A È B)’ = A’ Ç B’ (A Ç B)’ = A’ È B’ A È (A Ç B) = A A Ç (A È B) = A A È A’ = U A Ç A’ = Æ
.c om
Identity
5.3.2 Duality
Note that the identities in table 5.1 are arranged in pairs. The principle behind this arrangement is just the replacement of sets and operators. Suppose E is an equation of set algebra. The dual E* of E is the equation obtained by replacing each occurrence of È, Ç, U and Æ in E by Ç, È, Æ and U, respectively. For example, the dual of (U Ç A) È (B Ç A) = A is (Æ È A) Ç (B È A) = A
Page:
5.3.3 Proofs using set builder notation, membership tables and Venn diagrams a) Prove the distributive laws using set builder notation and logical equivalence. 1) Prove A È (B Ç C) = (A È B) Ç (A È C)
.c om
Proof: Let x is an arbitrary element of A È (B È C). Then x Î A È (B Ç C) Û x Î A or x Î (B Ç C) Û x Î A or (x Î B and x Î C) Û (x Î A or x Î B) and (x Î A or x Î C) Û x Î (A È B) and x Î (A È C) Û x Î (A È B) Ç (A È C) Hence A È (B Ç C) = (A È B) Ç (A È C)
m
2) Prove A Ç (B È C) = (A Ç B) È (A Ç C)
or
ld
fo
ru
Proof: Let x is an arbitrary element of A Ç (B È C). Then x Î A Ç (B È C) Û x Î A and x Î (B È C) Û x Î A and (x Î B or x Î C) Û (x Î A and x Î B) or (x Î A and x Î C) Û x Î (A Ç B) and x Î (A Ç C) Û x Î (A Ç B) È (A Ç C)
w
Hence A Ç (B È C) = (A Ç B) È (A Ç C)
tu
b) Prove the distributive laws using membership tables.
w .jn
Set identities can also be proved using membership tables. To indicate that an element in a set, a Y is used; to indicate that an element is not in a set, a N is used.
A Y Y Y Y N N N N
w w
Table: 1 A membership table for the Distributive law A Ç (B È C) = (A Ç B) È (A Ç C)
B Y Y N N Y Y N N
C Y N Y N Y N Y N
BÈC Y Y Y N Y Y Y N
A Ç (B È C) Y Y Y N N N N N
AÇB Y Y N N N N N N
AÇC Y N Y N N N N N
(A Ç B ) È (A Ç C) Y Y Y N N N N N
66
Page:
Table: 2 A membership table for the Distributive law A È (B Ç C) = (A È B) Ç (A È C)
67
B Y Y N N Y Y N N
C Y N Y N Y N Y N
BÇC Y N N N Y N N N
A È (B Ç C) Y Y Y Y Y N N N
AÈB Y Y Y Y Y Y N N
AÈC Y Y Y Y Y N Y N
(A È B ) Ç (A È C) Y Y Y Y Y N N N
.c om
A Y Y Y Y N N N N
c) Prove the Distributive law using Venn diagrams
m
Solution:
ru
A È (B Ç C) = (A È B) Ç (A È C)
w .jn
tu
w
or
ld
fo
Venn diagrams for LHS:
w w
Venn diagrams for RHS:
Fig. 5.2 Here the figures 5.2 (b) and 5.2 (e) are same and hence proved.
Page:
68
5.4 Partitions of sets In order to analyze a bigger set easily, we can be split them into smaller, nonoverlapping and non-empty, subsets. For example, students in a class may be partitioned into small groups on the basis of certain criteria so as to keep track of their progress and regular internal assessment.
.c om
Let A be a non-empty set. The partition of A is any set of non-empty, nonoverlapping subsets A1 , A2 , A3 , A4 ,…, An such that A = A1 È A2 È … È An i) The subsets Ai are mutually disjoint, i.e. Ai Ç Aj = Æ for i = j. ii)
fo
ru
m
Figure Fig .5.3 is the Venn diagram showing partition of set A into five subset A1 , A2 , A3 , A4 and A5.
or
ld
Example 3
Let A = {10,11,12,13}. Then A1 ={10}, A2 = {11,12}, A3 ={13} are the partitions
w
of A.
tu
5.5 Minsets
w w
Example 4
w .jn
Let X = {B1 ,B2 ,B3 ,…,Bn } where the elements B1 ,B2 , etc are the subsets of a set A. Then the set of the form C1 Ç C2 Ç C3 Ç … Ç Cn, where each Ci may be either Bi or its complement i.e. Bi’ is called a minset or minterm, generated by Bi s (i = 1,2,...,n).
Let B1 = {1,4,6} and B2 = {1,3,4} be two subsets of A = {1,2,3,4,5,6}. In order to have a partition of A without repetition of elements, we may describe B1 and B2 a s follows: C1 = B1 Ç B '2 = {1,4,6} Ç {2,5,6} = {6} C 2 = B1 Ç B 2 = {1,4,6} Ç {1,3,4} = {1,4} C 3 = B1' Ç B 2 = {1,4,6} Ç {2,5,6} = {3}
C 4 = B1' Ç B '2 = {2,3,4} Ç {2,5,6} = {2,5}
Page:
69
.c om
As shown in fig. 5.4, none of the sets C1 ,C2 ,C3 and C4 have elements in common, the set generated by B1 and B2 is the partition of A.
5.6 Let Us Sum Up Union
ru
m
The union of the sets A and B, denoted by A È B, is the set that contains those elements that are either in A or in B, or in both.
ld
fo
Intersection The intersection of sets A and B, denoted by A Ç B, is the set that contains those elements in both A and B.
tu
Difference of two sets
w
or
Disjoint If intersection of the sets A and B is an empty set, then these two sets are said to be disjoint. Symbolically, A Ç B = Æ
w .jn
The difference of A and B denoted by A – B or A\B, is the set having those elements that are in A but not in B.
w w
Properties of Difference of two sets · A–A= Æ · A–Æ =A · A–BÍA · A – B, A Ç B and B-A are mutually disjoint · (A – B) A B = Æ · (A – B) A – A Complement of a set Let U be the universal set and A be any set. The complement of A, denoted by A’, is the complement of A with respect to U. Properties · A È A’ = U
Page:
A Ç A’ = Æ U’ = Æ Æ’ = U (A’)’ = A (A – B) = A Ç B’ If A Í B, then A È (B – A) = B (A È B)’ = A’ Ç B’ (A Ç B)’ = A’ È B’
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
· · · · · · · ·
70
Page:
71
Set Identities Set Identities Name Identity laws Domination laws
.c om
Idempotent laws Complementation law Commutative laws
m
Associative laws
ru
Distributive laws
fo
De Morgan’s laws Absorption laws Complement laws
w
or
ld
Identity AÈÆ=A AÇU=A AÈU=U AÇÆ=Æ AÈA=A AÇA=A (A’)’ = A AÈB=BÈA AÇB=BÇA A È (B È C) = (A È B) È C A Ç (B Ç C) = (A Ç B) Ç C A Ç (B È C) = (A Ç B) È (A Ç C) A È (B Ç C) = (A È B) Ç (A È C) (A È B)’ = A’ Ç B’ (A Ç B)’ = A’ È B’ A È (A Ç B) = A A Ç (A È B) = A A È A’ = U A Ç A’ = Æ
tu
Duality
w .jn
The dual E* of E is the equation obtained by replacing each occurrence of È, Ç, U and Æ in E by Ç, È, Æ and U, respectively.
w w
Partitions of sets Let A be a non-empty set. The partition of A is any set of non-empty, nonoverlapping subsets A1 , A2 , A3 , A4 ,…, An such that A = A1 È A2 È … È An i) The subsets Ai are mutually disjoint, i.e. Ai Ç Aj = Æ for i = j. ii)
Page:
5.7 Lesson End Activities 1. Let A = {1.2,3.4.5} and B = {0, 3, 6}. Find a) A È B b) A Ç B c) A – B d) B – A. 2. Let A={a, b, c, d, e} and B ={a, b, c, d, e, f, g, h}. Find a) A È B b) A Ç B c) A – B d) B – A.
.c om
3. Let A be a set. Show that (A’)’ = A. 4. Let A be a set. Show that
m
b) A Ç Æ = Æ. d) A Ç A = A. f) AÈ U =U. h) Æ - A = Æ.
ru
a) A È Æ = A. c) A È A = A. e) A - Æ = A. g) A ÇU = A.
b) A Ç B = B Ç A.
ld
a) A È B = B È A.
fo
5. Let A and B be sets. Show that
or
6. Show that if A and B are sets, then A –B = A Ç B’.
w
7. Show that if A and B are sets, then (A Ç B) È ( A Ç B’) = A.
w .jn
tu
8. Let A, B, and C be sets. Show that a) AÈ(BÈC) = (AÈB)ÈC. b) AÇ(B Ç C) = (AÇB)ÇC. c) AÈ(BÇC) = (AÈB)Ç(AÈC).
w w
9. Let A, B, and C be sets. Show that (A – B) – C = (A – C) – (B – C). 10. Draw the Venn diagrams for each of these combinations of the sets A, B, and C. a) A Ç (B È C) b) A’ Ç B’ Ç C’ c) (A – B) È (A –C) È (B – C)
72
Page:
73
Unit II Lesson – 6 The inclusion-Exclusion Principle
Contents:
.c om
6.0 Aims and objectives 6.1 Introduction 6.2 The inclusion-Exclusion Principle 6.3 Problems and Solutions 6.4 Lesson End Activities 6.5 References 6.0 Aims and objectives
fo
Know what do you mean by an Inclusion-Exclusion Principle. Apply Inclusion-Exclusion Principle to solve problems.
ld
· ·
ru
After reading this lesson, you should be able to
m
In this lesson, we have discussed about the Inclusion- Exclusion Principle.
or
6.1 Introduction
w w
w .jn
tu
w
The Inclusion-Exclusion Principle method is used in finding the number of elements in a finite set (also called cardinal number). While applying this principle some terms are Included and some terms are excluded from an expression, so the name Inclusion-Exclusion Principle.
Page:
74
6.2 The inclusion-Exclusion Principle Let A and B be any finite sets. Then n(A È B) = n(A) + n(B) - n(A Ç B) In other words, to find the number n(A È B) of elements in the union, we add n(A) and n(B) and then we subtract n(A Ç B); that is, we “Include” n(A) and n(B), and we “exclude” n(A Ç B).This method of finding the number of elements in a finite set ( also called cardinal number) is known as Inclusion-Exclusion principle. The cardinal number of a set A is denoted by n(A). This principle holds for any number of sets like n(AÈBÈC) and so on.
.c om
Theorem 1: For any finite sets A, B, C we have n(AÈBÈC) = n(A) + n(B) + n(C) – n(AÇB) – n(AÇC) – n(BÇC) + n(AÇBÇC)
å n(A ) - å n(A i
1£ i £ n
+
i
Ç Aj)
1 £ i< j £ n
å n(A
i
ru
n(A 1 È A 2 È ... È A n ) =
m
Theorem 2: Let A1 , A2 , … , An be finite sets. Then
Ç A j Ç A k ) - ... + (-1) n +1 n(A 1 Ç A 2 Ç ... Ç A n )
fo
1£ i < j < k £ n
ld
Example 1
Let A = {1,2,3,4}, then n(A) = 4 since A is having only four elements.
ii)
Let A = {1,2,3,4} and B = {4,6,8,9} then A È B = {1,2,3,4,6,8,9} and A Ç B={4}. Therefore n(A) = 4, n(B) = 4 ,n(AÈB)=7 and n(AÇB)=1.
tu
w
or
i)
w .jn
The above can be verified by using the Inclusion- Exclusion principle n(AÈB)=n(A) + n(B) – n(AÇB). By applying the principle we get n(AÈB)= 4+4–1=7.
w w
Results
Simple but important results on the cardinality of sets are n(A È B) £ n(A) + n(B) when A Ç B = Æ n(A Ç B) £ Min {n(A), n(B)} n(A Å B) = n(A) + n(B) - 2n (A Ç B) n(A - B) ³ n(A) - n(B) n(A È B) = n(A) + n(B) - n(A Ç B) It is because when elements of A and B are added, the elements of A Ç B had been counted twice, since A Ç B is the subset of both A and B. But if sets A and B are disjoint, i.e. A Ç B = Æ, then n(AÈ B) = n(A) + n(B). 1) 2) 3) 4) 5)
Page:
6) (a) n(AÈBÈC) = n(A) + n(B)+n(C) - n(AÇB) - n(BÇC) - n(A ÇC) + n(AÇBÇC) (b) If the sets A, Band C are mutually disjoint, then n(A È B È C) = n(A) + n(B) + n(C) 7) n(A’) = n(U) - n(A) 8) (a) n(A) = n[(A Ç B’) È (A Ç B)] = n[(A - B) È (A Ç B)] = n(A - B) + n(A Ç B) (b) n(B) = n(B - A) + n(A Ç B)
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
9) n(A È B) = n(A - B) + n(A Ç B) + n(B - A)
75
Page:
76
6.3 Problems and Solutions 1) In a group of 200 people, each of whom is at least accountant or management consultant or sales manager, it was found that 80 are accountants, 110 are management consultants and 130 are sales managers, 25are accountants as well as sales managers, 70 are management consultants as well as sales managers, 10 are accountants, management consultants as well as sales managers. Find the number of those people who are accountants as well as management consultants but not sales managers.
ld
fo
ru
m
.c om
Solution Suppose A, M and S denote the set of accountants, management consultants and sales managers, respectively. Then it is given that n(A) = 80, n(M) = 110, n(S) = 130, n(A Ç S) = 25 n(M Ç S) = 70 and n(A Ç M Ç S) = 10 Now, find the number of those people who are accountants as well as management consultants but not sales managers, i.e. n (A Ç M Ç S’). n(A È M È S) = n(A) + n(M) + n(S)-n(A Ç M)-n(M Ç S)- n(A Ç S) + n(A Ç M Ç S) 200 = 80 + 110 + 130 - n(A Ç M) - 70 - 25 + 10 200 = 330 - 95 - n (A Ç M) n(A Ç M) = 330 - 200 - 95 = 35 Now n(A Ç M) = n(A Ç M Ç S’) + n(A Ç M Ç S) 35 = n(A Ç M Ç S’) + 10 or n(A Ç M Ç S’) = 35 - 10 = 25
w .jn
tu
w
or
2) A TV survey shows that 60 per cent people see program A, 50 per cent see program B, 50 per cent see program C, 30 per cent see program A and B, 20 per cent see program B and C, 30 per cent see program A and C, and 10 per cent do not see any program. Find (a) What per cent see program A, Band C? . (b) What per cent see exactly two programs? (c) What per cent see program A only?
w w
Solution Suppose X, Y and Z denote the set of people who see program A, Band C, respectively. Then it is given that n(X) = 60, n(Y) = 50, n(Z) = 50, n(X Ç Y) = 30, n(Y Ç Z) = 20, n(X Ç Z) = 30 n[(X È Y È Z)’] = 10 . (a) Let n( X È Y È Z) + n[ (X È Y È Z)’] = 100. Then n( X È Y È Z ) = 100 - n[ (X È Y È Z)’] = 100 - 10 = 90 But n( X ÈY È Z) = n(X)+n(Y)+n(Z)- n(X Ç Y)-n(Y Ç Z)- n(X Ç Z)+n( XÇYÇZ) 90 = 60 + 50 + 50 - 30 - 20 - 30 + n(X Ç Y Ç Z) or n(X n Y n Z) = 90 - 80 = 10 Thus, 10 per cent people see program A, Band C. (b) Since the set of people who see program A and B but not C, i.e. X Ç Y Ç Z’ and the set of people who see all the program A, Band C, i.e. X Ç Y Ç Z are disjoint sets, therefore
Page:
77
n( X Ç Y Ç Z’) + n( X Ç Y Ç Z) = n( X Ç Y ) n(X Ç Y Ç Z’) = n(X Ç Y) - n(X Ç Y Ç Z) = 30 - 10 = 20, n(X Ç Y’ Ç Z) + n(X Ç Y Ç Z) = n(X n Z) n(Z Ç Y’ Ç Z) = n(X Ç Z) - n(X Ç Y Ç Z) = 30 - 10 = 20, n(XC n Y n Z) + n(X n.Y n Z) = n(Y n Z) n(X’ ÇY Ç Z) = n(Y Ç Z) - n(X Ç Y Ç Z) = 20 - 10 = 10. Thus, the percentage of people who see exactly two program = 20 + 20 + 10 = 50. (b) Since n(X Ç Y’ Ç Z’) = n(X) –n(X Ç Y) - n(X Ç Z) + n(X Ç Y Ç Z) = 60 - 30 - 30 + 10 = 10
.c om
Thus, the percentage of people who see program A only is 10.
fo
ru
m
3) In a pollution study of 1,500 Indian rivers, the following data were reported: 520 were polluted by sulphur compounds, 335 were polluted by phosphates, 425 were polluted by crude oil, 100 were polluted by both crude oil and sulphur compounds, 180 were polluted by sulphur compounds and phosphates, 150 were polluted by both phosphates and crude oil and 28 were polluted by sulphur compounds, phosphates and crude oil. How many of the rivers were polluted by at least one of the three impurities? How many rivers were not polluted by exactly one of the three impurities? How many of the rivers were not polluted?
w .jn
tu
w
or
ld
Solution: Suppose S, P and C denote the set of rivers polluted by sulphur compounds, phosphates and crude oil, respectively. Then it is given that . n(S) = 520, n(P) = 335, n(C) = 425, n(C Ç S) = 100, n(S Ç P) = 180, n(P Ç C) = 150, n(S Ç P Ç C) = 28. (a) Number of rivers polluted by at least One of the three impurities n(S È P È C) = n(S)+n(P) + n(C)-n(S ÇP)-n(PÇC)-n(CÇS) + n(SÇPÇC) = 520 + 335 + 425 - 100 - 180 - 150 + 28 = 878
w w
(b) Number of rivers polluted by exactly sulphur compounds n(S Ç P’Ç C’) = n[ S Ç (P È C)’] = n(S) - n(S Ç P) - n(S Ç C) + n(S Ç P Ç C) = 520 - 180 - 100 + 28 = 268
(c) Number of rivers polluted by exactly phosphate n(P Ç S’ Ç C’) = n[P Ç (S È C)’] = n(P) - n(P Ç S) - n(P Ç C) + n(P Ç S Ç C) = 335-180-150+28 =33 (d) Number of rivers polluted by exactly crude oil n(C Ç P’ Ç S’) = n[C Ç (P’ È S’)] = n(C) - n(C Ç P) - n(C Ç S) + n(C Ç S Ç P) = 425 - 150 - 100 + 28 = 203. Thus, the number of rivers which were polluted by exactly one of the three impurities =268 + 33 + 203 = 504 and so the number of rivers which were not polluted at all = 1500 - 872 = 622.
Page:
78
.c om
4) Of a group of 20 persons, 10 are interested in music, 7 are interested in photography, and 4 like swimming; further more 4 are interested in both music and photography, 3 are interested in both music and swimming, 2 are interested in both photography and swimming and one is interested in music, photography and swimming. How many are interested in photography but not in music and swimming? Solution Suppose M, P and S denote the set of persons interested in music, photography and swimming, respectively. Then it is given that n(M) = 10, . n(P) = 7, n(S) = 4, n(M Ç P) = 4, n(M Ç S) = 3 n(P Ç S) = 2 and n(M Ç P Ç S)=1. Number of persons interested in photography but not in music and swimming is given by n(P Ç M’ Ç S’)= n[P Ç (M ÈS)’] = n(P) - n(P Ç M) - n(P Ç S) + n(PÇM ÇS) =7–4–2+1=2
w .jn
tu
w
or
ld
fo
ru
m
5) Out of 450 students in a school, 193 students read Science and 200 students read Commerce, 80 students read neither. Find out how many read both. Solution Suppose A and B denote the' set of students who read Science and Commerce, respectively. It is given that . . ; n(A) = 193, n(B) = 200, n(U)= 450 and n(A’ Ç B’) = 80. Now find the number of those students who read Science as well as Commerce, i.e. n(A n B). Since A’ Ç B’ = (A È B)’, therefore n(A È B)’ = 80. But n(A u B)’ = n(U) - n(A È B) 80 = 450 - n(A u B) or n(A u B) = 450 - 80 = 370 Further, we know that n(A È B) = n(A) + n(B) - n(A Ç B) 370 = 193 + 200 - n(A Ç B) n(A Ç B) = 23
w w
Thus, 23 students read both science and commerce.
Page:
79
6) In a survey concerning the smoking habits of consumers, it was found that 55 per cent smoke cigarette A, 50 per cent smoke B, 42 per cent smoke C, 28 per cent smoke A and B, 20 per cent smoke A and C, 12 per cent smoke Band C and 10 per cent smoke all the three cigarettes. (a) What percentage does not smoke? (b) What percentage smokes exactly two brands of cigarettes? Solution Let A, B, C be the sets of persons who smoke brand A, B, and C, respectively.
.c om
It is given that n(A) = 55; n(B) = 50; n(C) = 42; n(A Ç B) = 28; n(A Ç C) = 20; n(B Ç C) = 12; and n(A Ç B Ç C) = 10.
w
or
ld
fo
ru
m
(a) Now (A È B È C) is the set of all person who smoke either A or B or C; or any two brands or all the brands and (A u B u C)’ is the set of persons who do not smoke. Therefore, n(A È B È C) = n(A) + n(B) + n(C)-n(A Ç B)- (B Ç C)- n(A Ç C)+n(A Ç B Ç C) = 55 + 50 + 42 – 28 –12 –20 + 10 = 97 But, n(A È B È C)’= 100 - n(A È B È C) = 100 - 97 = 3 Hence, 3 per cent persons do not smoke. (b) A Ç B Ç C’ is the set of persons who smoke A and B, but not C and (A n B n C) is the set of persons who smoke all the 3 brands A, B, and C. Therefore n(A Ç B) = n(A Ç B Ç C’) + n(A Ç B Ç C) 28 = n(A Ç B Ç C’) + 10 or n(A Ç B Ç C’) = 18. Similarly, n(A Ç B’ Ç C) = 10 and n(A’ Ç B Ç C) = 2.
tu
Hence, total required number = 18 + 10 + 2 = 30.
w .jn
7) In a class of 25 students, 12 have taken economics, 8 have taken economics but not political science. Find the number of students who have taken economics and political science and those who have taken politics but not economics.
w w
Solution Suppose A and B denote the set of students who take economics and political science, respectively. It is given that n(A) = 12, n(A u B) = 25, and n(A n BC) = 8. Now we have to find the number of students who have taken economics and political science, i.e. n(A Ç B) and the number of students who have taken political science but not economics, i.e. n(B Ç A’). Now n(A) = n(A Ç B’) + n(A Ç B) or 12 = 8 + n(A Ç B) or n(A Ç B) = 12 – 8 = 4 Also n(A È B) = n(A) + n(B) – n(A Ç B) 25 = 12 + n(B) – 4 or n(B) = 17. Again, n(B) = n(A Ç B) + n(B Ç A’). Therefore 17 = 4+ n(B Ç A’) or n(B Ç A’)= 17 – 4 = 13.
Page:
80
8) Determine the cardinalities of the sets (a) A = {n7 : n is a positive integer} (b) B = {n109 : n is a positive integer} (c) A Ă&#x2C6; B. Solution
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
(a) The cardinality of the set A is infinity because its elements, i.e., number of positive integers which it contains are infinite. (b) The cardinality of the set is also infinite because of the same reason as in (i). (c) Since both A and B are infinite sets,. therefore the cardinality of their union is also infinite.
Page:
81
6.4 Let Us Sum Up Theorems 1) For any finite sets A, B, C we have n(AÈBÈC) = n(A) + n(B) + n(C) – n(AÇB) – n(AÇC) – n(BÇC) + n(AÇBÇC) 2) Let A1 , A2 , … , An be finite sets. Then
å n(A ) - å n(A i
1£ i £ n
+
i
Ç Aj)
1 £ i< j £ n
å n(A
i
Ç A j Ç A k ) - ... + (-1) n +1 n(A 1 Ç A 2 Ç ... Ç A n )
.c om
n(A 1 È A 2 È ... È A n ) =
1£ i < j < k £ n
m
Results
n(A È B) £ n(A) + n(B) when A Ç B = Æ n(A Ç B) £ Min {n(A), n(B)} n(A Å B) = n(A) + n(B) - 2n (A Ç B) n(A - B) ³ n(A) - n(B) n(A È B) = n(A) + n(B) - n(A Ç B) (a) n(AÈBÈC) = n(A) + n(B)+n(C) - n(AÇB) - n(BÇC) - n(A ÇC) + n(AÇBÇC) (b) If the sets A, Band C are mutually disjoint, then n(A È B È C) = n(A) + n(B) + n(C) 7. n(A’) = n(U) - n(A) 8. (a) n(A) = n[(A Ç B’) È (A Ç B)] = n[(A - B) È (A Ç B)] = n(A - B) + n(A Ç B) (b) n(B) = n(B - A) + n(A Ç B) 9. n(A È B) = n(A - B) + n(A Ç B) + n(B - A)
w w
w .jn
tu
w
or
ld
fo
ru
1. 2. 3. 4. 5. 6.
Page:
6.5 References 1) J K Sharma, ”Discrete Mathematics” 2) Kenneth H.Rosen, “Discrete Mathematics and its Applications” 3) Seymour Lipschutz and Marc Lipson, “Discrete Mathematics” 4) Charles D.Miller and Others, “Mathematical Ideas”
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
5) Wikipedia, the free encyclopedia.
82
Page:
Unit â&#x20AC;&#x201C; III Lesson â&#x20AC;&#x201C; 7 Mathematical Logic
w w
w .jn
tu
w
or
ld
fo
ru
m
7.0 Aims and objectives 7.1 Introduction 7.2 Propositional calculus 7.2.1 Propositions 7.2.2 Types of Propositions 7.2.3 Basic Logical Operations 7.2.4 Derived Connectives 7.3 Conditional statement 7.3.1 Special characteristics of conditional statements 7.3.2 Converse, Inverse and Contrapositive 7.4 Biconditional statement 7.5 Problems and Solutions 7.6 Let Us Sum Up 7.7 Lesson End Activities
.c om
Contents
83
Page:
84
7.0 Aims and objectives In this lesson, we have discussed the basis of propositional logic. With this logic, students can found the truth and falsity of the statements. After reading this lesson, you should able to understand · What is a propositional logic? and its usage in reasoning. · Types of statements · Connectives for forming compound statements
.c om
7.1 Introduction
ru
m
Logic, logical thinking, and correct reasoning have wide applications in many fields, including law, psychology, rhetoric, science, and mathematics. While an interesting study can be made of logic in human lives, we shall restrict our attention mainly to logic as it is used in mathematics. This logic was first studied systematically by Aristotle (384 B.C.-322 B.C.). Aristotle and his followers studied patterns of correct and incorrect reasoning.
w
or
ld
fo
Medieval philosophers and theologians, who made an intimate study of logical arguments, carried the work of Aristotle forward. A big advance in the study of mathematical logic came with the work of Gottfried Wilhelm von Leibniz (1646-1716), one of the inventors of calculus. Leibnitz introduced symbols to represent ideas in logicletters for statements and other symbols for the relations between statements. Leibnitz hoped that logic would become a universal characteristic and unify all of mathematics.
tu
Logic is the tool for reasoning about the truth and falsity of statements. There are two main directions in which logic develops.
w .jn
• The first is the depth to which we explore the structure of statements. The study of the basic level of structure is called propositional logic. First order predicate logic, which is often called just predicate logic, studies structure on a deeper level.
w w
• The second direction is the nature of truth. For example, one may talk about statements that are usually true or true at certain times.
“True” and “false” could be replaced by T and F (or any other two symbols) in our discussions. Using T and F relates logic to Boolean functions. In fact, propositional logic is the study of Boolean functions, where T plays the role of “true” and F the role of “false.” Our study is restricted to propositional and predicate logic only.
Page:
85
7.2 Propositional calculus 7.2.1 Propositions A declarative sentence that is either true or false, but not both, is called a proposition.
.c om
In mathematics, the propositions are denoted by alphabets known as propositional variables. The conventionally used alphabets are p, q, r, s, and so on. The truth- value of a proposition is true, denoted by T, if it is a true proposition and false, denoted by F, if it is a false proposition. Here the letters T and F are constants. Example for a true proposition: Chennai is the state capital of Tamil Nadu.
--- (1)
m
The truth-value of the above statement is true, dented by T.
ru
Example for a false proposition:
fo
Oxygen is a solid.
--- (2)
or
ld
The truth-value of the above statement is false, dented by F.
tu
7.2.2 Types of Propositions
w
The area of logic that deals with propositions is called the propositional calculus or propositional logic.
w .jn
There are two types of propositions namely 1) Simple proposition and 2) Compound proposition.
w w
A simple proposition is one in which the sentences cannot be further broken into simple or atomic sentences. Two or more simple propositions connected by operators is known as a compound proposition. The operators are known as logical connectives or simply connectives. The logical connectives are shown in the table 3.1. Table 3.1 - Logical connectives. Symbol Connective not Ø and Ù or Ú implies ® if and only if «
Type of statement Negation Conjunction Disjunction implication or conditional equivalence or biconditional
Page:
86
Truth Table: It shows the relationship between the truth- value of a compound proposition and the truth-values of its constituent simple propositions. 7.2.3 Basic Logical Operations The basic logical operations are conjunction, disjunction and negation.
.c om
Conjunction Let p and q be propositions. The proposition “p and q”, denoted by p Ù q, is true when both p and q are true and is false otherwise. The statement p Ù q is called the conjunction of p and q.
ru
pÙ q T F F F
fo
Table 3.2 p q T T T F F T F F
m
The truth table for the conjunctions of two propositions is given in the table 3.2.
w
Bharathiar University is at Coimbatore and 2+2 = 4. Bharathiar University is at Coimbatore and 2+2 = 5. Bharathiar University is at Chennai and 2+2 = 4. Bharathiar University is at Chennai and 2+2 = 5.
tu
1) 2) 3) 4)
or
ld
Illustration a) Consider the following four compound statements
w w
Disjunction
w .jn
Only the first statement is true. Each of the other statements is false, since at least one of its simple statements is false.
Let p and q be propositions. The proposition “p or q”, denoted by p Ú q, is false when both p and q are false and is true otherwise. The statement p Ú q is called the disjunction of p and q. The truth table for the disjunctions of two propositions is given in the table 3.3. Table 3.3 p q T T T F F T F F
pÚ q T T T F
Page:
87
Illustration b) Consider the following four compound statements 1) 2) 3) 4)
Bharathiar University is at Coimbatore or 2+2 = 4. Bharathiar University is at Coimbatore or 2+2 = 5. Bharathiar University is at Chennai or 2+2 = 4. Bharathiar University is at Chennai or 2+2 = 5.
Only the last statement is false. Each of the other statements is true, since at least one of its simple statements is true.
m
The inclusive disjunction of p and q is
ru
p : ABC Company earned 20% profit per share in 2005. q : ABC Company paid 12% dividend per share in 2005.
fo
Example 1 Let
.c om
The disjunction may be either Inclusive or Exclusive. In the inclusive disjunction the compound statement p Ú q is true only when at least one of the statement is true. But in the exclusive disjunction, commonly called inequivalence, the compound statement p Ú q is true only when either p or q but not both, is true.
or
ld
p Ú q : ABC Company earned 20% profit per share in 2005 or ABC Company paid 12% dividend per share in 2005 or both.
w
The exclusive disjunction of p and q is
Negation
w .jn
tu
p Ú q : ABC Company earned 20% profit per share in 2005 or ABC Company paid 12% dividend per share in 2005 but not both.
w w
The negation of a true statement is false, and the negation of a false statement is true. Its truth table is given in the table 3.4. Table 3.4 p Øp T F F T
Page:
88
7.2.4 Derived Connectives NAND It is obtained by negating the result of ANDing of two statements. For example, If p and q are two statements then NANDing of these two statements, denoted by p - q, is false when both p and q are true, otherwise true. Its truth table is given in the table 3.5.
p-q F T T T
.c om
Table 3.5 p q T T T F F T F F
ru
m
NOR
fo
It is obtained by negating the result of ORing of two statements.
or
ld
For example, if p and q are two statements then ORing of these two statements, denoted by p ¯ q, is true when both p and q are false, otherwise false. Its truth table is given in the table 3.6.
XOR
w .jn
tu
w
Table 3.6 p q T T T F F T F F
p¯q F F F T
w w
If p and q are two statements then XORing of these two statements, denoted by p Å q, is false when both p and q are same, otherwise true. Its truth table is given in the table 3.7. Table 3.7 p q T T T F F T F F
pÅq F T T F
Page:
89
7.3 Conditional statement A conditional statement is a compound statement that uses the connective if…then. For example, the statement If I read for too long, then I get a headache. In the above statement, the component coming after the word if gives a condition (but not necessarily the only condition) under which the statement coming after then will be true.
.c om
The conditional is written with an arrow, so that “if p, then q” is symbolized as p®q. We read p ® q as “p implies q” or “if p, then q”. In the conditional p ® q, the statement p is the antecedent, while q is the consequent.
fo
ru
m
The conditional connective may not always be explicitly stated. That is, it may be “hidden” in an everyday expression. For example, the statement “It is difficult to study when you are distracted” can be written “It you are distracted then it is difficult to study”.
p®q T F T T
w .jn
tu
w
or
Table 3.8 p q T T T F F T F F
ld
Truth table for the conditional “if p, then q” is given in 3.8
7.3.1 Special characteristics of conditional statements
w w
1) p ® q is false only when the antecedent is true and the consequent is false. 2) If the antecedent is false, then p ® q is automatically true. 3) If the consequent is true, then p ® q is automatically true. Negation of p ® q The negation of p ® q is p Ù Ø q. Conditional as a disjunction A conditional may be written as a disjunction as below. p ® q is equivalent to Ø p Ú q.
Page:
90
7.3.2 Converse, Inverse and Contrapositive
Related conditional Statements
(If p, then q.) (If q, then p.) (If not p, then not q.) (If not q, then not p.)
fo
ld
w
7.4 Biconditional statement
p®q q®p Øp®Øq Øq®Øp
or
Direct statement Converse Inverse Contrapositive
ru
m
.c om
An conditional statement is made up of an antecedent and a consequent. If they are interchanged, negated or both, a new conditional statement is formed. Suppose that we begin with the direct statement “If you stay, then I go,” and interchange the antecedent (“you stay”) and the consequent (“I go”). We obtain the new conditional statement “If I go, then you stay.” This new conditional is called the converse of the given statement. By negating both the antecedent and the consequent, we obtain the inverse of the given statement. “If you do not stay, then I do not go.” If the antecedent and the consequent are both interchanged and negated, the contrapositive of the given statement is formed: “If I do not go, then you do not stay.” These three related statements for the conditional p ® q are summarized below.
w w
w .jn
tu
In elementary algebra we learn that both of these statements are true: If x > 0, then 5x > 0. If 5x > 0, then x > 0. Notice that the second statement is the converse of the first. If we wish to make the statement that each condition (x > 0, 5x > 0) implies the other, we use the following language: x > 0 if and only if 5x > 0. This also may be stated as 5x > 0 if and only if x > 0. The compound statement p if and only if q is called a biconditional. It is symbolized p « q, and is interpreted as the conjunction of the two conditionals p ® q and q ® p. Using symbols, this conjunction is written (p ® q) Ù (q ® p ) so that, by definition, p « q º (p ® q) Ù (q ® p ).
Page:
91
Using this definition, the truth table for the biconditional p ÂŤ q can be determined as shown in table 3.9. Table 3.9 p q pÂŤq T T T T F F F T F F F T
.c om
Example 2 Tell whether each biconditional statement is true or false.
m
(a) 6+9= 15 if and only if 12+4= 16 Both 6 + 9 = 15 and 12 + 4 = 16 are true. By the truth table for the biconditional, this biconditional is true.
fo
ru
(b) 5 + 2 = 10 if and only if 17 + 19 = 36 . Since the first component (5 + 2 = 10) is false, and the second is true, the entire biconditional statement is false.
w w
w .jn
tu
w
or
ld
(c) 6=5 if and only if 12š12 Both component statements are false, so by the last line of the truth table for the biconditional, the entire statement is true. (Understanding this might take some extra thought!) .
Page:
7.5 Problems and Solutions 1) Make truth tables for (a) (p ¯ q) Ù (p ¯ r)
(b) p - q - r
(c) p Å q Å r
Solution (a) Truth table is shown in Table 3.10
Truth table 3.10: (p ¯ q) Ù (p ¯ r) (p ¯ r) F F F F F T F T
Truth table: 3.11 p - q - r
p- q- r T T F T F T F T
w
or
p-q F F T T T T T T
tu
r T F T F T F T F
w .jn
Q T T F F T T F F
ld
fo
(b) The truth table is shown in Table 3.11
p T T T T F F F F
(p ¯ q) Ù (p ¯ r) F F F F F F F T
.c om
(p ¯ q) F F F F F F T T
r T F T F T F T T
m
Q T T F F T T F F
ru
p T T T T F F F F
w w
(c) The truth table is shown in Table 3.12. Truth table: 3.12 p Å q Å r p T T T T F F F F
q T T F F T T F F
r T F T F T F T F
pÅq F F T T T T F F
pÅqÅr T F F T F T T F
92
Page:
93
2) If p and q are two statements, then show that the statement (p - q ) Å ( p - q ) is equivalent to (p Ú q) Ù (p ¯ q).
.c om
Solution: The equivalence of two compound statements is shown in the truth Table 3.13. Truth table: 3.13 (p - q) Å (p - q) and (p Ú q) Ù (p ¯ q) p Q p-q (p - q) Å (p - q) (p Ú q) (p ¯ q) (p Ú q) Ù (p ¯ q) (1) (2) (3) (4) (5) (6) (7) T T F F T F F T F T F T F F F T T F T F F F F T F F T F Since values in Columns (4) and (7) are same, therefore two statements are equivalent.
m
3) If p and q are two statements, then show that p Å q is equivalent to (p ÙØ q)Ú(Øp Ù g).
F T F T
F T F T
or
F T T F
w
T F T F
F T F F
F F T F
F T T F
tu
T T F F
ld
fo
ru
Solution: The equivalence of two compound statements is shown in truth Table 3.14. Truth table 3.14 : p Å q and (p ÙØ q) Ú (Øp Ù g) p q pÅq Øp Øq p ÙØ q Øp Ù g (p ÙØ q) Ú (Øp Ù g) (1) (2) (3) (4) (5) (6) (7) (8)
w .jn
Since values in Columns (3) and (8) are same, therefore two compound statements are equivalent.
w w
4) If p and q are two statements, then show that the statement (p Å q) Ú (p ¯ q) is equivalent to p-q. Solution: The equivalence of two compound statements is shown in truth Table 3.15. Truth table: 3.15 (p Å q) Ú (p ¯ q) and p-q p q (p Å q) (p ¯ q) (p Å q) Ú (p ¯ q) p-q (1) (2) (3) (4) (5) (6) T T F F F F T F T F T T F T T F T T F F F T T T Since values in Columns (5) and (6) are same, therefore two compound statements are equivalent.
Page:
7.6 Let Us Sum Up Symbols Used in this Chapter Symbols
and or not if. . . then if and only if
Ù Ú Ø ® «
Types of Statements Conjunction Disjunction Negation Conditional Biconditional
.c om
Connectives
Truth Tables p T F
m ru
p¯q F F F T
fo
p-q F T T T
pÚ q T T T F
ld
pÙ q T F F F
or
q T F T F
pÅq F T T F
p®q T F T T
w
p T T F F
Øp F T
tu
Statements Related to Conditional
w w
w .jn
Direct statement Converse Inverse Contrapositive
p®q q®p Øp®Øq Øq®Øp
(If p, then q.) (If q, then p.) (If not p, then not q.) (If not q, then not p.)
p«q T F F T
94
Page:
95
7.7 Lesson End Activities Write a negation for each of the following statements. 1. 5+3=9 2. Every good boy deserves favour. 3. Some people here can't play this game. 4. If it ever comes to that, I won't be here. 5. My mind is made up and you can't change it.
.c om
Let p represent "it is broken" and let q represent "you can fix it." Write each of the following in symbols. 6. If it isn't broken, then you can fix it. 7. It is broken or you can't fix it. 8. You can't fix anything that is broken.
ru
m
Using the same directions as for Exercises 6-8, write each of the following in words. 9. Øp Ù q 10. p « Øq
ld
fo
In each of the following, assume that p and q are true, with r false. Find the truth value of each statement. 11. Øp Ù Ør 12. r Ú (pÙq)
w .jn
tu
w
or
13. r ® (sÚr) (The truth value of the statement s is unknown.) 14. r « (p®Øq) 15. What are the necessary conditions for a conditional statement to be false? for a conjunction to be true? 16. Explain in your own words why, if p is a statement, the biconditional p« Øp must be false.
w w
Write a truth table for each of the following. Identify any tautologies. 17. p Ù (Øp Ú q) 18. Ø(pÙq)®(ØpÚØq) Decide whether each statement is true or false. 19. All positive integers are whole numbers. 20. If x + 4 = 6, then x > 1. Write each conditional statement in the form if. . . then. 21. All rational numbers are real numbers. 22. Being a rectangle is sufficient for a polygon to be a quadrilateral. 23. Being divisible by 2 is necessary for a number to be divisible by 6. 24. She cries only if she is hurt. For each statement, write (a) the converse, (b) the inverse, and (c) the contrapositive. 25. If a picture paints a thousand words, the graph will help me understand it. 26. Øp®(qÙr) (Use one of De Morgan's laws as necessary.)
Page:
96
Unit – III Tautology, Contradiction and Arguments Lesson 8 Contents 8.0 Aims and Objectives 8.1 Introduction 8.2 Tautology
.c om
8.3 Contradiction
8.4.1 Valid and Invalid Arguments 8.4.2 Using Truth Tables to Analyze Arguments
ru
8.5 Problems and Solutions
fo
8.6 Chapter Summary
or w
tu
8.0 Aims and Objectives
ld
8.7 Lesson End Activities 8.8 References
m
8.4 Arguments
w .jn
The main aim and objective of this lesson is to know about the Tautology, Contradiction and Arguments.
w w
After reading this unit, students should be able to · Identify the statements that are Tautology or Contradiction. · Test the validity of this argument
8.1 Introduction In this lesson we are going to discuss about the certain compound propositions that are always true or false irrespective of the truth values of its component propositions. The statement that is always true is called a tautology. The statement that is always false is called Contradiction. We also discussed the method of testing the validity of an argument.
Page:
97
8.2 Tautology Definition: A statement that represents the constant T is called a tautology. In other words, the statement is true for all truth values of the statement variables i.e. a tautology contain only T in the last column of their truth table. For example, the proposition “ p or not p”, that is, p Ú Ø p, is a tautology.
pÚ Øp T T
.c om
Table p Øp T F F T
Example1: Show that ((Ø p)Ú (Ø q)) Ú p is a tautology Øq F T F T
(Ø p)Ú (Ø q) F T T T
((Ø p)Ú (Ø q)) Ú p T T T T
m
Øp F F T T
ru
q T F T F
ld
fo
P T T F F
or
8.3 Contradiction
w w
w .jn
tu
w
Definition: A statement that represents the constant F is called a contradiction. In other words, the statement is false for all truth values of the statement variables i.e. a contradiction contain only F in the last column of their truth table. . Example 2: The proposition “ p and not p”, that is, p Ù Ø p, is a contradiction. Table p Øp T F F T
pÙ Øp F F
Note that the negation of a tautology is a contradiction since it is always false, and the negation of a contradiction is a tautology since it is always true.
Page:
98
8.4 Arguments
.c om
There are two types of reasoning: inductive and deductive. So far we have concentrated on using inductive reasoning to observe patterns and solve problems. Now, in this section and the next, we will study how deductive reasoning may be used to determine whether logical arguments are valid or invalid. A logical argument is made up of premises (assumptions, laws, rules, wide ideas, or observations) and a conclusion. Together, the premises and the conclusion make up the argument. Also recall that deductive reasoning involves drawing specific conclusions from given general premises. When reasoning from the premises of an argument to obtain a conclusion, we want the argument to be valid. 8.4.1 Valid and Invalid Arguments
m
An argument is valid if the fact that all the premises are true forces the conclusion to be true. An argument that is not valid is invalid, or a fallacy.
ru
It is very important to note that "valid" and "true" are not the same - an argument can be valid even though the conclusion is false (See Example below).
or
ld
fo
Definition An argument is an assertion that a given set of propositions P1 , P2 , â&#x20AC;Ś, Pn called premises, yields ( has a consequence) another proposition Q, called the conclusion. Such an argument is denoted by
tu
w
P1 , P2 , Âź, Pn Q
w .jn
Several techniques, like Euler diagrams (visual technique) and the method of truth table, can be used to check whether an argument is valid. In this section the method of truth tables is shown.
w w
8.4.2 Using Truth Tables to Analyze Arguments While Euler diagrams often work well for simple arguments, difficulties can develop with more complex ones. These difficulties occur because Euler diagrams require a sketch showing every possible case. In complex arguments it is hard to be sure that all cases have been considered. In deciding whether to use Euler diagrams to test the validity of an argument look for quantifiers such as "all," "some," or "no." These words often indicate arguments best tested by Euler diagrams. If these words are absent, it may be better to use truth tables to test the validity of an argument.
Page:
99
Example 3: Consider the following argument: If the floor is dirty, then I must mop it. The floor is dirty. ----------------------------------------------I must mop it.
ru
m
.c om
In order to test the validity of this argument, we begin by identifying the simple statements found in the argument. They are "the floor is dirty" and "I must mop it”. We shall assign the letters p and q to represent these statements: p represents "the floor is dirty." q represents "I must mop it." Now we write the two premises and the conclusion in symbols: Premise 1: p ® q Premise 2: p ---------------------Conclusion: q
Ù
p]
-
-
-
T F T F
w w
T T F F
q
w
premise
p®q
(p ® q) Ù (p)
w .jn
p
and
tu
premise
or
[(p ® q)
T F T T
ld
fo
To decide if this argument is valid, we must determine whether the conjunction of both premises implies the conclusion for all possible cases of truth values for and q. Therefore, write the conjunction of the premises as the antecedent of a conditional statement, and the conclusion as the consequent.
T F F F
®
q
-
-
implies
conclusion
[(p ® q) Ù p] ® q T T T T
Since the final column, indicates that the conditional statement that represents the argument is true for all possible truth values of p and q, the statement is a tautology. Thus, the argument is valid. The pattern of the argument in the example 3 (floor- mopping), p® q p -------q is a common one, and is called modus ponens, or the law of detachment.
Page: 100
In summary, to test the validity of an argument using truth tables, follow the steps in the box that follows. Testing the Validity of an Argument with a Truth Table 1. Assign a letter to represent each simple statement in the argument. 2. Express each premise and the conclusion symbolically.
.c om
3. Form the symbolic statement of the entire argument by writing the conjunction of all the premises as the antecedent of a conditional statement, and the conclusion of the argument as the consequent.
w w
w .jn
tu
w
or
ld
fo
ru
m
4. Complete the truth table for the conditional statement formed in part 3 above. If it is a tautology, then the argument is valid; otherwise, it is invalid.
Page: 101
8.5 Problems and Solutions 1) Use the truth table to determine whether the statement ((Ø p)Ú q) Ú (p Ù(Ø q)) is a tautology q T F T F
Øp F F T T
Øq F T F T
(Ø p)Ú q T F T T
p Ù (Ø q) F T F F
((Ø p)Ú q) Ú (p Ù (Ø q)) T T T T
.c om
P T T F F
The last column contains only T. Therefore the given statement is a tautology. 2) Determine whether the argument is valid or invalid.
ru
m
If my check arrives in time, I'll register for the Fall semester. I've registered for the Fall semester. -------------------------------------------------------------------------My check arrived in time.
or
ld
fo
Let p represent "my check arrives (arrived) in time" and let q represent "I'll register (I've registered) for the Fall semester." Using these symbols, the argument can be written in the form
w .jn
tu
w
p® q q -------p
To test for validity, construct a truth table for the statement [(p ® q) Ù q] ® p. p
p®q
(p ® q) Ù(q)
[(p ® q) Ù q] ® p
T F T F
T F T T
T F T F
T T F T
w w
T T F F
q
The third row of the final column of the truth table shows F, and this is enough to conclude that the argument is invalid. If a conditional and its converse were logically equivalent, then an argument of the type found in the above example would be valid. Since a conditional and its converse are not equivalent, the argument is an example of what is sometimes called the fallacy of the converse.
Page: 102
3) Determine whether the argument is valid or invalid. If a man could be two places at one time, I'd be with you. I am not with you. -------------------------------------------------------------------A man can't be two places at one time.
.c om
If p represents "a man could be two places at one time" and q represents "I'd be with you," the argument becomes p® q Øq -------Øp The symbolic statement of the entire argument is
m
[(p ® q) Ù Ø q] ® Ø p
q
p®q
Øq
(p ® q) Ù(Ø q)
T T F F
T F T F
T F T T
F T F T
F F F T
Øp
[(p ® q) Ù Ø q] ® Ø p
F F T T
T T T T
w
or
ld
fo
p
ru
The truth table for this argument, shown below, indicates a tautology, and the argument is valid.
tu
The pattern of reasoning of this example is called modus tollens, or the law of contraposition, or indirect reasoning.
w w
w .jn
With reasoning similar to that used to name the fallacy of the converse, the fallacy p® q Øp -------Øq is often called the fallacy of the inverse. An example of such a fallacy is "If it rains, I get wet. It doesn't rain. Therefore, I don't get wet." 4) Determine whether the argument is valid or invalid. I'll buy a car or I'll take a vacation. I won't buy a car. ----------------------------------------I'll take a vacation.
Page: 103
If p represents "I'll buy a car" and q represents "I'll take a vacation," the argument becomes
.c om
pÚ q Øp -------q We must set up a truth table for [(p Ú q) Ù Ø p] ® q Q
pÚ q
Øp
(p Ú q) Ù(Ø p)
[(p Ú q) Ù Ø q] ® q
T T F F
T F T F
T T T F
F F T T
F F T T
T T T T
ru
m
p
ld
fo
The statement is a tautology and the argument is valid. Any argument of this form is valid by the law of disjunctive syllogism. 5) Determine whether the argument is valid or invalid.
tu
w
or
If it squeaks, then I use WD-40. If I use WD- 40, then I must go to the hardware store. ---------------------------------------------------------------If it squeaks, then I must go to the hardware store.
w w
w .jn
Let p represent "it squeaks," let q represent "I use WD-40," and let r represent "I must go to the hardware store." The argument takes on the general form Make a truth table for the following statement: p® q q® r -------p® r
Page: 104
It will require eight rows. q
r
p® q
q®r
p®r
(p ® q) Ù(q®r)
[(p ® q) Ù (q®r)] ® (p ® r)
T T T T F F F F
T T F F T T F F
T F T F T F T F
T T F F T T T T
T F T T T F T T
T F T F T T T T
T F F F T F T T
T T T T T T T T
.c om
p
w w
w .jn
tu
w
or
ld
fo
ru
m
This argument is valid since the final statement is a tautology. The pattern of argument shown in this example is called reasoning by transitivity, or the law of hypothetical syllogism. .
Page: 105
8.6 Chapter Summary Tautology A statement is true for all truth values of the statement variables is called a tautology. Contradiction
.c om
A statement is false for all truth values of the statement variables is called a contradiction. Argument
fo
Valid and Invalid Arguments
ru
P1 , P2 , ¼, Pn Q
m
A logical argument is made up of premises (assumptions, laws, rules, wide ideas, or observations) and a conclusion and denoted by.
or
ld
An argument is valid if the fact that all the premises are true forces the conclusion to be true. An argument that is not valid is invalid, or a fallacy.
w
A summary of the valid and invalid forms of argument presented in this lesson follows.
w w
w .jn
tu
Valid Argument Forms Modus Modus Ponens Tollens p®q p®q p Øq ------------q Øp
Disjunctive Syllogism pÚ q Øp ------q
Invalid Argument Forms (Fallacies) Fallacy of the Fallacy of the Converse Inverse p®q p®q q Øp ------------p Øq
Reasoning by Transitivity p®q q®r ------p®r
Page: 106
8.7 Lesson End Activities
.c om
1. What is a hypothesis in an argument? 2. What is a premise in an argument? 3. What is a conclusion in an argument? 4. What is a valid argument? 5. What is an invalid argument? 6. State the modus ponens rule of inference. 7. State the modus tollens rule of inference. 8. State the addition rule of inference. 9. State the simplification rule of inference. 10. State the conjunction rule of inference.
p: I study hard.
q: I get A's.
r: I get rich.
ld
fo
ru
11. If I study hard, then I get A's. I study hard. ----------------------------------\I get A's.
m
Formulate the arguments of Exercises 11-15 symbolically and determine whether each is valid. Let
tu
w
or
12. If I study hard, then I get A's. If I don't get rich, then I don't get A's. ----------------------------------\I get rich.
w .jn
13. I study hard if and only if I get rich. I get rich. ----------------------------------\I study hard.
w w
14. If I study hard or I get rich, then I get A's. I get A's. ----------------------------------\If I don't study hard, then I get rich. 15. If I study hard, then I get A's or I get rich. I don't get A's and I don't get rich. ----------------------------------\I don't study hard.
Page: 107
w w
20.
m
Ør ® Øp r ----------\p p®r r®q p ----------\q
ru
19.
fo
p®r r®q ---------\q
ld
18.
or
p ® (rÚq) r ® Øq ------------\p ® r
w
17.
tu
p® r p® q ---------------\p ® ( rÙq)
w .jn
16.
.c om
In Exercises 16-20, write the given argument in words and determine whether each argument is valid. Let p: 4 megabytes is better than no memory at all. q: We will buy more memory, r: We will buy a new computer.
Page: 108
8.8 References 1) J K Sharma, ”Discrete Mathematics” 2) Kenneth H.Rosen, “Discrete Mathematics and its Applications” 3) Seymour Lipschutz and Marc Lipson, “Discrete Mathematics” 4) Charles D.Miller and Others, “Mathematical Ideas”
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
5) Wikipedia, the free encyclopedia.
Page: 109
Unit – III Lesson – 9 Method of proof and Predicate Calculus Contents
m
.c om
9.0 Aims and objectives 9.1 Introduction 9.2 Method of Proof 9.2.1 Direct Proof 9.2.2 Proof by contradiction (or Indirect Proof) 9.3 Predicate Calculus 9.4 Quantifiers 9.5 Mathematics and Predicate Calculus 9.6 Let Us Sum Up 9.7 References
ru
9.0 Aims and objectives
fo
In this lesson, we have discussed method of proofs and predicate calculus. With
ld
the proof methods, one can arrive at a conclusion from the given sequence of premises.
or
After reading this lesson, you should able to understand Direct and Indirect proof methods
·
Predicate calculus for reasoning.
·
Quantifiers and its types.
w .jn
tu
w
·
9.1 Introduction
w w
An argument that establishes the truth of a theorem is called a proof. Logic is a tool for the analysis of proofs. In this lesson, we describe some general methods of proof. In the previous lesson we have discussed the propositional logic which is not sufficient for all our logic needs. We need to go beyond the propositional calculus to the predicate calculus, which allows us to manipulate statements and to express Mathematics. This and other logics are employed in the design of expert systems, robots and artificial intelligence. We have discussed predicate calculus in this lesson.
Page: 110
9.2 Methods of Proof
.c om
A mathematical system consists of axioms, definitions, and undefined terms. Axioms are assumed true. Definitions are used to create new concepts in terms of existing ones. Some terms are not explicitly defined but rather are implicitly defined by the axioms. Within a mathematical system we can derive theorems. A theorem i s a proposition that has been proved to be true. Special kinds of theorems are referred to as lemmas and corollaries. An argument that establishes the truth of a theorem is called a proof. Logic is a tool for the analysis of proofs. In this section, we describe some general methods of proof. Theorems are often of the form For all x1 ,x2 ,…,xn , if p(x1 ,x2 ,…,xn), then q((x1 ,x2 ,…,xn).
or
ld
fo
ru
m
This universally quantified statement is true provided that the conditional proposition if p(x1 ,x2 ,…,xn), then q((x1 ,x2 ,…,xn) ----- (7.1) is true for all x1 ,x2 ,…,xn in the domain of discourse. To prove (7.1) we assume that x1 ,x2 ,…,xn are arbitrary members of the domain of discourse. If p(x1 ,x2 ,…,xn), by definition of p ® q, (7.1) is true; thus we need to consider the case that p(x1 ,x2 ,…,xn) is true.
w
9.2.1 Direct Proof
w .jn
tu
A direct proof assumes that p(x1 ,x2 ,…,xn) is true and then, using p(x1 ,x2 ,…,xn) as well as other axioms, definitions and theorems, shows directly that q(x1 ,x2 ,…,xn) is true.
w w
Example 1: We will give a direct proof of the following statement. For all real numbers d,d1 ,d2 and x if d = min{d1 ,d2 } and x <= d, then x <=d1 and x <=d2 . Proof. We assume that d,d1 ,d2 and x are arbitrary real numbers. The preceding discussion shows that it suffices to assume that d = min{d1 ,d2 } and x <= d is true and then prove that x <= d1 and x <=d2 is true. From the definition of min, it follows that d <=d1 and d <=d2 . From x <= d and d<=d1, we may derive x <= d1 from the theorem – for all real numbers x,y, and z if x <= y and y <= z, then x <= z. From x <= d and d <= d2, we may derive x <= d2 from the same previous theorem. Therefore, x <=d1 and x <=d2 .
Page: 111
Example 2
Let the following statements be true. · It is snowing. · If it is warm, then it is not snowing. · If it is not warm, then I cannot go for swimming. Show that the statement 'I cannot go for swimming' is a true statement.
m
.c om
Solution Let p, q and r represent the statements. p : it is snowing q : it is warm r : I can go for swimming Consider premises that the statements p, q ® Øp and Ø q ® Ø r are true. Then we shall prove that the statement Ø r is true. Since q = Ø p is true, its contrapositive p = Ø r is also true. Since p ® Ø q and Ø q® Ø r, then as per the law of syllogisms p ® Ø r. Since statement p is true, therefore, the statement - r: I cannot go for swimming, must be true.
or
ld
fo
ru
Example 3 Let the following statements be true. · If I enjoy studying, then I will study. · I will do my homework or I will not study. · I will not do my homework. Show that the statement 'I do not enjoy studying' is a true statement.
w .jn
tu
w
Solution Let p, q and r represent the statements. p : I enjoy study q : I will study r : I will do my homework Consider premises that the statements p ® q, Ø q Ú r and Ø r are true. Then we shall prove that the statement Ø p is true.
w w
Since Ø r is true, then r is false. Also either r or Ø q is true. Thus, Ø q is true. Since p ® q, therefore, Ø q® Ø p is true and hence, the statement Ø p: I do not enjoy study, must be true. 9.2.2 Proof by contradiction (or Indirect Proof) A second technique of proof is proof by contradiction. A proof by contradiction establishes (7.1) by assuming that the hypothesis p is true and that the conclusion q is false and then, using p and q’ as well as other axioms, definitions and theorems, devices a contradiction. A contradiction is a proposition of the form r Ù Ør (r may be any proposition whatever). A proof by contradiction is sometimes called an indirect proof since to establish (7.1) using proof by contradiction, one follows an indirect route: derive r Ù Ør, then conclude that (7.1) is true.
Page: 112
The only difference between the assumptions in a direct proof and a proof by contradiction is the negated conclusion. In a direct proof the negated conclusion is not assumed, where as in a proof by contraciction the negated conclusion is assumed. Proof by contradiction may be justified by noting that the propositions p ® q and p Ù Øq ® r Ù Ør are equivalent. The equivalence is immediate from a truth table.
q
r
p® q
p Ù Øq
r Ù Ør
p Ù Øq ® r Ù Ør
T T T T F F F F
T T F F T T F F
T F T F T F T F
T T F F T T T T
F F T T F F F F
F F F F F F F F
T T F F T T T T
ru
m
.c om
p
Example 4:
fo
We will give a proof by contradiction of the following statement: For all real numbers x and y, if x+y ³ 2, then either x ³ 1 or y ³ 1.
ld
Proof:
tu
w
or
Suppose that the conclusion is false. Then x < 1 and y < 1. Using a above mentioned theorem, we may add these inequalities to obtain x+y < 1+1 =2. At this point, we have derived the contradiction p Ù Øp, where p: x+y ³ 2.
w .jn
Thus we conclude that the statement is true.
w w
Example 5 Let the following statements be true. . If I am lazy, then I do not study. . I study or I enjoy myself. . I do not enjoy myself. Show that the statement 'I am not lazy' is a true statement. Solution Let p, q and r represent the statements p : I am lazy q : I study r : I enjoy myself Consider premises that the statements p ® Ø q, q Ú r and Ø r are true. Then we shall prove that the statement Ø p is true. Assuming that p is true. Since p is true and p ® Ø q, then Ø q is true. Thus, q is false. Also, r is false. But either q or r is true. This is not possible This contradiction implies that the assumption that p is true is false and hence Ø p is true.
Page: 113
Example 6 Show that 5 + Ö2 is an irrational number. Solution Let 5 + Ö2 = r be a rational number. Then Ö2 = r - 5. Since r and 5 are rational numbers, therefore, r - 5 is also a rational number. This implies that Ö2 is a rational number, which is a contradiction because Ö2 is an irrational number. Thus, the assumption that 5 + Ö2 must be false and hence, the given number is irrational.
.c om
9.3 Predicate Calculus We begin our discussion with examples. Example 7:
or
ld
fo
ru
m
We have been studying statements that are either true or false. But, consider the statement “x2 > 1.” In order to decide if this statement is true or false, we need to know the numerical value of x. If x = 1.1, then “x2 > 1” is true. If x = 0.9, then “x2 > 1” is false. The best way to think of this is to regard the statement “x2 > 1” as a function S(x) = “x2>1”. If we take this point of view, we need to specify the domain of S. First suppose the domain of S is R, the set of all real numbers. The codomain (or range) of S, by our description just given, is a set of statements that are either true or false (e.g., S(0.9) = “0.92 > 1”, S(2.3) = “2.32 > 1”). The function S is an example of a predicate.
w
Example 8:
tu
Consider the statement "All men are mortal" and reword the statement like
w .jn
"For all x, if x is a man then x is mortal."
w w
The sentence "x is a man" is not a statement in propositional calculus, since it involve an unknown thing x and we can't assign a truth value without knowing what x we're talking about. This sentence can be broken down into its subject, x, and a predicate, "is a man." We say that the sentence is a statement form, since it becomes a statement once we fill in x. Here is how we shall write it symbolically: The subject is already represented by the symbol x, called a term here, and we use the symbol P for the predicate "is a man." We
.c om
Page: 114
w w
w .jn
tu
w
or
ld
fo
ru
m
then write Px for the statement form. (It is traditional to write the predicate before the term; this is related to the convention of writing function names before variables in other parts of mathematics.) Similarly, if we use Q to represent the predicate "is mortal" then
write
the
statement
"If
x
is
a
Qx stands for "x is mortal." We can then man then x is mortal" as Px ÂŽ
.c om
Page: 115
w .jn
tu
w
or
ld
fo
ru
m
Qx . To write our whole statement, "For all x, if x is a man then x is mortal" symbolically, we need symbols for "For all x." We use the
w w
symbol "" " to stand for the words "for all" or "for every." Thus, we can write our complete statement as
w w "
.c om
m
ru
fo
ld
or
w
tu
w .jn
Page: 116
x [Px
Qx ].
®
.c om
Page: 117
w .jn
tu
w
or
ld
fo
ru
m
The symbol "" " is called a quantifier because it describes the number of things we are talking about: all of them.
w w
Specifically, it is the universal quantifier because it makes a claim that something happens universally.
.c om
Page: 118
Px ®
w w
w .jn
tu
w
or
ld
fo
ru
m
The square brackets around “
Qx ” define what is called the scope of the
.c om
Page: 119
x. That is, they surround what it is
w w
w .jn
tu
w
or
ld
fo
ru
m
quantifier we are claiming is true for all x.
Page: 120
Definition (Predicate and truth set) A predicate is any function whose codomain is statements that are either true or false. There are two things to be careful about: • The codomain is statements not the truth value of the statements. • The domain is arbitrary — different predicates can have different domains.
.c om
The truth set of a predicate S with domain D is the set of those x Î D for which S(x) is true. It is written {x Î D | S(x) is true} or simply {x | S(x)}.
In simple terms, the Predicate can be defined as
m
In general, a statement involving the n variables x1 ,x2 ,…,xn can be denoted by P(x1 ,x2 ,…,xn ).
ru
A statement of the form P(x1 ,x2 ,…,xn ) is the value of the propositional function P at the n-tuble (x1 ,x2 ,…,xn ), and P is called a predicate.
fo
9.4 Quantifiers
w
or
ld
The words and phrases like for all, each and n o ( n e ) are called universal quantifiers, while words and phrases like for some, there exists and (for) at least one are called existential quantifiers. Quantifiers are used to indicate how many cases of a particular situation exist.
w .jn
tu
The phrase “for all” the universal quantifier is written " (“A” rotated 180 ). If S(x) is a predicate and the set D is contained in the domain of x, the statement “"x Î D, S(x)” is read “for all x Î D, S(x) is true,” or just “for all x Î D, S(x).” The statement “"x Î D, S(x)” is true if and only if S(x) is true for every x Î D; otherwise the statement “"x Î D, S(x)” is false. If the value of D is clear, we may write simply "x S(x).
w w
The phrase “for some” is called the existential quantifier and is written $ (“E” rotated 180 ). If S(x) is a predicate and the set D is contained in the domain of x, the statement “ $x Î D, S(x)” is read “for some x Î D, S(x) is true,” or just “for some x Î D, S(x).” It is also read “there exists x Î D such that S(x).” The statement “ $x Î D, S(x)” is true if and only if S(x) is true for at least one x Î D; otherwise the statement “ $x Î D, S(x)” is false. If the value of D is clear, we may write simply $x S(x). In terms of truth sets: • “"x Î D, S(x)” is equivalent to saying that the truth set of S(x) contains the set D. • “$x Î D, S(x)” is equivalent to saying that the truth set of S(x) contains at least one element of the set D
Page: 121
Negation
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
Let us go back for a moment to the statement "All men are mortal":
"
®
w w
Question
w .jn
tu
w
or
ld
fo
ru
m
x [Px
.c om
Page: 122
Qx ].
.c om
Page: 123
What does its negation, Ø"
w w
®
w .jn
tu
w
or
ld
fo
ru
m
x [Px
w w
Qx]
.c om
m
ru
fo
ld
or
w
tu
w .jn
Page: 124
.c om
Page: 125
, say?
w w
w .jn
tu
w
or
ld
fo
ru
m
Answer Literally, it says: "It is not true that all men are mortal." More succinctly, "Some men are immortal."
Page: 126
"
ÂŽ
Ă&#x2DC;
w .jn
tu
w
or
ld
fo
ru
m
x [Px
.c om
Contrast this with "No men are mortal":
w w
9.5 Mathematics and Predicate Calculus
Qx ].
Page: 127
.c om
Mathematics is expressed in the language of the predicate calculus.
m
Here's an example of a mathematical
ru
statement expressed symbolically.
fo
Example 9: A Mathematical Statement
ld
Write the following statement symbolically:
or
"If a number is greater than 1 then it is greater than 0."
w
Solution
w .jn
tu
Since this is a statement meant to be true of every number, we need to rephrase it to make the universal quantifier obvious: "For all x, if x is a number and x is greater than 1, then x is greater than 0."
w w
Let us write N for the predicate "is a number" and use the standard notation ">" for "is greater than." Our statement is then:
.c om
Page: 128
"
w .jn
tu
w
or
ld
fo
ru
m
x [(Nx
w w
Ù
(x >1)) ®
.c om
Page: 129
m
(x >0)].
w w
w .jn
tu
w
or
ld
fo
ru
Notice that we put the phrases "x>1" and "x>0" in parentheses to make the meaning clearer.
Page: 130
9.6 Let Us Sum Up Ø Axioms are assumed true. Ø A theorem is a proposition that has been proved to be true. Ø Special kinds of theorems are referred to as lemmas and corollaries. Ø An argument that establishes the truth of a theorem is called a proof.
.c om
Direct Proof
m
A direct proof of (p ® q) has the following form. First assume that p is true. Then from this assumption draw one conclusion after another. Finally conclude that q is true. Therefore (p ® q) must always be true.
ru
Indirect Proof
or
ld
fo
An Indirect proof of (p ® q) has the following form. We assume that p is true, and that q is false. We then draw one conclusion after another, until we arrive at some statement r which we know is false. Contradiction, we say. So it cannot happen that p is true and q is false. This means that whenever p is true, q must also be true. Therefore (p ® q).
w
Predicate
w .jn
tu
A statement of the form P(x1 ,x2 ,…,xn ) is the value of the propositional function P at the n-tuble (x1 ,x2 ,…,xn ), and P is called a predicate. Predicate calculus
w w
The area of logic that deals with predicates and quantifiers is called the predicate calculus. Quantifiers
Ø The phrase “for all” the universal quantifier is written ". Ø The phrase “for some” is called the existential quantifier and is written $.
Page: 131
9.7 References 1) J K Sharma, ”Discrete Mathematics” 2) Kenneth H.Rosen, “Discrete Mathematics and its Applications” 3) Seymour Lipschutz and Marc Lipson, “Discrete Mathematics” 4) Charles D.Miller and Others, “Mathematical Ideas”
w w
w .jn
tu
w
or
ld
fo
ru
m
6) Richard JohnsonBaugh, ”Discrete Mathematics”
.c om
5) Wikipedia, the free encyclopedia.
Page: 132
Unit – IV Relations Lesson 10 Contents
.c om
10.0 Aims and Objectives 10.1 Introduction 10.2 Product of sets 10.3 Binary Relations 10.4 Types of relations 10.5 Problems and Solutions 10.6 Chapter Summary 10.7 References 10.0 Aims and Objectives
ld
Find product of sets. Know about the Binary Relations. Know the different types of relations.
w
or
· · ·
fo
After completing this lesson, you should able to
ru
m
In this lesson, we have discussed about the Product of sets, Binary Relations and Types of relations.
tu
10.1 Introduction
w w
w .jn
In mathematics and computer science, there are many relations used to establish a relation between pair of objects taken in a definite order. For example, “less than”, “is parallel to”, “is a subset of”, and so on. A relation between two sets can be defined by listing their elements as ordered pairs. In this lesson, we will discuss relations defined on sets and the ways of representing finite relations along with their properties. Relations will be defined by ordered pairs of elements. An ordered pair consists of two elements a and b is denoted as (a, b). Here the element a is designated as the first element and b as the second element. In particular (a, b) = (c, d) if and only if a = c and b = d. Thus, (a, b) ¹ (b, a). This contrasts with sets, where the order of elements is irrelevant; for example, {3,5} = {5,3}.
Page: 133
10.2 Product of sets Consider two non-empty finite sets A and B. The set of all ordered pairs (a, b) where a Î A and bÎ B is called the product or Cartesian product of A and B. This product is denoted by A ´ B (read as “A cross B”). By definition A ´ B ={(a, b) : a Î A and bÎ B} Example 1 If A = {1,2} and B = {a, b, c}, then
m
.c om
A ´ B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)} B ´ A = {(a, 1), (a, 2), (b, 1), (b, 2), (c, 1), (c, 2)} A2 = A ´ A = {(1, 1), (1, 2), (2, 1), (2, 2)} and n(A ´ B) = n(A) . n(B) =2 . 3 = 6
ld
fo
ru
From the above, we conclude the following: i) A ´ B ¹ B ´ A i.e. the order in which the sets are considered is important. ii) In fact, n(A ´ B) = n(A) . n(B) for any finite sets A and B. This follows from the observation that, for an ordered pair (a, b) in A ´ B, there are n(A) possibilities for a, and for each of these there are n(B) possibilities for b.
or
Product of n sets
w .jn
tu
w
The idea of a product of sets can be extended to any finite number of sets. Let A1 , A2 , … , An be n given sets. The set of all ordered n - tubles (a1 , a2 , … ,an ) where a1 ÎA1 , a2 Î A2 , …, an Î An is called the product of the sets A1 , A2 , … , An and is denoted by n
A 1 ´ A 2 ´ ... ´ A n or Õ A i i =1
w w
Important results 1) Let A, B, and C are sets and A Í B. Then (A ´ C) = (B ´ C). Proof. Let (a, c) be an arbitrary element of A ´ C. Then (a, c)Î(A ´ C) Þ a Î A and c Î C Þ a Î B and c Î C Þ (a, c) Î B ´ C Thus, (A ´ C) = (B ´ C). 2) If A Í B and C Í D, then prove that (A ´ C) Í (B ´ D). Proof. Let (a, c) be an arbitrary element of A ´ C. Then (a, c)Î(A ´ C) Þ a Î A and c Î C Þ a Î B and c Î D Þ (a, c) Î B ´ D Thus, (A ´ C) Í (B ´ C).
Page: 134
10.3 Binary Relations Definition: Let A and B be sets. A binary relation or, simply, relation R from A to B is a subset of A ´ B. In other words, a binary relation from A to B is a set R of ordered pairs where the first element of each ordered pair comes from A and the second element comes from B. Symbolically, R : A ® B if and only if R Í A ´ B and (a, b) Î R where a Î A and b Î B.
.c om
We use the notation a R b to denote that (a, b) Î R and a R b to denote that (a, b) Ï R. Moreover, when (a, b) belongs to R, a is said to related to b by R. Number of relations between two sets
ru
m
The total number of relations from A to B are 2mn, where m and n are the Cardinal number of the sets A and B respectively, including the empty relation and the relation A ´ B itself.
ld
fo
Domain and range of a relation
or
The domain of a relation R is the set of all first elements of the ordered pairs, which belong to R, and the range of R is the set of second elements.
w
Illustrations
w .jn
tu
a) Let A = {1, 2, 3} and B = {x, y, z} and let R = {(1,y), (1,z), (3,y)}. Then R is a relation from A to B, since R is a subset of A ´ B. With respect to this relation 1 R y, 1 R z, 3 R y but 1 R x, 2 R x, 2 R y, 2 R z, 3 R x, 3 R z.
w w
The domain of R is {1,3} and its range is {y,2} b) Let A = {eggs, milk, corn} and B = {cows, goats, hens}. We can define a relation R from A to B by (a, b) Î R if a is produced by b. In other words R: {(eggs, hens), (milk, cows), (milk, goats)} with respect to this relation eggs R hens, milk R cows, etc.
Page: 135
Set operations on relations
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
Since all relations are set of ordered pairs, the set operations can be carried on such sets. Let R and S be two relations, then we can define the following relation: Intersection of R and S: x (R Ă&#x2021; S) y = x R y
Page: 136
10.4 Types of relations Inverse relation Let R be a relation from a set A to set B. The inverse relation from B to A, denoted by R-1 , is the set of ordered pair {(b, a) : a Î A, b Î B, (a, b) Î R}. For example, the inverse of the relation R={(1, y), (1, z), (3, y)} from A={1, 2, 3} to B={x, y, z} follows:
.c om
R-1 = {(y,1), (z, 1), (y,3)} From the above, if R is any relation then (R-1 )-1 = R. Also, the domain of R-1 is equal to the range of R; the range of R-1 is equal to domain of R. Moreover, if R is a relation on A, then R-1 is also a relation on A.
m
Identity (or Diagonal) Relation
fo
ru
Let A be any set. Then the relation R in a set A denoted by IA is said to be identity relation if IA={(a, a) : a Î A}.
or
ld
Universal Relation
w
Let A be any set. Then A ´ A which is a subset of A ´ A is a relation on A called the universal relation
w .jn
tu
For example, if A ={2,3} then R = A ´ A = {(2,2), (2,3), (3,2), (3,3)} is universal relation. Empty (or Void) relation
A relation R in a set is said to be an empty relation provided R is a null set i.e.
w w
R=Æ.
Page: 137
10.5 Problems and Solutions 1) Consider the table given below that shows which students are taking which courses. Course CompSci Math Art History CompSci Math
.c om
Student Bala Manohar Chandra Ravi Ragu David
If we let X ={Bala, Manohar, Ragu, David} and Y ={CompSci, Math, Art, History,
ru
m
Our relation R in table can be written
fo
R={(Bala, CompSci), (Manohar, Math), (Chandra, Art), (Ravi, History), (Ragu, CompSci), (David, Math)}.
or
ld
Since (Ravi, History) Î R, we may write Ravi R History. The domain (First Column) of R is the set X and the range (Second Column) of R is the set Y.
w
2) Let X={2,3,4} and Y={3,4,5,6,7}.
w .jn
We obtain
tu
If we define a relation R from X to Y by (x,y) Î R if x divides y (with zero remainder).
R={(2,4),(2,6),(3,3),(3,6),(4,4)}.
w w
If we rewrite R as table, we obtain X 2 2 3 3 4
Y 4 6 3 6 4
The domain of R is the set {2,3,4} and the range of R is the set {3,4,6}. 3) Let R be the relation on X={1,2,3,4} defined by (x,y) ÎR if x £ y., x,y Î X. Then R={{1,1),(1,2),(1,3),(1,4),(2,2),(2,3),(2,4),(3,3),(3,4),(4,5)} The domain and range of R are both equal to X.
Page: 138
10.6 Chapter Summary Product of sets Let A and B be two non-empty finite sets. The set of all ordered pairs (a, b) where aÎA and bÎB is called the product or Cartesian product of A and B. This product is denoted by A´B (read as “A cross B”). By definition A ´ B ={(a, b) : a Î A and bÎ B}
.c om
Product of n sets Let A1 , A2 , … , An be n given sets. The set of all ordered n - tubles (a1 , a2 , … ,an ) where a1 ÎA1 , a2 Î A2 , …, an Î An is called the product of the sets A1 , A2 , … , An and is denoted by
i =1
m
n
A 1 ´ A 2 ´ ... ´ A n or Õ A i
fo
ru
Binary Relations A binary relation or, simply, relation R from set A to set B is a subset of A ´ B.
or
ld
Number of relations between two sets The total number of relations from A to B are 2mn, where m and n are the Cardinal number of the sets A and B respectively, including the empty relation and the relation A ´ B itself.
w .jn
Types of relations
tu
w
Domain and range of a relation The domain of a relation R is the set of all first elements of the ordered pairs, which belong to R, and the range of R is the set of second elements.
w w
Ø Inverse relation Let R be a relation from a set A to set B. The inverse relation from B to A, denoted by R-1 , is the set of ordered pair {(b, a) : a Î A, b Î B, (a, b) Î R}. Ø Identity (or Diagonal) Relation Let A be any set. Then the relation R in a set A denoted by IA is said to be identity relation if IA={(a, a) : a Î A}. Ø Universal Relation Let A be any set. Then A ´ A which is a subset of A ´ A is a relation on A called the universal relation. Ø Empty (or Void) relation A relation R in a set is said to be an empty relation provided R is a null set i.e. R=Æ.
Page: 139
10.7 References 1. J K Sharma, ”Discrete Mathematics” 2. Kenneth H.Rosen, “Discrete Mathematics and its Applications” 3. Seymour Lipschutz and Marc Lipson, “Discrete Mathematics” 4. Charles D.Miller and Others, “Mathematical Ideas”
w w
w .jn
tu
w
or
ld
fo
ru
m
6. Richard JohnsonBaugh, ”Discrete Mathematics”
.c om
5. Wikipedia, the free encyclopedia.
Page: 140
Unit – IV Lesson 11 Properties of relation, Partial Order and Equivalence relation Contents
.c om
11.0 Aims and Objectives 11.1 Introduction 11.2 Properties of relations 11.3 Partial order relations 11.4 Equivalence relation 11.5 Composition of relations 11.6 Chapter Summary 11.7 References
m
11.0 Aims and Objectives
ru
In this lesson, we have discussed about the Properties of relations, Partial order
fo
relations, Equivalence relation, and Composition of relations.
or
ld
After completing this lesson, you should able to
Know about Properties of relations.
·
Work with Partial order relations.
·
Compute Equivalence relation and Composition of relations.
w .jn
tu
w
·
11.1 Introduction
w w
In this lesson we covered some important properties of the relations like Reflexive
relation, Symmetric relation, Anti-symmetric relation and Transitive relation. Using the above properties we can define an equivalence relation which is also discussed in this lesson.
Page: 141
11.2 Properties of relations This section discusses some important properties or types of relations that are defined on a given set A. Reflexive relation A relation R on a set A is called reflexive if (a, a) Î R for every a Î A. In other words, for every a Î A, (a, a) Î R.
ru
m
.c om
Illustrations Consider the following relations on set A={1, 2, 3, 4}. 1) R1 = {(1, 1), (1, 2), (2, 3), (1, 3), (4, 4)} 2) R2 = {(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (4, 4)} 3) R3 = A ´ A , the universal relation 4) R4=Æ, the empty relation. Determine which of the relations are reflexive.
ld
fo
Here the set A contain the four elements 1, 2, 3 and 4 then a relation on A is reflexive if it contains the four pairs (1,1), (2,2), (3,3) and (4,4). Therefore, the relation R1 is not reflexive since 2 Î A but (2, 2) Ï R1 and also R4 is not reflexive. Where as the relations R2 and the universal relation R3 are reflexive.
or
Symmetric relation
tu
w
A relation R on a set is symmetric if whenever aRb then bRa, that is, if whenever (a, b)ÎR, then (b, a) Î R. The necessary and sufficient condition for a relation R to be symmetric is R = R-1 .
w w
w .jn
Illustrations 1) Let A={1, 2, 3, 4} and R={(1, 1), (1, 2), (2, 1), (2, 2), (3, 3), (4, 4)} then R-1 ={(1, 1), (2, 1), (1, 2), (2, 2), (3, 3), (4, 4)}. Here R = R-1 . Therefore R is symmetric.
2) Let A ={1, 2, 3} and R={(1, 2), (2, 3), (2, 1), (3, 3)} then R-1 ={(2, 1), (3, 2), (1, 2), (3, 3)}. Here R ¹ R-1 since (2,3) Î R where as (3,2) Ï R-1 . Hence R is not symmetric.
Anti-symmetric relation A relation R on a set A such that (a, b) Î R and (b, a) Î R only if a = b, for all a,bÎ R, is called anti-symmetric.
Page: 142
Transitive relation A relation R on a set A is transitive if whenever (a, b) Î R and (b, c) Î R, then (a,c) Î R, for all a,b,c Î A. 11.3 Partial order relations
ru
m
.c om
A relation, R on a set A is called a partial order or partial ordering relation if and only if following three conditions are satisfied 1) R is reflexive, i.e. a R a, for all a Î A. 2) R is anti-symmetric, i.e. a R b, b R a, if and only if a = b, for all a, b Î A. 3) R is transitive, i.e. a R b, b R c implies that a R c, for all a, b, c Î A. The set A on which a partial order relation, R is defined is called a partially ordered set or simply a poset, and it is denoted by (A, R). The relation '=' (equal to) defined on a set A is said to be total order relation provided for all a, b Î A, we have a = b. This implies that b = a. In other words, aRb and bRa, and hence the relation '=' is also a symmetric relation.
fo
11.4 Equivalence relation
tu
Reflexive: a ~ a Symmetry: if a ~ b then b ~ a Transitivity: if a ~ b and b ~ c then a ~ c.
w .jn
· · ·
w
or
ld
An equivalence relation is a binary relation between two elements of a set which groups them together as being "equivalent" in some way. That a is equivalent to b is denoted as "a~b" or "a b". An equivalence relation is reflexive, symmetric, and transitive. In other words, for all elements a, b, and c of the set X, the following must hold for "~" to be an equivalence relation on X:
A set X together with an equivalence relation on X is called a setoid.
w w
Examples of equivalence relations A ubiquitous equivalence relation is the equality ("=") relation between elements of any set. Other examples include: · · · · · ·
"Has the same birthday as" on the set of all people, given navie set theory. "Is similar to" or "congruent to" on the set of all triangles. "Is congruent to modulo n" on the integers. "Has the same image under a function" on the elements of the domain of the function. Logical equivalence of statements in logic. "Is isomorphic to" on models of a set of sentences.
Page: 143
Examples of relations that are not equivalences The relation " " between real numbers is reflexive and transitive, but not symmetric. For example, 7 5 does not imply that 5 7. It is, however, a partial order.
·
The relation "has a common factor greater than 1 with" between natural numbers greater than 1, is reflexive and symmetric, but not transitive. (The natural numbers 2 and 6 have a common factor greater than 1, and 6 and 3 have a common factor greater than 1, but 2 and 3 do not have a common factor greater than 1).
·
The empty relation R on a non-empty set X (i.e. aRb is never true) is vacuously symmetric and transitive, but not reflexive. (If X is also empty then R is reflexive.)
·
The relation "is approximately equal to" between real numbers or other things, even if more precisely defined, is not an equivalence relation, because although reflexive and symmetric, it is not transitive, since multiple small changes can accumulate to become a big change.
·
The relation "is a sibling of" on the set of all human beings is not an equivalence relation. Although siblinghood is symmetric (if A is a sibling of B, then B is a sibling of A) it is neither reflexive (no one is a sibling of himself), nor transitive (since if A is a sibling of B, then B is a sibling of A, but A is not a sibling of A). Instead of being transitive, siblinghood is "almost transitive", meaning that if A ~ B, and B ~ C, and A C, then A ~ C.
·
Symmetry and transitivity do not imply reflexivity, unless every A is related to some B.
w .jn
tu
w
or
ld
fo
ru
m
.c om
·
w w
Theorem ("Fundamental Theorem of Equivalence Relations") · An equivalence relation ~ partitions X. · Conversely, corresponding to any partitions of X, there exists an equivalence relation ~ on X. 11.5 Composition of relations The composition of binary relations is a concept of forming a new relation S o R from two given relations R a n d S, having as its most well-known special case the composition of functions.
Page: 144
Properties Composition of relations is associative. The inverse relation of S o R is (S o R)-1 = R-1 o S-1 . The compose of (partial) functions (i.e. functional relations) is again a (partial) function.
.c om
If R and S are injective, then S o R is injective, which conversely implies only the injectivity of R. If R and S are surjective, then S o R is surjective, which conversely implies only the surjectivity of S.
w w
w .jn
tu
w
or
ld
fo
ru
m
The binary relations on a set X (i.e. relations from X to X) form a monoid for composition, with the identity map on X as neutral element.
Page: 145
11.6 Let Us Sum Up Properties of relations Ø Reflexive relation A relation R on a set A is called reflexive if (a,a) Î R for every a Î A. Ø
Symmetric relation A relation R on a set A is called symmetric if for all a,b Î A, if (a,b) Î R, then (b,a)ÎR. Ø
.c om
Antisymmetric relation A relation R on a set A is called antisymmetric if for all a,b Î A, if (a,b) Î R and a ¹ b, then (b,a) Ï R. Ø
ru
m
Transitive relation A relation R on a set A is called transitive if for all a,b,z Î A, if (a,b) and (y,z) Î R, then (x,z) Î R.
fo
Partial order relations
w .jn
tu
Equivalence relation
w
or
ld
A relation, R on a set A is called a partial order or partial ordering relation if and only if following three conditions are satisfied 1) R is reflexive, i.e. a R a, for all a Î A. 2) R is anti-symmetric, i.e. a R b, b R a, if and only if a = b, for all a, b Î A. 3) R is transitive, i.e. a R b, b R c implies that a R c, for all a, b, c Î A.
A relation that is reflexive, symmetric and transitive on set A is called an equivalence relation on A.
w w
Composition of relations Let R1 be a relation from X to Y, and R2 be a relation from Y to Z. The composition of R1 and R2 , denoted R2 o R1 , is the relation from X to Z defined by R2 o R1 ={(x,z) : (x,y) Î R1 and (y,z) Î R2 for some y Î Y}
Page: 146
11.7 References 1. J K Sharma, ”Discrete Mathematics” 2. Kenneth H.Rosen, “Discrete Mathematics and its Applications” 3. Seymour Lipschutz and Marc Lipson, “Discrete Mathematics” 4. Charles D.Miller and Others, “Mathematical Ideas”
.c om
5. Wikipedia, the free encyclopedia.
w w
w .jn
tu
w
or
ld
fo
ru
m
6. Richard JohnsonBaugh, ”Discrete Mathematics”
Page: 147
Unit – IV Lesson 12 Functions Contents
.c om
12.0 Aims and Objectives 12.1 Introduction 12.2 Functions as Relations 12.3 Difference Between a Function and its Value 12.4 Types of Functions 12.5 Composition of Functions 12.6 Lesson End Activities 12.7 References 12.0 Aims and Objectives
ld
Know about Properties of relations. Work with Partial order relations. Compute Equivalence relation and Composition of relations .
or
· · ·
fo
After completing this lesson, you should able to
ru
m
In this lesson, we have discussed about the Properties of relations, Partial order relations, Equivalence relation, and Composition of relations.
w
12.1 Introduction
w w
w .jn
tu
Many everyday phenomena involve two quantities that are related to each other by some rule of correspondence. Such a rule of correspondence is called a function. The concept of a function is extremely important in discrete mathematics. Functions are used in the definition of such discrete structures as sequences and strings. Functions are also used to represent how long it takes a computer to solve problems of a given size. Recursive functions, which are functions defined in terms of themselves, are used throughout computer science. This section reviews the basic concepts involving functions needed in discrete mathematics. The terms such as mapping, transformation, etc., are also used for functions to depict a relation between two discrete objects.
Page: 148
Definition of a Function A function f from a set A to a set B is a rule of correspondence that assigns to each element x in the set A exactly one element y in the set B. The set A is the domain(or set of inputs) of the function f, and the set B contains the range(or set of outputs). Symbolically, the function f is expressed as: f : A ® B such that y = f(x), for x Î A and y Î B. The following characteristics are true of a function from a set A to a set B.
.c om
1. Each element in A must be matched with an element in B. 2. Some elements in B may not be matched with any element in A. 3. Two or more elements of A may be matched with the same element of B.
m
The converse of the third statement is not true. That is, an element of A (the domain) cannot be matched with two different elements of B.
ru
In other words, the relation f can be described as the set of elements written as: {(x, f(x)) : x Î A, f(x) Î B}.
fo
Example 1: Testing for functions
w
ii) iv)
{(a,4), (b,5)} { (a,1), (a,2), (b,3), (b,4), (c,5)}
w .jn
Yes, because each element of A is matched with exactly one element of B. No, because not all elements of A are matched with an element of B. Yes, It does not matter that each element of A is matched with the same element of B. iv) No, because the element a in A is matched with two elements, 1 and 2, in B. This is also true of the element b. Illustrations 1) Let A be the set of books in a library and N be the set of natural numbers. Let f be the rule which assigns to each book the number of pages contained in it. Here some natural number will be assigned to each book and no book can be assigned to more than one natural number. Therefore f is a function of A to N. 2) Let A = {l, 2, 3, 4} and B = {1, 2, 3}. Then f = {(1,2), (2, 3), (3, 3), (4, 2)} is a function from A to B. Since to each element in A we have assigned a unique element in B, therefore f(1) = 2, f(2) = 3, f(3) = 3, f(4) = 2. Also the range of the function is f(A) = {2, 3}. 3) Let A = {1, 2, 3} and B = {x, y, z}. Consider the relations R1 = {(1, x), (2, x)} and R2 = {(1, x), (1, y), (2, z), (3, y)}
w w
i) ii) iii)
{(a,2), (b,3), (c,4)} {(a,1), (b,1), (c,1)}
tu
i) iii)
or
ld
Let A={a,b,c} and B={1,2,3,4,5}. Does the set of ordered pairs represent a function from set A to set B?
Page: 149
The relation R2 is not a function because R2(1) = {x, y}. But relation R1 is a function with Domain = {l, 2} and Range = {x}. 4. Let I be the set of integers and A = {0, 1}. The relation between I and A defined as f: I® A such that ì 0 if x is even f (x) = í î 1 if x is odd
is a function because each set f(x) consists of a single element.
.c om
12.2 Functions as Relations
fo
ru
m
A relation can be used to express a one-to- many relationship between the elements of the sets A and B, where an element of A may be related to more than one element of B. A function represents a relation where exactly one element of B is related to each element in A. Relations are a generalization of functions; they can be used to express a much wider class of relationships between sets. Thus, every function is a relation but every relation is not a function.
w
or
ld
Illustration Let A={a, b, c, d}, B = {1, 2, 3} and R = {(a, 1), (b, 1), (c, 2), (d, 2)}. Then R is a function from A to B. Clearly, R is also a relation from A to B. But, consider the subset C of A x B given by C = {(a, 1), (b, 2), (a; 3), (c, 1), (d, 2)}. Here C is a relation from A to B. But C is not a function from A to B. The obvious reason is that the element a Î A is associated to two different elements 1, 3 Î B.
w w
w .jn
tu
12.3 Difference between a Function and its Value If f is the set of all ordered pairs of elements of A and B such that image of first element is the second element, i.e. (x, y) Î f, then y is called the value of f at the element x and is denoted by f(x). Hence, f is an element of A x B and f (x) is an element of B. For example, f = {x, y : y = 2x2 + 4x + 5} defines the function. The numbers x and y are called variables. The domain of the function is the set of all possible values of x and the range is the set of all values of y. In this case the domain is the set of all real numbers which can be denoted with interval notation as (¥, -¥), but the range of f is set of all positive numbers greater than or equal to 3, i.e. (3, ¥) because lowest value that y can assume is 3 for x = -1. Illustration If A = {1, 2, 3} and B = {2, 3, 4}, then the relation f defined by f(1) = 2, f(2) = 3, f(3)= 4 is a function from set A to B. We may also write f = {(1, 2), (2,3), (3, 4)}. Example If A = {I, 2, 3} and B = {2, 3, 4} are two sets, then show that {(I, 2), (1, 3), (3, 4)} is not a function from A to B.
Solution The relation, f = {(1, 2), (1, 3), (3, 4)} implies that f(1) = 2, f(1) = 3 and f(3) = 4.
Page: 150
Clearly f is not a function for two reasons: (i) The element 2 of A has no image in B. (ii) The element 1 of A has two images, viz., 2 and 3 in B. Identity function
.c om
Let A be any set. The function from A into A i.e. f : A ® A, which assigns to each element that element itself is called the identity function on A and is usually denoted by IA or simply I. In other words, IA(a) = a for every element a in A. 12.4 Types of Functions
m
Equal functions Two functions f : A ® B and g : A ® B are said to be equal if and only if f (x) = g (x) for every x Î A and are written as f = g.
fo
ru
Constant function A function f : A® B is called a constant function, if some element yÎB, is assigned to every element of A, i.e. f (x) = y for every x Î A. In other words, f:A® B is a constant function if the range of f consists of only one element.
w
or
ld
Onto function The function f: A ® B is said to be an onto (or surjective) function, if each element of B is the image of some element of A. In other words, f: A ® B is onto if the image of f is the entire codomain, i.e., if f(A)=B. In such a case we say that f is function from A onto B or that f maps A onto B.
w .jn
tu
Into function The function f : A ® B is said to be an into function, if there is at least one element in B which is not the f- image of any element in A. But every element of A has fimage in B. In this case the range of f is proper subset of B, that is, f (A) Í B and f (A)#B.
w w
Many-one and one-to-one functions The function f: A ® B is said to be a (a) Many-one function, if two or more different elements in A have same f- image in B, i.e, f(x1 )=f(x2 ) even if x1 # x2 for all x1 ,x2 Î A. (b) One-to-one (or injective) function, if different elements in the domain A have distinct images. In other words, f is one-to-one if f(a) = f(a’) implies a=a’. One-one onto (bijective) function The function f: A®B is said to be one-one onto function if to each element of A there corresponds one and only one element of B and every element of B have one and only image in A. One-one and onto function are also called bijective as shown in Fig. 12.1.
.c om
Page: 151
w .jn
tu
w
or
ld
fo
ru
m
One-one into function The function f : A ÂŽ B is said to be one-one into function if to each element of A there corresponds one element of B, but there are some element of B which do not correspond to any of the elements of A as shown in Fig. 12.2.
w w
Many-one into function The function, f : A ÂŽ B is said to be many-one into function if two or more elements of a set A corresponds to the same element of B and there are some elements in B which do not correspond to any of the elements of A as shown in Fig. 12.3.
Page: 152
.c om
Many-one onto function The function, f : A ® B is said to be many-one onto function if each element in B is joined to at least one element in A, and two or more elements in A are joined to the same element in B as shown in Fig. 12.4.
tu
w .jn
Invertible Functions
w
or
ld
fo
ru
m
Illustrations Let A be the set of students sitting on chairs in a classroom and let B be the set of chairs in the classroom. Let f b e the correspondence, which associates to each student the chair on which he sits. Since every student has some chair to sit and no student can sit on two or more than two chairs, therefore for the function defined as f: A ® B, the following cases may arise: 1. If every student gets a separate chair and no chair is left vacant, then this is a case of a one-one onto function. 2. If every student gets a separate chair and still some chairs are left vacant, it is a oneone into function. 3. If every student does not sit on a separate chair, i.e. more than one student sit on a chair, no chair is left vacant, it is a many-one onto function.
The domain and range of any function may be interchanged to form a new function. It is obtained by interchanging the position of elements in the ordered pair of original function.
w w
A function f : A ®B is invertible if its inverse relation f –1 is a function from B to A. In general, the inverse relation f –1 may not be a function. The following theorem gives simple criteria which tells us when it is. Theorem: onto.
A function f: A ® B is invertible if and only if f is both one-to-one and
If f : A ® B is one-to-one and onto, then f is called a one-to-one correspondence between A and B. This terminology comes from the fact that each element of A will then correspond to a unique element of B and vice versa.
Page: 153
Illustrations 1. Let f : A ® B such that y or f(x) = x + 1, for all x Î A and y Î B be a function. Since f is everywhere defined as well as one-one onto, therefore f is invertible. Thus f –1 is also one-one onto function from set B to A. 2. Let f : R ® R such that y or f(x) =x2 , for all x Î A and y Î B be a function. Since R is the set of real numbers, where f( -2 ) = f(2) = 4, therefore f is not one-one. Hence f is not invertible.
.c om
3. Let j : A ® B be a function defined everywhere. Let A and B two finite sets containing equal number of elements. In such a case (a) If f is one-one, then f is onto. (b) If f is into, then f is one-one.
m
Moreover, when A = B we need to prove only that a function is one-one onto to show that it is bijection.
ld
fo
ru
Remarks 1. A function which possesses an inverse is said to be invertible. 2. Only one-one and onto functions are invertible. 3. The inverse function of the given function f is unique. 4. Inverse function f -1 is onto if and only if f is everywhere defined.
or
12.5 Composition of Functions
tu
w
Let g be a function from the set A to the set B and let f be a function from the set B to the set C. The composition of the functions f and g, denoted by f o g, is defined by
w .jn
(f o g)(a) = f(g(a)).
w w
In other words, f o g is the function that assigns to the element a of A the element assigned by f to g(a). Note that the composition f o g cannot be defined unless the range of g is a subset of the domain of f. Example: Let g be the function from the set {a, b, e} to itself such that g(a) = b, g(b) = c, and g(c)=a. Let f be the function from the set {a, b, e} to the set {I, 2, 3} such that f(a) = 3, f(b) = 2, and f(c) = 1. What is the composition of f and g, and what is the composition of g and f? Solution: The composition f o g is defined by (f o g) (a) = f(g(a)) = f(b) = 2, (f o g) (b) = f(g(b)) = f(c) = 1, and (f o g) (c) = f(g(e)) = f(a) = = 3. Note that g o f is not defined, because the range of f is not a subset of the domain of g.
Page: 154
12.6 Lesson End Activities What is a function from X to Y?
2.
Explain how to use an arrow diagram to depict a function.
3.
What is the graph of a function?
4.
Define one-to-one function. Give an example of a one-to-one function. Explain how to use an arrow diagram to determine whether a function is one-to-one.
5.
Define onto function. Give an example of an onto function, Explain how to use an arrow diagram to determine whether a function is onto.
6.
What is a bijection? Give an example of a bijection.
7.
Define inverse function. Give an example of a function and its inverse. Given the arrow diagram of a function, how can we find the arrow diagram of the inverse function?
8.
Define composition of functions. How is the composition of f and g denoted? Give an example of functions f and g and their composition. Given the arrow diagrams of two functions, how can we find the arrow diagram of the composition of the functions?
9.
What is a binary operator? Give an example of a binary operator.
tu
w
or
ld
fo
ru
m
.c om
1.
w .jn
10. What is a unary operator? Give an example of a unary operator.
w w
Determine whether each relation in Exercises 11-15 is a function from X = {l,2,3,4} to Y={a,b,c,d}. If it is a function, find its domain and range, draw its arrow diagram, and determine if it is one-to-one or onto, if it is both one-to-one and onto, give the description of the inverse function as a set of ordered pairs, draw its arrow diagram, and give the domain and range of the inverse function. 11) {(1,a),(2,a),(3,c),(4,b)} 12) {(1,c),(2,a),(3,b),(4,c),(2,d)} 13) {(1,c),(2,d),(3,a),(4,b)} 14) {(1,d),(2,d),(4,a)} 15) {(1,b),(2,b),(3,b),(4,b)}
Page: 155
12.7 References 1) J K Sharma, ”Discrete Mathematics” 2) Kenneth H.Rosen, “Discrete Mathematics and its Applications” 3) Seymour Lipschutz and Marc Lipson, “Discrete Mathematics” 4) Charles D.Miller and Others, “Mathematical Ideas”
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
5) Wikipedia, the free encyclopedia.
Page: 156
Unit – V Lesson – 13 Graph Theory Contents:
.c om
13.0 Aims and objectives 13.1 Introduction 13.2 Graph 13.3 Directed Graph 13.4 Path, trail and walk 13.5 Applications of graphs 13.6 Let Us Sum Up 13.7 Lesson End Activities
m
13.0 Aims and objectives
ru
There are various types of graphs, each with its own definition. Unfortunately, some people apply the term “graph” rather loosely, so you can’t be sure what type of
fo
graph they’re talking about unless you ask them. After you have finished this chapter, we
or
ld
expect you to use the terminology carefully, not loosely.
13.1 Introduction
w
In mathematics and computer science, graph theory is the study of graphs;
tu
mathematical structures used to model pairwise relations between objects from a certain
w .jn
collection. The notion of a “graph” is deceptively simple: It is collection of ‘vertices’ (or ‘points’ or 'nodes') and a collection of ‘edges’ (or ‘lines’) that connect pairs of vertices. A graph may be undirected, meaning that there is no distinction between the two vertices
w w
associated with each edge, or its edges may be directed from one vertex to another. The graphs studied in graph theory should not be confused with "graphs of functions" and other kinds of graph.
Page: 157
13.2 Graph What is a Graph? There are various types of graphs, each with its own definition. To motivate the various definitions, we’ll begin with some examples.
.c om
Example 1 (A computer network) Computers are often linked with one another so that they can interchange information. Given a collection of computers, we would like to describe this linkage in fairly clean terms so that we can answer questions such as “How can we send a message from computer A to computer B using the fewest possible intermediate computers?”
fo
ru
m
We could do this by making a list that consists of pairs of computers that are connected. Note that these pairs are unordered since, if computer C can communicate with computer D, then the reverse is also true. (There are sometimes exceptions to this, but they are rare and we will assume that our collection of computers does not have such an exception.) Also, note that we have implicitly assumed that the computers are distinguished from each other: It is insufficient to say that “A PC is connected to a Mac.” We must specify which PC and which Mac. Thus, each computer has a unique identifying label of some sort.
w w
w .jn
tu
w
or
ld
For people who like pictures rather than lists, we can put dots on a piece of paper, one for each computer. We label each dot with a computer’s identifying label and draw a curve connecting two dots if and only if the corresponding computers are connected. Note that the shape of the curve does not matter (it could be a straight line or something more complicated) because we are only interested in whether two computers are connected or not. Below are two such pictures of the same graph. Each computer has been labeled by the initials of its owner.
Fig. 13.1 Computers (vertices) are indicated by dots (•) with labels. The connections (edges) are indicated by lines. When lines cross, they should be thought of as cables that lie on top of each other — not as cables that are joined. In our example, the vertices are the computers and a pair of computers is in E if and only if they are connected.
Page: 158
The notation Pk (V) stands for the set of all k-element subsets of the set V . Based on the previous example, we have Definition 1
A simple graph G is a pair G = (V,E) where • V is a finite set, called the vertices, points, or nodes of G, and • E is a subset of P2 (V ) (i.e., a set E of two-element subsets of V ), called the edges of G.
.c om
Vertices u and v are said to be adjacent if there is an edge e={u, v}. In such a case, u and v are called the end points of e and e is said to be connecting u and v.
w
or
ld
fo
ru
m
Example 2 (Routes between cities) Imagine four cities named A, B, C and D. Between these cities there are various routes of travel, denoted by a, b, c, d, e, f and g. Here is picture of this situation:
w w
w .jn
tu
Fig. 13.2 Looking at this picture, we see that there are three routes between cities B and C. These routes are named d, e and f. Our picture is intended to give us only information about the interconnections between cities. It leaves out many aspects of the situation that might be of interest to a traveler. For example, the nature of these routes (rough road, freeway, rail, etc.) is not portrayed. Furthermore, unlike a typical map, no claim is made that the picture represents in any way the distances between the cities or their geographical placement relative to each other. The object shown in this picture is called a graph. Following our previous example 1, one is tempted to list the pairs of cities that are connected; in other words, to extract a simple graph from the information. Unfortunately, this does not describe the problem adequately because there can be more than one route connecting a pair of cities; e.g., d, e and f connecting cities B and C in the figure 13.2. How can we deal with this? Here is a precise definition of a graph of the type required to handle this type of problem. Definition 2 (Graph) A graph is a triple G = (V,E, φ) where • V is a finite set, called the vertices of G, • E is a finite set, called the edges of G, and • φ is a function with domain E and codomain P2 (V ).
Page: 159
In the pictorial representation of the cities graph, G = (V, E, φ) where V = {A,B,C,D},
E = {a, b, c, d, e, f, g}
and φ=
.c om
Definition 2 tells us that to specify a graph G it is necessary to specify the sets V and E and the function φ. We have just specified V and φ in set theoretic terms. The picture of the cities graph specifies the same V and φ in pictorial terms. The set V is represented clearly by dots (•), each of which has a city name adjacent to it. Similarly, the set E is also represented clearly. The function φ is determined from the picture by comparing the name attached to a route with the two cities connected by that route. Thus, the route name d is attached to the route with endpoints B and C. This means that φ(d) = {B,C}.
fo
ru
m
The function φ is sometimes called the incidence function of the graph. The two elements of φ(x) = {u, v}, for any x Î E, are called the vertices of the edge x, and we say u and v are joined by x. We also say that u and v are adjacent vertices and that u is adjacent to v or , equivalently, v is adjacent to u. For any v ÎV, if v is a vertex of an edge x then we say x is incident on v. Likewise, we say v is a member of x, v is on x, or v is in x. Of course, v is a member of x actually means v is a member of φ(x).
w .jn
13.3 Directed Graph
tu
w
or
ld
Simple graphs are graphs: We can easily reconcile our two definitions by realizing that a simple graph is a special case of a graph. Let G = (V,E) be a simple graph. Define φ:E®E to be the identity map; i.e., φ (e) = e for all e Î E. The graph G’ = (V,E, φ) is essentially the same as G. There is one subtle difference in the pictures: The edges of G are unlabeled but each edge of G’ is labeled by a set consisting of the two vertices at its ends.
w w
A graph is said to be the directed graph if it required to associate a direction with each edge of the graph, that is, edges are ordered pairs of distinct vertices. Before we’ll begin to define a directed graph let us see the following example. Example 3 (Flow of commodities) Look again at Example 2. Imagine now that the symbols a, b, c, d, e, f and g, instead of standing for route names, stand for commodities (bread, computers, etc.) that are produced in one town and shipped to another town. In order to get a picture of the flow of commodities, we need to know the directions in which they are shipped. This information is provided by picture below: In set-theoretic terms, the information needed to construct the picture 13.3 can be specified by giving a pair D = (V,E, φ) where φ is a function. The domain of the function φ is E = {a, b, c, d, e, f, g} and the codomain is V × V. Specifically, φ=
Page: 160
.c om
Fig. 13.3 The structure specified by this information is an example of a directed graph, which we now define.
ru
m
Definition 3 (Directed graph). A directed graph (or digraph) is a triple D = (V, E, φ) where V and E are finite sets and φ is a function with domain E and codomain V × V. We call E the set of edges of the digraph D and call V the set of vertices of D.
or
ld
fo
Just as with graphs, we can define a notion of a simple digraph. A simple digraph is a pair D = (V,E), where V is a set, the vertex set, and E Í V × V is the edge set. Just as with simple graphs and graphs, simple digraphs are a special case of digraphs in which φ is the identity function on E; that is, φ(e) = e for all e Î E.
w
There is a correspondence between simple graphs and simple digraphs that is fairly common in applications of graph theory.
w w
w .jn
tu
Here is a picture (Fig. 13.4) of a simple graph and its corresponding digraph:
Fig. 13.4 Each, edge that is not a loop in the simple graph is replaced by two edges “in opposite directions” in the corresponding simple digraph. A loop is replaced by a directed loop (e.g.,{A} is replaced by (A,A)). Indegree The indegree of a vertex v in a directed graph is the number of edges ending at it (or) the indegree of a vertex v is the number of edges that have v as the head. It is denoted as indeg(v).
Page: 161
Outdegree The outdegree of a vertex v in a directed graph is the number of edges beginning from it or the outdegree of v is the number of arcs that have v as the tail. It is denoted as outdeg(v). Degree of a vertex
.c om
The degree of a vertex in a graph is the number of edges that touch it and is denoted as deg(v) where v is the vertex. Pendant (or end) vertex
A vertex is said to be pendant (or end) if its degree is one.
m
Isolated vertex
ru
A vertex is said to be isolated if its degree is zero.
fo
Even Vertex and Odd Vertex
w
13.4 Path, trail and walk
or
ld
A vertex is said to even or odd according as its degree is an even or an odd number.
w .jn
tu
A basic method for studying graphs and digraphs is to study substructures of these objects and their properties. One of the most important of these substructures is called a path. Definition 4 (Path, trail, walk and vertex sequence) Let G = (V,E, φ) be a graph.
w w
Let e 1 , e 2 ,…, e n-1 be a sequence of elements of E (edges of G) for which there is a sequence a1 , a2 , . . . , an of distinct elements of V (vertices of G) such that φ(ei) = {ai, ai+1} for i = 1, 2, . . . , n – 1. The sequence of edges e1 , e2 , . . ., en-1 is called a path in G. The sequence of vertices a1 , a2 , . . . , an is called the vertex sequence of the path. (Note that since the vertices are distinct, so are the edges.) If we require that e1 , e2 , . . ., en-1 be distinct, but not that a1 , a2 , . . . , an be distinct, the sequence of edges is called a trail. If we do not even require that the edges be distinct, it is called a walk. If G = (V,E, φ) is a directed graph, then φ(ei) = {ai, ai+1} is replaced by φ(ei ) = (ai, ai+1) in the above definition to obtain a directed path, trail, and walk respectively.
Page: 162
Note that the definition of a path requires that it does not intersect itself (i.e., have repeated vertices), while a trail may intersect itself. Although a trail may intersect itself, it may not have repeated edges, but a walk may. If P = (e1 , e2 ,…, en-1 ) is a path in G = (V,E, φ) with vertex sequence a1 , a2 , . . . , an then we say that P is a path from a1 to an . Similarly for a trail or a walk.
.c om
In the graph of Example 2 (Fig. 13.2), the sequence c, d, g is a path with vertex sequence A,C,B,D.If the graph is of the form G = (V,E) with E Í P2 (V ), then the vertex sequence alone specifies the sequence of edges and hence the path. Thus, Example 1(Fig. 13.1), the vertex sequence MN, SM, SE, TM specifies the path {MN, SM}, {SM, SE}, {SE, TM}. Similarly for digraphs. Consider the graph of Example 3 (Fig. 13.3). The edge sequence P = (g, e, c) is a directed path with vertex sequence (D,B,C,A). The edge sequence P = (g, e, c, b, a) is a directed trail, but not a directed path. The edge sequence P = (d, e, d) is a directed walk, but not a directed trail.
ru
m
Note that every path is a trail and every trail is a walk, but not conversely. However, we can show that, if there is a walk between two vertices, then there is a path. This rather obvious result can be useful in proving theorems, so we state it as a theorem.
w
or
ld
The following are equivalent: (a) There is a walk from u to v. (b) There is a trail from u to v. (c) There is a path from u to v.
fo
Theorem 2 (Walk implies path) Suppose u ¹v are vertices in the graph G = (V,E, φ).
w .jn
tu
Furthermore, given a walk from u to v, there is a path from u to v all of whose edges are in the walk.
w w
The length l of a walk is the number of edges that it uses. For an open walk, l = n–1, where n is the number of vertices visited (a vertex is counted each time it is visited). For a closed walk, l = n (the start/end vertex is listed twice, but is not counted twice).
Page: 163
Closed and open walk
m
.c om
A walk is closed if its first and last vertices are the same, and open if they are different.
ru
Fig. 13.5 Eulerian path
ld
fo
A path which passes through every edge (once and only once). If the starting and ending nodes are the same, it is an Euler cycle or an Euler circuit. If the starting and ending nodes are different, it is an Euler trail.
or
Hamiltonian path
w
A path which passes through every node once and only once. If the starting and ending nodes are adjacent, it is a Hamiltonian cycle.
tu
Finite graph
w .jn
A finite graph has a finite number of vertices and a finite number of edges. Observe that a graph with a finite number of vertices must automatically have a finite number of edges and so must be finite.
w w
Trivial graph
A finite graph with one vertex and no edges, i.e., a single point, is called the trivial graph. Order and Size of the graph If G(V,E) is finite then V(G) denotes the number of vertices in G and is called the order of G. If G(V,E) is finite then E(G) denotes the number of edges in G and is called the size of G.
Page: 164
Cycles or Loops
.c om
A loop is an edge that connects a vertex to itself. If a graph contains a cycle, it is cyclic; otherwise it is acyclic. A directed acyclic graph is called a dag from its acronym.
w w
w .jn
tu
w
or
ld
fo
ru
m
In the above graph, edge e6 forms a loop.
Page: 165
13.5 Applications of graphs Applications of graph theory are primarily, but not exclusively, concerned with labeled graphs and various specializations of these.
.c om
Structures that can be represented as graphs are ubiquitous, and many problems of practical interest can be represented by graphs. The link structure of a website could be represented by a directed graph: the vertices are the web pages available at the website and a directed edge from page A to page B exists if and only if A contains a link to B. A similar approach can be taken to problems in travel, biology, computer chip design, and many other fields. The development of algorithms to handle graphs is therefore of major interest in computer science.
ru
m
A graph structure can be extended by assigning a weight to each edge of the graph. Graphs with weights, or weighted graph, are used to represent structures in which pairwise connections have some numerical values. For example if a graph represents a road network, the weights could represent the length of each road. A digraph with weighted edges in the context of graph theory is called a network.
w .jn
tu
w
or
ld
fo
Networks have many uses in the practical side of graph theory, network analysis (for example, to model and analyze traffic networks). Within network analysis, the definition of the term "network" varies, and may often refer to a simple graph. Many applications of graph theory exist in the form of network analysis. These split broadly into two categories. Firstly, analysis to determine structural properties of a network, such as the distribution of vertex degrees and the diameter of the graph. A vast number of graph measures exist, and the production of useful ones for various domains remains an active area of research. Secondly, analysis to find a measurable quantity within the network, for example, for a transportation network, the level of vehicular flow within any portion of it.
w w
Graph theory is also used to study molecules in chemistry and physics. In condenced matter physics, the three dimensional structure of complicated simulated atomic structures can be studied quantitatively by gathering statistics on graph-theoretic properties related to the topology of the atoms. For example, Franzblau's shortest-path (SP) rings. In chemistry a graph makes a natural model for a molecule, where vertices represent atoms and edges bonds. This approach is especially used in computer processing of molecular structures, ranging from chemical editors to database searching. Graph theory is also widely used in socialogy as a way, for example, to measure actorâ&#x20AC;&#x2122;s prestige or to explore diffusion mechanisms, notably through the use of social network analysis software.
Page: 166
13.6 Let Us Sum Up graph, network An abstraction of relationships among objects. Graphs consist exclusively of nodes and edges. All characteristics of a system are either eliminated or subsumed into these elements. diagram, drawing A visible rendering of the abstract concept of a graph. point, node, vertex
.c om
Objects ("things") represented in a graph. These are almost always rendered as round dots. edge, link, arc
Relationships represented in a graph. These are always rendered as straight or curved lines. The term "arc" may be misleading.
m
undirected
ru
A graph in which each edge symbolizes an unordered, transitive relationship between two nodes. Such edges are rendered as plain lines or arcs.
fo
directed, digraph
or
ld
A graph in which each edge symbolizes an ordered, non-transitive relationship between two nodes. Such edges are rendered with an arrowhead at one end of a line or arc.
w
unweighted
w .jn
weighted (edge)
tu
A graph in which all the relationships symbolized by edges are considered equivalent. Such edges are rendered as plain lines or arcs. Weighted edges symbolize relationships between nodes which are considered to have some value, for instance, distance or lag time. Such edges are usually annotated by a number or letter placed beside the edge.
w w
weighted (vertex)
Weighted nodes have some value different from their identification. adjacent
Two edges are adjacent if they have a node in common; two nodes are adjacent if they have an edge in common. degree The number of edges which connect a node. regular A graph in which each node has the same degree. complete
Page: 167
A graph in which every node is linked to every other node. For a complete digraph, this means one link in either direction. route A sequence of edges and nodes from one node to another. Any given edge or node might be used more than once. path A route that does not pass any edge more than once. If the path does not pass any node more than once, it is a simple path. connected
.c om
If some route exists from every node to every other, the graph is connected. Note that some graphs are not connected. A diagram of an unconnected graph may look like two or more unrelated diagrams, but all the nodes and edges shown are considered as one graph.
m
loop, cycle
ru
A path which ends at the node where it began. A connected graph with no loops.
ld
Eulerian path
fo
tree
or
A path which passes through every edge (once and only once). If the starting and ending nodes are the same, it is an Euler cycle or an Euler circuit. If the starting and ending nodes are different, it is an Euler trail.
w
Hamiltonian path
w w
w .jn
tu
A path which passes through every node once and only once. If the starting and ending nodes are adjacent, it is a Hamiltonian cycle.
Page: 168
13.7 Lesson End Activities Review Questions
(b, b) (e, d, c, b) (a, d, c, d, e) ( d. c. b. e, d) (b, c, d, a, b, e, d, c, b) (a, d, c, h, e) (b, c, d, e, b, b) (d) (d, c, b)
w w
1) 2) 3) 4) 5) 6) 7) 8) 9)
w .jn
tu
w
or
ld
fo
ru
m
.c om
1. What is a path? 2. What is a simple path? 3. Give an example of a path that is not a simple path. 4. What is a cycle? 5. What is a simple cycle? 6. Give an example of a cycle that is not a simple cycle. 7. Define connected graph. 8. Give an example of a connected graph. 9. Give an example of a graph that is not connected. 10. What is a component of a graph? 11. Give an example of a component of a graph. 12. It a graph is connected, how many components does it have? 13. Define degree of vertex v. 14. What is the relationship between the sum of the degrees of the vertices in a graph and the number of edges in the graph. 15. In any graph, must the number of vertices of odd degree be even? 16. State a necessary and sufficient condition that a graph have a path with no repeated edges from v to w (v ยน w) containing all the edges and vertices. 17. If a graph G contains a cycle from v to v. must G contain a simple cycle from v to v? Exercises In Exercises 1-9, tell whether the given path in the graph is (a) A simple path (b) A cycle (c) A simple cycle
Page: 169
Unit – V Lesson 14 Subgraphs, Types of Graphs and Graph Representations. Contents
m
.c om
14.0 Aims and Objectives 14.1 Introduction 14.2 Subgraphs 14.3 Types of Graphs 14.4 Representation of graphs in computer memory 14.4.1 List structures 14.4.2 Matrix structures 14.5 Chapter Summary 14.6 Lesson End Activities 14.7 References
ru
14.0 Aims and Objectives
fo
The main aim and objective of this chapter is know about the subgraphs, various
ld
types of graphs and the different ways of representing the graphs in a computer.
tu
w
Construct a subgraph from a graph. Know about the various types of graphs Know about the ways of representing the graphs in a computer memory.
w .jn
· · ·
or
After reading this unit, you should be able to
14.1 Introduction
In this lesson, we first discuss about the subgraphs. A new graph can obtained by
w w
selecting certain edges and vertices from a given graph with certain restrictions. The graphs so obtained are called subgraphs. Next we discuss about the types of graphs. We conclude the lesson by discussing the various methods available for representing a graph in computers.
Page: 170
14.2 Subgraphs A subgraph G’ of a graph G is obtained by selecting certain edges and vertices from G subject to the restriction that if we select an edge e in G that is incident on vertices v and w, we must include v and w in G’. The restriction is to ensure that G’ is actually a graph. The formal definition follows. Definition 1 (Subgraph) Let G = (V,E,φ) be a graph. A graph G' = (V',E',φ') is a subgraph of G if V' Í V , E' Í E, and φ' is the restriction of φ to E'.
.c om
As we have noted, the fact that G' is itself a graph means that φ(x) Î P2 (V’ ) for each X Î E' and, in fact, the codomain of φ' must be P2 (V’). If G is a graph with loops, the codomain of φ' must be P2 (V') È P 1 (V'). This definition works equally well if G is a digraph. In that case, the codomain of φ' must be V × V.
ru
m
Example 1 (Subgraph — key information) For the graph G = (V,E,φ) below, let G'=(V',E', φ') be defined by V' = {A,B,C}, E' = {a, b, c, f}, and by φ' being the restriction of φ to E' with codomain P2 (V'). Notice that φ' is determined completely from knowing V', E' and φ. Thus, to specify a subgraph G', the key information is V' and E'.
ld
fo
As another example from the same graph, we let V' = V and E' = {a, b, c, f}. In this case, the vertex D is not a member of any edge of the subgraph. Such a vertex is called an isolated vertex of G'.
w w
w .jn
tu
w
or
One way of specifying a subgraph is to give a set of edges E' Í E and take V' to be the set of all vertices on some edge of E'. In other words, V' is the union of the sets φ(x) over all x. E'. Such a subgraph is called the subgraph induced by the edge set E' or the edge induced subgraph of E'. The first subgraph of this example is the subgraph induced by E' = {a, b, c, f}.
Fig. 14.1 Likewise, given a set V' Í V, we can take E' to be the set of all edges x Î E such that φ(x) Í V'. The resulting subgraph is called the subgraph induced by V ' or the vertex induced subgraph of V'. Referring to the picture again, the edges of the subgraph induced by V' = {C,B}, are E' = {d, e, f}. Look again at the above graph. In particular, consider the path c, a with vertex sequence C,A,B. Notice that the edge d has φ(d) = {C,B}. The
Page: 171
subgraph G' = (V ',E', φ'), where V ' = {C,A,B} and E' = {c, a, d} is called a cycle of G. In general, whenever there is a path in G, say e1 , . . . , en-1 with vertex sequence a1 , . . . , an , and an edge x with φ(x) = {a1 , an }, then the subgraph induced by the edges e1 , . . . , en1 , x is called a cycle of G. Parallel edges like a and b in the preceding figure induce a cycle. A loop also induces a cycle. The formal definition of a cycle is:
.c om
Definition 2 (Circuit and Cycle) Let G = (V,E, φ) be a graph and let e1 , . . . , en be a trail with vertex sequence a1 , . . . , an , a1 . (It returns to its starting point.) The subgraph G' of G induced by the set of edges {e1, . . . , en} is called a circuit of G. The length of the circuit is n. • If the only repeated vertices on the trail are a1 (the start and end), then the circuit is called a simple circuit or cycle.
ru
m
• If “trail” is replaced by directed trail, we obtain a directed circuit and a directed cycle.
or
ld
fo
In our definitions, a path is a sequence of edges but a cycle is a subgraph of G. In actual practice, people often think of a cycle as a path, except that it starts and ends at the same vertex. This sloppiness rarely causes trouble, but can lead to problems in formal proofs. Cycles are closely related to the existence of multiple paths between vertices. 14.3 Types of Graphs
tu
w
Null Graph
w .jn
The simplest type of graph is a null graph. It consists of a non-empty finite set of elements called vertices. Complete Graph
w w
A complete graph is a graph where every pair of distinct vertices are adjacent i.e., there is an edge between every pair of distinct vertices. A complete graph on n vertices is denoted by Kn (or sometimes by K(n) ). So, for example, figure 14.2 is the graph K5 .
Fig. 14.2, The Graph K5
Page: 172
Regular Graph A graph in which every vertex has the same degree is called a regular graph. If every vertex has degree r then we say the graph is regular of degree r. All null graphs are regular of degree zero. Weighted Graph
.c om
A graph with numbers on the edges is called a weighted graph. If edge e is labeled k, we say that the weight of edge e is k. In a weighted graph, the length of a path is the sum of the weights of the edges in the path. Bipartite Graph
m
A graph G=(V, E) is bipartite if there exist subsets V1 and V2 (either possibly empty) of V such that V1 Ç V2 = Æ, V1 È V2 = V and each edge in E is incident on one vertex in V1 and one vertex in V2.
ru
Example
w .jn
tu
w
or
ld
fo
The graph in fig. is bipartite since if we let V1 ={v 1 ,v2 ,v3 } and V2 ={v 4 ,v5 }, Each edge is incident on one vertex in V1 and one vertex in V2.
Fig. 14.3
Infinite Graph
w w
A graph is infinite if it has infinitely many vertices or edges or both; otherwise the graph is finite. An infinite graph where every vertex has finite degree is called locally finite. When stated without any qualification, a graph is usually assumed to be finite.
Page: 173
14.4 Representation of graphs in computer memory There are different ways to store graphs in a computer system. The data structure used depends on both the graph structure and the algorithm used for manipulating the graph. Theoretically one can distinguish between list and matrix structures but in concrete applications the best structure is often a combination of both. List structures are often preferred for sparse graphs as they have smaller memory requirements. Matrix structures on the other hand provide faster access for some applications but can consume huge amounts of memory.
.c om
14.4.1 List structures Incidence List
The edges are represented by an array containing pairs (ordered if directed) of vertices (that the edge connects) and possibly weight and other data.
m
Adjacency List
fo
ru
Much like the incidence list, each vertex has a list of which vertices it is adjacent to. This causes redundancy in an undirected graph: for example, if vertices A and B are adjacent, A's adjacency list contains B, while B's list contains A. Adjacency queries are faster, at the cost of extra storage space.
tu
w
or
ld
Example
w w
w .jn
Fig. 14.4 The graph pictured above (Fig. 14.4) has this adjacency list representation: a b c
adjacent to adjacent to adjacent to
b,c a,c a,b
14.4.2 Matrix structures Incidence matrix The graph is represented by a matrix of E (edges) by V (vertices), where [edge, vertex] contains the edge's data (simplest case: 1 - connected, 0 - not connected).
Adjacency matrix
Page: 174
There is an n by n matrix, where n is the number of vertices in the graph. If there is an edge from some vertex ‘x’ to some vertex ‘y’, then the element Mx,y is 1, otherwise it is 0. This makes it easier to find subgraphs, and to reverse graphs if needed. Examples Here is a simple example of a labeled graph and its adjacency matrix. The convention followed here is that an adjacent edge counts 1 in the matrix for an undirected graph. Adjacency matrix
fo
ru
m
.c om
Labeled Graph
ld
The adjacency matrix of a complete graph is all 1's except for 0's on the diagonal.
or
Laplacian matrix or Kirchhoff matrix or Admittance matrix
tu
Distance matrix
w
Is defined as degree matrix minus adjacency matrix and thus contains adjacency information and degree information about the vertices.
w w
w .jn
A symmetric n by n matrix an element Mx,y of which is the length of shortest path between x and y; if there is no such path Mx,y = infinity. It can be derived from powers of the Adjacency matrix.
Page: 175
14.5 Chapter Summary
the
ru
of
vertices
and
edges
whose vertices and edges of a given graph
w w
w .jn
tu
w
or
ld
fo
A graph G’ form subsets
m
.c om
Subgraph
G
.
If
G’
a
subgraph
of
w w
G
w .jn
tu
w
or
ld
fo
ru
m
is
.c om
Page: 176
,
then
G
said
to
be
a
supergraph
of
Gâ&#x20AC;&#x2122;
w .jn
tu
w
or
ld
fo
ru
m
is
.c om
Page: 177
.
w w
Null Graph
It consists of a non-empty finite set of elements called vertices.
Complete Graph A complete graph is a graph where every pair of distinct vertices are adjacent i.e., there is an edge between every pair of distinct vertices. A complete graph on n vertices is denoted by Kn (or sometimes by K(n) ). Regular Graph A graph in which every vertex has the same degree is called a regular graph.
Page: 178
Weighted Graph A graph with numbers on the edges is called a weighted graph. In a weighted graph, the length of a path is the sum of the weights of the edges in the path. Bipartite Graph A graph G=(V, E) is bipartite if there exist subsets V1 and V2 (either possibly empty) of V such that V1 Ç V2 = Æ, V1 È V2 = V and each edge in E is incident on one vertex in V1 and one vertex in V2.
.c om
Infinite Graph
m
A graph is infinite if it has infinitely many vertices or edges or both; otherwise the graph is finite. List structures Ø Incidence List
fo
ru
The edges are represented by an array containing pairs (ordered if directed) of vertices (that the edge connects) and possibly weight and other data. Ø Adjacency List
w
Ø Incidence matrix
or
ld
Much like the incidence list, each vertex has a list of which vertices it is adjacent to. Matrix structures
tu
The graph is represented by a matrix of E (edges) by V (vertices), where [edge, vertex] contains the edge's data (simplest case: 1 - connected, 0 - not connected).
w .jn
Ø Adjacency matrix
w w
There is an n by n matrix, where n is the number of vertices in the graph. If there is an edge from some vertex ‘x’ to some vertex ‘y’, then the element Mx,y is 1, otherwise it is 0. This makes it easier to find subgraphs, and to reverse graphs if needed. The adjacency matrix of a complete graph is all 1's except for 0's on the diagonal. Ø Laplacian matrix or Kirchhoff matrix or Admittance matrix Is defined as degree matrix minus adjacency matrix and thus contains adjacency information and degree information about the vertices. Ø Distance matrix A symmetric n by n matrix an element Mx,y of which is the length of shortest path between x and y; if there is no such path Mx,y = infinity. It can be derived from powers of the Adjacency matrix.
Page: 179
14.6 Lesson End Activities Review Questions 1. What is a subgraph? 2. Give an example of a subgraph.
w
or
ld
fo
ru
m
.c om
In Exercises 1-5, write the adjacency matrix of each graph.
w .jn
tu
4. The complete graph on five vertices K5 5. The complete bipartite graph K2.3 In Exercises 6-8, write the incidence matrix of each graph.
w w
6. The graph of Exercise 1 7. The graph of Exercise 2 8. The graph of Exercise 3 In Exercises 13-16, draw the graph represented by each adjacency matrix.
Page: 180
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
17) Write the adjacency matrices of the components of the graphs given by the adjacency matrices of Exercises 13-16.
Page: 181
.c om
In Exercises 24 and 25, draw the graphs represented by the incidence matrices.
w w
w .jn
tu
w
or
ld
fo
ru
m
1. What is an adjacency matrix? 2. If A is the adjacency matrix of a simple graph, what are the values of the entries in An ? 3. What is an incidence matrix?
Page: 182
14.7 References J K Sharma, ”Discrete Mathematics”
2)
Kenneth H.Rosen, “Discrete Mathematics and its Applications”
3)
Seymour Lipschutz and Marc Lipson, “Discrete Mathematics”
4)
Charles D.Miller and Others, “Mathematical Ideas”
5)
Wikipedia, the free encyclopedia.
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
1)
Page: 183
Unit V Lesson – 15 Trees
m
ld
fo
ru
15.0 Aims and objectives 15.1 Introduction 15.2 Tree 15.2.1 Rooted tree 15.2.2 Other trees 15.2.3 Height of the Tree 15.2.4 Facts and Enumeration 15.3 Binary tree 15.4 Tree traversal 15.4.1 Traversal methods 15.4.2 Sample implementations 15.5 Computer Representation of Trees 15.5.1 Computer Representation of General Trees 15.5.2 Computer Representation of Binary Trees 15.6 Let Us Sum Up 15.7 Lesson End Activities 15.8 References
.c om
Contents
or
15.0 Aims and objectives
w
The main aim and objective of this lesson is know about the trees, its properties,
tu
binary trees, tree traversing and representation of trees in computer.
Construct a tree. Perform inorder, preorder and postorder tree traversing Know about the ways of representing the trees in a computer memory.
w w
· · ·
w .jn
After reading this unit, you should be able to
15.1 Introduction Trees play an important role in a variety of algorithms. Trees are widely used in computer science data structures such as binary search trees, heaps, tries, etc. In this section, we define trees precisely and look at some of their properties.
Page: 184
15.2 Tree In graph theory, a tree is a graph in which any two vertices are connected by exactly one path. Alternatively, any connected graph with no cycles is a tree. A forest is a disjoint union of trees. Definition (Tree) If G is a connected graph without any cycles then G is called a tree. (If |V| = 1, then G is connected and hence is a tree.) A tree is also called a free tree.
w
or
ld
fo
ru
m
.c om
The graph in fig. 15.1 is connected but is not a tree. It has many cycles, including ({A, B, C}, {a, e, c}). The subgraph of this graph induced by the edges {a, e, g} is a tree. If G is a tree, then φ is an injection since if e1 ¹ e2 and φ(e1 ) = φ(e2 ), then {e1 , e2 } induces a cycle. In other words, any graph with parallel edges is not as tree. Likewise, a loop is a cycle, so a tree has no loops. Thus, we can think of a tree as a simple graph when we are not interested in names of the edges.
w .jn
tu
Since the notion of a tree is so important, it will be useful to have some equivalent definitions of a tree. We state them as a theorem Theorem 1 (Alternative definitions of a tree) If G is a connected graph, the following are equivalent.
w w
(a) G is a tree. (b) G has no cycles. (c) For every pair of vertices u ¹ v in G, there is exactly one path from u to v. (d) Removing any edge from G gives a graph which is not connected. (e) The number of vertices of G is one more than the number of edges of G.
A directed tree is a directed graph which would be a tree if the directions on the edges were ignored.
Page: 185
Example 1:
m
.c om
The example tree shown in fig. 15.2 has 6 vertices and 6 - 1 = 5 edges. The unique simple path connecting the vertices 2 and 6 is 2-4-5-6.
ru
15.2.1 Rooted tree
ld
fo
A tree is called a rooted tree if one vertex has been designated the root, in which case the edges have a natural orientation, towards or away from the root.
or
Definitions for rooted trees
A directed edge refers to the link from the parent to the child (the arrows in the picture of the tree).
·
The root node of a tree is the node with no parents. There is at most one root node in a rooted tree.
·
A leaf is a node that has no children.
·
The depth of a node n is the length of the path from the root to the node. The set of all nodes at a given depth is sometimes called a level of the tree. The root node is at depth zero.
w w
w .jn
tu
w
·
·
The height of a tree is the depth of its furthest leaf. A tree with only a root node has a height of zero.
·
Siblings are nodes that share the same parent node.
·
If a path exists from node p to node q, where node p is closer to the root node than q, then p is an ancestor of q and q is a descendant of p.
·
The size of a node is the number of descendants it has including itself.
Page: 186
Rooted trees, often with additional structure such as ordering of the neighbors at each vertex, are a key data structure in computer science. In a context where trees are supposed to have a root, a tree without any designated root is called a free tree. A polytree has at most one undirected path between any two vertices. In other words, a polytree is a directed acyclic graph (DAG) for which there is no undirected cycles either. 15.2.2 Other trees
.c om
A labeled tree is a tree in which each vertex is given a unique label. The vertices of a labeled tree on n vertices are typically given the labels 1, 2, â&#x20AC;Ś, n. An irreducible (or series-reduced) tree is a tree in which there is no vertex of degree 2. An ordered tree is a tree for which an ordering is specified for the children of each node.
m
15.2.3 Height of the Tree
w .jn
tu
w
or
ld
fo
ru
The root of the tree has level 0, and the level of any other vertex in the tree is one more than the level of its parent. In Fig.15.3, vertices v11 , v12 , v21 , v22 , v31 and v32 are at level. The depth (or height) of a tree is the maximum level of any leaf in the tree. This equals the length of the longest path from the root of any leaf. The tree in Fig.15.3 is of height 2.
w w
Theorem 2 There is unique path between each pair of vertices in a tree. Theorem 3 A tree with n vertices has n - 1 edges.
Page: 187
15.2.4 Facts and Enumeration Ø Facts
·
·
Every tree is a bipartite graph. Every tree with only countably many vertices is a planar graph. Every connected graph G admits a spanning tree, which is a tree that contains every vertex of G and whose edges are edges of G. Every connected graph even admits a normal spanning tree. Every non-null tree has at least one leaf, or vertex of degree 1 (If it has a vertex, it has a leaf).
.c om
·
Ø Enumeration
w w
w .jn
tu
w
or
ld
fo
ru
m
Given n labeled vertices, there are nn- 2 different ways to connect them to make a tree. This result is called Cayley’s formula. It can be proved by first showing that the number of trees with n vertices of degree d1 ,d2 ,...,dn is the multinomial coefficient
Page: 188
15.3 Binary tree In computer science, a binary tree is a tree data structure in which each node has at most two children. Typically the child nodes are called left and right. One common use of binary trees is binary search tree; another is binary heaps. Types of binary trees A rooted binary tree is a rooted tree in which every node has at most two children.
·
A full binary tree, or proper binary tree, is a tree in which every node has zero or two children.
·
A perfect binary tree (sometimes complete binary tree) is a full binary tree in which all leaves are at the same depth.
·
A complete binary tree is a tree with n levels, where for each level d <= n - 1, the number of existing nodes at level d is equal to 2d. This means all possible nodes exist at these levels. An additional requirement for a complete binary tree is that for the nth level, while every node does not have to exist, the nodes that do exist must fill from left to right. (This is ambiguous with perfect binary tree.)
·
A balanced binary tree is where the depth of all the leaves differs by at most 1.
·
A rooted complete binary tree can be identified with a free magma.
·
An almost complete binary tree is a tree in which each node that has a right child also has a left child. Having a left child does not require a node to have a right child. Stated alternately, an almost complete binary tree is a tree where for a right child, there is always a left child, but for a left child there may not be a right child.
·
A degenerate tree is a tree where for each parent node, there is only one associated child node. This means that in a performance measurement, the tree will behave like a linked list data structure.
·
The number of nodes n in a complete binary tree can be found using this formula: n = 2h + 1 - 1 where h is the height of the tree.
·
The number of leaf nodes n in a complete binary tree can be found using this formula: n = 2h where h is the height of the tree.
w w
w .jn
tu
w
or
ld
fo
ru
m
.c om
·
Page: 189
15.4 Tree traversal In computer science, tree-traversal refers to the process of visiting each node in a tree data structure, exactly once, in a systematic way. Such traversals are classified by the order in which the nodes are visited. The following methods or algorithms are described for a binary tree, but they may be generalized to other trees as well. 15.4.1 Traversal methods
m
.c om
Compared to linear data structures like linked lists and one dimensional arrays, which have only one logical means of traversal, tree structures can be traversed in many different ways. Starting at the root of a binary tree, there are three main steps that can be performed and the order in which they are performed define the traversal type. These steps are: Performing an action on the current node(referred to as â&#x20AC;&#x153;visitingâ&#x20AC;? the node); or repeating the process with the subtrees rooted at our left and right children. Thus the process is most easily described through recursion.
fo
ru
To traverse a non-empty binary tree T with root R in preorder, perform the following operations:
or
ld
1. Visit the root. 2. Traverse the left subtree of R in preorder. 3. Traverse the right subtree of R in preorder.
tu
w
To traverse a non-empty binary tree T with root R in inorder, perform the following operations:
w .jn
1. Traverse the left subtree of R in inorder. 2. Visit the root. 3. Traverse the right subtree of R in inorder.
w w
To traverse a non-empty binary tree T with root R in postorder, perform the following operations: 1. Traverse the left subtree of R in postorder. 2. Traverse the right subtree of R in postorder. 3. Visit the root. (This is also called Depth-first traversal.) Finally, trees can also be traversed in level-order, where we visit every node on a level before going to a lower level. This is also called Breadth- first traversal. Traversal where levels are visited successively, starting with level 0 (the root node), and nodes are visited from left to right on each level.
Page: 190
In this binary search tree, Preorder traversal sequence: F, B, A, D, C, E, G, I, H
·
Inorder traversal sequence: A, B, C, D, E, F, G, H, I
Note that the inorder traversal of a binary search tree yields an ordered list
ld
·
fo
ru
m
·
.c om
Example 2
Postorder traversal sequence: A, C, E, D, B, H, I, G, F
·
Level-order traversal sequence: F, B, G, A, D, I, C, E, H
w
or
·
tu
15.4.2 Sample implementations
w .jn
preorder(node) print node.value if node.left null then preorder(node.left) if node.right null then preorder(node.right)
w w
inorder(node) if node.left null then inorder(node.left) print node.value if node.right null then inorder(node.right) postorder(node) if node.left null then postorder(node.left) if node.right null then postorder(node.right) print node.value All three sample implementations will require stack space proportional to the height of the tree. In a poorly balanced tree, this can be quite considerable.
Page: 191
15.5 Computer Representation of trees 15.5.1 Computer Representation of General Trees Suppose T is a general tree. The tree T will be maintained in memory by means of a linked representation which uses three parallel arrays INFO, CHILD(or DOWN), and SIBL(or HORZ), and a pointer variable ROOT as follows. First of all, each node N of T will correspond to a location K such that: INFO[K] contains the data at node N.
(2)
CHILD[K] contains the location of the first child of N. The condition CHILD[K]=NULL indicates that N has no children.
(3)
SIBL[K] contains the location of the next sibling of N. The condition SIBL[K]=NULL indicates that N is last child of its parent.
m
.c om
(1)
fo
ru
Furthermore, ROOT will contain the location of the root R of T. Although this representation may seem artificial, it has the important advantage that each node N of T, regardless of the number of children of N, will contain exactly three fields.
or
ld
The above representation may be extended to represent a forest F consisting of trees T1 , T2 ,â&#x20AC;Ś, Tm by assuming the roots of the tree are siblings. In such a case, ROOT will contain the location of the root R1 of the tree T1 ; or when F is empty, ROOT will equal NULL.
w
15.5.2 Computer Representation of Binary Trees
w w
w .jn
tu
Binary trees can be constructed from programming language primitives in several ways. In a language with records and references, binary trees are typically constructed by having a tree node structure, which contains some data and references to its left child and its right child. Sometimes it also contains a reference to its unique parent. If a node has fewer than two children, some of the child pointers may be set to a special null value, or to a special sentinel node. Binary trees can also be stored as an implicit data structure in arrays, and if the tree is a complete binary tree, this method wastes no space. In this compact arrangement, if a node has an index i, its children are found at indices 2i + 1 and 2i + 2, while its parent
.c om
Page: 192
w w
w .jn
tu
w
or
ld
fo
ru
m
(if any) is found at index ĂŤ((i-1)/2)Ăť (assuming the root has index zero). This method benefits from more compact storage and better locality of reference, particularly during a preorder traversal. However, it is expensive to grow and wastes space proportional to 2h - n for a tree of height h with n nodes.
Page: 193
15.6 Let Us Sum Up A tree is a graph in which any two vertices are connected by exactly one path. A tree is called a rooted tree if one vertex has been designated the root. A directed edge refers to the link from the parent to the child (the arrows in the picture of the tree).
.c om
The root node of a tree is the node with no parents. There is at most one root node in a rooted tree. A leaf is a node that has no children.
m
The depth of a node n is the length of the path from the root to the node. The set of all nodes at a given depth is sometimes called a level of the tree. The root node is at depth zero.
fo
ru
The height of a tree is the depth of its furthest leaf. A tree with only a root node has a height of zero.
ld
Siblings are nodes that share the same parent node.
or
If a path exists from node p to node q, where node p is closer to the root node than q, then p is an ancestor of q and q is a descendant of p.
tu
w
The size of a node is the number of descendants it has including itself.
w .jn
A labeled tree is a tree in which each vertex is given a unique label. The vertices of a labeled tree on n vertices are typically given the labels 1, 2, â&#x20AC;Ś, n.
w w
An irreducible (or series-reduced) tree is a tree in which there is no vertex of degree 2. An ordered tree is a tree for which an ordering is specified for the children of each node. A binary tree is a tree data structure in which each node has at most two children. Typically the child nodes are called left and right. A tree-traversal refers to the process of visiting each node in a tree data structure, exactly once, in a systematic way.
Page: 194
15.7 Lesson End Activities Review Questions
m
.c om
1. Define free tree. 2. Define rooted tree. 3. What is the level of a vertex in a rooted tree? 4. What is the height of a vertex in a rooted tree? 5. Give an example of a hierarchical definition tree. 6. What is preorder traversal? 7. Give an algorithm to execute a preorder traversal. 8. What is inorder traversal? 9. Give an algorithm to execute an inorder traversal. 10. What is postorder traversal? 11. Give an algorithm to execute a postarder traversal. 12. Explain how a tree can be used to represent an expression.
ru
Exercises
w w
w .jn
tu
w
or
ld
fo
I) In Exercises 1-5, list the order in which the vertices are processed using preorder, inorder, and postorder traversal.
m
.c om
Page: 195
w w
w .jn
tu
w
or
ld
fo
ru
II) Which of the graphs in Exercises 1-4 are trees? Explain.
w w
.c om
m
ru
fo
ld
or
w
tu
w .jn
Page: 196