system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5:When a music composer writes a piece in a certain key, are they only using the 7 notes in the given key?

I'm a self taught musician that has studied a bit of music theory (key signatures, circle of fifths, relative keys, etc), but I want to get more proficient. I guess I'm confused on how composers use tonal keys. Take Beethoven's No 5 in C Minor as an example. I find it hard to believe that only the seven notes in the Cmin scale are used throughout the entire composition. So I ask, for my own betterment as a seeker of understanding, how do you write into and out of keys during a piece of music? Thanks!!
gpt
No. The seven notes are the "central home base," but the composer isn't confined to just those notes. You can use chords from other keys, in modern music, using the 'flat 7' chord is common. (Song is in C Major, but a Bb Major chord is also used.)

What Beethoven did and other composers do is modulate keys. Aka, spend some time in a different key, before coming back to home base. (Start in c minor, spend some time playing in g minor, then come back to c minor.) Great composers do this so seamlessly that the common non-musician  may not notice. 

Hope this helps.

Source: Took music theory courses in college/ professional a cappella arranger.