(Here you can follow the exposition of the sonata Op. 14 No. 2, with the different parts being pointed out in text. You can also read more about that sonata HERE)
Before we start, a quick explanation of what tonic, dominant and subdominant is.
Every piece that we talk about on this blog (and at least 99% of the music you listen to) is in a tonality, C Major for example. That is the tonal “home” of the piece, and it will probably (but not always, as we shall see) start and end in that tonality.
Pieces therefore will, at some point, establish that tonality, which key the piece is in. After that, any “detour” into another tonality will destabilize the music.
The name of the tonality that is the key of the piece is called the tonic.
Other tonalities can be closer or further away in their relationship to the tonic. The further away they are, the more they destabilize the music.
The tonality with the closest relationship to the tonic, is the dominant, which is five whole tone-steps above the tonic: