I was learning the seven-mirror rule trick online today. There was a diagram of every major key along with its corresponding number of accidentals. It was shown that the key of C♭ has seven flats. But, isn’t C♭ just B? By the seven mirror rule: if B♭ has two flats, then B must have five sharps. Last time I checked, seven and five are two different numbers. I’m struggling to explain this inconsistency.
In music, there's something we call enharmonic equivalence. Simply put, two pitches are enharmonic if they are spelled differently but can be played by the same piano key.* They're the musical equivalent of a homophone: like to, two, and too, E♯ and F and G♭♭ all sound the same but are spelled differently.
That's what's happening here. C♭ major is in fact spelled with 7 flats. Even though C♭ sounds the same as B on a piano, B major is nevertheless a distinct key, and it has 5 sharps.
For more on enharmonics, check out What's the difference between a G♭ and an F#? and What is the difference between equivalent Flat and Sharp keys as far as musical notation? Are there any reasons to prefer one over the other?
*Note: This is a simplification, but the specifics aren't really pertinent right now.
The answer to this question revolves around the fact that there is only a half step between B-C and E-F and when you apply the Major scale step pattern for the scale of B, only 5 notes are sharpened. On the other hand, when you apply the Major scale step pattern for Cb, 7 flats are required to maintain the Major scale step pattern. When you cross reference each of the notes, you will find them to be the enharmonic equivalent, (same notes) and we end up with a situation along the same lines as how some folks pronounce the word Either with a long E or a long I. It's still the same word no matter how it's pronounced. It's the same for Major scales B and Cb.
When the ideas around key signatures where being developed they wanted the system to go from 0 - 7 sharps and 0 - 7 flats. The thing was that there where only 12 notes in an octave. So that gave rise to nine notes in the octave only having one key starting on the note and three pairs of keys that are enharmonically equivalent. Those being C# / Db, B / Cb and F# and Gb.
That being said that does not make the system any less great, some instruments would prefer Cb and others would prefer B. A guitar, for instance, abhors a key with flats, B major would be massively easier to play than Cb and on the other side as I understand it a harp, for instance would love keys with flats. The system has to provide for all instruments and that it does.
Not met the 'seven mirror rule', but assume it refers to the same letter name key, as in B=5#, so Bb=2b. E=4#, so Eb=3b, and so on. So - where's the problem? C=0#, so Cb=7b This follows that rule to a T. Assuming that is the rule!
We, here, are talking about Cb, not to be confused with a similar sounding B - which incidentally, as aforementioned, contains 5#...
Personally, I'd try to expunge this rule from the brain!