Theoretical key

In music theory, theoretical keys or impossible keys are keys with key signatures that contain at least one double-flats or double-sharps.
Double-flats and double-sharps are used in music as accidentals, but they are rarely placed in the key signature (in music that uses equal temperament), because it would make reading the key signature very difficult.
For example, the key of G major is rarely used to write music down, because its key signature has an F. An equal-tempered scale of G major has exactly the same notes as the A major scale. Key pairs like this are called enharmonically equivalent. So the theoretical key of G major is usually written with the key signature of A major.
Enharmonic equivalence.
A piece of Western music usually has a home key, and a passage within it may modulate to another key, which is usually closely related to the home key. (Usually, close to the original around the circle of fifths.) When the key is near the top of the circle (a key signature of zero or few accidentals), the writing of both keys is easy- a small number of extra sharps or flats is added. But if the home key is near the bottom of the circle (a key signature with many accidentals), enharmonic equivalence may need to be used because simply adding accidentals will result in a key with too many accidentals to be easy to play or write in.
The need to consider theoretical keys.
In each of the bottom three places on the circle of fifths the two enharmonic equivalents "can" both be written without double-sharps or double-flats and so do not classify as 'theoretical keys':
But when a relative key is on the opposite side of the circle from its home key, then in theory modulating to that key would involve adding so many sharps or flats that double-sharps and double-flats would have to be written in the key signature. The following keys (six of them are the parallel major/minor keys of those above) would require up to seven double-sharps or double-flats:
For example, if a piece in E major were to modulate up a fifth to B major, which is next to it on the circle and on the same side of the circle, the notation is clear and simple; an extra sharp is added to make five sharps. If it was modulated again, it would become F major, written with six sharps. The next modulation, to C has seven sharps. But the next modulation would be to a theoretical key of G which would need an eighth sharp- for the previous F note to become F in the key signature. To avoid theoretical keys, the new section would usually be written in the enharmonically equivalent key signature of A major.