# How Many Keyboard Shortcuts Are There

Have you ever pressed key chord like
`Ctrl` + `Alt` + `Delete ⌦`
?
What about key sequence such as
`F10` `e` `c`?
(in Microsoft Windows, that activates menu, edit, and copy.)

How many chord combinations are there? and how many key sequences are there? Let's find out.

Let's consider the 4 modifiers:
`Alt`
`Ctrl`
`Shift`
`❖ Window`
.
(lets forget about the right side modifiers for now). If we can use only 1 modifier, we have

`Alt``Ctrl``Shift``❖ Window`

We have a total of 4 possibilities.

Now, lets consider in combination with letter keys. For ease of calculation, let's say there are only 20 letter keys to chose from to be used with modifier. e.g.

- 1
`Ctrl`+`a` - 2
`Ctrl`+`b` - 3
`Ctrl`+`c` - ...
- 20
`Ctrl`+`t`

So the total is 4 * 20 = 80

If we can hold 2 modifiers, we have

`Alt`+`Ctrl``Alt`+`Shift``Alt`+`❖ Window``Ctrl`+`Shift``Ctrl`+`❖ Window``Shift`+`❖ Window`

We have 6 possibilities

4 things, select 2 out of it, order doesn't matter, the possible choices are 6.

Now, since there are 20 letters to combine with, we have 120 possible choices, because 6 * 20 = 120.

We can write this by a formula:
`fbinocof(4,2)`

returns 6.

The formula `fbinocof(n,k)`

is
the possibilities of taking k things out of n.
( The formula is usually called Binomial coefficient, and is
`Binomial[n,k] := n! / (k! (n - k)! )`

)

Now, with formula, we have:

`( fbinocof(4,1) === 4 )`

4 modifiers, holding 1, is 4 possibilities.`( fbinocof(4,2) === 6 )`

4 modifiers, holding 2, Is 6 possibilities.`( fbinocof(4,3) === 4 )`

4 modifiers, holding 3, is 4 possibilities.`( fbinocof(4,4) === 1 )`

4 modifiers, holding 4, is 1 possibilities.

So 4 modifiers, holding any of 1 to 4 of them at the same time, is 15 possibilities. ( 4 + 6 + 4 + 1 === 15)

Multiply by 20 letter key choices ( 15 * 20 === 300 ), result is 300 possibilities.

Here is the code to compute it:

const ffactorial_values = [1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800, 39916800, 479001600, 6227020800, 87178291200, 1307674368000, 20922789888000]; const ffactorial = ((n) => ( ( n < ffactorial_values.length ) ? (ffactorial_values[n]) : (ffactorial_values[n] = ffactorial(n-1) * n) ) ); // fbinocof(n,k) returns the Binomial coefficient. (or, the possibilities of n things take k) Version 2020-07-17 const fbinocof = ((n,k) => ffactorial(n) / ( ffactorial(k) * ffactorial(n - k) ) );

With code, it looks simpler. Look at this:

// 4 modifiers, holding 1 console.log ( fbinocof(4,1) === 4 ); // 4 modifiers, holding 2 console.log ( fbinocof(4,2) === 6 ); // 4 modifiers, holding 3 console.log ( fbinocof(4,3) === 4 ); // 4 modifiers, holding 4 console.log ( fbinocof(4,4) === 1 ); console.log ( 4 + 6 + 4 + 1 === 15); // sum is 15 // multiply by 20 letter key choices console.log ( 15 * 20 === 300 ); // result is 300

Now, we consider both sides of
`Alt`
`Ctrl`
`Shift`
`❖ Window`
. There are a total of 8 modifiers.

8 modifiers, holding 1 to 4 of them at the same time, then press 1 of 20 letter key choices, give us 3240 possibilities.

console.log ( fbinocof(8,1) ); // 8 console.log ( fbinocof(8,2) ); // 28 console.log ( fbinocof(8,3) ); // 56 console.log ( fbinocof(8,4) ); // 70 console.log ( 8 + 28 + 56 + 70); // 162 // sum is 162 console.log ( 162 * 20 ); // 3240 // possibilities of chord with holding max of 4 out of 8, with 20 letter choices

We stop at holding 4 modifier at the same time, because holding more than 4 modifiers is not practical.

## How Many Key Sequence Combinations Are There?

Now we consider key sequences such as
`F10` `e` `c`.

Let's call the first key (such as `F10`) the leader key.
Let's suppose there are 20 letter keys to chose from, for easy calculation.

For total of 3 key presses, counting the leader key, and suppose 20 letter key choices, we have 400 possibilities.

// 3 keys key sequence possibilities console.log ( 1 * 20 * 20 ); // 400

If we allow total of 4 key strokes, we have 8000 possibilities.

// 4 keys key sequence possibilities console.log ( 1 * 20 * 20 * 20 ); // 8000

That's a lot more than chord keys.

Now we consider leader key sequence of 3 keys, but 2 different leader keys, we have

// 3 keys key sequence, 20 letter choices, 2 leader keys console.log ( 2 * 20 * 20 ); // 800 // 800 possibilities

Here is a list of n leader keys possibilities:

- 1 * 20 * 20 = 400
- 2 * 20 * 20 = 800
- 3 * 20 * 20 = 1200
- 4 * 20 * 20 = 1600
- 5 * 20 * 20 = 2000
- 6 * 20 * 20 = 2400
- 7 * 20 * 20 = 2800
- 8 * 20 * 20 = 3200

So, a total of 3 key presses in order, with 8 possible choice of starting keys, and 20 letter choice of subsequence keys, give us 3200 possibilities.

## Conclusion

Comparing the ease of pressing keys and possible combinations:

- key sequences can create far more shortcuts than modifier key combinations.
- key sequences are far more easier to press than modifier key combinations.

Note: the holding modifer keys are bad due to the position of the modifiers, typically at corner of keyboard, and due to a particular order of press/release required. For example, to press
`Ctrl` + `c`, you need to it in this order:

- press
`Ctrl` - press
`c` - release
`c` - release
`Ctrl`

Must be in that order precisely.

If the modifier key are designed as true chord keyboard keys, such as on piano or steno machine, then chord is faster to press than key sequences (because you press all of the keys at once, instead of one by one), and also more combinations (because now you can press practically 8 keys at once (as in piano playing).)

See also:

#### Keybinding and Input-System

- Why Alt Tab is Inefficient
- How Many Shortcuts Are There
- Emacs vs vim, Keybinding Efficiency
- vim HJKL vs IJKL
- Gamers WASD Keys
- Design of vim Mode Activation Key
- History of Key Shortcuts: Emacs, vim, WASD, Etc
- History of vi Keys
- Muscle Memory vs Mnemonics
- Ctrl ❌

Ban Key Combos - Ban Shift Key
- Function Key vs Key Chord
- Fast-repeat vs Non-fast-repeat Keys
- Modifier Keys Usage Frequency

Keyboard Shortcut vs Launch Buttons- Best Way to Insert Parenthesis/Brackets

Math Input Design

Create Math/TeX/APL Layout- Linux Mac Windows, Which is Best for Keybinding?
- Dual-Function Keys (Home Row Mods)
- Xah Shorthand System