Sei sulla pagina 1di 42

DISCRETE MATHEMATICS

K.H. Rosen, Discrete Maths and its


applications, McGraw-Hill.
Course covers introduction to set theory,
functions, relations, logic, graphical
representation.

Functions
Df A function is a rule which assigns to
each member a of a set A a unique
member b of set B. We write f: AB.
Alternatively we write f(a)=b. So far have
been concerned with the case when
A=B=R (the set of real numbers)
Note for each element a of A an element b
exists in B but not vice-versa.

Functions as relations
Recall relation is a subset of AxB
A function is a special case of relation R
where (a,b) in R implies there is no (a,b)
in R unless b , b coincide and where there
is (a,b) in R for any a in A.
Thus for a function F the following
statements are equivalent
F(a)=b, aFb, (a,b)F.

Domain and Codomain of f: AB


A is the domain, B is the codomain of f
Example let f be the function that rounds
up a number to the nearest integer. Hence
round(.1)=0, round (3.6)=4. So round
RZ.
Hence domain is the set of real numbers
whilst the codomain is the set of integers.

Image, pre-image and Range


If f(a)=b we say b is the image of a under f.
Likewise we refer to a as the pre-image of b. We
also talk about the images and pre-images of
subsets of A and B. For example if S is a subset
of A the image of S is f(S)={f(s) | sS}. The
range of a function is the set f(A).
Ex suppose f: RR,f(x)=x, then image of 2 is 4,
pre-image of 9 is 3, Range of f is {xR,|x>0}.

Injective,surjective,bijective
A function is injective if f(x)=f(y) implies
x=y. ( one to one mapping) Examples
f(x)=x+1, f(x)=x both defined on R are
injective, not injective. But if we define
only on positive real numbers both are
injective.
A function is surjective if for every element
b of B there exists a in A with f(a)=b.
( mapping is onto)

Example
f:RR f(x)=x+1 is surjective
f(x)=x is not surjective since no x exists
with f(x)=-1. But if we define on C the set
of complex numbers both are surjective.
Definition If f is surjective and injective we
say it is bijective ( one to one and onto)

Exercise

Consider two finite sets A and B. Evaluate:


a) The number of functions from A to B.
b) The number of injections from A to B.
c) The number of bijections from A to B.

Exercise- find examples of


functions from N to N satisfying:

a) An injection but not surjection


b) A surjection but not injection
c) A bijection
d) neither a surjection or injection

Inverse of a function
Df The function f:BA is the inverse of f : A
B and has the property that f(f(x))=x,:xA
Theorem The function f has an inverse iff f is
bijective. To prove this think of f as the relation
{(b,a))},with (a,b)f BA
Since f injective there is no more than one
element of A for each element of B and since f
surjective there is no less than one element of A
for each element of B so f is a function

Inverse
Now show if f has an inverse it must be bijective
If f(a)=f(b)it follows that f(f(a))=f(f(b) so by
definition of inverse we have a=b so that f is
injective
For any b in B a=f(b) and then f(a)=f(f(b))=b
so there is an element a in A for every b in B
with f(a)=b, so f is surjective. Since f injective
and surjective it is also bijective

INTRODUCTION TO LOGIC
What do we mean by logic?
Oxford Dict. The systematic use of
symbolic techniques and mathematical
techniques to determine the forms of valid
deductive argument.
Thus logic is the common language by
which we can demonstrate the validity of
our reasoning

PROPOSITIONS AND
NEGATIONS
Proposition is a declarative statement that is true or
false, but not both.
Ex All Maths undergraduates wear sandals. False
All Maths undergraduates have tutors. True
If a relation is transitive then R is transitive. True
Hopefully the Circle Line will be running tonight. Not a
proposition.
Propositional logic is the branch of logic dealing with
reasoning about propositions.
We will use symbols to denote propositions. Ex let p be
the proposition all Maths students wear glasses. Let p be
the proposition that all EE1 students know how to wire a
plug. False.

NEGATION AND USE OF


PROPOSITIONS
Use several propositions to build compound
propositions
Df Let p be a proposition. Then the proposition
It is not the case that p is another proposition
called the negation of p and written as p. Ex
This lecture course is given at Imperial College.
Its negation is It is not the case that this lecture
course is given at Imperial College. OR this
lecture course is not given at Imperial College.

Conjuncton and Disjunction


Given propositions p and q the proposition p and q
written pq is true when both p and q are true and false
otherwise, it is called the conjunction of p and q.
Given propositions p and q then the proposition p or q
denoted by pq is the proposition that is false when both
p and q are false and true otherwise. pq is called the
disjunction of p and q.
Ex Suppose p is Maths undergraduates love tofu and q
is Maths undergraduates are weird
Then pq is Maths undergrads either love tofu or are
weird or both.
pq is maths undergrads like tofu and are weird.

IMPLICATIONS
When we say p implies q, written pq, we mean
the proposition which is false when p is true and
q is false, and true otherwise. ( think )
When pq we might say if p, then q, p is
sufficient for q, q if p, q is necessary for p, p
only if q
Example Suppose p is I revised and q is I
passed the exam Then pq may be expresed
as if I revised I passed I passed if I revised or I
revised only if I passed

Implications
There is no need for a relationship between the premise
and conclusion. Example If all Maths undergrads like
tofu, then 1+1=2. True regardless of tofu.
If all Maths undergrads like tofu then 1+2=4 True
because not all undergrads like tofu.
If we are in london 1+2=4 False because we are in
London but 1+2 is 3.
If all Maths undergrads like tofu then 1+2=4 True since
not all maths students like tofu.
Note that in English implies can also mean causes so
English considers the meaning of propositions whilst
Logic considers whether they are true or false..

CONVERSE, CONTRAPOSITIV,
AND INVERSE
a iff b is the same as (ab)(ba) and is
written as ab. Hence ab is true when a and b
are both true or when a and b are both false
(and is otherwise false)
We define ba to be the converse of ab.
The contrapositive of a proposition ab is the
proposition ba.
The inverse of ab is the proposition ab.

LOGICAL EQUIVALENCE
A tautology is a compound proposition that is
always true, eg pp is a tautology.
A contradiction is a compound proposition that is
always false. Eg pp is a contradiction.
We say propositions p and q are logically
equivalent, written as if pq, if pq is a
tautology. Eg (pq)pq.. De Morgans
Theorem
We can express an implication in terms of a
disjunction and a negation pqpq

LOGIVAL EQUIVALENCE
Hence an implication is logically
equivalent to its contrapositive
pqpqqpqp
If I revised, I passed if I didnt pass I
didnt revise.
Likewise its converse is logically
equivalent to its inverse.
qpqppqpq

LOGICAL EQUIVALENCE
The most common mistake in logic is to
assume an implication is logically
equivalent to its inverse
Examples: if I revised I passed is not
equivalent to if I didnt revise I didnt pass
if I eat too much I will get fat is not
equivalent to if I dont eat too much I will
not get fat

OPERATOR PRECEDENCE

BASIC RULES
aba(b)
abca(bc)
abc(ab)c
Hence order of increasing precedence is

LOGIC AND ENGLISH


LANGUAGE
Language often ambiguous so try and identify the basic
propositions and build into logical statements.
I sell donuts and coffee I sell coffee ^I sell donuts
I am not good at golf(I am good at golf)
If its raining its not sunnyrainingsunny
You can have chicken or fish you can have chicken
you can have fish
Unless causes problems!!! I will play golf if it doesnt rain
can be (it will rain')'I will play golf
or (it will rain')I will play golf

PREDICATE LOGIC
Propositional logic is limited, eg how do we
express All Maths undergrads are clever in
terms of the cleverness of particular maths
undergrads? Or express there is a maths
undergrad wearing sandals in terms of whether
each individual maths undergrad is wearing
sandals
We therefore generalize the idea of a proposition
to a predicate, predicates take one or more
variable as arguments

PREDICATE LOGIC
Examples: Let P(x) be the statement
x>12 then P(1) is false, P(23) is true.
Let P(x) denote the statement x is a
Professor in the Mathematics Department
then P(Hall) is true but P(Limebeer) is
false
Thus P(x) is not true or false until we
specify an argument

UNIVERSAL QUANTIFIERS
Suppose P(x) is the predicate has a heart
Then we can discuss P(Hall), P(Limebeer) but
how can we say all humans have a heart.
Predicates deal with this using quantification.
Definition The universal quantification of P(x) is
the proposition P(x) is true for all values of x in
the universe of discourse Hence in the universe
of discourse consisting of all humans we would
say the universal quantification of P(x) is true
Notation We write xP(x) which we read as for
all x, P(x) for the universal quantification of P(x)

UNIVERSAL QUANTIFICATION
Of course we also need to specify the
universe of discourse but here can use set
theory
Suppose P(x) is the predicate x0, then
we can say xR P(x), ie for all real x
P(x)
but (xC P(x))

EXISTENTIAL QUANTIFIER
Suppose P(x) is x is wearing a necklace then
P(Florence) is the proposition Florence is
wearing a necklace but how do we say there is
an EE1 Student wearing a necklace?
Definition The existential quantification of P(x) is
the proposition there exists an element x in the
universe of discourse such that P(x) is true
Notation we write xP(x) which we read as there
exist x such that P(x). Hence if J=set of all EE!
Students we can write xJP(x)

Potrebbero piacerti anche