Course contentsShow
← Computer Science
Lesson 82 of 2,8722. Discrete Mathematics for CSFree lesson

Sequence Fundamentals and Notation

Introducing sequences as functions from natural numbers, with subscript and functional notation.

Sequence Fundamentals and Notation

What you'll learn: How to think about sequences as special functions that assign values to counting positions.

What Is a Sequence?

A sequence is simply an ordered list of elements. In mathematics and computer science, we formally define a sequence as a function from the natural numbers (0, 1, 2, 3, ...) to some set of values.

Think of a sequence like a numbered row of mailboxes: each mailbox has a position number (1st, 2nd, 3rd, ...), and inside each mailbox is a value. The sequence is the function that tells you what's in mailbox n.

Two Ways to Write Sequences

Subscript Notation

The most common way to write sequences uses subscripts:

a₀, a₁, a₂, a₃, ...

  • The letter (like a) names the sequence
  • The subscript tells you the position (starting from 0 or 1, depending on context)
  • Example: a₃ means "the value at position 3"

Functional Notation

Since sequences are functions, we can also write them as:

a(n) or aₙ

This means "the value that sequence a assigns to position n."

For example, if a(n) = 2n, then:

  • a(0) = 0
  • a(1) = 2
  • a(2) = 4
  • a(3) = 6

This gives us the sequence: 0, 2, 4, 6, 8, ...

Why This Matters

Sequences appear everywhere in CS: array indices, iteration counters, algorithm analysis, and recursive definitions all rely on this concept of mapping positions to values.

Key Takeaway: A sequence is a function from natural numbers to values, written either with subscripts (aₙ) or function notation (a(n)), where n represents the position in the ordered list.