Books and online resources (No textbook required)
Combinatorial Reasoning. Duane Detemple and William Webb.
Discrete Mathematics, An Open Introduction. Oscar Levin.
A Gentle Introduction to the Art of Mathematics. Joe Fields.
Discrete Mathematics Elementary and Beyond. Lázló Lovász, Jozsef Pelikán, and Katalin Vesztergombi.
Discrete Mathematics and its Applications. Rosen.
A First Course in Discrete Mathematics. Ian Anderson.
Discrete Mathematics for Computer Scientists. Cliff Stein, Robert Drysdale, and Kenneth Bogart.
How to Write Proofs.
Mathematics for Computer Science. Eric Lehman, Tom Leighton, and Albert Meyer.
Discrete and Combinatorial Mathematics. Ralph Grimaldi.
Essential Discrete Mathematics for Computer Science. Harry Lewis and Rachel Zax.
Instructional Team
The team consists of 16 people and one Guinea pig. Find us here.
Tutoring Schedule (mostly done by undergraduate TAs)
Find the schedule here
(No more Navigate approintments, just walk in to Dolciani Math Learning Center on the 7th floor of East building)
Gradescope (for hw only)
Submit HW here
Recitations (Recitation instructors: Shayan, Arezoo, Daniel, Anthony)
Recitations will be added here on a regular basis. Each recitation instructor will use these as guide to cover what is appropriate given their recitation schedule.
Actual class notes for Spring 2024 (current offering, based on older lectures here)
PART I
Lecture 1 Ch. 1 Sections 1, 2, and 3.
- The general topics one might encounter in Discrete Math. Big ideas: combinatorics, number theory, proofs, set/relations/functions, graph theory, ...)
- Example questions and settings that people study and how they relate to above.
- The sum $1+2+\ldots+n=n(n+1)/2$ using a geometric proof.
- Planar graphs.
Lecture 2 Ch. 0 Sections 2, 3, and 6.
- The idea that counting reveals patterns and determines complexity of things we are dealing with.
- Counting: Euler's formula for planar graphs $v-e+f=2$.
- Counting: $1+2+\ldots+(n-1)$ is the number of pairs.
- Generalization to $a + (a+s) + (a+2s) + \ldots + b=\frac{a+b}{2}(\frac{b-a}{s}+1)$.
- Counting: permutations and $n!$.
- Sum and product notations $\Sigma$ and $\Pi$ (also seen as loops).
Lecture 3 Ch.0 Section 11, Ch. 1 Section 4.
- Manipluation of sum and product notation.
- Splitting sums and nested sums (also seen as nested loops).
- Snakes and Ladders (counting pairs).
- Addition rule and product rule.
- Students must read about sets (Ch. 0).
Lecture 4 Ch. 1 Section 4.
- Putting the product rule to work through examples.
- Practicing the product rule and overcounting.
Lecture 5 Ch. 2 Section 1, Section 6 first two pages.
- The 4 ways of selection: unordered/ordered, no repetition/repetition.
- $k$-permutations and $k$-combinations, with notation and formula.
- Selection with order and repetition: the $n^k$ formula.
- Some examples of counting with words.
- Application of the selection framework to counting problems should not be "literal".
Lecture 6 Ch. 1 Section 5, Ch.2 Section 4.
- $n$ choose 2 themes
- Handshake Lemma
- Making pairs vs. making teams
Lecture 7 Ch. 0 Section 11, Ch.2 Section 2 (excluding equivalence and partial order relations).
- Sets and their notation
- Subsets
- Intersection, union, product (relation to addition and product rules)
- The power set and the sum of binomial coefficients
Lecture 8 Ch. 2 Section 2 (first two pages).
- Functions
- Onto (surjection), one-to-one (injection), and bijection
- Significance of bijection (equal cardinality, inverse function)
- Quantifiers $\forall$, $\exists$, $\exists!$, and if-then $\Rightarrow$ (implies)
- How to show one-to-one and onto
Lecture 9 Ch. 2 Section 6.
- Counting with bijections
- Power sets $\rightarrow$ binary patterns
- Selecting $k$ from $n$ with repetition and no order $\rightarrow$ integer solutions to $x_1+x_2+\ldots+x_n=k, x_i\geq 0$
Lecture 10 Ch. 2 Section 5.
- Review/practice of functions: one-to-one, onto, bijection
- Review/practice of binary pattern problems
- An example of counting binary patterns with $n$ bits and $k$ 1s, and integer solutions to $x_1+x_2+\ldots +x_n=k$
- Pascal triangle, binomial coefficients, and their properties
- Binomial Theorem (without proof)
Lecture 11 Ch. 2 Sections 3 and 5.
- Binomial Theorem with proof
- Sum of binomial coefficients
- Alternating sum of binomial coefficients
- A fact about even and odd subsets
- Multinomials (Multinomial Theorem) and counting anagrams
PART II
Lecture 12 Ch. 3 Section 6 and 1st page of Section 7.
- Propositions and proofs
- Logical operators, Not $\neg$, And $\wedge$, Or $\vee$, Implication $\Rightarrow$
- Understanding implication (why $0\Rightarrow 0$ and $0\Rightarrow 1$ are true)
- Truth tables
- Different ways of saying $P\Rightarrow Q$ (or it's opposite)
- The contrapositive ($P\Rightarrow Q$ is equivalent to $\neg Q\Rightarrow\neg P$)
Lecture 13 Ch. 3 Section 6 and 1st page of Section 7.
- Contrapositive
- if and only if (iff), symbol $\Leftrightarrow$, (implication in both directions)
- Boolean functions and how to construct them with $\neg, \wedge, \vee$
- DeMorgan's Laws
- Commutative, Associative, and Distributive properties of $\wedge$ and $\vee$
Lecture 14 Ch. 3 Section 7.
- Properties of implication
- The three techniques: Direct proof, Contrapositive, Proof by contradiction
- Examples of each of the above, covering even/odd numbers, rational numbers, and $\sqrt{2}$
Lecture 15 Ch. 3 Sections 2, 3, and 7.
- Proof by contradiction $\neg P\Rightarrow$ False means that $P$ is true
- Technique: start with the negative of the statement, get to something false (called contradiction)
- Three examples of proof by contradiction, $\sqrt{2}$ is irrational, uncoverable grid, and primes are infinite
Lecture 16
- More proofs
- How to prove iff
- A summary of proof techniques, here
Lecture 17 Ch. 3 Section 8 (about countability).
- Hilbert's hotel (thought experiment)
- $S$ is countable iff ($S$ is finite or there is a bijection $f:S\rightarrow \mathbb{N}$)
- $S$ is countable iff there is a one-to-one function $f:S\rightarrow\mathbb{N}$
- S is countable iff elements can be ordered in such a way that every element has a finite rank
- $S$ is infinite and countable means $S$ and $\mathbb{N}$ have the same cardinality
- Subsets, Intersection, and Union of countable sets are countable
Lecture 18 Ch. 3 Section 8
- $\mathbb{Z}$ is countable
- The product of two countable sets is countable
- $\mathbb{Q}$ is countable (think of $\mathbb{Q}$ as a "subset" of $\mathbb{Z}\times\mathbb{N}$)
- $\mathbb{R}$ is uncountable (Cantor's diagonalization proof)
- The power set of a set $S$ is "bigger" than $S$, there is no bijection $f:S\rightarrow \mathcal{P}(S)$ (similar diagonalization proof is possible)
Lecture 19 Ch. 4 Sections 1, 2, 4, and 6
- Inclusion Exclusion
- General formula and proof
- The OR logic (for union)
- Divisibility example
- Good passwords example
- The lazy professor (read Section 3 for next time)
Lecture 20 Ch. 4 Sections 3 and 5, and parts of Section 8
- The Lazy professor revisited (derangments vs. permutations)
- Counting derangements using Inclusion-Exclusion
- Formula for derangements is $!n=n!\sum_{i=0}^n \frac{(-1)^i}{i!} \approx n!/e$
- Basic form of Pigeonhole with examples
Lecture 21 Ch. 4 Secrion 8
- Generalized Pigeonhole with $n$ objects and $m$ boxes
- The $\lceil m/n\rceil$ and $\lfloor(m-1)/n\rfloor +1$ formulas
- Examples of Pigeonhole
- The $m_1+m_2+\ldots+m_n-n+1$ variant form of Pigeonhole
Lecture 22 Ch. 5 is written differently from notes, so follow notes
- Proof by induction
- Base case, inductive hypothesis, induction step
- Examples of proof by induction
Lecture 23
- What can go wrong: no base case, inductive step does not work for all $k$, both ok but result is wrong
- Examples of what can go wrong
- Strong induction: inductive hypothesis $\wedge_{i\leq k}P(i)=P(k)\wedge P(k-1)\wedge\ldots$ as opposed to $P(k)$
- How many base cases are needed? (check values of $k$ for which inductive step actually works)
- Examples of strong induction
Lecture 24
- Induction and recurrences
- Examples of strong induction
PART III
Lecture 25 Ch. 6 Section 6
- Solving Linear Homogeneous Recurrences
- Recurrences of the form $a_n=Aa_{n-1}+Ba_{n-2}$
- The characteristic equation method
Lecture 26 Ch. 6 Sections 1, 2, 3, 4
- Counting by establishing a recurrence
- Name the quantity your counting, e.g. $a_n$, then express $a_n$ in terms of $a_{n-1}, a_{n-2}, \ldots$
- Cutting a place with lines
- Tiling with dominos
- Tower of Hanoi
Lecture 27 Ch.6 Sections 10, 11
- Generating functions
- Solving recurrences using the generating function method
- Solving recurrences asymptotically, e.g. Mergesort
- Divide-and-Conquer has recurrences of the form $T(n)=aT(n/b)+f(n)$
Lecture 28 Ch. 6 Section 12
- More on making homogeneous recurrences
- Solving characteristic equations of degree 3 by guessing one solution and factoring
- Catalan numbers and the recurrence $c_n=c_0c_{n-1}+c_1c_{n-2}+\ldots+c_{n-1}c_0$
Lecture 29 Ch. 7 Sections 1 and 2
- Divisibility, notation $a|b$
- Uniqueness of representation $b=aq+r$, where $0\leq r\lt a$
- $\gcd(a,b)$ and $\textrm{lcm}(a,b)$
- Finding $\gcd(a,b)$ by brute force and prime factorization
- Finding $\gcd(a,b)$ efficiently
Lecture 30 Ch. 7 Sections 3 and 4
- Extended Euclidean algorithm
- Euclidean alg $\Rightarrow \gcd(a,b)=ar+bs$, where $r,s\in\mathbb{Z}$
- Using $ar+bs=a(r+b)+b(s-a)$, we can say: $\gcd(a,b)=ar-bs$, where $r,s\in\mathbb{Z}_{\geq 0}$
Lecture 31 Ch. 7 Sections 5 and 9
- Coprimes: $gcd(a,b)=1\Leftrightarrow ar-bs=1$
- Inverse of $a$ modulo $n$ when $\gcd(a,n)=1$
- Finding the inverse of $a$ modulo $n$ using the extended Euclidean algorithm
- Modular arithmetic
Lecture 32 Ch. 2 Section 2
- Equivalence relation: reflexive, symmetric, transitive
- Classes of equivalence
- Congruence is an equivalent relation
Chapter 0
Read as much as possible from this as soon as you can. The topics of this chapter will be briefly covered as they come up. This chapter covers basic mathematical concepts that we will use at some point during the course. Make sure you are comfortable with most of these concepts.
Chapters 1 - 8 (main topics)
(1) Introduction - Euler formula: v-e+f=2 - Why counting? (the lazy professor example) - Basic examples of counting (snakes and ladders) - Addition and multiplication rules - Handshake lemma - Generalization (n choose k) (2) Counting - Permutations - Ordered selection - n choose k - Sets, relations, functions - Onto functions and one-to-one correspondence (bijection) - Equivalence relations and partial orders - Anagrams and forming teams - The binomial theorem and Pascal triangle - Selection with repetition (ordered and non-ordered) (3) What is a proof? - The pigeonhole principle - Primes are infinite - A water juggling puzzle - Proof by contradiction, by case analysis, by picture - What are proofs? - A false proof of Pythagoras - Some logic, Boolean gates/functions - What is implication? - Proof by counter example, contradiction (again), contrapositive - Self reference and diagonalization, the barber paradox - Countable vs. uncountable (4) Two useful principles - The inclusion-exlusion principle, two sets - What about more than two sets? - The lazy professor revisited - More examples of using inclusion-exclusion - The pigeonhole principle revisited (generalized) - Examples of using pigeonhole - The birthday paradox - Simplified Ramsey theory - Proving program termination by Ramsey (and partial order) |
(5) Inductive proofs - A weird proof - Proof by induction, definition - Some false proofs - Examples of proof by induction - Rules of thumb for induction (6) Recurrences - What is a recurrence? - Cutting the plane - Towers of Hanoi - Fibonacci - Solution for a_n=Aa_{n-1}+Ba_{n-2} - Generating functions - Sorting - Traveling in Manhattan and the Calatan numbers - Stirling numbers - Balls and bins (6 variantions) (7) Number theory - Divisibility and primes - The Euclidean algorithm, why not brute force? - The extended Euclidean algorithm - Co-primes - Fundamental theorem of arithmetic (uniqueness of prime factorization) - Properties and distribution of primes - Congruence as an equivalence relation - Multiplicative inverses - The Chinese remainder theorem - Fermat's little theorem and primality testing - Cryptography, breaking it by Chinese remaindering (8) Graphs - Vertices, edges, and connectivity - Trees - Counting trees - Finding the best tree - The traveling salesman problem - Hamiltonian cycles and Eulerian walks - Graph coloring and planarity |
Note: While these notes reflect what is covered in class, they are far from being perfect (e.g. typos) or complete. But they should be self contained. They are intended for class use only. Many examples and explanations are actually taken from the above references, although no referencing is explicit within the text. Therefore, I emphasize that these notes are intended for class use only. For outside visitors of this page, please use them for your own benefit only. Do not distribute. No one should upload these documents on third party websites!
Homework (almost weekly, submitted through Gradescope, follow template in terms of number of pages and order of questions)
Homework 0 Due 1/31/2024
Homework 1 Due 2/7/2024
Homework 2 Due 2/14/2024
Homework 3 Due 2/22/2024
Homework 4 Due 2/29/2024
TEST 1 will be on Wed. March 6 in class from 1:30 to 3:00
Here's a sample TEST 1 and another from previous years
Test results
Homework 5 Due 3/13/2024
Homework 6 Due 3/20/2024
Homework 7 Due 3/28/2024
Homework 8 Due 4/3/2024
TEST 2 will be on Wed. April 10 in class from 1:30 to 3:00
Here are some sample questions for practice,
and their answers.
Homework 9 Due 4/18/2024
Homework 10 Due 5/6/2024
Homework 11 (last homework) coming soon...
Solutions to homework and tests
Programming Explorations and Fun Activities (optional, only for those who are interested)
[Integer games]
- Write a function that takes a positive integer $n$ and outputs the Collatz sequence starting with $n$ and ending with $1$. Recall that, given a positive integer $n$, the next number is either $n/2$ if $n$ is even, or $3n+1$ if $n$ is odd. Example: 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1.
Additional idea: Replace the sequence by a binary sequence as follows: If the number goes up, place a 1, and if the number goes down, place a 0. The above sequence becomes: 1 0 0 1 0 0 0 1 0 0 0 0. Explore how different initial numbers lead to different binary patterns. How many 1s are there? What's the average distance between consecutive 1s? Etc...
- Write a function that takes a list of integers $(a_1, a_2, \ldots, a_n)$ of some length $n$ and outputs its Ducci sequence until $(0, 0, \ldots, 0)$ (such algorithm might not stop in general, but it will if $n=4$). Recall that $(a_1, a_2, \ldots, a_n)\rightarrow (|a_1-a_2|, |a_2-a_3|, \ldots, |a_n-a_1|)$. Example: $(1,2,3,4), (1, 1, 1, 3), (0,0,2,2), (0,2,0,2), (2,2,2,2), (0,0,0,0)$.
Additional idea: Find examples for $n\neq 4$ where the sequence never ends. For instance, experiment with $n=3$.
[Listing pairs]
Recall the socks example. Write a function that takes an integer $n$ and outputs all possible pairs; for instance, when $n=5$, the output should look like:
x x - - - x - x - - x - - x - x - - - x - x x - - - x - x - - x - - x - - x x - - - x - x - - - x xAdditional idea: Can you modify the function to display only pairs that are at a minimum distance $d$? For instance, if the minimum distance is $d=2$, the above example for $n=5$ will become:
x - x - - x - - x - x - - - x - x - x - - x - - x - - x - xExplore how that changes the number of pairs from $n(n-1)/2$. Find a formula in terms of $n$ and $d$.
for m in range(1,n+1): for i in range(0,k): #check if m modulo some p[i] is zero and increment a countThis will be $O(nk)$ time, which is pretty slow especially when $n$ is large; for instance, try it on $n=1000000000$ (a billion) and $p=[2,3,5]$, and see how long it takes in seconds.
x = rand(1, n) y = rand(1, n) z = rand(1, n) while x>0 and y>0 and z>0 control = rand(1,2) if control == 1 x = rand(x, n) y = rand(y, n) z = z-1 else y = rand(y, n) x = x-1
Grading policy
Homework 10% (almost weekly)
Test 1 25% (*)
Test 2 25% (*)
Final 40% (scheduled by Hunter College on 5/16/2024, 1:45 - 3:45)
(*) Date will be announced at least 10 days in advance. Given that lecture time is only 50 minutes (from 1:30 to 2:20), tests will use an extended class session from 1:30 to 3:00 to allow for more time.