Course contentsShow
← Computer Science
Lesson 1756 of 2,87240. Theory of Computation: Regular LanguagesFree lesson

Alphabets and Strings

Define alphabets as finite sets of symbols and strings as finite sequences of symbols from an alphabet.

Alphabets and Strings

What you'll learn: You'll understand how alphabets and strings form the foundation of formal language theory in computation.


After working with databases and complex graph queries, we now step into the theoretical foundation of computation itself. Before we can discuss what computers can and cannot compute, we need precise definitions of the basic building blocks: alphabets and strings.

What Is an Alphabet?

An alphabet is simply a finite set of symbols. Think of it like the building blocks you have available. The symbols can be anything:

  • Binary alphabet: {0, 1}
  • English lowercase: {a, b, c, ..., z}
  • DNA alphabet: {A, C, G, T}
  • Keyboard symbols: {a, b, ..., z, 0, ..., 9, !, @, #, ...}

The key word is finite—an alphabet must have a countable, limited number of symbols. We often use the Greek letter Σ (sigma) to denote an alphabet.

What Is a String?

A string is a finite sequence of symbols chosen from an alphabet. Strings are ordered—the position of each symbol matters.

From the binary alphabet {0, 1}, we can form strings like:

  • 0
  • 101
  • 1111000
  • ε (the empty string with no symbols)

From the alphabet {a, b, c}, we get strings like abc, cab, aaa, or just b.

Notice that "finite sequence" means strings must end—no infinitely long strings allowed in this theory.

Key Takeaway: An alphabet is a finite set of symbols; a string is a finite ordered sequence of symbols from that alphabet. Together, they provide the formal vocabulary for defining what computations look like.