Question: Is there a good mnemonic or trick for working out the key signature from a given key? I can always write out the chromatic scale, then count out the appropriate intervals from the tonic, and figure the key signature out from that, but I'm wondering if there are any mnemonics or tricks for making this easier.

Also, are there any tricks for going in the other direction, from key signature to key? Of course this won't map to a single key, since there are all of the modes with the same key signature, but something that would make it easy to figure out the major and relative minor given a key signature would be helpful.

Answer: 
The easiest way for me to figure this out (until you start memorizing them or gaining more aural awareness of tonality) was to remember the orders of sharps and flats (which are opposites of each other), and two simple rules for translating from key signature to major keys.

**Sharps:**

* Order: FCGDAEB = Fat Cats Go Down After Eating Breakfast
* From the last sharp in the key signature, go up one semitone to name the name of the major scale.

**Flats:**

* Order: BEADGCF = BEAD, Greatest Common Factor
* The name of the major scale is the *second to last* flat in the key signature.

**Minor:** The name of the relative minor scale (that is, the one with the same key signature as a major scale) is a minor third below the name of the major scale for any key signature.

**Example:** Flats and sharps in the key signature always occur in the same order, so we can easily translate from number of b/#s in the key signature to key.

* Three flats:

	1. Name the flats in order (Bb, Eb, Ab)
	2. Find the second to last flat (Eb major)
	3. Down a minor third for the relative minor (C minor)
* Four sharps:

	1. Name the sharps in order (F#, C#, G#, D#)
	2. Take the last sharp up a half step (E major)
	3. Down a minor third for the relative minor (C# minor)
* Six sharps:

	1. Name the sharps in order (F#, C#, G#, D#, A#, E#)
	2. Take the last sharp up a half step (F **#** major, watch out for enharmonics!)
	3. Down a minor third for the relative minor (D# minor)
* One flat (**EXCEPTION TO THE RULE**):

	1. Bb in the key signature means F major
	2. Or D minor

Finding a key signature from the name of a key is literally the exact opposite process. Some skills that will help with all of this would be learning your scales (both the technique AND the note names, on piano especially) and developing your aural skills to the point where you can identify which note is the tonic just based on the music that you hear.
I think you've already received a good answer for determining the key signature from key, but for the other way round, it's actually *really* simple fortunately.

All you need to know is two rules and a special case:

* If the key signature is composed of sharps, then the major key is a semitone above the ultimate (right-most) sharp. (Rather to be pedantic, I mean the major key's *tonic*.)
* If the key signature is composed of flats, then the major key is the penultimate flat.
* No sharps or flats means the major key is C; a single flat means the major key is F.

In both cases the corresponding (enharmonic) minor key is a *minor third* below the major key.

Of course, given any key signature alone, it is indeed not possible to determine whether the piece is in a major or minor key. For this, a pretty reliable way is to look for raised (sharped) seventh degrees, i.e. the note just below the key's tonic, since it is used in the harmonic minor. So if you don't find any (or perhaps just the odd one), then it's almost surely the major key. Also, looking at the notes/chord with which the piece or (a given section) is resolved should indicate what the key is, though it's definitely not foolproof.