0% found this document useful (0 votes)
18 views

comp106_0_intro

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

comp106_0_intro

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

COMP 106

Discrete Mathematics
for Computer Science and Engineering

• Instructor: Alptekin Küpçü


• Lectures: check course calendar
• PS: check course calendar
• Teaching assistants: check course website
• Textbook: Kenneth H. Rosen, Discrete Mathematics
and Its Applications, McGraw-Hill (8th edition)
• Course webpage:
– https://sites.google.com/a/ku.edu.tr/comp106/
• E-mail: [email protected]
Course Objectives

• To learn how to reason, in a formal way

• To learn mathematics as a “language”

• To learn basic mathematical tools and discrete structures for


problem solving in computer science
Course Objectives
(more specific)

• Discrete Mathematics
– Logic
– Mathematical reasoning, notation, theorems, proofs
– Number theory
• Algorithms
– Problem solving, algorithm design, complexity analysis
• Discrete Structures
– Tools for problem solving and algorithm design
– Relations, finite-state machines, Turing machines
• Applications
Course Outline
• Ch. 1-2: Foundations:
– Logic, propositional logic, sets, functions.
• Ch. 3: Algorithms:
– Complexity of algorithms, integers.
• Ch. 4: Number theory:
– Cryptography, modular arithmetic, prime numbers.
• Ch. 5: Induction & Recursion:
– Mathematical induction, recursive algorithms, recurrence.
• Ch. 9: Relations:
– Representing relations, connectivity analysis, equivalence relations.
• Ch. 13: Modeling Computation:
– Theory of computation, grammars, finite-state machines, Turing
machines.
Why do we learn Discrete Mathematics and
Where will we use it?
• Logic:
– Everyday reasoning: To understand each other and conduct
meaningful arguments.
– Special courses and areas: Artificial Intelligence, Software
Verification, VLSI Circuit Design, Database Queries.
– Web Search: How to create the query that matches what we are
trying to find.
– Computer Programming: Think about forall quantifier as a for
loop over all elements of the domain. What about constructing
the correct if-elseif-else clause?
Why do we learn Discrete Mathematics and
Where will we use it?
• Proofs:
– Everywhere: How to consistently prove what you are saying is
true.
– Special courses and areas: Software Verification, Automated
Theorem Proving, Algorithm Correctness, Security of
Cryptographic Algorithms, Distributed Systems and Algorithms,
Theory of Computation, Computational Complexity.
– Mathematical induction is yet another very powerful proof
method.
Why do we learn Discrete Mathematics and
Where will we use it?
• Sets:
– Everywhere: Sets are one of the most basic mathematical
concepts that we shall employ every day. For example, we sort a
set of numbers, we consider finding an element in a set.
– Special courses and areas: Databases (how to create the correct
SQL query for obtaining the desired response).
– Remember the representation of set operations as logical
operations.
– The principle of inclusion and exclusion can generalize set
operations to more than two sets.
– Sets are important data structures used to represent and
organize data. (COMP 202 Data Structures)
Why do we learn Discrete Mathematics and
Where will we use it?
• Matrices:
– Main part of linear algebra.
– Special courses and areas: Signal Processing, Image
Processing, Speech Processing, Multimedia, Graphics,
Computer Vision, Lattices (and thus Cryptography), Scientific
Computation.
– Computer Programming: Vectors are arrays in programming.
Matrices can be represented as multi-dimensional arrays.
Thus, algorithms working with arrays (so, a lot of algorithms) are
directly related to linear algebra.
Why do we learn Discrete Mathematics and
Where will we use it?
• Functions:
– Functions can be thought as algorithms and algorithms can
be thought as functions.
– Functions can also represent time and space (and
communication etc.) complexity of algorithms.
– Functions relate elements of one set to elements of some other
set.
– Needless to say, functions are everywhere.
Why do we learn Discrete Mathematics and
Where will we use it?
• Complexity of Algorithms:
– A computer scientist’s main job is to create algorithms. Furthermore, we must
analyze algorithms so that we can compare them against alternatives.
– Problems are defined by the input-output relationships. Algorithms are ways to
solve problems. There may be multiple algorithms solving the same problem, but
using different amount of resources (e.g., time, memory, bandwidth, hard drive,
graphical processor).
– The most commonly used complexity notation is the Big-Oh notation.
– Big-Oh notation is mathematically based on a functional definition. Thus, it is important
to understand functions.
– The complexity of algorithms let us understand which problems can be solved quickly
and which ones require an algorithm that requires too much time.
– The most common complexity classes are P, NP, and NP-complete. There are many
other classes of problems based on the complexity of the algorithms for solving them.
– This difference between problems that can be solved quickly and problems that require
too much time is the basis of cryptography. If P=NP, which means in some sense
everything is easy to solve, then cryptographic algorithms fail to provide security since
the problem of breaking them also becomes easy.
– There are problems that are unsolvable, regardless of the complexity of the
algorithm used. One such problem is the Halting Problem.
Why do we learn Discrete Mathematics and
Where will we use it?
• Recursion:
– Recursion is very powerful: Everything can be computed by
some recursive algorithm.
– Every recursive algorithm has an iterative equivalent. But in
some cases, the recursive algorithm is much simpler to implement.
– Correctness of recursive algorithms is generally proven using
mathematical induction.
– Complexity of recursive algorithms is usually analyzed using
recurrence relations.
– Recursive algorithms later lead to interesting algorithmic styles
such as memoization and dynamic programming. Recurrence
relations can easily analyze divide-and-conquer algorithms.
– You will use recursion when Programming, and learning about
Data Structures (COMP 202) and Algorithms (COMP 305).
Why do we learn Discrete Mathematics and
Where will we use it?
• Relations:
– Everyday: Relation between students of this course and the instructor.
– Computer Programming: Relation between variables in a program. Relation between
functions/methods in software. Relation between statements of a programming
language (e.g., used by compilers).
– Sorting: Partial orderings and total orderings are used to sort elements of a set
according to some well-defined order.
– Databases: Relational database model uses relations to represent and compute over
the data.
– Remember that functions can be thought as relations relating an element in the
domain with an element in the range.
– Remember that relations are sets of tuples of elements in multiple domains.
– Relations can be represented as graphs. Closures of relations can be analyzed as
paths in graphs.
– Equivalence relations and equivalence classes are important. They are directly related
to modular arithmetic.
– Lattices have many interesting applications including cryptographic constructions.
– Equivalence relations and orderings also play important roles in game theory,
artificial intelligence, and optimization.
Why do we learn Discrete Mathematics and
Where will we use it?
• Number Theory:
– Basis of modern cryptography.
– Prime numbers and Modular Arithmetic are important aspects of
number theory.
– Number-theoretic algorithms are very useful, and provide
important examples for understanding complexity of algorithms.
– Important number-theoretic algorithms such as Extended
Euclidean Algorithm and Chinese Remainder Theorem are very
useful when working with large numbers. Applications include
cryptography, signal processing, and scientific computing.
– Also relates to abstract algebra, groups, fields, rings,
polynomials.
Why do we learn Discrete Mathematics and
Where will we use it?
• Computation:
– Can computers do everything? No.
– For things that computers can do, how efficiently can they do them?
– Interestingly, languages are extremely related to computation. A class of
computers can recognize well-defined languages.
– Special courses and areas: Natural Language Processing, Compiler Design,
Computer Networks, Speech and Text Processing, Algorithm Complexity,
Theory of Computation, Cryptography.
– Finite State Machines: Simple machines in everyday use. For example,
vending machines. Switch clause in a programming language is directly
related to finite state machines. They form the basis of algorithms and
computers.
– Turing Machine: A computer with infinite memory (but no random-access
memory). A finite state machine with infinite sequential memory.
– Java is a Turing-complete programming language. This means, anything
that can be done using a Turing Machine (a computer) can be done using
Java language.
Why do we learn Discrete Mathematics and
Where will we use it?
• There are many important topics of
discrete mathematics that we will not
cover in this course, but we will cover in
other courses. For example, combinatorics
and probability, graphs and graph theory,
Boolean functions.
Discrete Mathematics

(Discrete) mathematics is like a game:

• We need to learn rules (that is, definitions),

• and tools (that is, discrete structures);

• And we need skills to use them (that is, via reasoning)


A false proof

1  1  (1)(1)  1 1  1

What’s wrong?

You should know the rules of the game!


Consequences of 1 = -1

1 1 1
  (multiply by )
2 2 2
3
2 1 (add )
2

“Since I and the Pope are clearly


2, we conclude that I and the
Pope are 1. That is, I am the
Pope.”
Bertrand Russell
(1872 - 1970)
Reasoning (Example)

“If you are older than 18 years, then you can have a driving license”

Given this as a fact, can you infer the following?

“If you can have a driving license, then you are older than 18 years”

or

“If you can’t have a driving license, then you are not older than 18 years”
Mathematical language (Example)

p: “you are older than 18 years”


q: “you can have a driving license”

“If you are older than 18 years, then you can have a driving license”
p → q

“If you can have a driving license, then you are older than 18 years”
q → p

“If you can’t have a driving license, then you are not older than 18 years”
┐q → ┐p
Tools: Discrete Structures (Example)
Consider the flight network of an airline company

Problem: Which cities are linked? Is there a connection


between city A and city B?
Solution: Use a relation (or graph) structure!
Tools: Discrete Structures (Example)

Problem: Given a task (of any kind), can it be done with a computer?

Solution: Use Turing machines!

You might also like