A sequence is a function in disguise
You already know what a function is: a machine that takes an input and returns an output.
A sequence is that exact machine with one restriction. Its only legal inputs are the counting numbers . You feed it a position and it hands back the -th term, written .
So is a function. Feed it and it returns:
Nothing new is happening. A sequence is a function with the domain trimmed down to the positive integers. The output is a list.
Evaluate a term
Use the sequence .
What is , the fifth term?
Two families worth knowing
Most sequences in this course are one of two kinds.
An arithmetic sequence adds a fixed step every time. The step is the common difference :
A geometric sequence multiplies by a fixed factor every time. The factor is the common ratio :
The widget plots the terms as a stem plot, one stalk per position. Set it to arithmetic and drag .
A positive tilts the stalks upward in a straight line; that is the whole personality of an arithmetic sequence. Switch to geometric later in this lesson and the stalks curve instead, because each one is the last one scaled.
Explicit and recursive: same sequence, two descriptions
There are two ways to pin down a sequence.
The explicit rule gives straight from . For a geometric sequence with and :
The recursive rule gives each term from the one before it:
Both describe . The explicit rule is a teleporter, jump straight to term 100. The recursive rule is a staircase, you climb one step at a time. Same sequence, and you will see both styles again: recursion is exactly how a model unrolls over a sequence of tokens.
A geometric term
A geometric sequence has first term and common ratio .
What is the fifth term ?
From sequence to series
Now add the list up as you go.
A series is the running total of a sequence. The -th partial sum is what you get after adding the first terms:
The partial sums form their own sequence. For , the terms are and the partial sums are:
Look at that second list. Each new term is half as big as the last, so each partial sum jumps half as far as the previous jump. The running total is creeping toward something. It looks like 2.
A closed form for the geometric sum
You should not have to add a hundred terms by hand. There is a formula, and it comes from one clean trick.
Write the sum, then write times the sum, and line them up:
Subtract the second line from the first. Everything in the middle cancels, leaving only the ends:
That is the finite geometric sum. It works for any ratio except , where you would divide by zero.
Sum a doubling series
Add the first five powers of two: .
What is the total?
Push n to infinity
Now the payoff. Switch the widget to geometric and slowly drag down: from 2, through 1, to 0.5, to , and on past .
Watch the bottom plot, the partial sums. There is a sharp boundary at :
- When , each term is smaller than the last. The partial sums settle onto a flat line.
- When , each term is bigger. The partial sums blow up.
- When , the sum lurches back and forth forever and never settles.
Inside the band something genuinely strange is true: you add infinitely many positive numbers and the total is finite.
The formula for the infinite sum
Look again at the closed form , and ask what happens as grows without bound.
The only piece that depends on is . If , then shrinks toward 0. Half, then a quarter, then an eighth of nothing. So settles on:
This is the headline. Here is the famous case: is equal to 1, or just below it?
Write it as a series: , geometric with and . The formula gives:
Not approximately 1. Exactly 1. There is no number wedged between and 1, so they are the same number wearing two outfits.
An infinite geometric sum
Evaluate the infinite sum .
What finite number does it equal?
Where this shows up
You just did something that the rest of calculus only dresses up: you ran an infinite process and it landed on a finite, definite answer.
That is the entire idea of a limit. Training a network is an infinite process in spirit, take a small step, take another, take another, hoping the loss settles. Whether a process settles, and onto what, is the question the next lesson makes precise.
Lesson complete