DS Lecture 12
DS Lecture 12
• Three parts:
– Base case(s): show it is true
for one element
– Inductive hypothesis: assume
it is true for any given element
• Must be clearly labeled!!!
– Show that if it true for the next
highest element
2
Climbing an Infinite Ladder
Suppose we have an infinite ladder:
1. We can reach the first rung of the ladder.
2. If we can reach a particular rung of the
ladder, then we can reach the next rung.
6
Example - 2: Use mathematical induction to prove the
following formula.
𝑛 (𝑛+1 ) ( 2𝑛+1 )
Sn = 1 + 2 + 3 + 4 + + n =
2 2 2 2 ... 2
6
1. Show n = 1 is true.
1( 2) ( 3 )
Sn = 1 =
2
6
2. Assume that Sk is true.
Sk = 1 + 2 + 3 + 4 + + k =
2 2 2
𝑘2
( 𝑘+1 )
...
( 2 𝑘+12
)
6
( 𝑘+ 1 )( 𝑘+2 )( 2 𝑘+3 )
Show that Sk+1 = is true.
6
7
Sk+1 = (12 + 22 + 32 + 42 + . . . + k2) + (k + 1)2
k k 12k 1
+ (k + 1)2
6
2
𝑘 ( 𝑘+1 ) ( 2 𝑘+1 ) +6 ( 𝑘+1 ) Factor out a (k + 1)
¿
6
( 𝑘+1 ) [ 𝑘 ( 2 𝑘+ 1 ) +6 ( 𝑘+1 ) ]
¿
6
( 𝑘+1 ) [ 2𝑘 +7 𝑘+6 ] ( 𝒌+𝟏 )( 𝒌 +𝟐 ) ( 𝟐 𝒌+𝟑 )
2
¿ ¿
6 𝟔 8
Recursion
9
10
11
12
13
14
15
16
17
18
Discrete Mathematics in the
Real World
19
20
Computers run software and store files.
21
22
Online Shopping
Encryption and decryption are part of
cryptography, which is part of discrete
mathematics. For example, secure
internet shopping uses public-key
cryptography.
23
Analog Clock
An Analog Clock has gears inside, and the
sizes/teeth needed for correct timekeeping are
determined using discrete math.
24
Dijkstra’s Algorithm and Google Maps
25
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.
26
27
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.
28
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.
29
Finding Friends on
Facebook
Graph theory can be used in speeding up
Facebook performance.
30
DNA Fragment Assembly
Graph theory is used in DNA sequencing.
31
Learning Discrete Mathematics
make you a better Programmer?
One of the most important competences – that one must
33
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.
34
Combinatorics
One cannot program without loops or recursion.
(I mean we could, but it wouldn't be very useful)
Getting a sense of the Mathematics behind
these very essential programming concepts help
you optimise your code.
35
Graphs
One cannot overestimate the importance of
graphs in CS today, what with the emergence
of social networks and the need to represent all
types of complex relationships between
entities. Learning Graphs can help you
visualise a lot of data structures better. Also,
there is a lot of room for better programming in
graphs. Having mathematical knowledge about
them is essential to do that.
36
Moral of the Story???
Discrete Math is needed to see mathematical
37
Problems Solved using Discrete Mathematics
39
lottery?
Problems Solved using Discrete Mathematics
9. Relations
How can we deal with the relationships between
elements of sets
10. Graphs
Find the shortest tour that visits each of a group of
cities only once and then ends in the starting city.
11. Trees
Binary search tree
Huffman coding
12. Boolean Algebra
The circuits in computers and other electronic
devices have inputs, each of which is either a 0 or a
1
40 Modeling Computation
13.
Can a task be carried out using a computer? How can
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.
41
42