The key describes the note around which a piece of music is built. In Lesson 6 you learned that when a song consists of notes from a particular scale, it is said to be written in the key which has the same notes as that scale. The key signature is written at the start of each line of music, just after the clef.
The number of sharps or flats in any key signature depends on the number of sharps or flats in the corresponding major scale. The following diagrams show the major scales and key signatures for the keys of G and F. Without sharps and flats, these scales would not contain the correct pattern of tones and semitones which gives the major scale its distinctive sound.
The G major scale contains one sharp, F#, therefore the key signature for the key of G major contains one sharp, F#.
The F major scale contains one sharp, Bb, therefore the key signature for the key of F major contains one sharp, Bb.
Some scales contain sharps while others contain flats because there has to be a separate letter name for each note in the scale. E.g., the G major scale contains F# instead of Gb even though these two notes are identical in sound.
If Gb was used, the scale would contain two notes with the letter name G and no note with the letter name F. In the key of F major, the note Bb is chosen instead of A# for the same reason. If A# was used, the scale would contain two notes with the letter name A and no note with the letter name B.
The following charts show the key signatures of all major scales containing sharps or flats. The C major scale is not represented because it contains no sharps or flats. As there are twelve notes used in music, including sharps and flats, there are twelve possible starting notes for scales.
However, you can see from the charts that since F# and Gb are enharmonic notes (i.e., the same notes), the scales F# major and Gb major are actually the same. Note too that only some of the keys that contain sharps or flats have sharps or flats in their name.
An interval is the distance between two notes. Intervals are named according to the number of letters they are apart, plus the notes themselves, e.g., C to G is a fifth. For more on intervals, see Progressive Music Theory.