Each key signature is related to two keys: one minor key and one major key. We say that these two keys share the same key signature. The diatonic tones of these two keys can be written in this key signature in the most readable way i.e. using as few accidentals as possible. Also, from the name of the key signature and the names of the keys, it is obvious that they are related.
For instance, the D major key and the B minor key share the same key signature: the D major/B minor key signature. The next figure shows the diatonic tones of the D major key and the diatonic tones of the B minor key written in the D major/B minor key signature. We see that the diatonic tones of the D major key are written without accidentals while the diatonic tones of the B minor key are written using only two accidentals.
Figure: The diatonic tones of the D major key and the diatonic tones of the B minor key written in the D major/B minor key signature
A passage written in a certain key is usually written using the related key signature because this enables writing the passage in the most readable way i.e. with using as few accidentals as possible. The reason is that in tonal music, diatonic tones occur far more often than altered tones.
For instance, passages written in the D major key and also passages written in the B minor key are usually written in the D major/B minor key signature. The figure from the previous chapter shows two passages written in the D major key and in the D major/B minor key signature.