Intervals, and why the spelling matters
The distance between two notes has two independent measures, and confusing them is the mistake that stalls everything else in theory.
An interval is the distance between two notes. The sentence sounds simple until you try to measure it, and find that there are two distances in there, measured in different ways.
The number comes from the letters
Count the note names, including both ends. From C to E: C, D, E, three names, a third. From C to G: C, D, E, F, G, five names, a fifth.
Notice that the accidental plays no part in that count. C to E and C to E flat are both a third, because the letters are the same.
The quality comes from the semitones
What separates the two is the distance in semitones, measured against the number you just found. C to E has four semitones: , a major third. C to E flat has three: , a minor third.
The case that decides everything
Now the pair that makes this model worth the trouble.
From C to F sharp is six semitones. From C to G flat is also six semitones. The two notes sound identical on a piano.
But F and G are different letters. C to F is a fourth; C to G is a fifth. So:
- — augmented fourth
- — diminished fifth
Same sound, different names. And here is the part that matters: they resolve in opposite directions. The augmented fourth opens outward; the diminished fifth closes inward. A musician who treats the two as the same thing will write the wrong resolution, and will not understand why it sounded wrong.
Inversion
Turn an interval upside down, taking the lower note up an octave, and the new number added to the old one always makes nine. A third becomes a sixth, a fourth becomes a fifth, a second becomes a seventh.
The quality inverts too: major becomes minor, augmented becomes diminished, and perfect stays perfect.
What to take from this
The number and the quality are independent measures, taken from different things: one from the letters, the other from the semitones. Keeping the two apart is what makes it possible to write music that makes sense, and it is the reason everything on this site treats C sharp and D flat as distinct notes, even though they sound the same.