0% found this document useful (0 votes)
61 views93 pages

DS Lecture-1

This document provides an overview of a discrete structures course. It outlines the course administration details, including times, location, instructor, and assessments. It describes what discrete mathematics is and why it is relevant to computer science. Examples are given of how discrete mathematics is used in areas like cryptography, computer graphics, and network optimization. The goals of the course are to learn about logic, sets, functions, counting, graphs, trees, and mathematical induction.

Uploaded by

Muzamal1656
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
61 views93 pages

DS Lecture-1

This document provides an overview of a discrete structures course. It outlines the course administration details, including times, location, instructor, and assessments. It describes what discrete mathematics is and why it is relevant to computer science. Examples are given of how discrete mathematics is used in areas like cryptography, computer graphics, and network optimization. The goals of the course are to learn about logic, sets, functions, counting, graphs, trees, and mathematical induction.

Uploaded by

Muzamal1656
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 93

MA - 210

Discrete Structures

Introduction
Lecture-1
Overview of this Lecture

• Course Administration

• What is it about?

• Course Themes, Goals, and Syllabus

• Propositional logic
Course Administration
Timings

Lecture Hours:

Monday (α ): 12:00 PM – 03:00 PM


Tuesday (Ω): 12:00 PM – 03:00 PM
Location:
Class Room 5

Lecturer: Mona Waseem


Office: Faculty Office (Room-10), Ground Floor, CPED
Phone: 051-9047
Email: [email protected]
Assessments

Homework (12%)
Quiz (13%)
Midterm (25%)
Final (50%)
Homework and Quiz

• Homework is very important. It is the best way for you to


learn the material.
• You can discuss the problems with your classmates, but all
work handed in should be original, written by you in
your own words.
• Homework should be handed in in class.
• 20% penalty for each day late.

• Most Probably Quiz will be announced a week


before BUT there will be NO Re-Take for Quiz
in any Case.
Textbook

Discrete Mathematics and Its Applications


by Kenneth H. Rosen, 7th Edition
Reference Book (1)

Discrete Mathematics
by Richard Johnsonbaugh
7th or 8th Edition
Reference Book (2)

Discrete Mathematics
by Edgar Goodaire and Michael Parmenter
3rd Edition.
Course Learning Outcome (CLO’s)

Bloom’s
S. No. Course Learning Outcome (CLO’s) Learning
Level

Recall the basic concepts of logic and proofs, set theory,


1. C1, PLO-1
relations in functions and complexity of algorithms.
Demonstrate the fundamental concepts of counting, graphs,
2. C2, PLO-1
trees, and Mathematical Induction.
Confidently apply the knowledge learnt to solve
3. mathematical problems in computer science and engineering C3, PLO-2
disciplines.

Learning Levels (LL): Knowledge (LL1), Comprehension (LL2), Application


(LL3), Analysis (LL4), Synthesis (LL5), Evaluation (LL6)
Overview of this Lecture

Course Administration

What is MA-210 about?

Course Themes, Goals, and Syllabus


What is MA-210 about?

Continuous vs. Discrete Math


Why is it computer science/engineering?
Mathematical techniques for DM
What Are Discrete Structures?

Discrete math is mathematics that deals with discrete objects:


• Discrete Objects are those which are separated from (distinct from)
each other, such as integers, rational numbers, houses, people, etc.
Real numbers are not discrete.
• In this course, we’ll be concerned with objects such as integers,
propositions, sets, relations and functions, which are all discrete.
• We’ll learn concepts associated with them, their properties, and
relationships among them.
Discrete structures are:
– Theoretical basis of computer science
– A mathematical foundation that makes you think logically
– A prerequisite course to understand the fundamentals of programming
Discrete vs. Continuous Mathematics

Continuous Mathematics
It considers objects that vary continuously;
Example: analog wristwatch (separate hour, minute, and second hands).
From an analog watch perspective, between 1 :25 p.m. and 1 :26 p.m.
there are infinitely many possible different times as the second hand moves
around the watch face.

Real-number system --- core of continuous mathematics;


Continuous mathematics --- models and tools for analyzing real-world
phenomena that change smoothly over time. (Differential equations etc.)
Discrete vs. Continuous Mathematics

Discrete Mathematics
It considers objects that vary in a discrete way.
Example: digital wristwatch.
On a digital watch, there are only finitely many possible different times
between 1 :25 P.m. and 1:27 P.m. A digital watch does not show split
seconds: no time between 1 :25:03 and 1 :25:04. The watch moves from one
time to the next.
Integers --- core of discrete mathematics
Discrete mathematics --- models and tools for analyzing real-world
phenomena that change discretely over time and therefore ideal for studying
computer science – computers are digital! (numbers as finite bit strings; data
structures, all discrete! Historical aside: earliest computers were analogue.)
Discrete vs Continuous
What is MA-210 about?

Why is it computer science/engineering?


(examples)
Why Discrete Mathematics? (I)

• Computers use discrete structures to represent


and manipulate data.
• is the basic building block for becoming a
Computer Scientist
• Computer Science is not Programming
• Computer Science is not Software Engineering
• Edsger Dijkstra: “Computer Science is no more
about computers than Astronomy is about
telescopes.”
• Computer Science is about problem solving.
Why Discrete Mathematics? (II)

• Mathematics is at the heart of problem solving


• Defining a problem requires mathematical rigor
• Use and analysis of models, data structures,
algorithms requires a solid foundation of
mathematics
• To justify why a particular way of solving a
problem is correct or efficient (i.e., better than
another way) requires analysis with a well-
defined mathematical model.
Problem Solving requires mathematical rigor
(Accuracy, Objectivity)

• Your boss is not going to ask you to solve


– an MST (Minimal Spanning Tree) or
– a TSP (Travelling Salesperson Problem)
• Rarely will you encounter a problem in an
abstract setting
• However, he/she may ask you to build a rotation
of the company’s delivery trucks to minimize
fuel usage
• It is up to you to determine
– a proper model for representing the problem and
– a correct or efficient algorithm for solving it
Discrete Mathematics in the Real
World

21
 Computers run software and store files.

 The software/files both stored as huge strings of 1s and 0s.

 Binary math is discrete mathematics.

22
23
24
Number Theory:
RSA and Public-key Cryptography

Alice and Bob have never met but they would like to
exchange a message. Eve would like to eavesdrop.
E.g. between you and the Bank of America.

They could come up with a good


encryption algorithm and exchange the
encryption key – but how to do it without
Eve getting it? (If Eve gets it, all security
is lost.)

CS folks found the solution:


public key encryption. Quite remarkable that is feasible.
Number Theory:
Public Key Encryption

RSA – Public Key Cryptosystem (why RSA?)


Uses modular arithmetic and large primes  Its security comes from the computational difficulty
of factoring large numbers.
• Encode:
• C = Me (mod n)
RSA Approach
• M is the plaintext; C is ciphertext
• n = pq with p and q large primes (e.g. 200 digits long!)
• e is relative prime to (p-1)(q-1) Hmm??
• Decode: What does this all mean??
d
How does this actually work?
• C = M (mod pq) Not to worry. We’ll find out.
• d is inverse of e modulo (p-1)(q-1)

The process of encrypting and decrypting a message


correctly results in the original message (and it’s fast!)
Online Shopping
Encryption and decryption are part of cryptography,
which is part of discrete mathematics. For example,
secure internet shopping uses public-key
cryptography.

28
Analog Clock
An Analog Clock has gears inside, and the sizes/teeth needed
for correct timekeeping are determined using discrete math of
modular arithmetic.

29
Dijkstra’s Algorithm and Google Maps
Google Maps uses discrete mathematics to determine
fastest driving routes and times.

30
Railway Planning
Railway planning uses discrete math: deciding how to
expand train rail lines, train timetable scheduling, and
scheduling crews and equipment for train trips use both
graph theory and linear algebra.

31
32
Computer Graphics
Computer graphics (such as in video games) use linear
algebra in order to transform (move, scale, change
perspective) objects. That's true for both applications like
game development, and for operating systems.

33
Smarter Phones for All
Cell Phone Communications: Making efficient use of the broadcast
spectrum for mobile phones uses linear algebra and information
theory. Assigning frequencies so that there is no interference with
nearby phones can use graph theory or can use discrete
optimization.

34
Graphs and Networks

Many problems can be represented


by a graphical network representation.

•Examples:
– Distribution problems
– Routing problems
Aside: finding the right
– Maximum flow problems problem representation
– Designing computer / phone / road networks is one of the key issues
– Equipment replacement in this course.
– And of course the Internet
Networks are
New Science of Networks pervasive
Sub-Category Graph
No Threshold

Utility Patent network


1972-1999
(3 Million patents)
Gomes,Hopcroft,Lesser,Selman

Neural network of the


nematode worm C- elegans
(Strogatz, Watts)

NYS Electric
Power Grid Network of computer scientists
Cyber communities
(Thorp,Strogatz,Watts) ReferralWeb System
(Automatically discovered)
(Kautz and Selman)
Kleinberg et al
Applications of Networks
Physical analog Physical analog
Applications Flow
of nodes of arcs
phone exchanges,
Cables, fiber optic Voice messages,
Communication computers,
links, microwave Data,
systems transmission
relay links Video transmissions
facilities, satellites
Pumping stations Water, Gas, Oil,
Hydraulic systems Pipelines
Reservoirs, Lakes Hydraulic fluids
Integrated Gates, registers,
Wires Electrical current
computer circuits processors
Rods, Beams,
Mechanical systems Joints Heat, Energy
Springs
Passengers,
Intersections, Highways,
Transportation freight,
Airports, Airline routes
systems vehicles,
Rail yards Railbeds
operators
Finding Friends on Facebook
Graph theory can be used in speeding up Facebook
performance.

39
DNA Fragment Assembly
Graph theory is used in DNA sequencing.

40
Applications Of Discrete Structures

Algorithms can be used in searching for a letter or number in the list.


The study of these sorting algorithms often involves analyzing their time
complexity, space complexity, and other performance characteristics
using discrete mathematics concepts.
Applications Of Discrete Structures
 Set theory can be used to determine number of students enrolled in
discrete structures and number of students enrolled in applied
physics in this semester.
Learning Discrete Mathematics make you a
better Programmer?
 One of the most important competences – that one must have; as a

program developer is to be able to choose the right algorithms and data


structures for the problem that the program is supposed to solve.
 The importance of discrete mathematics lies in its central role in the

analysis of algorithms and in the fact that many common data structures
– and in particular graphs, trees, sets and ordered sets – and their
associated algorithms come from the domain of discrete mathematics.

43
Logic and Proofs
Programmers use logic. All the time. While everyone has to
think about the solution, a formal study of logical
thinking helps you organize your thought process more
efficiently.

44
Logic:
Hardware and software specifications

Formal: Input_wire_A
value in {0, 1}

One-bit Full Adder with


Example 1: Adder
Carry-In and Carry-Out

4-bit full adder


Example 2: System Specification:

–The router can send packets to the edge system only if it supports the new address space.
–For the router to support the new address space it’s necessary that the latest software release be installed.
–The router can send packets to the edge system if the latest software release is installed.
–The router does not support the new address space.

How to write these specifications in a formal way? Use Logic.


Propositional Logic
System specifications demonstrate the requirements of
a system. These requirements are stated in English
sentences which can be ambiguous. Therefore,
translating these English requirements into logical
expressions removes the ambiguity and check for the
consistency of specifications.
Compound propositions and quantifiers can be used to
express the specifications and then find an assignment
of truth values that make all the specifications true.
Why Proofs?
Why proofs? The analysis of an algorithm requires one to
carry out (or at the very least be able to sketch) a proof of
the correctness of the algorithm and a proof of its
complexity

47
Moral of the Story???
Discrete Math is needed to see mathematical structures in

the object you work with, and understand their properties.


This ability is important for computer/software engineers,
data scientists, security and financial analysts.
it is not a coincidence that math puzzles are often used

for interviews.

48
Discrete Mathematics is a Gateway Course
Topics in discrete mathematics will be important in many
courses that you will take in the future:
Computer Science: Computer Architecture, Data Structures,
Algorithms, Programming Languages, Compilers, Computer
Security, Databases, Artificial Intelligence, Networking,
Graphics, Game Design, Theory of Computation, Game Theory,
Network Optimization ……
Other Disciplines: You may find concepts learned here useful
in courses in philosophy, economics, linguistics, and other
departments.

52
Course Themes, Goals, and Course Outline
Goals of MA-210
Introduce students to a range of mathematical tools from discrete
mathematics that are key in computer science

Mathematical Sophistication
How to write statements rigorously Practice works!
How to read and write theorems, lemmas, etc.
How to write rigorous proofs
Actually, only practice works!
Areas we will cover:
Logic and proofs Note: Learning to do proofs from
Set Theory watching the slides is like trying to
Number Theory learn to play tennis from watching
Counting and combinatorics
it on TV! So, do exercises!
Tentative Topics MA-210
Logic and Methods of Proof
Propositional Logic --- SAT as an encoding language!
Predicates and Quantifiers
Methods of Proofs
Number Theory
Modular arithmetic
RSA cryptosystems
Sets
Sets and Set operations
Functions
Counting
Basics of counting
Pigeonhole principle
Permutations and Combinations
Topics MA-210
Graphs and Trees
Graph terminology
Example of graph problems and algorithms:
graph coloring
TSP
shortest path
Min. spanning tree
What’s your job?

• Build a mathematical model for each scenario


• Develop an algorithm for solving each task
• Prove that your solutions work
– Termination: Prove that your algorithms terminate
– Completeness: Prove that your algorithms find a
solution when there is one.
– Soundness: Prove that the solution of your algorithms
is always correct
– Optimality (of the solution): Prove that your algorithms
find the best solution (i.e., maximize profit)
– Efficiency, time & space complexity: Prove that your
algorithms finish before the end of life on earth

Bart Selman
CS2800
Discrete Structures

Logic

Bart Selman
CS2800
Logic

• Logic, is the study of reasoning and making sense


of things in a systematic and clear way.
• It helps us figure out if our ideas and arguments
make sense, and it provides a way to think through
problems and come to reliable conclusions.
• Logic is like having a set of steps to follow to
make good decisions and understand things better.

Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Activity

Which of these sentences are propositions? What are the


truth values of those that are propositions?
•Boston is the capital of Massachusetts.
•Miami is the capital of Florida.
•2+3=5
•x+7=10
Answer this question

Bart Selman
CS2800
Answers

1. Boston is the capital of Massachusetts.


1. Proposition: Yes
2. Truth Value: True
2. Miami is the capital of Florida.
1. Proposition: Yes
2. Truth Value: False (Miami is not the capital of Florida; it is Tallahassee)
3. 2 + 3 = 5.
1. Proposition: Yes
2. Truth Value: True (mathematically correct)
4. x + 7 = 10.
1. Not a Proposition (contains a variable; its truth depends on the value of x)

Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Activity

What is the negation of these propositions


•Mei has an MP3 player.
•There is no pollution.
•2+1=3
•The summer in Maine is hot and sunny.

Bart Selman
CS2800
Answers

1. Mei has an MP3 player:


1. Negation: Mei does not have an MP3 player.
2. Symbolically: ¬p
2. There is no pollution:
1. Negation: There is pollution.
2. Symbolically: ¬q
3. 2+1=3:
1. Negation: 2+1 is not equal to 3.
2. Symbolically: ¬(2+1=3)
4. The summer in Maine is hot and sunny:
1. Negation: The summer in Maine is not hot and sunny (it could be cold or
not sunny).
2. Symbolically: ¬(p∧q)

Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Activity

Let p and be the propositions


p: It is below freezing
q: It is snowing
Write these propositions using p and q and logical connectives
a)It is below freezing and snowing
b)It is below freezing but not snowing
c)It is not below freezing and it is not snowing
d)It is either snowing or below freezing(or both)

Bart Selman
CS2800
Answers

a. It is below freezing and snowing:


p∧q
b. It is below freezing but not snowing:
p∧¬q
c. It is not below freezing and it is not snowing:
¬p∧¬q
d. It is either snowing or below freezing (or both):
p∨q

Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Activity

Let p and be the propositions


p: It is below freezing
q: It is snowing
Write these propositions using p and q and logical connectives
a)If it is below freezing, then it is snowing.

b) It is snowing whenever it is below freezing.

c) That it is below freezing is necessary and sufficient for it to be snowing

Bart Selman
CS2800
Activity

Let p and be the propositions


p: It is below freezing
q: It is snowing
Write these propositions using p and q and logical connectives
a) If it is below freezing, then it is snowing.
p→q
b) It is snowing whenever it is below freezing.
p→q
c) That it is below freezing is necessary and sufficient for it to be snowing
p↔q

Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Bart Selman
CS2800
Activity

Construct a truth table for each of these compound


propositions
•p ∧ ¬p
•p v ¬p
•p ⊕ (p v q)
•(p v q) → (p ∧ q)
•p ⊕ ¬ q

Bart Selman
CS2800
The end

Bart Selman
CS2800

You might also like