Introduction To Discrete Mathematics
Introduction To Discrete Mathematics
Mathematics
Discrete Mathematics and logic
are the core for any modern study of
Computer Science.
Why do we study Discrete Mathematics
• Learn a particular set of mathematical facts and how to apply them
for solving problems in operations research
• Teach us how to think logically and mathematically
• How to solve a problem in different ways
• To understand and create mathematical arguments
• Provides the mathematical foundations for many computer science
courses for example: data structures, algorithms, database theory,
automata theory, formal languages, compiler theory, computer
security, and operating systems.
What is Discrete Mathematics
• Discrete Mathematics is not a branch of mathematics, like algebra,
calculus, etc.
• Its set of branches of math that all have in common the feature that
they are "discrete" rather than "continuous” such as:
• Logic and Boolean algebra
• Relations and Functions
• Algorithms and Theory of Computation
• Number Theory
• Matrix Theory
• Induction and Recursion
Discrete numbers sets
• Discrete means made up of distinct parts, collection of objects called
Sets.
• Set is countable if its members can be counted or finite:
• W: the positive natural numbers (1,2,3…)
• N: the natural numbers (0,1,2,3…)
• Z: the integers (…–3,–2,–1,0,1,2,3…)
• Q: the rational numbers (i.e., fractions, or repeating decimals)
• BUT
• R, the real numbers (i.e., whole numbers 0,1,2 rational numbers ¾, 0.252, 1.2
irrational numbers as π, e, √2, etc.) is not countable!
Example of Discrete and Continuous
• Discrete math concerns sets of objects that are countable.
Continuous math concerns sets of objects that are "measurable".
• An analog clock is (at least in theory) continuous but a digital clock is
discrete
• A film, with "frames", is discrete while the real events depicted on the
film are continuous.
Mathematical Modelling
• Understanding how machine works is done by modelling it as discrete
mathematical system.
• For that reason, we are studying discrete mathematics, so we obtain
the tools and techniques required to design and understand
computer systems.
• Learning how to use these tool and techniques is knows as
mathematical modelling.
• So Mathematical modelling is the process of using mathematics to
create a formulate solutions to real work problems.
Modelling
Abstract Transformed
Problem Solution
Model Model
Pseudocode & Algorithms
• Pseudocode is a collection of structured language elements suitable
for expressing an algorithm in unambiguous terms.
• Algorithm is unambiguous sequence of instructions that yields a
solution to come problem in finite time.
Algorithms
Algorithms are made of statements: assigned statements and control
statements.
begin
statement 1;
statement 2;
.
.
statement n;
end
Conditional statement
• Allows a choice between two alternatives and is of the form if-then or if-then-else.
begin
if condition then statement
end
Or
begin
if condition then statement 1
else statement 2
end
Iterative statements or loops
Can be in one of the following format:
repeat
statement 1;
statement 2;
.
.
statement n;
until condition
Example 1
• Give an algorithms that add two numbers together and assign the
result to Total:
begin
Input First_number and Second_number;
Total:= First_number + Second_number
end
Example 2
• Give an algorithms that interchange the values assigned to two
variables A and B
begin
Input A and B;
Temp := A
A := B
B := Temp
end
Example 3
• Give an algorithms that compute the absolute value of n and store
the results in absolute
begin
Input x;
if x<0 then absolute := -x
else absolute := x
Output absolute;
end
Example 3 without using else
• Give an algorithms that compute the absolute value of n and store
the results in absolute
begin
Input x;
if x<0 then x:= -x;
absolute := x;
Output absolute;
end
Example 4
• Give an algorithms that compute the sum of the squares of the first x positive integers
begin
sum := 0;
for i:=1 to x do
begin
j:=i*i;
sum := sum + j;
end
Output sum;
end
• Converting algorithms into working programs is the subject of
Programming and Algorithms and Data Type modules.
• So this module Mathematics for Computing will teach you the tools
and techniques you require for mathematical modelling.
George Boole was born in Lincoln, England, in
November 1815. Because of his family’s
difficult financial situation, Boole struggled to AUGUSTA
educate himself while supporting his family. ADA,
Nevertheless, he became one of the most COUNTESS
important mathematicians of the 1800s OF
Boole introduced what is now called Boolean LOVELAC
algebra E (1815–
GEORGE BOOLE (1815–1864) 1852)
Augustus De Morgan was born in India, where Augusta Ada was the only child from the
his father was a colonel in the Indian army. De marriage of the famous poet Lord Byron
Morgan’s family moved to England when he and Lady Byron, Annabella Millbanke,
was 7 months old. De Morgan studied who separated when Ada was 1 month
mathematics at Trinity College, Cambridge, old.
graduating in 1827. Ada showed her gift for mathematics at
In the 1840s De Morgan made fundamental an early age. She translated an article on
contributions to the development of symbolic an invention by Charles Babbage, and
logic. He invented notations that helped him added her own comments. Because she
prove propositional equivalences, such as the introduced many computer concepts,
laws that are named after him. Ada is considered the first computer
AUGUSTUS DE MORGAN (1806–1871) programmer.
Week 2,3,4 : • Propositions
• Truth Tables
Logic Theory • De Morgan’s Laws
structure
Week 8,9,10: • Graphs of Functions
• Functions Terminology
Functions • Operators over functions