هياكل متقطعة المرحلة الاولى الكورس الاول

Download as pdf or txt
Download as pdf or txt
You are on page 1of 111

First stage, computer science department, college of

science for women, university of Baghdad.


Dr. Amer Almahdawi.
 The concept of a set appears in all mathematics. The course introduces the notation and
terminology of set theory which is basic and used throughout the text.
 SETS AND ELEMENTS, SUBSETS
 A set may be viewed as any well-defined collection of objects, called the elements or
members of the set.
 One usually uses capital letters, A,B,X,Y,….., to denote sets, and lowercase letters,
a,b,x,y,….., to denote elements of sets. Synonyms for “set” are “class,””collection” and
“family.”
 Membership in a set is denoted as follows:
 a ∈ S denotes that a belongs to a set S
 a, b ∈ S denotes that a, b belong to a set S.
 Here ∈ is the symbol meaning “is an element of.” We use ∉ to mean “is not an element
of.”
 Specifying Sets
 There are essentially two ways to specify a particular set. One way, if possible, is to
list its members separated by commas and contained in braces{ }. A second way is
to state those properties which characterized the elements in the set. Example
illustrating those two ways are:
 A = {1,3, 5,7,9} and B ={x|x is an even integer, x > 0}
 That is, A consists of the numbers 1, 3, 5, 7, 9. the second set, which reads:
 B is the set of x such that x is an even integer and x is greater than 0.
 Denotes the set B whose elements are the positive integers. Note that a letter,
usually x, is used to denote a typical member of the set: and the vertical line | is
read as “such that” and the comma as “and.”
 Example 1.1
 (a) The set A above can also be written A={x|x is an odd positive integer, x < 10}.
 (b) We cannot list all the elements of the above set B although frequently we specify the
set by
 B = {2, 4, 6,….}
 Where we assume that everyone knows what we mean. Observe that 8 ∈ B, but 3 ∉ B.
 (c) Let E = {x|𝑥 2 − 3𝑥 + 2 = 0}, F={2,1} and G={1,2,2,1}. Then E=F=G.
 We emphasize that a set does not depend on the way in which its elements are
displayed. A set remains the same if its elements are repeated or rearranged.
 Even if we can list the elements of a set, it may not be practical to do so. That is, we
describe a set by listing its elements only if the set contains a few elements: otherwise
we describe a set by the property which characterizes its elements.
 Subset
 Suppose every elements in a set A is also an element of a set B, that is, suppose a ∈
A implies a ∈ B. Then A is called a subset of B. We also say that A is contained in B or
that B contains A. This relationship is written
 A ⊆ B or B ⊇ A
 Two sets are equal if they both have the same elements or, equivalently, if each is
contained in the other. That is:
 A = B if and only if A ⊆ B and B ⊆ A
 If A is not a subset of B, that is, if at least one element of A does not belong to B, we
write A ⊄ B.
 EXAMPLE 1.2 Consider the sets:
 A = {1, 3, 4, 7, 8, 9}, B= {1, 2, 3, 4, 5}, C= {1, 3}.
 Then C ⊆ A and C ⊆ B since 1 and 3, the elements of C, are also members of A and
B. But B ⊄ A since some of the elements of B, e.g., 2 and 5, do not belong to A.
Similarly, A ⊄ B.
 Property 1: It is common practice in mathematics to put a vertical line “|” or
slanted line “/” through a symbol to indicate the opposite or negative meaning of a
symbol.
 Property 2: The statement A ⊆ B does not exclude the possibility that A = B. In fact,
for every set A we have A ⊆ A since, trivially, every element in A belongs to A.
However, if A ⊆ B and A ≠ B, then we say A is a proper subset of B (sometimes
written A ⊂ B).
 Property 3: Suppose every element of a set A belongs to a set B and every element
of B belongs to a set C. Then clearly every element of A also belongs to C. In other
words, if A ⊆ B and B ⊆ C, then A ⊆ C.
 The above remarks yield the following theorem.
 Theorem 1.1: Let A, B, C be any sets. Then:
 (i) A ⊆ A
 (ii) If A ⊆ B and B ⊆ A, then A = B
 (iii) If A ⊆ B and B ⊆ C, then A ⊆ C
 Special symbols
 Some sets will occur very often in the text, and so we use special symbols for them.
Some such symbols are:
 N = the set of natural numbers or positive integers: 1, 2, 3, . . .
 Z = the set of all integers: . . . ,−2,−1, 0, 1, 2, . . .
 Q = the set of rational numbers
 R = the set of real numbers
 C = the set of complex numbers
 Observe that N ⊆ Z ⊆ Q ⊆ R ⊆ C.
 Universal Set, Empty Set
 All sets under investigation in any application of set theory are assumed to belong
to some fixed large set called the universal set which we denote by U unless
otherwise stated or implied.
 Given a universal set U and a property P, there may not be any elements of U which
have property P. For example, the following set has no elements:
 S = {x | x is a positive integer, 𝑥 2 = 3}
 Such a set with no elements is called the empty set or null set and is denoted by ∅
there is only one empty set. That is, if S and T are both empty, then S = T , since they
have exactly the same elements, namely, none.
 The empty set ∅ is also regarded as a subset of every other set. Thus we have the
following simple result which we state formally.
 Theorem 1.2: For any set A, we have ∅ ⊆ A ⊆ U.
 Disjoint Sets
 Two sets A and B are said to be disjoint if they have no elements in common. For
example, suppose
 A = {1, 2}, B= {4, 5, 6}, and C = {5, 6, 7, 8}
 Then A and B are disjoint, and A and C are disjoint. But B and C are not disjoint
since B and C have elements in common, e.g., 5 and 6.We note that if A and B are
disjoint, then neither is a subset of the other (unless one is the empty set).
First stage, computer department, college of science for
women, university of Baghdad.
Dr. Amer Almahdawi.
 A Venn diagram is a pictorial representation of sets in which sets are represented
by enclosed areas in the plane.
 The universal set U is represented by the interior of a rectangle, and the other sets
are represented by disks lying within the rectangle.

 If A ⊆ B, then the disk representing A will be entirely within the disk representing B
 as in next figure.
 A⊆B U

B A

 If A and B are disjoint, then the disk representing A will be separated from the disk
representing B as in the next figure.
U

B A
 However, if A and B are two arbitrary sets, it is possible that some objects are in A
but not in B, some are in B but not in A, some are in both A and B, and some are in
neither A nor B; hence in general we represent A and B as in the next figure.

A B
 Many verbal statements are essentially statements about sets and can therefore be
described by Venn diagrams. Hence Venn diagrams can sometimes be used to
determine whether or not an argument is valid.
 EXAMPLE 1.3 Show that the following argument (adapted from a book on logic by
Lewis Carroll, the author of Alice in Wonderland) is valid:
 S1: All my tin objects are saucepans.
 S2: I find all your presents very useful.
 S3: None of my saucepans is of the slightest use.
 S : Your presents to me are not made of tin.
 The statements S1, S2, and S3 above the horizontal line denote the assumptions,
and the statement S below the line denotes the conclusion.
 The argument is valid if the conclusion S follows logically from the assumptions S1,
S2, and S3.
 By S1 the tin objects are contained in the set of saucepans, and by S3 the set of
saucepans and the set of useful things are disjoint. Furthermore, by S2 the set of
“your presents” is a subset of the set of useful things. Accordingly, we can draw the
Venn diagram in the next figure.
 The conclusion is clearly valid by the Venn diagram because the set of “your
presents” is disjoint from the set of tin objects.
 This section introduces a number of set operations, including the basic operations
of union, intersection, and complement.
 Union and Intersection
 The union of two sets A and B, denoted by A ∪ B, is the set of all elements which
belong to A or to B; that is,
 A ∪ B = {x | x ∈ A or x ∈ B}
 Here “or” is used in the sense of and/or. Figure (a) is a Venn diagram in which A ∪ B
is shaded.
 The intersection of two sets A and B, denoted by A ∩ B, is the set of elements which
belong to both A and B; that is,
 A ∩ B = {x | x ∈ A and x ∈ B}
 Figure (b) is a Venn diagram in which A ∩ B is shaded.

 Recall that sets A and B are said to be disjoint or nonintersecting if they have no
elements in common or, using the definition of intersection, if A ∩ B = ∅, the empty
set. Suppose
 = A ∪ B and A ∩ B = ∅
 Then S is called the disjoint union of A and B.
 (a) Let A = {1, 2, 3, 4}, B = {3, 4, 5, 6, 7}, C = {2, 3, 8, 9}. Then
 A ∪ B = {1, 2, 3, 4, 5, 6, 7}, A ∪ C = {1, 2, 3, 4, 8, 9}, B ∪ C = {2, 3, 4, 5, 6, 7, 8, 9},
 A ∩ B = {3, 4}, A ∩ C = {2, 3}, B ∩ C = {3}.
 (b) Let U be the set of students at a university, and let M denote the set of male
students and let F denote the set of female students. The U is the disjoint union of M
of F; that is,
 U = M ∪ F and M ∩ F = ∅
 This comes from the fact that every student in U is either in M or in F, and clearly no
student belongs to both M and F, that is, M and F are disjoint.
 The following properties of union and intersection should be noted.
 Property 1: Every element x in A∩B belongs to both A and B; hence x belongs to A
and x belongs to B. Thus A ∩ B is a subset of A and of B; namely
 A ∩ B ⊆ A and A ∩ B ⊆ B
 Property 2: An element x belongs to the union A∪ B if x belongs to A or x belongs
to B; hence every element in A belongs to A ∪ B, and every element in B belongs to
A ∪ B. That is,
 A ⊆ A ∪ B and B ⊆ A ∪ B
 We state the above results formally:
 Theorem 1.3: For any sets A and B, we have:
 (i) A ∩ B ⊆ A ⊆ A ∪ B and (ii) A ∩ B ⊆ B ⊆ A ∪ B.
 The operation of set inclusion is closely related to the operations of union and
intersection, as shown by the following theorem.
 Theorem 1.4: The following are equivalent: A ⊆ B, A ∩ B = A, A ∪ B = B.
 This theorem is proved in Problem 1.8. Other equivalent conditions to are given in
Problem 1.31.
 Complements, Differences, Symmetric Differences
 Recall that all sets under consideration at a particular time are subsets of a fixed
universal set U. The absolute complement or, simply, complement of a set A, denoted
by AC, is the set of elements which belong to U but which do not belong to A. That
is,
 AC = {x | x ∈ U, x ∉ A}
ሗ or 𝐴. Fig. (a) is a Venn diagram in which AC
 Some texts denote the complement of A by A
is shaded.

 The relative complement of a set B with respect to a set A or, simply, the difference of A
and B, denoted by A\B, is the set of elements which belong to A but which do not belong
to B; that is
 A\B = {x | x ∈ A, x ∉ B}
 The set A\B is read “A minus B.” Many texts denote A\B by A − B or A ∼ B. Fig. (b) is a
Venn diagram in which A\B is shaded.
 The symmetric difference of sets A and B, denoted by A ⊕ B, consists of those
elements which belong to A or B but not to both. That is,
 A ⊕ B = (A ∪ B)\(A ∩ B) or A ⊕ B = (A\B) ∪ (B\A)
 Figure (c) is a Venn diagram in which A ⊕ B is shaded.
 Suppose U = N = {1, 2, 3, . . .} is the universal set. Let
 A = {1, 2, 3, 4}, B= {3, 4, 5, 6, 7}, C= {2, 3, 8, 9}, E= {2, 4, 6, . . .}
 (Here E is the set of even integers.) Then:
 AC = {5, 6, 7, . . .}, BC = {1, 2, 8, 9, 10, . . .}, EC = {1, 3, 5, 7, . . .}
 That is, EC is the set of odd positive integers. Also:
 A\B = {1, 2}, A\C = {1, 4}, B\C = {4, 5, 6, 7}, A\E = {1, 3},
 B\A = {5, 6, 7}, C\A = {8, 9}, C\B = {2, 8, 9}, E\A = {6, 8, 10, 12, . . .}.
 Furthermore:
 A ⊕ B = (A\B) ∪ (B\A) = {1, 2, 5, 6, 7}, B⊕ C = {2, 4, 5, 6, 7, 8, 9},
 A ⊕ C = (A\C) ∪ (C\A) = {1, 4, 8, 9}, A⊕ E = {1, 3, 6, 8, 10, . . .}.
 Consider n distinct sets A1, A2, …, An. A fundamental product of the sets is a set of
the form
∗ ∗ ∗ ∗ ∗
 𝐴1 ∩ 𝐴2 ∩ . . . ∩ 𝐴𝑛 where 𝐴𝑖 = A or 𝐴𝑖 = 𝐴𝐶
 We note that:
 (i) There are m = 2𝑛 such fundamental products.
 (ii) Any two such fundamental products are disjoint.
 (iii) The universal set U is the union of all fundamental products.
 Thus U is the disjoint union of the fundamental products. There is a geometrical
description of these sets which is illustrated below.
 Figure (a) is the Venn diagram of three sets A, B, C. The following lists the m = 23 = 8
fundamental products of the sets A, B, C:
 P1 = A ∩ B ∩ C, P2 = A ∩ B ∩ 𝑪𝑪 , P3 = A ∩ 𝑩𝑪 ∩ C, P4 = A ∩ 𝑩𝑪 ∩ 𝑪𝑪
 P5 = 𝑨𝑪 ∩ B ∩ C, P6 = 𝑨𝑪 ∩ B ∩ 𝑪𝑪 , P7 = 𝑨𝑪 ∩ 𝑩𝑪 ∩ C, P8 = 𝑨𝑪 ∩ 𝑩𝑪 ∩𝑪𝑪 .
 The eight products correspond precisely to the eight disjoint regions in the Venn
diagram of sets A, B, C as indicated by the labeling of the regions in Fig. (b).
First stage, computer science department, college of
science for women, university of Baghdad.
Dr. Amer Al-Mahdawi
 Sets under the operations of union, intersection, and complement satisfy various
laws (identities) which are listed in Table 1-1. In fact, we formally state this as:
 Theorem 1.5: Sets satisfy the laws in Table 1-1.
 Remark: Each law in Table 1-1 follows from an equivalent logical law. Consider, for
example, the proof of DeMorgan’s Law 10(a):
 (A ∪ B)C = {x |x ∉ (A or B)} = {x |x ∉ A and x ∉ B} = AC ∩ BC
 Here we use the equivalent (DeMorgan’s) logical law:
 ¬(p ∨ q) = ¬p ∧¬q
 where ¬ means “not,” ∨ means “or,” and ∧ means “and.” (Sometimes Venn
diagrams are used to illustrate the laws in Table 1-1 as in Problem 1.17.)
 Duality
 The identities in Table 1-1 are arranged in pairs, as, for example, (2a) and (2b).We
now consider the principle behind this arrangement. 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
 Observe that the pairs of laws in Table 1-1 are duals of each other. It is a fact of set
algebra, called the principle of duality, that if any equation E is an identity then its
dual E∗ is also an identity.
 Sets can be finite or infinite. A set S is said to be finite if S is empty or if S contains
exactly m elements where m is a positive integer; otherwise S is infinite.
 EXAMPLE 1.7
 (a) The set A of the letters of the English alphabet and the set D of the days of the week
are finite sets. Specifically, A has 26 elements and D has 7 elements.
 (b) Let E be the set of even positive integers, and let I be the unit interval, that is,
 E = {2, 4, 6, . . .} and I = [0, 1] = {x | 0 ≤ x ≤ 1}
 Then both E and I are infinite.
 A set S is countable if S is finite or if the elements of S can be arranged as a sequence, in
which case S is said to be countably infinite; otherwise S is said to be uncountable. The
above set E of even integers is countably infinite, whereas one can prove that the unit
interval I = [0, 1] is uncountable.
 The notation n(S) or |S| will denote the number of elements in a set S. (Some texts
use #(S) or card(S) instead of n(S).) Thus n(A) = 26, where A is the letters in the
English alphabet, and n(D) = 7, where D is the days of the week. Also n(∅) = 0 since
the empty set has no elements.
 The following lemma applies.
 Lemma 1.6: Suppose A and B are finite disjoint sets. Then A ∪ B is finite and
 n(A ∪ B) = n(A) + n(B)
 This lemma may be restated as follows:
 Lemma 1.6: Suppose S is the disjoint union of finite sets A and B. Then S is finite
and Proof.
 n(S) = n(A) + n(B)
 In counting the elements of A ∪ B, first count those that are in A. There are n(A) of
these. The only other elements of A ∪ B are those that are in B but not in A. But since
A and B are disjoint, no element of B is in A, so there are n(B) elements that are in B
but not in A. Therefore, n(A ∪ B) = n(A) + n(B).
 For any sets A and B, the set A is the disjoint union of A\B and A ∩ B. Thus Lemma
1.6 gives us the following useful result.
 Corollary 1.7: Let A and B be finite sets. Then
 n(A\B) = n(A) − n(A ∩ B)
 For example, suppose an art class A has 25 students and 10 of them are taking a
biology class B. Then the number of students in class A which are not in class B is:
 n(A\B) = n(A) − n(A ∩ B) = 25 − 10 = 15
 Given any set A, recall that the universal set U is the disjoint union of A and AC.
Accordingly, Lemma 1.6 also gives the following result.
 Corollary 1.8: Let A be a subset of a finite universal set U. Then
 n(AC) = n(U) − n(A)
 For example, suppose a class U with 30 students has 18 full-time students. Then
there are 30−18 = 12 part-time students in the class U.
 Inclusion–Exclusion Principle
 There is a formula for n(A ∪ B) even when they are not disjoint, called the
Inclusion–Exclusion Principle. Namely:
 Theorem (Inclusion–Exclusion Principle) 1.9: Suppose A and B are finite sets.
Then A ∪ B and A ∩ B are finite and
 n(A ∪ B) = n(A) + n(B) − n(A ∩ B)
 That is, we find the number of elements in A or B (or both) by first adding n(A) and
n(B) (inclusion) and then subtracting n(A ∩ B) (exclusion) since its elements were
counted twice.
 We can apply this result to obtain a similar formula for three sets:
 Corollary 1.10: Suppose A, B, C are finite sets. Then A ∪ B ∪ C is finite and
 n(A ∪ B ∪ C) = n(A) + n(B) + n(C) − n(A ∩ B) − n(A ∩ C) − n(B ∩ C) + n(A ∩ B ∩ C)
 Mathematical induction (Section 1.8) may be used to further generalize this result
to any number of finite sets.
 EXAMPLE 1.8 Suppose a list A contains the 30 students in a mathematics class,
and a list B contains the 35 students in an English class, and suppose there are 20
names on both lists. Find the number of students: (a) only on list A, (b) only on list B,
(c) on list A or B (or both), (d) on exactly one list.
 (a) List A has 30 names and 20 are on list B; hence 30 − 20 = 10 names are only on
list A.
 (b) Similarly, 35 − 20 = 15 are only on list B.
 (c) We seek n(A ∪ B). By inclusion–exclusion,
 n(A ∪ B) = n(A) + n(B) − n(A ∩ B) = 30 + 35 − 20 = 45.
 In other words, we combine the two lists and then cross out the 20 names which
appear twice.
 (d) By (a) and (b), 10 + 15 = 25 names are only on one list; that is, n(A ⊕ B) = 25.
 1.7 CLASSES OF SETS, POWER SETS, PARTITIONS
 Given a set S, we might wish to talk about some of its subsets. Thus we would be
considering a set of sets. Whenever such a situation occurs, to avoid confusion, we
will speak of a class of sets or collection of sets rather than a set of sets. If we wish to
consider some of the sets in a given class of sets, then we speak of subclass or
subcollection.
 EXAMPLE 1.9 Suppose S = {1, 2, 3, 4}.
 (a) Let A be the class of subsets of S which contain exactly three elements of S. Then
 A = [{1, 2, 3}, {1, 2, 4}, {1, 3, 4}, {2, 3, 4}]
 That is, the elements of A are the sets {1, 2, 3}, {1, 2, 4}, {1, 3, 4}, and {2, 3, 4}.
 (b) Let B be the class of subsets of S, each which contains 2 and two other elements
of S. Then
 B = [{1, 2, 3}, {1, 2, 4}, {2, 3, 4}]
 The elements of B are the sets {1, 2, 3}, {1, 2, 4}, and {2, 3, 4}. Thus B is a subclass of A,
since every element of B is also an element of A. (To avoid confusion, we will
sometimes enclose the sets of a class in brackets instead of braces.)
 Power Sets
 For a given set S , we may speak of the class of all subsets of S. This class is called
the power set of S , and will be denoted by P(S). If S is finite, then so is P(S). In fact,
the number of elements in P(S) is 2 raised to the power n(S). That is,
 n(P (S)) =2𝑛(𝑆)
 (For this reason, the power set of S is sometimes denoted by 2S.)
 EXAMPLE 1.10 Suppose S = {1, 2, 3}. Then
 P(S) = [∅, {1}, {2}, {3}, {1, 2}, {1, 3}, {2, 3}, S]
 Note that the empty set ∅ belongs to P(S) since ∅ is a subset of S. Similarly, S
belongs to P(S). As expected from the above remark, P(S) has 23 = 8 elements.
 Partitions
 Let S be a nonempty set. A partition of S is a subdivision of S into nonoverlapping,
nonempty subsets. Precisely, a partition of S is a collection {Ai } of nonempty
subsets of S such that:
 (i) Each a in S belongs to one of the Ai .
 (ii) The sets of {Ai } are mutually disjoint; that is, if
 𝐴𝑗 ≠ 𝐴𝑘 then 𝐴𝑗 ∩ 𝐴𝑘 = ∅
 The subsets in a partition are called cells. Figure 1-6 is a Venn diagram of a partition of
the rectangular set S of points into five cells, A1, A2,A3,A4,A5.

 EXAMPLE 1.11 Consider the following collections of subsets of S = {1, 2, . . ., 8, 9}:


 (i) [{1, 3, 5}, {2, 6}, {4, 8, 9}]
 (ii) [{1, 3, 5}, {2, 4, 6, 8}, {5, 7, 9}]
 (iii) [{1, 3, 5}, {2, 4, 6, 8}, {7, 9}]
 Then (i) is not a partition of S since 7 in S does not belong to any of the subsets.
Furthermore, (ii) is not a partition of S since {1, 3, 5} and {5, 7, 9} are not disjoint. On the
other hand, (iii) is a partition of S.
 The set operations of union and intersection were defined above for two sets. These
operations can be extended to any number of sets, finite or infinite, as follows.
 Consider first a finite number of sets, say, A1,A2, . . .,Am. The union and intersection
of these sets are denoted and defined, respectively, by

 That is, the union consists of those elements which belong to at least one of the sets,
and the intersection consists of those elements which belong to all the sets.
 EXAMPLE 1.12 Consider the sets
 An essential property of the set N = {1, 2, 3, …} of positive integers follows:
 Principle of Mathematical Induction I: Let P be a proposition defined on the
positive integers N; that is, P(n)
 is either true or false for each n ∈ N. Suppose P has the following two properties:
 (i) P(1) is true.
 (ii) P(k + 1) is true whenever P(k) is true.
 Then P is true for every positive integer n ∈ N.
 We shall not prove this principle. In fact, this principle is usually given as one of the
axioms when N is developed axiomatically
 EXAMPLE 1.13 Let P be the proposition that the sum of the first n odd numbers is n2; that is,
 P(n) : 1 + 3 + 5+・ ・ ・+(2n − 1) = n2
 (The kth odd number is 2k −1, and the next odd number is 2k +1.) Observe that P(n) is true for n =
1; namely,
 P(1) = 12
 Assuming P(k) is true, we add 2k + 1 to both sides of P(k), obtaining
 1 + 3 + 5+・ ・ ・+(2k − 1) + (2k + 1) − k2 + (2k + 1) = (k + 1)2
 which is P(k + 1). In other words, P(k + 1) is true whenever P(k) is true. By the principle of
mathematical
 induction, P is true for all n.
 There is a form of the principle of mathematical induction which is sometimes more convenient to
use.
 Although it appears different, it is really equivalent to the above principle of induction.
 Principle of Mathematical Induction II: Let P be a proposition defined on the
positive integers N such that:
 (i) P(1) is true.
 (ii) P(k) is true whenever P(j) is true for all 1 ≤ j < k.
 Then P is true for every positive integer n ∈ N.
 Remark: Sometimes one wants to prove that a proposition P is true for the set of
integers
 {a, a + 1, a + 2, a + 3, . . .}
 where a is any integer, possibly zero. This can be done by simply replacing 1 by a
in either of the above Principles of Mathematical Induction.
First stage, computer science department, college of
science for women, university of Baghdad.
Dr. Amer Almahdawi
▪ The reader is familiar with many relations such as “less than,” “is parallel to,” “is a
subset of,” and so on. In a certain sense, these relations consider the existence or
nonexistence of a certain connection between pairs of objects taken in a definite
order. Formally, we define a relation in terms of these “ordered pairs.”
▪ An ordered pair of elements a and b, where a is designated as the first element and
b as the second element, is denoted by (a, b). In particular,
▪ (a,b) = (c,d)
▪ if and only if a = c and b = d. Thus (a, b) ≠ (b, a) unless a = b. This contrasts with sets
where the order of elements is irrelevant; for example, {3, 5} = {5, 3}.
▪ Consider two arbitrary 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. A short designation
of this product is A × B, which is read “A cross B.” By definition.
▪ A × B = {(a, b) | a ∈ A and b ∈ B}
▪ One frequently writes A2 instead of A × A.
▪ EXAMPLE 2.1 R denotes the set of real numbers and so R2 = R×R is the set of
ordered pairs of real numbers. The reader is familiar with the geometrical
representation of R2 as points in the plane as in Fig. 2-1. Here each point P
represents an ordered pair (a, b) of real numbers and vice versa; the vertical line
through P meets the x-axis at a, and the horizontal line through P meets the y-axis at
b. R2 is frequently called the Cartesian plane.
▪ EXAMPLE 2.2 Let A = {1, 2} and B = {a, b, c}. Then
▪ A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}
▪ B × A = {(a, 1), (b, 1), (c, 1), (a, 2), (b, 2), (c, 2)}
▪ Also, A × A = {(1, 1), (1, 2), (2, 1), (2, 2)}
▪ There are two things worth noting in the above examples. First of all A×B = B ×A.
The Cartesian product deals with ordered pairs, so naturally the order in which the
sets are considered is important. Secondly, using n(S) for the number of elements
in a set S, we have:
▪ n(A × B) = 6 = 2(3) = n(A)n(B)
▪ 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.
▪ The idea of a product of sets can be extended to any finite number of sets. For any
sets A1,A2, . . . , An, the set of all ordered n-tuples (a1, a2, . . . , an) where a1 ∈ A1, a2 ∈
A2, . . . , an ∈ An is called the product of the sets A1, . . . , An and is denoted by

▪ Just as we write A2 instead of A × A, so we write An instead of A × A×・ ・ ・×A,


where there are n factors all equal to A. For example, R3 = R × R × R denotes the
usual three-dimensional space.
▪ We begin with a definition.
▪ Definition 2.1: Let A and B be sets. A binary relation or, simply, relation from A to B
is a subset of A × B.
▪ Suppose R is a relation from A to B. Then R is a set of ordered pairs where each first
element comes from A and each second element comes from B. That is, for each
pair a ∈ A and b ∈ B, exactly one of the following is true:

▪ If R is a relation from a set A to itself, that is, if R is a subset of A2 = A×A, then we say
that R is a relation on A.
▪ The domain of a relation R is the set of all first elements of the ordered pairs which
belong to R, and the range is the set of second elements.
▪ EXAMPLE 2.3
▪ (a) 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,

▪ The domain of R is {1, 3} and the range is {y, z}.


▪ (b) Set inclusion ⊆ is a relation on any collection of sets. For, given any pair of set A
and B, either A ⊆ B or A ⊄ B.
▪ (d) Let A be any set. An important relation on A is that of equality,
▪ {(a, a) | a ∈ A}
▪ which is usually denoted by “=.” This relation is also called the identity or diagonal
relation on A and it will also be denoted by ΔA or simply Δ.
▪ (e) Let A be any set. Then A × A and ∅ are subsets of A × A and hence are relations
on A called the universal relation and empty relation, respectively.
▪ Inverse Relation
▪ Let R be any relation from a set A to a set B. The inverse of R, denoted by R −1, is the
relation from B to A which consists of those ordered pairs which, when reversed,
belong to R; that is,
▪ R−1 = {(b, a) | (a, b) ∈ R}
▪ For example, let A = {1, 2, 3} and B = {x, y, z}. Then the inverse of
▪ R = {(1, y), (1, z), (3, y)} is R−1 = {(y, 1), (z, 1), (y, 3)}
▪ Clearly, if R is any relation, then (R−1)−1 = R. Also, the domain and range of R−1 are
equal, respectively, to the range and domain of R. Moreover, if R is a relation on A,
then R−1 is also a relation on A.
▪ PICTORIAL REPRESENTATIVES OF RELATIONS
▪ There are various ways of picturing relations.
▪ Relations on R
▪ Let S be a relation on the set R of real numbers; that is, S is a subset of R2 = R × R.
Frequently, S consists of all ordered pairs of real numbers which satisfy some given
equation E(x, y) = 0 (such as x2 + y2 = 25).
▪ Since R2 can be represented by the set of points in the plane, we can picture S by
emphasizing those points in the plane which belong to S. The pictorial
representation of the relation is sometimes called the graph of the relation. For
example, the graph of the relation x2+y2 = 25 is a circle having its center at the
origin and radius 5. See Fig. 2-2(a).
▪ Suppose A and B are finite sets. There are two ways of picturing a relation R from A
to B.
▪ (i) Form a rectangular array (matrix) whose rows are labeled by the elements of A
and whose columns are labeled by the elements of B. Put a 1 or 0 in each position
of the array according as a ∈ A is or is not related to b ∈ B. This array is called the
matrix of the relation.
▪ (ii) Write down the elements of A and the elements of B in two disjoint disks, and
then draw an arrow from a ∈ A to b ∈ B whenever a is related to b. This picture will
be called the arrow diagram of the relation.
▪ Figure 2-3 pictures the relation R in Example 2.3(a) by the above two ways.
▪ Let A, B and C be sets, and let R be a relation from A to B and let S be a relation from
B to C. That is, R is a subset of A × B and S is a subset of B × C. Then R and S give rise
to a relation from A to C denoted by R ◦ S and defined by:
▪ a(R ◦ S) c if for some b ∈ B we have aRb and bSc.
▪ That is ,
▪ R ◦ S = {(a, c) | there exists b ∈ B for which (a, b) ∈ R and (b, c) ∈ S}
▪ The relation R◦S is called the composition of R and S; it is sometimes denoted simply
by RS.
▪ Suppose R is a relation on a set A, that is, R is a relation from a set A to itself. Then
R◦R, the composition of R with itself, is always defined. Also, R◦R is sometimes
denoted by R2. Similarly, R3 = R2◦R = R◦R◦R, and so on. Thus Rn is defined for all
positive n.
▪ Let A = {1, 2, 3, 4}, B = {a, b, c, d}, C = {x, y, z} and let
▪ R = {(1, a), (2, d), (3, a), (3, b), (3, d)} and S = {(b, x), (b, z), (c, y), (d, z)}
▪ Consider the arrow diagrams of R and S as in Fig. 2-4. Observe that there is an
arrow from 2 to d which is followed by an arrow from d to z. We can view these two
arrows as a “path” which “connects” the element 2 ∈ A to the element z ∈ C. Thus:
▪ 2(R ◦ S)z since 2Rd and dSz
▪ Similarly there is a path from 3 to x and a path from 3 to z. Hence
▪ 3(R ◦ S)x and 3(R ◦ S)z
▪ No other element of A is connected to an element of C. Accordingly,
▪ R ◦ S = {(2, z), (3, x), (3, z)}
▪ Our first theorem tells us that composition of relations is associative.
▪ Theorem 2.1: Let A, B, C and D be sets. Suppose R is a relation from A to B, S is a
relation from B to C, and T is a relation from C to D. Then
▪ (R ◦ S) ◦ T = R ◦ (S ◦ T )
▪ There is another way of finding R◦S. Let MR and MS denote respectively the matrix
representations of the relations R and S. Then

Multiplying MR and MS we obtain the matrix

▪ The nonzero entries in this matrix tell us which elements are related by R◦S. Thus M =
MRMS and MR◦S have the same nonzero entries.
First stage, computer science department, college of
science for women, university of Baghdad.
Dr. Amer Almahdawi
 Relations:
 Let A and B are two sets, every subset of A×B is called relation from A to B, denoted
by R.
 Remark:
 1. We say R relation on A if R⊆A×A.
 2. If (a,b)∈R, then denoted by a R b.
 3. If (a,b)∉ R, then denoted by 𝒂 𝑹 𝒃 .
 Example:
 1. Let A={1,2,3} and B={a,b}. Then R={(1,a),(1,b),(3,a)} is a relation from A to B.
Furthermore, 1 R a,1 R b,3 R a.
 2. Let w={a,b,c}. then R={(a,b),(a,c),(c,c),(c,b)} is a relation in w. Moreover, a R a,b
R a,c R c,a R b.
 Reflexive relation: Let 𝑅 be a relation in a set 𝐴, i.e. Let 𝑅 be a subset of 𝐴 × 𝐴. then
𝑅 is called a reflexive relation if for every 𝑎 ∈ 𝐴, (𝑎, 𝑎) ∈ 𝑅. In other words, 𝑅 is
reflexive if every element in 𝐴 is related to its self.
 Example:
 1. Let V={1,2,3,4} and R={(1,1),(2,4),(3,3),(4,1),(4,4)}. then R is not reflexive since
(2,2) dose not belong to R. Notice that all ordered pairs (a,a) must belong to R in
order for R to be reflexive.
 2. Let R be the relation in the real numbers defined by the open sentence " x<y".
Then R is not reflexive since 𝑎 < 𝑎 for every real number a.
 3. Let Q be a family of sets, and let 𝑅 be the relation in Q defined by
" 𝑥 𝑖𝑠 𝑎 𝑠𝑢𝑏𝑠𝑒𝑡 𝑜𝑓 𝑦 ". Then 𝑅 is a reflexive relation since every set is a subset of
itself.
 Symmetric relation: Let 𝑅 be a relation in a set 𝐴. Then 𝑅 is called a symmetric
relation if (𝑎, 𝑏) ∈ 𝑅 implies (𝑏, 𝑎) ∈ 𝑅 that is, if 𝑎 related to 𝑏, then 𝑏 is also related
to 𝑎.
 Example:
 1. Let 𝑆 = {1, 2, 3} and let 𝑅 = { 1, 3 , 4, 2 , 2, 4 , 2, 3 , 3, 1 }. Then 𝑅 is not a
symmetric relation since (2, 3) ∈ 𝑅 but (3, 2) ∉ 𝑅.
 2. Let 𝑅 be the relation in the natural numbers 𝑁 which is defined by " 𝑥 𝑑𝑖𝑣𝑖𝑑𝑒𝑠 𝑦".
Then 𝑅 is not symmetric since 2 𝑑𝑖𝑣𝑖𝑑𝑒𝑠 4 but 4 𝑑𝑜𝑒𝑠 𝑛𝑜𝑡 𝑑𝑖𝑣𝑖𝑑𝑒𝑠 2. i.e. (2, 4) ∈ 𝑅 but
(4, 2) ∉ 𝑅.
 Transitive relation: A relation 𝑅 in a set 𝐴 is called a transitive relation if (𝑎, 𝑏) ∈ 𝑅
and (𝑏, 𝑐) ∈ 𝑅 implies (𝑎, 𝑐) ∈ 𝑅.
 Example:
 1. Let 𝑅 be the relation in the real numbers defined by "𝑥 < 𝑦 ". Then if 𝑎 < 𝑏 and 𝑏
< 𝑐 implies 𝑎 < 𝑐. Thus 𝑅 is a transitive relation.
 2. Let 𝑤 = {𝑎, 𝑏, 𝑐}, and let 𝑅 = { 𝑎, 𝑏 , 𝑐, 𝑏 , 𝑏, 𝑎 , 𝑎, 𝑐 }. Then 𝑅 is not a transitive
relation since (𝑐, 𝑏) ∈ 𝑅 and (𝑏, 𝑎) ∈ 𝑅 but (𝑐, 𝑎) ∉ 𝑅.
 Equivalence relation: A relation 𝑅 in a set 𝐴 is an equivalence relation if
 1. 𝑅 is reflexive, that is, for every 𝑎 ∈ 𝐴, (𝑎, 𝑎) ∈ 𝑅.
 2. 𝑅 is symmetric, that is, (𝑎, 𝑏) ∈ 𝑅 implies (𝑏, 𝑎) ∈ 𝑅.
 3. 𝑅 is transitive, that is, (𝑎, 𝑏) ∈ 𝑅 and (𝑏, 𝑐) ∈ 𝑅 implies (𝑎, 𝑐) ∈ 𝑅.
 Example: Let 𝐴 = {1, 2, 3}. Determine whether the relation is reflexive, symmetric or transitive.
 1. 𝑅 = 1,1 , 1,2 , 2,1 , 2,2 , 3,3 .
 2. 𝑅 = 1,3 , 1,1 , 3,1 , 1,2 , 3,3 .
 3. 𝑅 = 1,2 , 1,3 , 3,1 , 1,1 , 3,3 , 3, 2 .
 4. 𝑅 = { 1,2 , 1,3 , 2,3 , 1,1 , 3,1 , 3,3 , 2,1 , (2,2)}.
 5. 𝑅 = 1,3 , 3,1 , 2,2 .
 Solution:
 1. Reflexive, symmetric, transitive.
 2. Not reflexive, not symmetric, not transitive.
 3. Not reflexive, not symmetric, transitive.
 4. Reflexive, not symmetric, not transitive.
 5. Not reflexive, symmetric, not transitive.
 Example:
 Consider the relation 𝑅 that is define on 𝑍 by 𝑎 𝑅 𝑏 ↔ ∃ 𝑘 ∈ 𝑍, 𝑎 − 𝑏 = 3𝑘 .
 Solution:
 (3, 0) ∈ 𝑅 since 3 − 0 = 3 = 3 1 , 𝑘 = 1
 (0, 3) ∈ R since 0 − 3 = −3 = 3 −1 , 𝑘 = −1
 (15, 9) ∈ 𝑅 since 15 − 9 = 6 = 3 2 , 𝑘 = 2
1
 (−1, −2) ∉ 𝑅 since −1 − −2 = 1 = 3𝑘, 𝑘 = ∉𝑍
3
 Now,
 1. 𝑅 is reflexive?
 Let 𝑎 ∈ 𝑍 → 𝑎 − 𝑎 = 0 = 3 0 , 𝑘 = 0 → 𝑎 𝑅 𝑎. So that, 𝑅 is reflexive.
 2. 𝑅 is symmetric?
 Let 𝑎 𝑅 𝑏, we have to show 𝑏 𝑅 𝑎?
 Since 𝑎 𝑅 𝑏 → ∃ 𝑘 ∈ 𝑍; 𝑎 − 𝑏 = 3𝑘
 Now,
 𝑏 − 𝑎 = − 𝑎 − 𝑏 = −3𝑘 = 3 −𝑘 = 3𝑘1 s.t. 𝑘1 = −𝑘
 ∴ 𝑏 − 𝑎 = 3𝑘1 → 𝑏 𝑅 𝑎 so that 𝑅 is symmetric.
 3. 𝑅 is transitive?
 Let 𝑎 𝑅 𝑏 ∧ 𝑏 𝑅 𝑐, we have to show 𝑎 𝑅 𝑐?
 𝑎 − 𝑏 = 3𝑘1 ∧ 𝑏 − 𝑐 = 3𝑘2 ; 𝑘1 , 𝑘2 ∈ 𝑍
 𝑎 − 𝑐 = 𝑎 − 𝑏 + 𝑏 − 𝑐 = 3𝑘1 + 3𝑘2 = 3 𝑘1 + 𝑘2 = 3𝑘; 𝑤ℎ𝑒𝑟𝑒 𝑘 = 𝑘1 + 𝑘2
 ∴𝑎𝑅𝑐
 So that from (1), (2), and (3) 𝑅 is equivalence relation.
 Problem:
 Let 𝐴 = {1, 2, 3, 4, 5} and 𝑅 is defined on 𝐴 by 𝑅 = { 𝑥, 𝑦 , 𝑥 + 𝑦 = 5}. Is 𝑅 an
equivalence relation.
 Example:
 Let 𝐴 = 𝑍 × 𝑍 − {0}, we define the relation 𝑅 on 𝐴 by 𝑎, 𝑏 𝑅 𝑐, 𝑑 ↔ 𝑎𝑑 = 𝑏𝑐.
 Solution:
 (0,1) R (0,2)
 (2,4) R (10,20)
 (5,15) R (25,10)
 1. 𝑅 is reflexive relation?
 Let (𝑎, 𝑏) ∈ 𝐴, it is clear that 𝑎, 𝑏 𝑅 (𝑎, 𝑏) since 𝑎𝑏 = 𝑏𝑎.
 2. 𝑅 is symmetric relation?
 Let 𝑎, 𝑏 𝑅 𝑐, 𝑑 → 𝑎𝑑 = 𝑏𝑐 → 𝑏𝑐 = 𝑎𝑑 → 𝑐𝑏 = 𝑑𝑎 → 𝑐, 𝑑 𝑅 (𝑎, 𝑏).
 3. 𝑅 is transitive relation?
 Let 𝑎, 𝑏 𝑅 𝑐, 𝑑 ∧ 𝑐, 𝑑 𝑅 (𝑒, 𝑓), we have to show that 𝑎, 𝑏 𝑅 𝑒, 𝑓 ?
𝑎𝑑 𝑎𝑑
 Since 𝑎𝑑 = 𝑏𝑐 ∧ 𝑐𝑓 = 𝑑𝑒 → 𝑐 = → 𝑐𝑓 = 𝑓 = 𝑑𝑒 → 𝑎𝑑𝑓 = 𝑏𝑑𝑒 →
𝑏 𝑏
 𝑎𝑓 = 𝑏𝑒, ∴ 𝑎, 𝑏 𝑅 (𝑒, 𝑓) so that by (1), (2), and (3) 𝑅 is equivalence relation.
 Functions
 Definition: Let 𝑓 be a relation defined from a set 𝐴 to set 𝐵, then 𝑓 is called a
function " 𝑑𝑒𝑛𝑜𝑡𝑒𝑑 𝑏𝑦 𝑓: 𝐴 → 𝐵 " if the following holds:
 1. ∀𝑎 ∈ 𝐴, ∃ 𝑏 ∈ 𝐵 such that (𝑎, 𝑏) ∈ 𝑓.
 2. If 𝑎, 𝑏1 ∈ 𝑓 𝑎𝑛𝑑 𝑎, 𝑏2 ∈ 𝑓 𝑡ℎ𝑒𝑛 𝑏1 = 𝑏2 .
 The set 𝐴 is called the domain of the function 𝑓, and 𝐵 is called the co-domain or
range of 𝑓. Further, if 𝑎 ∈ 𝐴 then the element in 𝐵 which is assigned to 𝑎 is called
image of 𝑎 and is denoted by 𝑓(𝑎).
 Example:
 1. Let 𝐴 = {𝑎, 𝑏, 𝑐, 𝑑} and 𝐵 = {𝑎, 𝑏, 𝑐}. Define a function 𝑓 of 𝐴 into 𝐵 be the
correspondence 𝑓 𝑎 = 𝑏, 𝑓 𝑏 = 𝑐, 𝑓 𝑐 = 𝑐 𝑎𝑛𝑑 𝑓 𝑑 = 𝑏 . By this definition, the
image for example are 𝑏 𝑎𝑛𝑑 𝑐.
 2. Let 𝐴 = {1, 2, 3}, 𝑔: 𝐴 → 𝐴 defined by 𝑔 = { 1, 2 , 3, 1 } is not function because not
for each 𝑎 ∈ 𝐴, i.e. 2 ∈ 𝐴, ∄𝑏 ∈ 𝑠. 𝑡 (2, 𝑏) ∈ 𝑔.
 3. ℎ: 𝐴 → 𝐴 define by ℎ: { 1, 3 , 2, 1 , 1, 2 , 3, 1 } is not function since (1, 2) ∈ ℎ and
(1, 3) ∈ ℎ but 2 ≠ 3.
 Example: Let 𝐴 = {𝑚, 𝑛, 𝑜, 𝑝} and 𝐵 = {1, 2}. Determine whether the relation 𝑅 from
𝐴 𝑡𝑜 𝐵 is a function. If it is function, give its range.
 1. 𝑅 = { 𝑚, 1 , 𝑛, 1 , 𝑜, 1 , 𝑝, 1 }.
 2. 𝑅 = 𝑚, 1 , 𝑛, 2 , 𝑚, 2 , 𝑜, 1 , 𝑝, 2 .
 3. 𝑅 = 𝑚, 2 , 𝑝, 1 , 𝑛, 1 , 𝑜, 1 , 𝑚, 1 .
 Solution:
 1. Yes function, 𝑅𝑎𝑛𝑔𝑒 𝑅 = {1}.
 2. No.
 3. No.
 Problem: Let 𝐴 = {𝑤, 𝑥, 𝑦, 𝑧} and 𝐵 = {1, 2}. Determine whether the relation 𝑅 from
𝐴 𝑡𝑜 𝐵 is a function. If it is function, give its range.
 1. 𝑅 = { 𝑤, 2 , 𝑥, 2 , 𝑦, 2 , 𝑧, 2 }.
 2. 𝑅 = 𝑤, 1 , 𝑥, 2 , 𝑤, 2 , 𝑦, 1 , 𝑧, 2 .
 3. 𝑅 = 𝑤, 2 , 𝑧, 1 , 𝑥, 1 , 𝑦, 1 , 𝑤, 1 .
 Equal function
 If 𝑓 𝑎𝑛𝑑 𝑔 are two functions defined on the same domain 𝐷 and if 𝑓 𝑎 = 𝑔(𝑎) for
every 𝑎 ∈ 𝐷, then the functions 𝑓 𝑎𝑛𝑑 𝑔 are equal and we write 𝑓 = 𝑔.
 Example:
 Let 𝑓 𝑥 = 𝑥 2 where 𝑥 is a real number. Let 𝑔 = 𝑥 2 where 𝑥 is a complex number,
then the function 𝑓 is not equal to 𝑔 since they have different domains.
 Example: Let the function 𝑓 be defined by the diagram

1
1
2
3
2 4

 Let a function 𝑔 be defined by the formula 𝑔 𝑥 = 𝑥 2 where the domain of 𝑔 is the


set {1, 2}, then 𝑓 = 𝑔 since they both have the same domain and since 𝑓 𝑎𝑛𝑑 𝑔
assign the same image to each element in the domain.
First stage, computer department, college of science for
women, university of Baghdad.
Dr. Amer Al-Mahdawi
 Let 𝑓 be a mapping of 𝐴 𝑖𝑛𝑡𝑜 𝐵, that is, 𝑓: 𝐴 → 𝐵 we define the range of 𝑓 to consist
of those elements in 𝐵 which appear as the image of at least one element in 𝐴. We
denote the range of 𝑓: 𝐴 → 𝐵 by 𝑓 𝐴 ; i.e. 𝑓 𝐴 = {𝑏 ∈ 𝐵; (𝑎, 𝑏) ∈ 𝑓}.
 Identity function
 Let 𝐴 be any set. Let the function 𝑓: 𝐴 → 𝐴 be defined by the formula 𝑓 𝑥 = 𝑥 for
each element in 𝐴 then 𝑓 is called the identity function and denote by 𝐼 or 𝐼𝐴 .
 Constant function
 A function 𝑓 of 𝐴 𝑖𝑛𝑡𝑜 𝐵 is called a constant function if the same element 𝑏 ∈ 𝐵 is
assigned to every element in 𝐴. In other words, 𝑓: 𝐴 → 𝐵 is a constant function if the
range of 𝑓 consists of only one element.
 Example: a 1
 Let the function 𝑓 be defined by the diagram b 2
c 3
 Then 𝑓 is a constant function since 3 is assigned to every element in 𝐴.
 Example: a 1

 Let the function be defined by the diagram


2
b
3
c

 Then 𝑓 is not a constant function since the range of 𝑓 consists of both 1 𝑎𝑛𝑑 2.
 Definition: Let 𝑓 be a function of 𝐴 into 𝐵. Then 𝑓 is called
 1. One – one [injective]
 If 𝑥1 ≠ 𝑥2 → 𝑓(𝑥1 ) ≠ 𝑓(𝑥2 )
 or
 If 𝑓 𝑥1 = 𝑓 𝑥2 → 𝑥1 = 𝑥2
 2. Onto [surjective]
 If for each 𝑏 ∈ 𝐵, there exists 𝑎 ∈ 𝐴 such that 𝑓 𝑎 = 𝑏. i.e. 𝑓 𝐴 = 𝐵.
 3. Bijective
 If 𝑓 is both injective and surjective.
 Example:
 1. The identity function is injective since 𝐼 𝑥1 = 𝐼 𝑥2 → 𝑥1 = 𝑥2 .
 2. The identity function is surjective since for each 𝑏 ∈ 𝐵, ∃ 𝑎 ∈ 𝐴 such that 𝑓 𝐴 = 𝐵.
 3. Let 𝐴 = {𝑎, 𝑏, 𝑐, 𝑑}, 𝐵 = {𝑎, 𝑏, 𝑐}. Define by 𝑓 𝑎 = 𝑏, 𝑓 𝑏 = 𝑐, 𝑓 𝑐 = 𝑐 and 𝑓 𝑑 = 𝑏
then 𝑓 𝐴 = {𝑏, 𝑐} ≠ 𝐵 so that 𝑓 is not onto. x
a
 4. Let A = 𝑎, 𝑏, 𝑐, 𝑑 , 𝐵 = {𝑥, 𝑦, 𝑧}, Let 𝑓: 𝐴 → 𝐵 define by b y
c
z
d

 𝑓 is not injective because 𝑓 𝑎 = 𝑓(𝑑) but 𝑎 ≠ 𝑑. 𝑓 is surjective, notice that 𝑓 𝐴


= 𝑥, 𝑦, 𝑧 = 𝐵, thus 𝑓 is onto.
 Problem:
 Let 𝐴 𝑎𝑛𝑑 𝐵 are two sets and the function from 𝐴 to 𝐵 are given. Determine whether the
function is one to one or onto (or both or neither).
 1. 𝐴 = 0.2, 0.07, 5 , 𝐵 = 𝑟, 𝑠, 𝑡 ,
 𝑓 = { 5, 𝑡 , 0.2, 𝑠 , 0.07, 𝑟 }
 2. 𝐴 = 𝑚, 𝑛, 𝑜 , 𝐵 = 2, 1, 5 ,
 𝑓 = { 𝑚, 5 , 𝑜, 1 , 𝑛, 1 }
 Composition function
 Let 𝑓: 𝐴 → 𝐵 𝑎𝑛𝑑 𝑔: 𝐵 → 𝐶 be two functions then we define a function 𝑔𝑜𝑓: 𝐴 → 𝐶 by
𝑔𝑜𝑓 𝑎 = 𝑔 𝑓 𝑎 ∀𝑎 ∈ 𝐴. This new function is called the composition function of
𝑓 𝑎𝑛𝑑 𝑔.
𝑓 B
𝑔

A C

(𝑔𝑜𝑓)

 Example: B C
A
 Let 𝑓: 𝐴 → 𝐵 𝑎𝑛𝑑 𝑔: 𝐵 → 𝐶 be defined by the diagram a x r

 We compute 𝑔𝑜𝑓 : 𝐴 → 𝐶 by its definition b y s


c z t
 𝑔𝑜𝑓 𝑎 = 𝑔 𝑓 𝑎 =𝑔 𝑦 =𝑡
 𝑔𝑜𝑓 𝑏 =𝑔 𝑓 𝑏 =𝑔 𝑧 =𝑟
 𝑔𝑜𝑓 𝑐 = 𝑔 𝑓 𝑐 =𝑔 𝑦 =𝑡
 Example:
 Let 𝑓: 𝑁 → 𝑁, 𝑔: 𝑁 → 𝑁 such that 𝑓 𝑥 = 3𝑥 2 and 𝑔 𝑥 = 4𝑥 2 + 2. Now,

 𝑔𝑜𝑓 𝑥 =𝑔 𝑓 𝑥 = 𝑔 3𝑥 2 = 4(3𝑥 2 )2 +2 = 36𝑥 4 + 2.


 𝑓𝑜𝑔 𝑥 = 𝑓 𝑔 𝑥 = 𝑓 4𝑥 2 + 2 = 3(4𝑥 2 + 2)2 = 3(16𝑥 4 + 16𝑥 2 + 4). It is clear that
𝑔𝑜𝑓 ≠ 𝑓𝑜𝑔.
 Inverse of function
 Let 𝑓 be a function of 𝐴 into 𝐵, and let 𝑏 ∈ 𝐵. Then the inverse of 𝑏, denoted by
𝑓 −1 (𝑏) consists of those elements in 𝐴 which are mapped onto 𝑏, that is, those
elements in 𝐴 which have be as their image. i.e. if 𝑓: 𝐴 → 𝐵 then 𝑓 −1 𝑏 = {𝑥; 𝑥
∈ 𝐴, 𝑓 𝑥 = 𝑏} . Notice that 𝑓 −1 𝑏 is always a subset of 𝐴.
 Example: A
B

 Let the function f :A→B be defined by the diagram x


a

 Then 𝑓 −1 𝑥 = 𝑏, 𝑐 , 𝑓 −1 𝑦 = 𝑎 , 𝑓 −1 𝑧 = ∅. b
y

c z
 Graph Theory
 Graph theory began in 1936 when Leonhard Euler solved a problem that had been
puzzling the good citizens of the town Kaliningrad in Russia. The river Pregl
divides the town into four sections, and in The Euler's days seven bridges
connected these sections. The people wanted to know if it were possible to start at
any location in town, cross every bridge exactly once, and return to the starting
location. Euler showed that it is impossible to take such a walk.
 A problem in graph theory that attracted considerably more attention is the four-
color map problem. Frank Guthrie, a former student of Augustus De Morgan,
observed that he was able to color the map England so that no two adjacent
counties have the same color by using four different colors. He asked his brother,
who in 1852 was a student of De Morgan, to ask De Morgan whether his conjecture
that four colors will suffice to color every map so that no two adjacent counties
have the same color was true.
 In 1879, Alfred Bray Kempe, a lawyer who had studied mathematics at Cambridge
University, published a proof of the four-color conjecture that was highly
acclaimed. Unfortunately, his proof had a fatal error. The theorem was finally
proved by the American mathematicians Kenneth Appel and wolfgang Haken at the
University of Illinois.
 Graph
 A graph is a nonempty finite set of vertices V along with a set E of 2-element
subsets of V. The elements of V are called vertices, and the elements of E are edges.
Mathematically, G=(V, E). where, E={(𝑣𝑖 , 𝑣𝑗 ), 𝑣𝑖 , 𝑣𝑗 ∈ 𝑉}.
 Let us consider 𝑉 = {𝑃, 𝑄, 𝑇, 𝑆, 𝑅} and E={(P,Q), (P, T), (T,S), (Q,S), (Q,R), (S,R)}.
 Hence, the graph G=(V, E) becomes as G G:

 Example:
 Let V={v_1,v_2 ,v_3,v_4,v_5,v_6} and E={(v_1,v_2), (v_1,v_3), (v_1,v_4), (v_4,v_5),
(v_5,v_6)}.
 Hence, the graph becomes as G G:
 Order and Size
 The number of vertices in a graph G=(V, E) is called its order, and the number of
edges its size. That is the order of G is 𝑉 and its size 𝐸
 Consider the following graph G G:

 The order of G= 𝑉 = 5 and the size of G= 𝐸 = 8


 Example: G:
 Consider the graph G as
 The order of G= 𝑉 = 4 and the size of G= 𝐸 = 5

 Adjacent Vertices
 Two vertices are adjacent if they are joined by an edge. In other words, there is an
edge in the graph that has both vertices as endpoints.
 Consider the graph G as
 Here the vertices a and b are adjacent, b and c are adjacent,
G:
 a and c are adjacent, c and d are adjacent. Vertices a and d
 are not adjacent.
 Parallel Edges
 Two or more edges are called parallel edges when they have same end vertices.
 Consider the graph G as G:
 Here the edges p and q are parallel
 Loop
 A graph that contain an edge from a vertex to itself;
 such an edge is referred to as loop.
 Consider the graph G as
G:
 It is clear that the edge 𝑒1 is a loop.
 Simple and Multi Graph
 If a graph has no loops and parallel edges then it's known as a simple graph,
otherwise a multi graph.
 Consider the graphs G and D as G D:

 The graph in D is simple graph


 because there exists no loop and
 parallel edges between vertices,
 while the graph in G is a multi- graph because there exists parallel edges between
vertices A and B.
 Pseudo Graph
 A graph G is known as a pseudo graph if we allow both parallel edges and loops.
 Consider the graph G as
 Digraph
 A directed graph (or digraph) is a graph that is a set of vertices connected by
edges, where the edges have a direction associated with them.
 Consider the graph G as a simple directed graph
 Example: G:
 Let V={1,2,3,4,5} and E={(1,2), (1,3), (2,3), (2, 4), (3,4), (4, 5)}
 Hence, the digraph G becomes as

 Weighted Graph
 In many applications, each edge of a graph has an associated numerical value,
called a weight.
 Consider the graph G as

G:
 Example:
 Let us consider V={1, 2, 3, 4, 5} and E={𝑒1 , 𝑒2 , 𝑒3 , 𝑒4 , 𝑒5 }, where, 𝑒1 =(1, 2), 𝑒2 =(1, 3),
𝑒3 =(2, 4), 𝑒4 =(3, 4), 𝑒5 =(4, 5) and w(𝑒1 )=3, w(𝑒2 )=5, w(𝑒3 )=2, w(𝑒4 )=4, w(𝑒5 )=1. Find
the graph G.
 Degree of Vertex
 The degree of vertex is the number of edges having that vertex as an end point.
 Isolated Vertex
 A vertex with degree 0 is called an isolated vertex.
 Example:
 Consider the following graphs G and D
G:
 In the graph in Figure G, the vertex A has
D:
 degree 2, vertex B has degree 4, and vertex
 E has degree 3. In Figure D, vertex a has
 degree 4, vertex e (isolated degree) has
 degree 0, and vertex b has degree 2.
 Path
 A path in a graph is a sequence of v_1 , v_2,…, v_k of vertices each adjacent to the
next, and a choice of an edge between each v_i and v_(i+1) so that no edge is
chosen more than once.
 Consider the graph G as
 Path is a, b, c, d or can use a, c, d G:

 Circuit is a path that begins and ends at the same vertex.


 Complete Graph
 The graph G is called complete if every vertex in G is connected to every other
vertex.
 Consider the graph G as
 The graph G is complete G:
 Regular Graph
 If each vertex of a graph has the same degree as every other vertex, the graph is
called regular.
 Consider the graph G as G:
 In graph G, degree (v_1) = degree (v_2)= degree (v_3)=2
 Also the graph is complete.
First stage, computer department, college of science for
women, university of Baghdad.
Dr. Amer Al-Mahdawi.
 If each vertex of a graph has the same degree as every other vertex, the graph is
called regular.
G:
 Consider the graph G as
 In graph G, degree (𝑣1 ) = degree (𝑣2 )= degree (𝑣3 )=2
 Also the graph is complete.
 Example:
G:
 Consider the graph G as
 Here the degree of every vertex is 3, but the graph is not
 complete.
 Problems
1. In exercises a through d, give V, the set of vertices, and E, the set of edges for the
graph G.
a b c d

2. Draw a picture of the graph G=)V, E), where V={a, b, c, d, e}, E={𝑒1 , 𝑒2 , 𝑒3 , 𝑒4 , 𝑒5 , 𝑒6 },
and 𝑒1 = 𝑒5 = {𝑎, 𝑐}, 𝑒2 = {𝑎, 𝑑}, 𝑒3 = {𝑒, 𝑐}, 𝑒4 = {𝑏, 𝑐}, and 𝑒6 = {𝑒, 𝑑}.
3. Give the degree of each vertex in Figure a in 1.
4. Give the degree of each vertex in Figure c in 1.
5. List all paths that begin at a in Figure b in 1.
6. List three circuits that begin at 5 in Figure d in 1.
7. Which of the graphs in 1(a, b, or c) are regular?
 If there is a path containing one or more edges which starts from a vertex 𝑣 and
terminates into the same vertex, then the path is known as a cycle.
 Example
 Consider the graph G as G:

 In the graph G, one cycle is 1,2,3,1, and another cycle is 1,2,3,4,1


 Pendant Vertex
 A vertex v of a graph of G is said to be a pendant vertex if and only if it has degree
1.
G:
 Consider the graph G as
 In graph G degree of g, f, e, d are equal 1. Therefore, these
 vertices are pendant vertices.
 The most useful way of representing any graph is the matrix representation. It is a
square matrix of order (𝑛 × 𝑛) where, n is the number of vertices in the graph G.
Generally denoted by 𝐴 = [𝑎𝑖𝑗 ] where 𝑎𝑖𝑗 is the ith row and jth column element. The
general form of adjacency matrix is given as
𝑎11 𝑎12 𝑎13 𝑎1𝑛
𝑎21 𝑎22 𝑎23 ⋯ 𝑎2𝑛
1; 𝑖𝑓 𝑡ℎ𝑒𝑟𝑒 𝑖𝑠 𝑎𝑛 𝑒𝑑𝑔𝑒 𝑓𝑟𝑜𝑚 𝑣𝑖 𝑡𝑜 𝑣𝑗
 A= 𝑎31 𝑎32 𝑎33 𝑎3𝑛 Where, 𝑎𝑖𝑗 = ቊ
⋮ ⋱ ⋮ 0; 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
𝑎𝑛1 𝑎𝑛2 𝑎𝑛3 ⋯ 𝑎𝑛𝑛
 This matrix is called as adjacency matrix.
 Notes
 In the adjacency matrix if the main diagonal elements are zero, then the graph is said to
be a simple graph.
 In case of a multi graph the adjacency matrix can be found out with the relation. 𝑎𝑖𝑗
𝑛; 𝑛 𝑏𝑒 𝑡ℎ𝑒 𝑛𝑢𝑚𝑏𝑒𝑟 𝑜𝑓 𝑒𝑑𝑔𝑒𝑠 𝑓𝑟𝑜𝑚 𝑣𝑖 𝑡𝑜 𝑣𝑗
=ቊ
0; 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
 In case of a weighted graph the adjacency matrix can be found out with the
relation.
𝑤; 𝑤 𝑖𝑠 𝑡ℎ𝑒 𝑤𝑒𝑖𝑔ℎ𝑡 𝑜𝑓 𝑡ℎ𝑒 𝑒𝑑𝑔𝑒𝑠 𝑓𝑟𝑜𝑚 𝑣𝑖 𝑡𝑜 𝑣𝑗
1. 𝑎𝑖𝑗 =
0; 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
G:
 Consider the graph G as
 Hence, the adjacency matrix is given as

𝑣1 𝑣2 𝑣3 𝑣4 𝑣5 𝑣6
𝑣1 0 1 1 0 0 1
𝑣2 1 0 1 0 0 0
 A= 𝑣3 1 1 0 1 0 0
𝑣4 0 0 1 0 1 0
𝑣5 0 0 0 1 0 0
𝑣6 1 0 0 0 0 0
 Example: G:
 Consider the graph G as
 The adjacency matrix of the above graph with respect to

0 0 3 0
5 0 1 7
 the ordering A, B, C, and D is given as 𝐴 =
2 0 0 4
0 6 8 0
 Example:
 Consider the graph G as G:
 Find the adjacency matrix of the graph with respect to the
 ordering A, B, C and D.
 Suppose that G be a simple undirected graph with 𝑚 vertices and 𝑛 edges, then the
incidence matrix I=[𝑎𝑖𝑗 ] is a matrix of order (𝑚 × 𝑛) where the element 𝑎𝑖𝑗 is
defined as
1; 𝑖𝑓 𝑣𝑒𝑟𝑡𝑒𝑥 𝑖 𝑏𝑒𝑙𝑜𝑛𝑔𝑠 𝑡𝑜 𝑒𝑑𝑔𝑒𝑠 𝑗
 𝑎𝑖𝑗 =
0; 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
 Consider the graph G as G:

 Hence, the incidence matrix of the graph G is of order (4 × 5).


 The incidence matrix relative to the ordering a, b, c, d and
 𝑒1 , 𝑒2 , 𝑒3 , 𝑒4 , 𝑒5 is given as
1 0 0 0 1
1 1 0 1 0
𝐼=
0 1 1 0 0
0 0 1 1 1
 Suppose that G be simple graph with n vertices. Then the (𝑛 × 𝑛) matrix
P=[𝑝𝑖𝑗 ](𝑛×𝑛) defined by
1; 𝑖𝑓 𝑡ℎ𝑒𝑟𝑒 𝑖𝑠 𝑎 𝑝𝑎𝑡ℎ 𝑓𝑟𝑜𝑚 𝑣𝑖 𝑡𝑜 𝑣𝑗 G:
 𝑝𝑖𝑗 =
0; 𝑂𝑡ℎ𝑒𝑟𝑤𝑖𝑠𝑒
 is known as the path matrix of the graph G.
 Consider the graph G as
 The path matrix of the graph relative to the ordering
 𝑣1 , 𝑣2 , 𝑣3 , 𝑣4 , 𝑣5 is given as
0 1 0 1 1
1 0 0 1 1
𝑃= 0 0 0 0 0
1 1 0 0 1
1 1 0 1 0
 A graph is called connected if there is a path from any vertex to any other vertex in
graph. Otherwise, the graph is disconnected.
 Consider the graphs G and D as G: D:

 The graph in G is connected while,


 in graph D is disconnected.
 Statements
 Statements is a verbal sentence helpful will be denoted by the letters , 𝑞, 𝑟, … . . . The
fundamental property of a statement is that it is either true or false but not both.
The truth fullness or falsity of a statement is called its truth value. Some statements
are composite, that is, composed of sub statements are various connectives which
will be discussed subsequently.
 Example:
 1. " 𝐻𝑖𝑏𝑎 𝑖𝑠 𝑎 𝑛𝑖𝑐𝑒 𝑎𝑛𝑑 𝑎 𝑐𝑙𝑒𝑣𝑒𝑟 𝑔𝑖𝑟𝑙 " is a composite statement with sub statements
" 𝐻𝑖𝑏𝑎 𝑖𝑠 𝑎 𝑛𝑖𝑐𝑒 " and " 𝐻𝑖𝑏𝑎 𝑖𝑠 𝑎 𝑐𝑙𝑒𝑣𝑒𝑟 𝑔𝑖𝑟𝑙 " .
 2. " 𝑊ℎ𝑒𝑟𝑒 𝑎𝑟𝑒 𝑦𝑜𝑢 𝑔𝑜𝑖𝑛𝑔? " is not a statement since it is neither true nor false.
 3. " 𝐽𝑜ℎ𝑛 𝑖𝑠 𝑠𝑖𝑐𝑘 𝑜𝑟 𝑜𝑙𝑑 " is a composite statement with sub statements
" 𝐽𝑜ℎ𝑛 𝑖𝑠 𝑠𝑖𝑐𝑘 " or " 𝐽𝑜ℎ𝑛 𝑖𝑠 𝑜𝑙𝑑 ".
 A fundamental property of a composite statement is that, its truth value is
completely determined by the truth value of its sub statements and the way they
are connected to form the composite statement.
 Conjunction
 Any two statements can be combined by the word " 𝑎𝑛𝑑 " to form a composite
statement which is called the conjunction of the original statements. The
conjunction of the two statements 𝑝 𝑎𝑛𝑑 𝑞 is denoted by 𝑝 ∧ 𝑞.
 Example:
 Let 𝑝 be " 𝐼𝑡 𝑖𝑠 𝑟𝑎𝑖𝑛𝑖𝑔 " and let 𝑞 be " 𝑇ℎ𝑒 𝑠𝑢𝑛 𝑖𝑠 𝑠ℎ𝑖𝑛𝑖𝑛𝑔 ". Then 𝑝 ∧ 𝑞 denotes the
statement "𝐼𝑡 𝑖𝑠 𝑟𝑎𝑖𝑛𝑖𝑔 𝑎𝑛𝑑 𝑡ℎ𝑒 𝑠𝑢𝑛 𝑖𝑠 𝑠ℎ𝑖𝑛𝑖𝑛𝑔 " . The truth value of the composite
statement 𝑝 ∧ 𝑞 satisfies the following property:
 If 𝑝 is true and 𝑞 is true, then 𝑝 ∧ 𝑞 is true, otherwise 𝑝 ∧ 𝑞 is false. In other words,
the conjunction of two statement is true only if each component is true.
 Example:
 Consider the following four statements
 1. Paris is in France and 2 + 2 = 5.
 2. Paris is in England and 2 + 2 = 4.
 3. Paris is in England and 2 + 2 = 5.
 4. Paris is in France and 2 + 2 = 4.
 It is clear that only (4) is true. Each of the other statements is false since at least one
of its components is false.
 Truth table of " 𝑝 ∧ 𝑞 " can be written in the form
p q 𝒑∧𝒒
T T T
T F F
F T F
F F F
 Disjunction
 Any two statements can be combined by the word " 𝑜𝑟 " to form a new statement
which is called the disjunction of the original two statements. The disjunction of
statements 𝑝 𝑎𝑛𝑑 𝑞 is denoted by 𝑝 ∨ 𝑞.
 Example:
 Let 𝑝 be " 𝐻𝑒 𝑠𝑡𝑢𝑑𝑖𝑒𝑑 𝐹𝑟𝑒𝑛𝑐ℎ 𝑎𝑡 𝑡ℎ𝑒 𝑢𝑛𝑖𝑣𝑒𝑟𝑠𝑖𝑡𝑦 ", and let 𝑞 be " 𝐻𝑒 𝑙𝑖𝑣𝑒𝑑 𝑖𝑛 𝐹𝑟𝑎𝑛𝑐𝑒 "
then 𝑝 ∨ 𝑞 is the statement
" 𝐻𝑒 𝑠𝑡𝑢𝑑𝑖𝑒𝑑 𝐹𝑟𝑒𝑛𝑐ℎ 𝑎𝑡 𝑡ℎ𝑒 𝑢𝑛𝑖𝑣𝑒𝑟𝑠𝑖𝑡𝑦 𝑜𝑟 ℎ𝑒 𝑙𝑖𝑣𝑒𝑑 𝑖𝑛 𝐹𝑟𝑎𝑛𝑐𝑒 ".
 The truth value of the composite statement 𝑝 ∨ 𝑞 satisfies the following property:
 If 𝑝 is true or 𝑞 is true or both 𝑝 𝑎𝑛𝑑 𝑞 are true, then 𝑝 ∨ 𝑞 is true, otherwise, 𝑝 ∨ 𝑞 is
false. In other words, the disjunction of two statements is false only if 𝑝 𝑎𝑛𝑑 𝑞 are
false. The truth table of " 𝑝 ∨ 𝑞 " can be written in the form
p q 𝒑∨𝒒
T T T
T F T
F T T
F F F
 Example:
 Consider the following four statements
 1. Paris is in France or 2 + 2 = 5.
 2. Paris is in England or 2 + 2 = 4.
 3. Paris is in France or 2 + 2 = 4.
 4. Paris is in England or 2 + 2 = 5.
 It is clear that only (4) is false. Each of the other statements is true since at least one
of its components is true.
 Negation
 Given any statement 𝑝, another statement, called the negation of 𝑝, can be formed
by writing " 𝐼𝑡 𝑖𝑠 𝑓𝑎𝑙𝑠𝑒 𝑡ℎ𝑎𝑡 … " before 𝑝 or, if possible by inserting in 𝑝 the word
" 𝑛𝑜𝑡 " . The negation of 𝑝 is denoted by ∿𝑝.
 Example:
 Consider the following three statements
 1. Paris is in France.
 2. It is false that Paris is in France.
 3. Paris is not in France.
 Then (2) and (3) are each the negation of (1).
 Example:
 Consider the following statements
 1. 2 + 2 = 5
 2. It is false that 2 + 2 = 5
 3. 2 + 2 ≠ 5
 Then (2) and (3) are each the negation of (1).
 The truth value of the negation of a statement satisfies the following property:
 If 𝑝 is true, then ∿𝑝 is false; if 𝑝 is false, then ∿𝑝 is true.
𝒑 ∿𝒑
T F
F T
 Conditional
 Many statements, especially in mathematics are of the form " 𝑖𝑓 𝑝 𝑡ℎ𝑒𝑛 𝑞 " such
statements are called conditional statements and are denoted by 𝑝 → 𝑞. The truth
value of the conditional statement 𝑝 → 𝑞 satisfies the following property:
 The conditional 𝑝 → 𝑞 is true unless 𝑝 is true and 𝑞 is false.
 The truth table of " 𝑝 → 𝑞 " can be written in the form
p q 𝒑→𝒒
T T T
T F F
F T T
F F T
First stage, computer department, college of science for
women, university of Baghdad.
Dr. Amer Al-Mahdawi.
 Remark:
 Consider the conditional proposition 𝑝 → 𝑞 and other simple conditional proposition
which contain 𝑝 and 𝑞, i.e. 𝑝 → 𝑞, 𝑞 → 𝑝, ∿𝑝 → ∿𝑞 𝑎𝑛𝑑 ∿𝑞 → ∿𝑝, called respectively, the
converse, inverse, and contra positive propositions. The truth table of these four
propositions are as follows:
p q ∿𝒑 ∿𝒒 𝒑→𝒒 𝒒→𝒑 ∿𝒑 → ∿𝒒 ∿𝒒 → ∿𝒑
T T F F T T T T
T F F T F T T F
F T T F T F F T
F F T T T T T T
 Example:
 Let 𝑝: 𝑁𝑜𝑜𝑟 𝑎𝑡 ℎ𝑜𝑚𝑒.
 𝑞: 𝑁𝑜𝑜𝑟 𝑎𝑛𝑠𝑤𝑒𝑟𝑠 𝑡ℎ𝑒 𝑝ℎ𝑜𝑛𝑒.
 𝑝 → 𝑞: 𝐼𝑓 𝑁𝑜𝑜𝑟 𝑎𝑡 ℎ𝑜𝑚𝑒 𝑡ℎ𝑒𝑛 𝑠ℎ𝑒 𝑤𝑖𝑙𝑙 𝑎𝑛𝑠𝑤𝑒𝑟 𝑡ℎ𝑒 𝑝ℎ𝑜𝑛𝑒.
 𝑞 → 𝑝: 𝐼𝑓 𝑁𝑜𝑜𝑟 𝑎𝑛𝑠𝑤𝑒𝑟𝑒𝑑 𝑡𝑜 𝑡ℎ𝑒 𝑝ℎ𝑜𝑛𝑒 𝑡ℎ𝑒𝑛 𝑠ℎ𝑒 𝑖𝑠 𝑎𝑡 ℎ𝑜𝑚𝑒.
 ∿𝑝 → ∿𝑞: 𝐼𝑓 𝑁𝑜𝑜𝑟 𝑖𝑠 𝑛𝑜𝑡 𝑎𝑡 ℎ𝑜𝑚𝑒 𝑡ℎ𝑒𝑛 𝑠ℎ𝑒 𝑖𝑠 𝑛𝑜𝑡 𝑎𝑛𝑠𝑤𝑒𝑟 𝑡ℎ𝑒 𝑝ℎ𝑜𝑛𝑒.
 ∿𝑞 → ∿𝑝: 𝐼𝑓 𝑁𝑜𝑜𝑟 𝑖𝑠 𝑛𝑜𝑡 𝑎𝑛𝑠𝑤𝑒𝑟 𝑡ℎ𝑒 𝑝ℎ𝑜𝑛𝑒 𝑡ℎ𝑒𝑛 𝑠ℎ𝑒 𝑖𝑠 𝑛𝑜𝑡 𝑎𝑡 ℎ𝑜𝑚𝑒.
 Biconditional
 Another common statement is of the form " 𝑝 𝑖𝑓 𝑎𝑛𝑑 𝑜𝑛𝑙𝑦 𝑖𝑓 𝑞 " or simply, " 𝑝 𝑖𝑓𝑓 𝑞 ".
Such statements are called biconditional statements and denoted by 𝑝 ↔ 𝑞.
 The truth value of the biconditional statement 𝑝 ↔ 𝑞 satisfies property:
 If 𝑝 𝑎𝑛𝑑 𝑞 have the same truth value, then " 𝑝 ↔ 𝑞 " is true,
 If 𝑝 𝑎𝑛𝑑 𝑞 have opposite truth value, then " 𝑝 ↔ 𝑞 " is false.
 Example:
 Consider the following statements
 1. Paris is in France iff 2 + 2 = 5.
 2. Paris is in England iff 2 + 2 = 4.
 3. Paris is in France iff 2 + 2 = 4.
 4. Paris is in England iff 2 + 2 = 5.
 According , (3) and (4) are true while (1) and (2) are false.
 The truth table written as follows
p q 𝒑↔𝒒
T T T
T F F
F T F
 Logical Equivalence F F T

 Two statements are said to be logically equivalent if their truth table are identical.
We denote the logical equivalent of 𝑝 𝑎𝑛𝑑 𝑞 by " ≡ ".
 Example:
 The truth tables of 𝑝 → 𝑞 ∧ 𝑞 → 𝑝 𝑎𝑛𝑑 𝑝 ↔ 𝑞 are as follows:
p q 𝒑→𝒒 𝒒→𝒑 𝒑 → 𝒒 ∧ (𝒒 → 𝒑)
T T T T T
T F F T F
F T T F F
F F T T T

p q 𝑝↔𝑞
T T T
T F F
F T F
F F T
 Hence, 𝑝 → 𝑞 ∧ 𝑞 → 𝑝 ≡ 𝑝↔𝑞
 Example:
 The truth tables below show that 𝑝 → 𝑞 𝑎𝑛𝑑 ∿𝑝 ∨ 𝑞 are logically equivalent, i.e. 𝑝
→ 𝑞 ≡ ∿𝑝 ∨ 𝑞

p q 𝒑→𝒒 p q ∿𝒑 ∿𝒑 ∨ 𝒒
T T T T T F T
T F F T F F F
F T T F T T T
F F T F F T T

 Problems
 Show that
 1. ∿(𝑝 ∧ 𝑞) ≡ ∿𝑝 ∧ ∿𝑞
 2. ∿(𝑝 → 𝑞) ≡ 𝑝 ∧ ∿𝑞

You might also like