Formula Bro

Math and physics formulas, explained like you are new.


Geometric Series

In one sentence: A geometric series adds up a list where each term is the one before it times a fixed number, and this formula finds the whole sum in one step.

∑k=0n−1rk=1−rn1−r(r≠1)\sum_{k=0}^{n-1} r^{k} = \frac{1 - r^{n}}{1 - r} \quad (r \neq 1)

Read it out loud: “The sum, written with the Greek capital letter sigma, for k from 0 up to n minus 1, of r to the power k, equals one minus r to the power n, divided by one minus r. This works when r is not equal to 1. The letter k is a counter, r is the common ratio that each term is multiplied by, and n is the number of terms.”

Before you start

The ideas and signs this page uses, explained from zero. For powers of ten, Greek letters and other notation in general, see Math basics.

The sum sign ∑\sum

The capital Greek letter sigma, written ∑\sum, means add up. Below it, k=0k = 0 says where the counter starts, and the letter on top, n−1n - 1, says where it stops. So ∑k=022k\sum_{k=0}^{2} 2^{k} means 20+21+22=1+2+4=72^{0} + 2^{1} + 2^{2} = 1 + 2 + 4 = 7. The sum has nn terms when kk runs from 0 to n−1n - 1.

Powers, like rkr^{k}

A small raised number is an exponent. rkr^{k} means rr multiplied by itself kk times, so 23=2×2×2=82^{3} = 2 \times 2 \times 2 = 8. Any number to the power 0 equals 1, so r0=1r^{0} = 1. A negative exponent means divide: 2−1=122^{-1} = \frac{1}{2}, which is one half.

The common ratio rr

In a geometric series, each term is the one before it times the same number rr, which is called the common ratio. With r=2r = 2 the terms are 1, 2, 4, 8, 16. With r=12r = \frac{1}{2} the terms are 1, one half, one quarter, and so on. The list grows or shrinks by a fixed factor each time, not by a fixed amount.

Limits and getting close to a value

A limit is the value that a quantity gets closer and closer to as a counter keeps growing. The terms 12\frac{1}{2}, 14\frac{1}{4}, 18\frac{1}{8} get closer and closer to 0. The sum 1+12+14+⋯1 + \frac{1}{2} + \frac{1}{4} + \cdots gets closer and closer to 2, and it never goes past 2.

The not-equal sign ≠\neq and the dots ⋯\cdots

r≠1r \neq 1 means that rr is not equal to 1. The three dots ⋯\cdots mean that the list continues in the same pattern, so 1+2+4+⋯+5121 + 2 + 4 + \cdots + 512 keeps doubling until the last term, 512. The dots are a shorthand for ‘and so on’.

Dynamic array (background)

A dynamic array is a list stored in computer memory in one block with a fixed amount of room. When the block is full and a new item arrives, the program builds a new block twice as big and copies every old item across. Copying takes time, so the total copying work matters for how fast adding items is.

Reward discount factor γ\gamma (background)

In reinforcement learning, a method where a computer learns from rewards, a reward received later is worth less. The factor γ\gamma (gamma, a Greek letter) is a number between 0 and 1, and a reward received kk steps later is multiplied by γk\gamma^{k}. Adding these discounted rewards gives a geometric series.

What each symbol means

SymbolMeaning

∑k=0n−1\sum_{k=0}^{n-1}

Add up the terms for every kk from 0 up to n−1n - 1. That is nn terms in all, because the counter starts at 0. The sum has no unit when the terms count things, such as copies or dollars.

kk

The step counter, a whole number that starts at 0 and goes up by 1. The first term is at k=0k = 0, which is r0=1r^{0} = 1. It counts positions in the list, so it has no unit.

rkr^{k}

The term at step kk: the number rr multiplied by itself kk times. For r=2r = 2 and k=3k = 3, the term is 2×2×2=82 \times 2 \times 2 = 8. Its unit is the same unit as the terms of the list, such as copies.

rr

The common ratio, the number each term is multiplied by to get the next term. For doubling, r=2r = 2. The formula needs r≠1r \neq 1, because the division by 1−r1 - r would be zero. The ratio has no unit.

nn

The number of terms in the series, a whole number such as 4 or 10. It counts the terms that are added, so it has no unit. It is not the same thing as the size of the list being built in the example.

1−rn1−r\frac{1 - r^{n}}{1 - r}

The closed form, a quick way to find the total. The top, 1−rn1 - r^{n}, is what is left after cancellation, and the bottom, 1−r1 - r, is the factor that remains. The division by 1−r1 - r is why the formula excludes r=1r = 1.

The formula piece by piece

rkr^{k}

The term at step kk, which is rr multiplied by itself kk times. When k=0k = 0 the term is 1, when k=1k = 1 it is rr, and when k=2k = 2 it is r×rr \times r. The whole series is these terms added together.

∑k=0n−1rk\sum_{k=0}^{n-1} r^{k}

The total of all nn terms, from the first term at k=0k = 0 to the last term at k=n−1k = n - 1. This is the total we want to find. The rest of the formula gives a faster way to find it than adding every term.

rnr^{n}

The term one step past the end of the list. It is the next term after rn−1r^{n-1}, because rn−1×r=rnr^{n-1} \times r = r^{n}. Multiplying the whole sum by rr shifts every term one place along, so rnr^{n} appears when the shifted list is lined up against the original.

1−rn1 - r^{n}

The leftover after the cancellation. When the shifted sum is subtracted from the original sum, almost every term cancels, and only the first term 1 and the last term −rn-r^{n} remain. Dividing by 1−r1 - r turns that leftover into the total.

∑k=0n−1rk=1−rn1−r(r≠1)\sum_{k=0}^{n-1} r^{k} = \frac{1 - r^{n}}{1 - r} \quad (r \neq 1)

In one plain sentence: adding the first nn powers of rr, starting from r0=1r^{0} = 1, gives 1 minus rnr^{n}, divided by 1 minus rr, as long as rr is not equal to 1.

What the formula is doing, and why

What goes in and what comes out. You give the formula a ratio rr and a number of terms nn. You get the sum of the terms r0,r1,…,rn−1r^{0}, r^{1}, \ldots, r^{n-1}. The ratio decides almost everything, because each term is the last one times rr. The formula gives the total directly, without adding each term one by one.

Why does the trick work? Call the sum SS. Multiply the whole list by rr, and every term moves one place along. Now subtract the shifted list from the original. Almost every term cancels, and S−rS=1−rnS - rS = 1 - r^{n} is what remains. Dividing by 1−r1 - r gives S=1−rn1−rS = \frac{1 - r^{n}}{1 - r}. The division needs r≠1r \neq 1, because 1−r1 - r would then be zero. If r=1r = 1, every term is 1, and the sum is nn.

Why does the answer depend on whether rr is bigger than 1? If r>1r > 1, the terms grow, the last term is the biggest, and for large nn the sum is close to rnr−1\frac{r^{n}}{r - 1}. If 0<r<10 < r < 1, the terms shrink, and the sum settles toward 11−r\frac{1}{1 - r} as nn grows. For r=12r = \frac{1}{2}, the sum 1+12+14+⋯1 + \frac{1}{2} + \frac{1}{4} + \cdots gets close to 2.

Why is doubling cheap on average? The early steps are small, so the total is less than twice the final size. In the example below, the copies made while a list doubles add up to less than twice the number of items. The last copy alone is about half of all the copying, so the work is concentrated at the end.

An everyday picture

Think of a savings plan that doubles each week. You save 1 dollar in week 1, 2 dollars in week 2, 4 dollars in week 3, and so on. After 3 weeks your total is 1 + 2 + 4 = 7 dollars, which is one less than twice the 4 dollars you saved in week 3. In general, after nn weeks your total is one less than twice what you saved in the last week.

Worked example: Copies in a doubling array

A dynamic array starts with room for 1 item. When it is full and a new item arrives, it builds a new block with twice the room and copies every item across. We add 10 items and count the copies. The copies form a geometric series with ratio r=2r = 2. Its number of terms is the number nn in the formula, which is 4 here, not 10.

  1. Find when the block is full. The block starts with room for 1 item. Adding item 2 finds the block full, so it copies 1 item into a new block with room for 2. Adding item 3 finds that block full, so it copies 2 items into a new block with room for 4.
  2. Continue the pattern. Adding item 5 finds the room of 4 full, so it copies 4 items into room for 8. Adding item 9 finds the room of 8 full, so it copies 8 items into room for 16. Items 10 and beyond fit in that block, so no more copies happen while we add 10 items.
  3. Write the copies as a series. The copies are 1, 2, 4 and 8. Each one is the one before times 2, so this is a geometric series with ratio r=2r = 2. It has 4 terms, so the formula’s nn is 4 here.
  4. Add the terms. Adding the copies gives 1+2+4+8=151 + 2 + 4 + 8 = 15 copies in total. This matches the pattern, because each term doubles the one before.
  5. Apply the formula. With r=2r = 2 and n=4n = 4, the formula gives 1−241−2=1−16−1=−15−1=15\frac{1 - 2^{4}}{1 - 2} = \frac{1 - 16}{-1} = \frac{-15}{-1} = 15. The two minus signs cancel, so the answer is 15 copies. Both methods agree.
  6. Compare with the list size. The list holds 10 items, so twice the list size is 2⋅10=202 \cdot 10 = 20. Since 15 is less than 20, the total copying is less than twice the number of items. On average that is 1510=1.5\frac{15}{10} = 1.5 copies per item.

Answer: Inserting 10 items causes 15 copies in total, which is less than 2⋅10=202 \cdot 10 = 20. In general, doubling keeps the total copying below twice the number of items, so each item costs about 2 copies or fewer on average.

The numbers in this example are recomputed by script every time the site is built.

Common mistakes

Where you will meet it

Questions people ask

What happens when $r$ is greater than 1?

The formula still works. For r=2r = 2 and 10 terms it gives 1−2101−2=1023\frac{1 - 2^{10}}{1 - 2} = 1023. That equals 1+2+⋯+5121 + 2 + \cdots + 512, and the last term, 512, is about half of the total.

Why does the sum settle when $r$ is between 0 and 1?

Each power rnr^{n} shrinks toward 0 as nn grows. For example, (12)10=11024(\frac{1}{2})^{10} = \frac{1}{1024}, which is almost 0. The top of the formula then goes to 1, and the sum goes to 11−r\frac{1}{1 - r}. For r=12r = \frac{1}{2}, that limit is 2.

Why is $r = 1$ a special case?

The formula divides by 1−r1 - r, which is zero when r=1r = 1. In that case each term is 1, so the sum is nn. For example, four terms of 1 add up to 1+1+1+1=41 + 1 + 1 + 1 = 4.

Sources

  1. Geometric series, Wikipedia
  2. Dynamic array, Wikipedia

| All Computer Science formulas |

Published 2026-10-22. Plain-text copy for AI agents and readers: computer-science/geometric-series.md.