# Math Problem: Piano Key Combinations



## beingforitself (Nov 2, 2009)

How many unique combinations of the 88 piano keys are there, including any combination of 1, 2, 3, ... , or 88 different keys played simultaneously?

At first glance, I think the answer is 88 + 87!! + 86!! + 85!! + ... + 1

where n!! is defined as n + (n-1) + (n-2) + ... + 1

Is this right?


----------



## qqwref (Nov 2, 2009)

No.

If you want to count the number of unique combinations of any number of keys, just notice that each key can be either used or not used, so there are 2^88 combinations exactly. (If you don't count pressing 0 keys, there are 2^88 - 1 possible chords.)


----------



## TacticalPenguin (Nov 2, 2009)

88+(88*87)+(88*87*86)+(88*87*86*85)+...(88*87*86*...45*44) + (88*87*86*...44*43)+(88*87*86*...45*44)...+ 88*87 + 88 + 1

Each term in the sum represents the number of possible combinations for 1 2 3 4 ... 41 42 43 ... 86 87 88 keys.

edit: or the easy way that qqwref found that i totally overlooked. chances are they come out equal...


----------



## beingforitself (Nov 2, 2009)

qqwref said:


> No.
> 
> If you want to count the number of unique combinations of any number of keys, just notice that each key can be either used or not used, so there are 2^88 combinations exactly. (If you don't count pressing 0 keys, there are 2^88 - 1 possible chords.)



Err, sorry if this sounds dumb, but I don't quite follow how this counts out all the possible piano chords (I don't have a very mathematical mind). Could you possibly describe verbally how 2^n counts out all possible combinations of a set of n objects?


----------



## JBCM627 (Nov 2, 2009)

Think about a small piano with 2 keys. The first key can be up with the second key in 2 possible states, or it can be down with the 2nd key in 2 possible states (2*2 = 2^2).

With 3 keys, you have these 4 states, but in addition the 3rd key can have 2 possible states for each of the 4 cases (2*2*2 = 2^3).

Continuing this pattern, you have 2^n states for a piano with n keys.


----------



## beingforitself (Nov 2, 2009)

JBCM627 said:


> Think about a small piano with 2 keys. The first key can be up with the second key in 2 possible states, or it can be down with the 2nd key in 2 possible states (2*2 = 2^2).
> 
> With 3 keys, you have these 4 states, but in addition the 3rd key can have 2 possible states for each of the 4 cases (2*2*2 = 2^3).
> 
> Continuing this pattern, you have 2^n states for a piano with n keys.



Makes perfect sense to me now, thanks.


----------



## qqwref (Nov 2, 2009)

TacticalPenguin said:


> 88+(88*87)+(88*87*86)+(88*87*86*85)+...(88*87*86*...45*44) + (88*87*86*...44*43)+(88*87*86*...45*44)...+ 88*87 + 88 + 1
> 
> Each term in the sum represents the number of possible combinations for 1 2 3 4 ... 41 42 43 ... 86 87 88 keys.
> 
> edit: or the easy way that qqwref found that i totally overlooked. chances are they come out equal...



Your sum is incorrrect. Think about the number of ways you can choose a 2-key chord... it is not 88*87, but half that, because if you just choose the first key and then the second one you could make each chord in two possible ways. The number of ways to choose k out of the 88 keys (which is known as "88 choose k" in math speak) is (88 * 87 * ... * (89-k)) / (k * (k-1) * ... * 1).


----------



## TacticalPenguin (Nov 2, 2009)

Youre right about the duplicates thing, I certainly missed that, I was thinking permutations not combinations, but your math was doing the same - it is for permutations not combinations. Combinations would be 
(88 * 87 * ... * (89-k)) / (k * (k-1) * ... * 1)*k!


----------



## qqwref (Nov 2, 2009)

Sorry, no, you're wrong again. You only divide by k! once.


----------



## TacticalPenguin (Nov 2, 2009)

Ah right I was quite confused. 

N choose R = (N!/(N-R)!)/R!
and N permute R = N!/(N-R)!
Very well.


----------

