Lecture notes · Math for Computer Science · Lecture 13

Sums and Asymptotics

MIT 6.042J Mathematics for Computer Science, lecture 13, explained in plain English

Want this lecture to stick? In LessonBound you get checked practice questions for every part, can ask about anything you don't get, and can listen with your screen off. Free, no ads.

Learn this lecture free

Watch or read the original lecture: MIT OpenCourseWare.

Part 1 · 0:00–10:00

The professor sets up a stacking-blocks challenge, asking whether a block can be stacked all the way out past the edge of a table, and says today's math will be used to study it.

Key ideas

Words to know

center of mass
The balance point of a whole object or stack. If it stays over the support below, the stack does not tip.
stable
Steady and not likely to fall over. A stable stack can stand up on its own without someone holding it.
closed-form expression
A short formula that gives the answer to a long sum directly, so you do not have to add up every piece one by one.
overhang
Not used in this part by name, so skip it. The idea is simply how far a block sticks out past the one under it.

Example

Think of stacking books on the edge of a desk. Each book can sit farther out than the one below, but the pile must still balance over the book it rests on. If you push too far, the whole stack tips over, just like the blocks in the lecture.

3 checked practice questions for this part are in the app.

Part 2 · 10:00–20:00

This part shows how to stack blocks as far out over a table edge as possible without the stack tipping, and begins a way to work out how far that reaches.

Key ideas

Words to know

center of mass
The balance point of an object or group of objects. If you could support it at that point, it would not tip.
greedy algorithm
A step-by-step method that always takes the biggest possible step right now and never goes back to change earlier choices.
stability constraint
The rule that a stack stays up only if its balance point lies on the block beneath it.
recursive formula
A formula that works out a value using the value for a smaller case, such as the answer for k minus 1 blocks being used to find the answer for k blocks.

Example

Think of stacking books on the edge of a table to hang one over the side as far as possible. You slide the top book out until its balance point is just at the edge, then slide the stack above it out the same way. If you push any further, the whole pile tips over.

3 checked practice questions for this part are in the app.

Part 3 · 20:00–30:00

This part shows how the stacking-blocks puzzle turns into a sum of fractions, called the harmonic sum, and why that sum grows very slowly.

Key ideas

Words to know

harmonic number
The total you get when you add up fractions 1 over 1, 1 over 2, 1 over 3, and so on, up to some number n. The lesson writes it as H n.
closed-form expression
A neat formula that gives the answer directly, without having to add up every piece one by one.
greedy strategy
A way of solving a problem by making the choice that looks best at each step. Here, each block is placed as far out as it can go over the block below.
integral
A tool from calculus for finding the total area under a curve. The lesson uses integrals to estimate sums that have no closed form.

Example

Picture a pile of books on a table, each one slid a little further out than the one under it. Each new book adds only a small extra overhang, and the small amounts add up to a total that keeps growing. The harmonic sum works the same way: each new fraction is tiny, but together they slowly add up to more and more.

3 checked practice questions for this part are in the app.

Part 4 · 30:00–40:00

This part shows how to estimate big sums and products using the area under a curve, with two examples: the harmonic numbers and n factorial.

Key ideas

Words to know

harmonic number
The sum 1 + 1/2 + 1/3 and so on, up to 1/n. It is the total you get by adding those fractions.
factorial
n factorial, written n!, is the product of all whole numbers from 1 up to n. For example, 4! is 1 times 2 times 3 times 4.
natural log
A special kind of logarithm, written ln or log here. It answers the question: what power must the number e be raised to, to get this number?
closed-form expression
A simple formula you can plug a number into to get the answer directly, without adding up every term one by one.

Example

Imagine trying to find the total area under a hill by drawing rectangles. Rectangles that stick above the curve give you an upper estimate, and rectangles that stay under it give you a lower estimate. The true total must lie between the two, so you get a trustworthy range without an exact answer.

3 checked practice questions for this part are in the app.

Part 5 · 40:00–50:00

This part shows how to estimate how fast n factorial grows using Stirling's formula, then introduces big O notation for comparing how fast functions grow.

Key ideas

Words to know

Stirling's formula
A formula that gives a very close estimate of n factorial, using e and the square root of 2 times pi times n.
Tilde notation
A short way to write that two functions are roughly equal when x gets very large, meaning the ratio between them goes to 1.
Big O notation
A way to say that one function grows no faster than another, ignoring constant multipliers, when the input gets large.
Limit
The value a function gets closer and closer to as the input keeps getting bigger, like x going to infinity.

Example

Think of two runners, one who runs at a steady pace and one who doubles their speed every minute. After a long race, the steady runner can never catch up, so the first is 'big O' of the second in terms of how fast they grow. Big O is just a way of saying which function is always at most as fast as another, no matter how big the input gets.

3 checked practice questions for this part are in the app.

Part 6 · 50:00–1:00:00

This part explains how to tell whether one growth rate is capped by another, using the limit test and the rule that constant factors and smaller terms can be ignored.

Key ideas

Words to know

big O
A way of saying one function grows no faster than another, ignoring constant factors and smaller terms.
limit
The value a ratio gets closer and closer to as the input becomes very large.
polynomial
An expression built from powers of x with numbers in front, such as x squared plus 3x.
exponential
A function where the input is the power, such as e to the x or 2 to the x. These grow very fast.

Example

Picture two savings accounts. One adds 10 dollars every month, and the other doubles every month. Even if the first one starts with more money, the doubling account eventually leaves it far behind, which is the same idea as any polynomial being beaten by any exponential.

3 checked practice questions for this part are in the app.

Part 7 · 1:00:00–1:10:00

This part explains three shorthand symbols (big O, big omega, and theta) that describe how fast a function grows, and warns about common misuses of them.

Key ideas

Words to know

big O
A way to say a function grows no faster than another function, like an upper limit on growth.
big omega
A way to say a function grows at least as fast as another function, like a lower limit on growth.
theta
A way to say two functions grow at the same rate, because they are both big O and big omega of each other.
tilde
A symbol meaning the ratio of two things goes to 1 as the input gets very large, so they are roughly the same size in the long run.

Example

Think of two people saving money. One adds 100 dollars a month and the other adds 1 dollar a month, so the first grows much faster. Ignoring small fixed amounts, the savings growth is the main thing to compare, which is the idea behind leaving out constants and small terms.

3 checked practice questions for this part are in the app.

Part 8 · 1:10:00–1:20:00

This part explains two more growth symbols, little o and little omega, and then shows a false proof that warns against misusing big O.

Key ideas

Words to know

little o
A way of saying one function grows strictly slower than another. Equal growth rates do not count.
little omega
A way of saying one function grows strictly faster than another. Equal growth rates do not count.
limit
The value a ratio gets closer and closer to as the input gets bigger. Here the ratio is either shrinking to 0 or growing to infinity.
induction
A proof method that checks a first case, then shows that if a statement holds for n, it also holds for n plus 1.

Example

Think of two runners, one who runs at a steady pace and one who is always slower and falls further behind. If you divide the slow runner's distance by the fast runner's distance over time, that ratio keeps shrinking toward 0. That is the idea behind little o: one function falls further and further behind the other.

3 checked practice questions for this part are in the app.

Part 9 · 1:20:00–1:23:34

This part explains why you should never put big O notation inside a proof by induction or inside a predicate, because the function disappears and false results can follow.

Key ideas

Words to know

big O
A shorthand that says how fast a function grows compared to a simpler function, such as n. Saying a function is O of n means it grows no faster than a constant times n, once the input is large.
asymptotic notation
The family of shorthand symbols, including big O, used to describe how a function behaves when its input gets very large.
scalar
A single plain number, as opposed to a function that gives a different output for each input.
predicate
A statement that is either true or false, such as a claim about a value in a proof.

Example

Think of a speed camera that records how a car's speed changes over a long road trip. That full record is a pattern you can study, but a single reading taken at one moment is just one number. Asking whether one number 'grows' tells you nothing, which is why big O needs a whole pattern, not one value.

3 checked practice questions for this part are in the app.

← Lecture 11: Relations, Partial Orders, and Scheduling · Lecture 16: Counting Rules I →

Notes written by AI (Claude) from the lecture's official transcript, so check anything important against the lecture. MIT OpenCourseWare · CC BY-NC-SA 4.0 · not affiliated with or endorsed by MIT. These notes are shared under the same license.

LessonBound · Free lecture notes · Privacy · Terms · New York