l1 DM Eng 2016
l1 DM Eng 2016
What is discrete mathematics? Discrete mathematics is the part of mathematics devoted to the study
of discrete objects (Here discrete means consisting of distinct or unconnected elements). More
generally, discrete mathematics is used whenever objects are counted, when relationships between
finite (or countable) sets are studied, and when processes involving a finite number of steps are
analyzed. A key reason for the growth in the importance of discrete mathematics is that information
is stored and manipulated by computing machines in a discrete fashion.
There are several important reasons for studying discrete mathematics. First, through this course you
can develop your mathematical maturity, that is, your ability to understand and create mathematical
arguments. You will not get very far in your studies in the mathematical sciences without these
skills. Second, discrete mathematics is the gateway to more advanced courses in all parts of the
mathematical sciences. Discrete mathematics provides the mathematical foundations for many
computer science courses, including data structures, algorithms, database theory, automata theory,
formal languages, compiler theory, computer security, and operating systems. Students find these
courses much more difficult when they have not had the appropriate mathematical foundations from
discrete math.
Logic
The rules of logic specify the precise meaning of mathematical statements. For instance, the rules
give us the meaning of such statements as, “There exists an integer that is greater than 100 that is a
power of 2”, and “For every integer n the sum of the positive integers not exceeding n is ”.
Logic is the basis of all mathematical reasoning, and it has practical applications to the design of
computing machines, to artificial intelligence, to computer programming, to programming languages,
and to other areas of computer science.
Propositions
A proposition is a statement that is either true or false, but not both.
Example. All the following statements are propositions.
1. Washington, D.C., is the capital of the United States of America.
2. Toronto is the capital of Canada.
3. 1 + 1 = 2.
4. 2 + 2 = 3.
Propositions 1 and 3 are true, whereas 2 and 4 are false.
Some sentences that are not propositions are given in the next example:
Example. Consider the following sentences:
1. What time is it?
2. Read this carefully.
3. x + 1 = 2.
4. x + y = z.
Sentences 1 and 2 are not propositions because they are not statements. Sentences 3 and 4 are not
propositions because they are neither true nor false, since the variables in these sentences have not
been assigned values.
Letters are used to denote propositions, just as letters are used to denote variables. The conventional
letters used for this purpose are p, q, r, s, … 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.
We now turn our attention to methods for producing new propositions from those that we already
have. Many mathematical statements are constructed by combining one or more propositions. New
propositions, called compound propositions, are formed from existing propositions using logical
operators.
Let p be a proposition. The statement “It is not the case that p” is another proposition, called the
negation of p. The negation of p is denoted by p. The proposition p is read “not p”.
Example. Find the negation of the proposition “Today is Friday”.
Solution: The negation is “It is not the case that today is Friday”. This negation can be more simply
expressed by “Today is not Friday”.
A truth table displays the relationships between the truth values of propositions.
Table 1. The truth table for the negation of a proposition
p p
T F
F T
The negation of a proposition can also be considered the result of the operation of the negation
operator on a proposition. The negation operator constructs a new proposition from a single existing
proposition. We will now introduce the logical operators that are used to form new propositions from
two or more existing propositions. These logical operators are also called connectives.
Let p and q be propositions. The proposition “p and q”, denoted by , is the proposition that is
true when both p and q are true and is false otherwise. The proposition is called the
conjunction of p and q.
Example. Find the conjunction of the propositions p and q where p is the proposition “Today is
Friday” and q is the proposition “It is raining today”.
Solution: The conjunction of these propositions, , is the proposition “Today is Friday and it is
raining today”. This proposition is true on rainy Fridays and is false on any day that is not a Friday
and on Fridays when it does not rain.
Let p and q be propositions. The proposition “p or q”, denoted by , is the proposition that is
false when p and q are both false and true otherwise. The proposition is called the disjunction
of p and q.
Table 3. The truth table for the disjunction of two propositions
p q
T T T
T F T
F T T
F F F
The use of the connective or in a disjunction corresponds to one of the two ways the word or is used
in English, namely, in an inclusive way. A disjunction is true when either of the two propositions in
it is true or when both are true. For instance, the inclusive or is being used in the statement “Students
who have taken calculus or computer science can take this class”. Here, we mean that students who
have taken both calculus and computer science can take the class, as well as the students who have
taken just one of the two subjects. On the other hand, we are using the exclusive or when we say
“Students who have taken calculus or computer science, but not both, can enroll in this class”. Here,
we mean that students who have taken both calculus and a computer science course cannot take the
class. Only those who have taken exactly one of the two courses can take the class. Similarly, when a
menu at a restaurant states, “Soup or salad comes with an entree”, the restaurant almost always
means that customers can have either soup or salad, but not both. Hence, this is an exclusive, rather
than an inclusive, or.
Example. Find the disjunction of the propositions p and q where p is the proposition “Today is
Friday” and q is the proposition “It is raining today”.
Solution: The disjunction of p and q, , is the proposition “Today is Friday or it is raining
today”. This proposition is true on any day that is either a Friday or a rainy day (including rainy
Fridays). It is only false on days that are not Fridays when it also does not rain.
Sometimes, we use or in an exclusive sense. When the exclusive or is used to connect the
propositions p and q, the proposition “p or q (but not both)” is obtained.
Let p and q be propositions. The exclusive or of p and q, denoted by , is the proposition that is
true when exactly one of p and q is true and is false otherwise.
Table 4. The truth table for the exclusive or of two propositions
p q
T T F
T F T
F T T
F F F
Let p and q be propositions. The implication is the proposition that is false when p is true and
q is false and true otherwise. In this implication p is called the hypothesis (or antecedent or premise)
and q is called the conclusion (or consequence).
Table 5. The truth table for the implication
p q
T T T
T F F
F T T
F F T
Because implications arise in many places in mathematical reasoning, a wide variety of terminology
is used to express . Some of the more common ways of expressing this implication are: “if p,
then q”, “p implies q”, “if p, q”, “p only if q”, “p is sufficient for q”, “q if p”, “q whenever p”, “q is
necessary for p”.
We can build up compound propositions using the negation operator and the different connectives
defined so far. Parentheses are used to specify the order in which the various logical operators in a
compound proposition are applied. In particular, the logical operators in the innermost parentheses
are applied first. For instance, is the conjunction of and . To cut down on
the number of parentheses needed, we specify that the negation operator is applied before all other
logical operators. This means that is the conjunction of and , namely , not
the negation of the conjunction and , namely .
There are some related implications that can be formed from . The proposition is called
the converse of . The contrapositive of is the proposition .
Example. Find the converse and the contrapositive of the implication “If today is Thursday, then I
have a test today”.
Solution: The converse is “If I have a test today, then today is Thursday”. And the contrapositive of
this implication is “If I do not have a test today, then today is not Thursday”.
Let p and q be propositions. The biconditional is the proposition that is true when p and q
have the same truth values and is false otherwise.
Table 6. The truth table for the biconditional
p q
T T T
T F F
F T F
F F T
Note that the biconditional is true precisely when both the implications and are
true. Because of this, the terminology “p if and only if q” is used for this biconditional. Other
common ways of expressing the proposition are: “p is necessary and sufficient for q” and “if
p then q, and conversely”.
Bit operations
Computers represent information using bits. A bit has two possible values, namely, 0 (zero) and 1
(one). This meaning of the word bit comes from binary digit, since zeros and ones are the digits used
in binary representations of numbers. A bit can be used to represent a truth value, since there are two
truth values, namely, true and false. We will use a 1 bit to represent true and a 0 bit to represent false.
That is, 1 represents T (true), 0 represents F (false). A variable is called a Boolean variable if its
value is either true or false. Consequently, a Boolean variable can be represented using a bit.
Table 7. Tables for the bit operations OR, AND and XOR.
x y
0 0 0 0 0
0 1 1 0 1
1 0 1 0 1
1 1 1 1 0
Computer bit operations correspond to the logical connectives. By replacing true by a one and false
by a zero in the truth tables for the operators , and , the tables shown in Table 7 for the
corresponding bit operations are obtained. We will also use the notation OR, AND and XOR for the
operators , and , as is done in various programming languages.
Information is often represented using bit strings, which are sequences of zeros and ones. When this
is done, operations on the bit strings can be used to manipulate this information.
A bit string is a sequence of zero or more bits. The length of this string is the number of bits in the
string.
Example. 101010011 is a bit string of length nine.
We can extend bit operations to bit strings. We define the bitwise OR, bitwise AND and bitwise XOR
of two strings of the same length to be the strings that have as their bits the OR, AND and XOR of
the corresponding bits in the two strings, respectively. We use the symbols , and to represent
the bitwise OR, bitwise AND and bitwise XOR operations respectively.
Example. Find the bitwise OR, bitwise AND and bitwise XOR of the bit strings 0110110110 and
1100011101.
Solution: 1110111111 – bitwise OR, 0100010100 – bitwise AND, 1010101011 – bitwise XOR.
Glossary
maturity – зрелость; gateway – ворота, вход
proposition – предложение; truth value – истинностное значение
compound proposition – составное (сложное) предложение; connective – связка
inclusive – включающий; exclusive – исключающий; to enroll – вносить в список
parentheses – скобки; contrapositive – противоположное
biconditional – условный в обе стороны, эквивалентность
antecedent – предшествующий, предыдущий член отношения; premise – предпосылка
conclusion – заключение; innermost – самый внутренний; to cut down – сокращать
converse – обратное; ambiguous – двусмысленный; rule of inference – правило вывода