AlgoViz

Geometric sequences

easy 15 min

A geometric sequence multiplies by the same ratio every step: 1, 2, 4, 8 or 64, 32, 16, 8.

Where it shows up

The same pattern appears across everyday software.

  • Dynamic arrays everywhere

    Python lists, Java's ArrayList, C++'s std::vector and Go slices grow their capacity by a constant factor when full. The copy costs form a geometric series, which is the whole proof that append is amortised O(1).

  • Exponential backoff

    When a network request fails, clients wait 1, 2, 4, 8 seconds before retrying, often with random jitter. The total waiting after k retries is 2^k - 1 seconds, so a few retries cover a long outage without hammering the server.

  • Compound interest and growth

    Money growing 5% a year is a geometric sequence with r = 1.05, and the balance after n deposits is a geometric sum. The same model describes bacteria doubling every hour: 2^n after n hours.

  • Half-life and decay

    Radioactive material, drug levels in the blood and cache entries with exponential decay all shrink by a fixed ratio per time step: a geometric sequence with 0 < r < 1.

  • Map tiles and image pyramids

    Each zoom level of a web map has 4 times as many tiles as the one above. Because the series is geometric, storing every coarser level as well costs only about a third more than the most detailed level alone.

  • Git bisect and binary search

    Finding the bad commit among 1,000 halves the range with each test: 1,000, 500, 250 and so on, about 10 tests instead of 1,000.