What You See

If you look at a piano, there's only a single visual pattern you can notice: 2 black keys followed by 3 black keys. These keys, along with the white keys immediately underneath them, form a set of 12 keys.

Each key represents a note that we have labeled from [begin-latex-inline]\text{A}[end-latex-inline] to [begin-latex-inline]\text{G}[end-latex-inline], with the black keys marked by a [begin-latex-inline]\sharp[end-latex-inline] (pronounced sharp) or [begin-latex-inline]\flat[end-latex-inline] (pronounced flat).

Thus, every black key can be marked by two accents:
- [begin-latex-inline]\sharp[end-latex-inline] when coming from the immediate left key
- [begin-latex-inline]\flat[end-latex-inline] when coming from the immediate right key

It's important to realize that black keys, although they look physically separated from the white keys and don't have their own letter, are not just an extension of the white keys. They are distinct notes arranged in this pattern to help us navigate the keyboard. Therefore, you should think of those 12 keys as ordered from left to right: [begin-latex-inline]\text{C}[end-latex-inline], [begin-latex-inline]\text{C}^\sharp / \text{D}^\flat[end-latex-inline], [begin-latex-inline]\text{D}[end-latex-inline], [begin-latex-inline]\text{D}^\sharp / \text{E}^\flat[end-latex-inline], [begin-latex-inline]\text{E}[end-latex-inline], [begin-latex-inline]\text{F}[end-latex-inline], [begin-latex-inline]\text{F}^\sharp / \text{G}^\flat[end-latex-inline], [begin-latex-inline]\text{G}[end-latex-inline], [begin-latex-inline]\text{G}^\sharp / \text{A}^\flat[end-latex-inline], [begin-latex-inline]\text{A}[end-latex-inline], [begin-latex-inline]\text{A}^\sharp / \text{B}^\flat[end-latex-inline], [begin-latex-inline]\text{B}[end-latex-inline].

Those 12 notes are in fact all the notes we have. As you move from one block of 12 notes on the piano to the next block on the right, the notes are the "same" but with a doubled frequency. To our ears, a note and its doubled frequency belong to the same pitch family: they are simply higher or lower versions of the same fundamental sound.

Frequencies

Moving one key to the right multiplies its frequency by a constant factor. Since taking 12 steps to the right doubles the frequency [begin-latex-inline](k^{12} = 2 \iff k = 2^{1/12} \approx 1.06)[end-latex-inline], we multiply by [begin-latex-inline]1.06[end-latex-inline] for each step to the right and divide by [begin-latex-inline]1.06[end-latex-inline] for each step to the left.

As a reference, the middle [begin-latex-inline]\text{A}[end-latex-inline] of a piano ([begin-latex-inline]\text{A}[end-latex-inline] of the 4th block, also called [begin-latex-inline]\text{A}4[end-latex-inline]) has a frequency of 440 Hz. So the frequencies of the middle 12 notes must be:

[begin-latex]\begin{array}{c | c | c} \text{\#} & \text{Note} & \text{Frequency (Hz)} \\[4pt] \hline \rule{0pt}{1.4em} 1 & \text{C} & 261.63 \\ 2 & \text{C}^\sharp / \text{D}^\flat & 277.18 \\ 3 & \text{D} & 293.66 \\ 4 & \text{D}^\sharp / \text{E}^\flat & 311.13 \\ 5 & \text{E} & 329.63 \\ 6 & \text{F} & 349.23 \\ 7 & \text{F}^\sharp / \text{G}^\flat & 369.99 \\ 8 & \text{G} & 392.00 \\ 9 & \text{G}^\sharp / \text{A}^\flat & 415.30 \\ 10 & \text{A} & 440.00 \\ 11 & \text{A}^\sharp / \text{B}^\flat & 466.16 \\ 12 & \text{B} & 493.88 \end{array}[end-latex]

Scales

Intervals

A half-step is the distance between any key and its immediate left/right neighbor. For example, taking a half-step to the right starting at [begin-latex-inline]\text{C}[end-latex-inline] will take us to [begin-latex-inline]\text{C}^\sharp / \text{D}^\flat[end-latex-inline], and taking a half-step to the right starting at [begin-latex-inline]\text{E}[end-latex-inline] will take us to [begin-latex-inline]\text{F}[end-latex-inline].

A whole-step is a distance of 2 half-steps.

Patterns

Most music doesn't use all 12 notes at once; instead, it uses a subset called a scale. While there are many types of scales, two stand out as fundamental in music theory: major scales and minor scales.

You can build a major scale by starting at any of the 12 notes and selecting keys based on this pattern: [begin-latex-inline]\text{WWHWWWH}[end-latex-inline] (where [begin-latex-inline]\text{W}[end-latex-inline] is a whole-step, and [begin-latex-inline]\text{H}[end-latex-inline] is a half-step). For example, looking at the table of notes above, if you start at [begin-latex-inline]\text{C}[end-latex-inline] and follow the pattern, you will select: [begin-latex-inline]\text{C,D,E,F,G,A,B,C}[end-latex-inline]. This is what we call the [begin-latex-inline]\text{C}[end-latex-inline]-major scale! It's a very simple scale indeed because it contains only the white notes.

Notice how the pattern is cyclic in that you always end up back to the first note where you started.

Here is a table of all major scales:

[begin-latex]\begin{array}{c | c c c c c c c c} \text{Root} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 \\[4pt] \hline \rule{0pt}{1.4em} \text{C} & \text{C} & \text{D} & \text{E} & \text{F} & \text{G} & \text{A} & \text{B} & \text{C} \\ \text{D}^\flat & \text{D}^\flat & \text{E}^\flat & \text{F} & \text{G}^\flat & \text{A}^\flat & \text{B}^\flat & \text{C} & \text{D}^\flat \\ \text{D} & \text{D} & \text{E} & \text{F}^\sharp & \text{G} & \text{A} & \text{B} & \text{C}^\sharp & \text{D} \\ \text{E}^\flat & \text{E}^\flat & \text{F} & \text{G} & \text{A}^\flat & \text{B}^\flat & \text{C} & \text{D} & \text{E}^\flat \\ \text{E} & \text{E} & \text{F}^\sharp & \text{G}^\sharp & \text{A} & \text{B} & \text{C}^\sharp & \text{D}^\sharp & \text{E} \\ \text{F} & \text{F} & \text{G} & \text{A} & \text{B}^\flat & \text{C} & \text{D} & \text{E} & \text{F} \\ \text{F}^\sharp & \text{F}^\sharp & \text{G}^\sharp & \text{A}^\sharp & \text{B} & \text{C}^\sharp & \text{D}^\sharp & \text{E}^\sharp & \text{F}^\sharp \\ \text{G} & \text{G} & \text{A} & \text{B} & \text{C} & \text{D} & \text{E} & \text{F}^\sharp & \text{G} \\ \text{A}^\flat & \text{A}^\flat & \text{B}^\flat & \text{C} & \text{D}^\flat & \text{E}^\flat & \text{F} & \text{G} & \text{A}^\flat \\ \text{A} & \text{A} & \text{B} & \text{C}^\sharp & \text{D} & \text{E} & \text{F}^\sharp & \text{G}^\sharp & \text{A} \\ \text{B}^\flat & \text{B}^\flat & \text{C} & \text{D} & \text{E}^\flat & \text{F} & \text{G} & \text{A} & \text{B}^\flat \\ \text{B} & \text{B} & \text{C}^\sharp & \text{D}^\sharp & \text{E} & \text{F}^\sharp & \text{G}^\sharp & \text{A}^\sharp & \text{B} \end{array}[end-latex]
You may wonder why we chose to use [begin-latex-inline]\sharp[end-latex-inline] instead of [begin-latex-inline]\flat[end-latex-inline] or vice-versa in some scales. The reason is that each scale should be written using all letters from [begin-latex-inline]\text{A-G}[end-latex-inline] exactly once. We also name the scale after its first note. This makes it easier to read/write music sheets later on, but it also makes it easier to remember the scales: notice how each scale has its notes ordered. In effect, you only have to remember where the [begin-latex-inline]\sharp/\flat[end-latex-inline] are.

Notice how each major scale has the same sound pattern: this is because what matters is not the notes themselves, but the intervals.

While major scales generally sound bright, minor scales evoke a darker mood. A minor scale is built using the pattern: [begin-latex-inline]\text{WHWWHWW}[end-latex-inline].

[begin-latex]\begin{array}{c | c c c c c c c c} \text{Root} & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 \\[4pt] \hline \rule{0pt}{1.4em} \text{C} & \text{C} & \text{D} & \text{E}^\flat & \text{F} & \text{G} & \text{A}^\flat & \text{B}^\flat & \text{C} \\ \text{C}^\sharp & \text{C}^\sharp & \text{D}^\sharp & \text{E} & \text{F}^\sharp & \text{G}^\sharp & \text{A} & \text{B} & \text{C}^\sharp \\ \text{D} & \text{D} & \text{E} & \text{F} & \text{G} & \text{A} & \text{B}^\flat & \text{C} & \text{D} \\ \text{E}^\flat & \text{E}^\flat & \text{F} & \text{G}^\flat & \text{A}^\flat & \text{B}^\flat & \text{C}^\flat & \text{D}^\flat & \text{E}^\flat \\ \text{E} & \text{E} & \text{F}^\sharp & \text{G} & \text{A} & \text{B} & \text{C} & \text{D} & \text{E} \\ \text{F} & \text{F} & \text{G} & \text{A}^\flat & \text{B}^\flat & \text{C} & \text{D}^\flat & \text{E}^\flat & \text{F} \\ \text{F}^\sharp & \text{F}^\sharp & \text{G}^\sharp & \text{A} & \text{B} & \text{C}^\sharp & \text{D} & \text{E} & \text{F}^\sharp \\ \text{G} & \text{G} & \text{A} & \text{B}^\flat & \text{C} & \text{D} & \text{E}^\flat & \text{F} & \text{G} \\ \text{G}^\sharp & \text{G}^\sharp & \text{A}^\sharp & \text{B} & \text{C}^\sharp & \text{D}^\sharp & \text{E} & \text{F}^\sharp & \text{G}^\sharp \\ \text{A} & \text{A} & \text{B} & \text{C} & \text{D} & \text{E} & \text{F} & \text{G} & \text{A} \\ \text{B}^\flat & \text{B}^\flat & \text{C} & \text{D}^\flat & \text{E}^\flat & \text{F} & \text{G}^\flat & \text{A}^\flat & \text{B}^\flat \\ \text{B} & \text{B} & \text{C}^\sharp & \text{D} & \text{E} & \text{F}^\sharp & \text{G} & \text{A} & \text{B} \end{array}[end-latex]

Notice how some scales have exactly the same notes, for example [begin-latex-inline]\text{C}[end-latex-inline]-major and [begin-latex-inline]\text{A}[end-latex-inline]-minor. However, they differ in their center of gravity: melodies in [begin-latex-inline]\text{C}[end-latex-inline]-major will want to resolve towards [begin-latex-inline]\text{C}[end-latex-inline], while melodies in [begin-latex-inline]\text{A}[end-latex-inline]-minor will want to resolve towards [begin-latex-inline]\text{A}[end-latex-inline]. In fact, for every major scale you will find a corresponding minor scale that contains exactly the same notes:

[begin-latex]\begin{array}{c | c} \text{Major} & \text{Minor} \\[4pt] \hline \rule{0pt}{1.4em} \text{C} & \text{A} \\ \text{D}^\flat & \text{B}^\flat \\ \text{D} & \text{B} \\ \text{E}^\flat & \text{C} \\ \text{E} & \text{C}^\sharp \\ \text{F} & \text{D} \\ \text{F}^\sharp & \text{D}^\sharp \\ \text{G} & \text{E} \\ \text{A}^\flat & \text{F} \\ \text{A} & \text{F}^\sharp \\ \text{B}^\flat & \text{G} \\ \text{B} & \text{G}^\sharp \end{array}[end-latex]

Here are some melodies written in different scales:

Triads

Playing multiple notes together produces a chord. The most fundamental type of chord is a triad, built by selecting a starting note (the root) from a scale, skipping the next note to pick the 3rd, and skipping another note to pick the 5th (a [begin-latex-inline]1-3-5[end-latex-inline] pattern).

For example, starting on degree 1 of the [begin-latex-inline]\text{A}[end-latex-inline] Major scale gives the triad [begin-latex-inline]\text{A}-\text{C}^\sharp-\text{E}[end-latex-inline]. However, you can build a [begin-latex-inline]1-3-5[end-latex-inline] triad starting on every degree of the scale (looping around when needed):

[begin-latex]\begin{array}{c | c c c | l} \text{\#} & \text{Root} & \text{3rd} & \text{5th} & \text{Triad Name} \\[4pt] \hline \rule{0pt}{1.4em} 1 & \text{A} & \text{C}^\sharp & \text{E} & \text{A Major} \\ 2 & \text{B} & \text{D} & \text{F}^\sharp & \text{B Minor} \\ 3 & \text{C}^\sharp & \text{E} & \text{G}^\sharp & \text{C}^\sharp\text{ Minor} \\ 4 & \text{D} & \text{F}^\sharp & \text{A} & \text{D Major} \\ 5 & \text{E} & \text{G}^\sharp & \text{B} & \text{E Major} \\ 6 & \text{F}^\sharp & \text{A} & \text{C}^\sharp & \text{F}^\sharp\text{ Minor} \\ 7 & \text{G}^\sharp & \text{B} & \text{D} & \text{G}^\sharp\text{ Diminished} \end{array}[end-latex]

Notice how the triads built on notes other than the root are identical to the primary (also called tonic) triads of their own respective keys! For example, [begin-latex-inline]\text{D}-\text{F}^\sharp-\text{A}[end-latex-inline] is the primary triad of [begin-latex-inline]\text{D}[end-latex-inline]-major. It's much easier to refer to it as the "[begin-latex-inline]\text{D}[end-latex-inline]-major triad" rather than the "4th degree triad of [begin-latex-inline]\text{A}[end-latex-inline]-major".

There's an exception: the final, diminished triad. A diminished triad is like a minor triad, but with its 5th note lowered by a half-step (hence the name diminished).

Every major scale produces this exact sequence of qualities: Major, Minor, Minor, Major, Major, Minor, Diminished.

You can quickly find a triad of your choice (without first deriving the full scale) by using the following intervals after picking your root note:

Applying these three formulas across all 12 keys yields the complete matrix of triads:

[begin-latex]\begin{array}{c | c | c | c} \text{Root} & \text{Major } & \text{Minor } & \text{Diminished } \\[4pt] \hline \rule{0pt}{1.4em} \text{C} & \text{C} \quad \text{E} \quad \text{G} & \text{C} \quad \text{E}^\flat \quad \text{G} & \text{C} \quad \text{E}^\flat \quad \text{G}^\flat \\ \text{D}^\flat & \text{D}^\flat \quad \text{F} \quad \text{A}^\flat & \text{D}^\flat \quad \text{F}^\flat \quad \text{A}^\flat & \text{D}^\flat \quad \text{F}^\flat \quad \text{A}^{\flat\flat} \\ \text{D} & \text{D} \quad \text{F}^\sharp \quad \text{A} & \text{D} \quad \text{F} \quad \text{A} & \text{D} \quad \text{F} \quad \text{A}^\flat \\ \text{E}^\flat & \text{E}^\flat \quad \text{G} \quad \text{B}^\flat & \text{E}^\flat \quad \text{G}^\flat \quad \text{B}^\flat & \text{E}^\flat \quad \text{G}^\flat \quad \text{B}^{\flat\flat} \\ \text{E} & \text{E} \quad \text{G}^\sharp \quad \text{B} & \text{E} \quad \text{G} \quad \text{B} & \text{E} \quad \text{G} \quad \text{B}^\flat \\ \text{F} & \text{F} \quad \text{A} \quad \text{C} & \text{F} \quad \text{A}^\flat \quad \text{C} & \text{F} \quad \text{A}^\flat \quad \text{C}^\flat \\ \text{F}^\sharp & \text{F}^\sharp \quad \text{A}^\sharp \quad \text{C}^\sharp & \text{F}^\sharp \quad \text{A} \quad \text{C}^\sharp & \text{F}^\sharp \quad \text{A} \quad \text{C} \\ \text{G} & \text{G} \quad \text{B} \quad \text{D} & \text{G} \quad \text{B}^\flat \quad \text{D} & \text{G} \quad \text{B}^\flat \quad \text{D}^\flat \\ \text{A}^\flat & \text{A}^\flat \quad \text{C} \quad \text{E}^\flat & \text{A}^\flat \quad \text{C}^\flat \quad \text{E}^\flat & \text{A}^\flat \quad \text{C}^\flat \quad \text{E}^{\flat\flat} \\ \text{A} & \text{A} \quad \text{C}^\sharp \quad \text{E} & \text{A} \quad \text{C} \quad \text{E} & \text{A} \quad \text{C} \quad \text{E}^\flat \\ \text{B}^\flat & \text{B}^\flat \quad \text{D} \quad \text{F} & \text{B}^\flat \quad \text{D}^\flat \quad \text{F} & \text{B}^\flat \quad \text{D}^\flat \quad \text{F}^\flat \\ \text{B} & \text{B} \quad \text{D}^\sharp \quad \text{F}^\sharp & \text{B} \quad \text{D} \quad \text{F}^\sharp & \text{B} \quad \text{D} \quad \text{F} \end{array}[end-latex]
Some notes are marked with double flats [begin-latex-inline]\flat\flat[end-latex-inline]. This is because triads must be written such that the three letters used are separated each by a single letter:
- Correct: [begin-latex-inline]\text{D}^\flat-\text{F}^\flat-\text{A}^{\flat\flat}[end-latex-inline]
- Wrong: [begin-latex-inline]\text{D}^\flat-\text{F}^\flat-\text{B}[end-latex-inline]

The following example shows chords being arpeggiated (notes of the chords played independently) in a famous song:

Visualize

We can plot all notes, scales, and triads on a graph to observe the connections between each.

The graph models the nodes (notes/scales/triads) as particles with repulsive forces, and the edges (links) as springs that pull the nodes towards each other. Interestingly, the optimal geometrical shape of the graph that minimizes tensions turns out to be the circle of fifths! This actually makes sense given that notes in the circle of fifths are closer to each other when their scales share most of the same notes.