Movatterモバイル変換


[0]ホーム

URL:


 Blaise Pascal  1623-1662 Christiaan Huygens  1629-1695 Jacques Bernoulli  1655-1705 Leibniz 1646-1716

Combinatorics and Probabilities

 Michon
 

Related articles on this site:

Articles formerly on this page:

Related Links / Further Reading (Outside this Site)

The Electronic Journal of Combinatorics.
AOL: Combinatorics.
Combinatorics and more... Blog of Gil Kalai  (b. 1955).
Probability, symmetry, linearity [1,2,3,4,5,6Mikhail Gromov  (IHES, 2014).
 
border
border

Combinatorics & Probability    [Utility]


(2002-02-05)
In a game-show,the contestant wins if he guesses correctly which one of three doors hides the (only) prize. The rules of the game state that the contestant makes a tentative guess and is thenshown one wrong choice among the two doors which he did not pick. He is then given the opportunity to change his guess. Should he do so?

Yes, always!  The chances of winning aredoubled by switching this way.

The reason is that the first guess is right with probability 1/3, whereas one of theother two choices is correct with probability 2/3.The rules are actually a disguise for a simple choice between two alternatives:Would you rather win if theprize is behind the door you first picked (1/3) or win if it's not (2/3)?

Monty Hall, 1975Before making national news in 1991, as chronicled below, this puzzle appeared underseveral other guises,  including Bertrand's Box Paradox introduced by Joseph Bertrand (1822-1900; X1839) in Calcul des probabilités (1889) andThe Three Prisoner Problem,whichMartin Gardnerpresented in 1959, in hisScientific American column(and again in his 1961 bookMore Mathematical Puzzles). The popularity ofMonty Hall'sTV gameshowLet's Make a Deal revived interestin the problem, about which Steve Selvin wrote a letter to the editorentitled "A Problem in Probability", publishedin the February 1975 issue ofThe American Statistician(with a follow-up inAugust 1975).

Most notably, the problem was posed by a readerof the famous puzzle columnistMarilyn vos Savant(Parade Magazine, September 9, 1990),whosecorrect answer started a flood of objections. The thing became known as theMonty Hall Problem,in honor ofthe popular host of the TV showLet's Make a Deal (which ran 4500 timesfrom 1963 to 1990). The craze culminated in a front-page article ofthe Sunday New York Times,  onJuly 21, 1991. A number of people just could not believe the above answer was correct (they were wrong). Fewer people remarked that the above rules were not directly applicable to thesituation inLet's Make a Deal (they are right). Actually, it's quite interesting to investigate how different "rules" affect the conclusion:

What if the show's host is not obligated to reveal a wrong choice?

We can't begin to address the issue if we don't have a clue about the host's obligations.For example, the producers may ask him to flip a fair coin in order to decide whetheror not to proceed as above (in such a case the contestant should still take theopportunity to switch whenever available, but his overall probability of winning isreduced from 2/3 to 1/2). It may also be known to the contestant that the "hostile" host only gives the opportunityto switch when the initial guess was right (in which case the contestant should clearlyalways decline any such "opportunity" and will win with probability 1/3). A generalized analysis may be carried out along the following lines:

From watching many previous shows, the contestant knows that he will be givenan opportunity to switch with probability  x  if his original guess was rightand with probability  y  otherwise. 
Should he switch when given the opportunity to do so?

A contestant who always  switches will winwith probability(1-x)/3 + 2y/3 . The first term is the probabilitythe contestant was right and can't switch, whereas thesecond term is the probability he was wrong and could switch.It's better to switch whenever that probability is larger than 1/3 (which is the probability of winning when one never switches). In other words, a contestant should  switch whenever2y is at least equal to x.

A host may want to keep his show interesting by having (clever) contestantsreact differently (or indifferently) to the switching opportunity. The above demonstrates that such a host should allow good guesses tobe changed twice as often as he does for bad guesses (so that x = 2y). This makes the contestant win with probability 1/3,whether he decides to switch or not.


(2002-04-01)     [abridged]
Of three prisoners (A, B and C), only the one secretly pardoned by the governorwill escape execution.The governor picked at random and told the warden.The warden refuses to tell the fate of A,but agrees to nameanother prisoner who's doomed;he reveals that B was not pardoned.The survivor will thus be A or C.What's the probability that it will be A?

Before the warden's revelation, the probability that A would survive was clearly 1/3,as the governor's "random" choice was presumably not biased in favor of anyone.The confirmation of the execution of either one of the other two prisoners does notchanges that.It's irrelevant to the fate of A, whose probability of survival remains 1/3.

However, things are looking brighter for C who is now known to survive with probability 2/3,since he escapes execution whenever A does not.

This is another version of the infamous "paradox" discussed in theprevious article.However, this presentation of the so-calledThree Prisoners Paradox predates theequivalentMonty Hall Paradox by several decades,as it was introduced byMartin Gardner in the October 1959 issue ofScientific American. A recent account may be found in Gardner's own 2001 book:The Colossal Book of Mathematics, W.W. Norton & Company, New York,ISBN 0-393-02023-1.


( J. S. of Parkville, MD.2000-05-03)
In how many ways can 6 children be seated at a circular table?

  120 ways.

This is thefactorial of 5 (namely, 5!);the number of ways the 5 other children may be placed to the left ofsome arbitrarily chosen kid.

5 ways to choose the kid placed first to the left, 4 ways to chose the second,3 ways for the third, 2 ways for the fourth, 1 way for the last...


Bachet Square (2002-02-15) 
Bachet square  is a 4 by 4 layout of the 16 court cards(aces and faces) where every suit and every value appearsonly once in every row or column and in either diagonal.
How many different Bachet squares  are there ?

Given a first row of 4 distinct letters,onlytwo squares exist whereeach letter appears once in each row,in each column, and in either diagonal:

D D
CDABDCBA
DCBABADC
BADCCDAB

There are 576 = (4!)2 choices for the first row in a Bachet square (4! = 24  ways to choose the order of the suits and4! = 24 choices for the values). Given the first row, we obtaintwo Bachet squares,(using either the first pattern for suits and the second one for values,orvice versa).  All told: 1152  Bachet squares.

 Bachet de Meziriac  (1581-1638)
 Thus, among the  16! = 20922789888000  possible squares ofthe court cards, only one in  18162144000  is a Bachet squareClaude-Gaspard Bachet de Méziriac (1581-1638)described those rare arrangements in 1624. They resurfaced inRécréations mathématiques et physiques  byJacquesOzanam (1694).


(2000-10-08, by popular request) 
What does C(n,p) mean?  [We don't recommend the notation  nCp. ]

C(n,p) is usually pronounced "n choose p". It is simply the number of ways to pickp objects among n different ones. It's so commonly used when counting things that weneeda special notation for this. In handwriting or in print,  C(n,p)  in oftenwritten as a pair of parentheses enclosing an n above a p. For example C(10,5) may be written as a 10 above a 5 between parentheses,without anything else within the parentheses:

C(10,5)   =   C   =   C   =   10
5
   =   252

How do we obtain this value of C(10,5)? Well, let's first count how many ways you could pick the5 elementsin order: You have 10 choices for the first element,but then there are only 9 unpicked elements left, so you only have 9 choices forthe second element, 8 for the third, 7 for the fourth and 6 for the fifth. All told, you haveways to choose anordered sequence of5 objects if you have 10 to choose from. This isnot quite the answer we want, because we're afterthe number of ways you could get a given set of 5 elementsirrespective of the order in which you pick them...  Read on.

Let's count the number of ways to order 5 things. It looks very much like what we did before: You have 5 ways to pick the first,4 ways to pick the second, 3 ways to pick the third, 2 ways to pick the fourth,and just 1 possibility left for the fifth and last. All told, you have ways to order 5 elements.

Each of your 30240 sequences of 5 objects is thus part ofone (and only one)collection of 120 sequencesin which the same objects appear, insome order. The number of suchcollections is clearly 30240/120, or 252. Therefore, there are 252 different ways to pick 5 unordered elements among 10: C(10,5)=252.

Make sure you understand the above example before going any further...

Instead of writing nn, you may write n!  (it's called afactorial,but there's nothing to it; it's just shorthand). The factorial notation makes it easy to express what we just told you about: What's the number of ways you can order p elements? Well, p!, of course...

The number of ways to pick an ordered sequence of p elements from n possible onesis obtained with the method illustrated by the above example:

n (n-1) (n-2) ... (n-p+1)   =   n! / (n-p)!

Think about it: The left-hand side has p factors and the right-hand side isa product of n factors divided by (n-p) factors so there are only p of them left...

Using factorials,  C(n,p)  is the above divided by  p! which means that:

C(n,p)   =   C   =   C   =   n
p
   =   n!
Vinculum
(n-p)! p!

If all these things are new to you,  it's normal to be confused at first. Study the above and everything will be clear in the end.

The Binomial Theorem  (Khayyám's Theorem) :

The choice numbers  C(n,p) are also called binomial coefficients  because theyappear in the following formula for the  n-th  power of a binomial.  The summation is understood to entail allintegral values of  p  from  0  to infinity. However, when  n  is an integer, the sum includes only n+1terms, because  C(n,p)  is zero when  p  is greater than n.

(1+x)n   =  p C(n,p) xp

To establish the validity of that formula, we simply remark that xp  appears as many times in the expansion of theproduct of  n  factors on the left-hand side as there are ways to choose theterm  x  (instead of the constant term 1)  in  p  of those factors.

Isaac Newton (1643-1727) remarked that Khayyam's formula remains valid even when the exponent  n is not an integer,provided the right-hand side is duly interpreted as an infinite sum (a power series  that converges when |x| < 1 )  and  C(n,p) is properly defined in the following way, which doesn't require  n to be an integer: Isaac Newton  1643-1727

C(n,p)   =    n (n-1) (n-2) ... (n-p+1)
Vinculum
p!

 Blaise Pascal  1623-1662

Pascal's Formula and Pascal's Triangle:

C(n+1,p+1)   =   C(n,p) + C(n,p+1)

Thiscould be shownby using the above expression for C(n,p), but there's an easier approach... Just notice that you can pick (p+1) objects among (n+1) in one of two ways: Either you pick the last object or you don't! There are C(n,p) ways to do the first thing and C(n,p+1) ways to do the second. Halmos

With this formula, you can build a table of the choice numbers  withoutany multiplications. If you write the coefficients C(n,p) in a table where n is the number of the line(lowest on top) and p the number of the column (lowest to the left). Each coefficient is the sum of the two numbers above it (one is directly on top, the other is to the left of that one).

     0   1   2   3    4    5    6    7    8    9   10   11  12  13 0:  1 1:  1   1 2:  1   2   1 3:  1   3   3   1 4:  1   4   6   4    1 5:  1   5  10  10    5    1 6:  1   6  15  20   15    6    1 7:  1   7  21  35   35   21    7    1 8:  1   8  28  56   70   56   28    8    1 9:  1   9  36  84  126  126   84   36    9    110:  1  10  45 120  210  252  210  120   45   10    111:  1  11  55 165  330  462  462  330  165   55   11    112:  1  12  66 220  495  792  924  792  495  229   66   12   113:  1  13  78 286  715 1287 1716 1716 1287  715  286   78  13   114:  1  14  91 364 1001 2002 3003 3432 3003 2002 1001  364  91  1415:  1  15 105 455 1365 3003 5005 6435 6435 5005 3003 1365 455 10516:  1  16 120 560 1820 4368 8008 ...17:  1  17 136 680 2380 6188 ...18:  1  18 153 816 3060 8568 ...19:  1  19 171 969 3876 ...

Note that C(n,n) is 1, so is C(n,0) (there's only one way to pick no object at all). More generally,  C(n,p) = C(n,n-p) because there are as many ways to pick  p objectsas there are ways to discard  that many.

Pascal's triangle  has many interesting properties. Here are some of them:

Fibonacci Sequence :

It's not difficult to prove that sums of the successive antidiagonals  form the celebrated Fibonacci sequence :

1,  1,  1+1 = 2,  1+2 = 3,  1+3+1 = 5,  1+4+3 = 8,  1+5+6+1 = 13,  1+6+10+4 = 21,  1+7+15+10+1 = 34,  1+8+21+20+5 = 55   (A000045)

Gould's Sequence  (Dress Sequence) :

Count the number of odd  entries in line number  n.  This gives youthe sequence shown below,known as Gould's sequence. It was apparently introduced in 1961 by Henry W. Gould (b. 1928)butManfred R. Schroeder (b. 1926)  has also called it the Dress Sequence, afterAndreas Dress(b. 1938).

1, 2, 2, 4, 2, 4, 4, 8, 2, 4, 4, 8, 4, 8...(A001316)

Every term in it is a power of  2. Theexponent in the powerwhich corresponds to the number n row  turns outto be the number of  "1" bits in the binary expansion of  n (A000120). For example, the number  n = 1000000000 (one billion)  is expressed in binaryas  111011100110101100101  which has  13 ones in it.  Therefore, the number of odd entries inthat distant row is:

2 13   =   8192


(2013-11-26)  
The number of ways to separate  n  objetcs into several collections.

The ordinarychoice number  C(n,p)  can beseen as the number of ways to put n objects into either a red box ora blue box so that they contain respectively p and n-p objects. Note that:

C(n,p) = C(n,n-p)     and    C(n,p) = 0  when either  p < 0  or  n < p.

Likewise, the number of ways to distribute  n  objects intothree boxes so that the first two contain respectively  p and  q  objects is denoted  C(n,p,q). Such a distribution can be obtained by picking  p  objectsamong n for the first box and  q  objects among theremaining  n-p  for the second box  (the restgoes into the third box).  Clearly, the result doesn't dependon the order in which the boxes are filled and it can be expressedsymmetrically:

C(n,p,q)  =  C(n,p) C(n-p,q)  =  C(n,q) C(n-q,p)  =  C(n,p+q) C(n-p-q,p)
 
C(n,p,q)   =   n! / [ (n-p-q)! p! q! ]

More generally, the number of ways  n  distinct objects canbe distributed among  k  distinct boxes of fixed sizes (n1 ... n)  is:

C(n, n1 ... nk-1)   =  n! / [ n1! ... nk-1! nk! ]  where   n1 + n2 + ... + nk  =  n

Such a quantity is called a multichoice number.


(2018-08-29)  
Answer :   It's the choice number   C(n+p-1 , p)  Let's prove that:

Consider putting markers into an array so that the leftmost square is marked and a total of  p squares are left unmarked.  If the array has  n+p  squares, there are  n  markers.  Because the position of one marker is imposed, the number of ways to do so is:

C(n+p-1 , n-1)   =   C(n+p-1 , p)

Such arrays are clearly in one-to-one correspondence with the repartitions of  p identical balls into  n  numbered bins:  We just associate bin number  k with the  k-th  marker from the left. The number of balls in the bin is the number of unmarked squares to the right of itsassigned marker  (until either the next marker or the right end of the array, whichever comes first).  QED

To put it in a nutshell:

  • There are  C(n,p)  ways to make  p  unordered choices among  n  possibilities, if duplicates are disallowed.
  • There are  C(n+p-1 , p)  ways to make  p  unordered choices among  n  possibilities, if duplicates are allowed.

This simple remark governs the statistical behavior of elementary particles,  according to quantum logic. Loosely speaking,  the above bins  are quantum states and there are two possibilities:

  • There can be at most one fermion  per bin.
  • There can be many bosons  in each bin.


(2013-04-23) 
How many different outcomes are there from  p  dice with  n  faces.

Answer :   C ( n+p-1 , p )   as explainedabove.


calcuqueen (Linda of Hot Springs, SD.2000-10-09)
A few days ago[2000-10-06],I asked how many 3-scoop sundaes I could make with 7 flavors of ice cream (allowing repeated use of the same flavor). I found the answer (84) by enumeration and someone posted the same resultas7 + (6)(7) + C(7,3).  I discovered this interesting pattern:
84   =   (1)(7) + (2)(6) + (3)(5) + (4)(4) + (5)(3) + (6)(2) + (7)(1)
 
(Taylor of Portland, OR.2000-10-22)
How many triple scoop cones can be made with 31 flavors of ice cream?

For  n different flavors, the answer is the following choice number:

C(n+2,3)   =   n(n+1)(n+2)/6

That's  84  when  n = 7,  or  5456  when n = 31.
That's a thinly disguised special case of the previous problem.

To provide an alternate explanation in concrete terms, let's consider that the flavors are listed in alphabetical order on the menu. A weird waitress insists that you may not name any flavor more than once but are allowedto use the words FIRST and LAST (at most once each) to refer respectivelyto the first or the last flavor you picked explicitely. Each type of sundae can be so named in a unique way. This is equivalent to picking 3different "flavors" among n+2 (including the two bogus "flavors" FIRST and LAST) which can be done in C(n+2,3) ways. QED

Now, about Linda's pattern  (which is indeed pretty). It's fairly easy to prove its correctness using, for example,the formulas for sums of consecutive integers and squares of consecutive integers. However, there's a better way, using straight combinatorics(which Linda may or may not have used to discover the pattern):

To name a sundae, you may first choose your "middle" flavor from the menu. You are then allowed to pick one flavor below the middle one (including itself)and one flavor above it (including itself), for a total of 3 flavors, allowing anyrepetitions.

Thus, if your middle choice is  kth  on the list, you have k (n+1k) possible choices; k  choices for the lower  flavor and (n+1k)  for the upper  one. The sum over all possible middle choices (from k=1 to k=n)  is the total number of possible sundaes. That's also Linda's "pattern":

 
C(n+2, 3)  =    
 
   k  (n+1k)


Matthew LeBaron (2002-03-15; e-mail)
[...] Shirts come in 3 sizes (S, M, and L) and 5 colours (Red, Blue, Green, Black,and White). They are sold in packages containing 4 randomly selected shirts. Order within a package is irrelevant and duplicates ares allowed. How many types of packages are there? What's the formula to determine this, given any set of numbers?

The number of different types of shirts to choose from is:

n   =   3 x 5   =   15

To specify a package of  p = 4  shirts, you must select  p  of those  n  types,  allowing repetitions. It's like putting  p  identical balls into  n  numbered bins. The number of ways to do so  is:

C(n+p-1 , p)   =   C(15+4-1 , 4)   =   C(18,4)   =   3060

That's the correct numerical answer to a silly question. (What sane retailer would ever bundle together shirts of different sizes?)

 
C(n+p-1, p)  =    
 
   C(n,q+1)  C(p1,q)


(2004-02-14) 
A set of  n generic points of the plane define  C(n,2) distinct  straight lines, of which no two are parallel and no three meet outside of the  n original points.  How many new  points of intersection are there?

I am dedicating this to my high-school teacher,Mr. Leterrier  [also a khôlleur  atTaupe Laplace]  who posed thisnicequestion to my high-school class in 1972 or 1973  (time flies). I still remember finding the answer through some awkward method,just like the rest of the class did.

Only after simplifying the result did it occur to me that there ought to be an  elegant solution. Give it a fair shot before peeking! 


(2016-01-17) 
The result of many enumerations of interest to computer scientists.

1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786... (A000108).
Starting with  n = 0,  the  nth Catalan numberis  C(2n,n) / (n+1)

This quantity often  occurs in combinatorics.  For example:

  • It's the number of different binary trees with  n  internal nodes.
  • It's the number of ways an n-sided convex polygon can betriangulated using only nonintersecting diagonals.


(J. F. of Los Angeles, CA.2000-10-29)
Suppose 1.5 percent of the plastic spacers produced by a high speed moldinjection machine are defective.For a random sample of 200 spacers, find the probability that:
A. None of the spacers are defective.
B. Three or more of the spacers are defective.

With p=0.015 and q=1-p=0.985, exactly k spacers are defective with probabilityC(200,k) pkq200-k.In particular:

No spacer is defective (k=0) with probability q200, which is about 4.86683%.

Exactly one is defective (k=1) with probability200pq199,or about 14.823%

Exactly 2 are defective with probability19900p2q198,or about 22.46%.

Adding the above three results, we see that 2 or less spacers are defectivewith a probability of about 42.15%.Therefore, 3 or more are defective with a probability of about 57.85%.

Incidentally, the most likely number of defective spacers is k=3(with a probability of about 22.574%), after which the probabilities decrease rapidly:16.93% for k=4, 10.1% for k=5, 5% for k=6, 2.11% fo k=7,0.76% for k=8, 0.25% for k=9, 0.073% for k=10, etc.In a sample of n spacers, the average number of bad spacers is n times the probabilityof a bad spacer. Here, that means 2000.015, which is also 3.


goldda (2001-03-14)
How likely is it that 2 out of 5 children have the same birthday?

As usual, observethat "2 children have the same birthday" when 3, 4, or 5 do... Let's first suppose that no one is born on February 29th:

If we assume each kid has one of 365 equiprobable birthdays,it's easier to compute the probability that they all havedifferent birthdays: The second kid has a birthday different from the first one with probability (364/365). Knowing that the first two birthdays are different,the third birthday is different from these two with probability (363/365), etc. All told, the probability of having 5 different birthdays is.The probability that (at least) two kids share the same birthday is therefore,or481626601/17748900625, which is about 2.71% (0.0271355737).

Now, let's bring leap years and February 29 into the picture.We may even afford the luxury of using the full Gregorian calendar(century years are not leap years except when divisible by 400; 2000 was a leap year,1900 was not). This is appropriate only when we do not know at what time the family lived(for a 20th or 21st century family the Julian odds of exactly one leap year in 4are more appropriate since 2000 was a leap year). The Julian probability of having one's birthday on Feb. 29 is q = 1/1461(1 leap year in 4 years). The corresponding Gregorian probability is q = 97/146097(97 leap years in 400 years).

Using either value for q,we may state that none of the 5 kids were born on February 29with a probability (1-q) for which the above analysis applies,so two kids have an identical birthday other than Feb. 29 with a probability(481626601/17748900625)(1-q). To this, we should add the probability that at least 2 kids were born on Feb. 29,which is 1-(1-q).

All told, this gives a probability of180043909073061/6656578833083301or about 2.7047512782 % in theJulian case (limited to 20th/21st century),whereas theGregorian case (from recent history to far into the future) correspondsto a probability of about 2.7050013288 %. (That'sexactly 1800420599383851642470257 chances in 66558954341646251642470257.)To summarize, the desired probability is about:

  • 2.705001 %   based on 97 leap years in 400 years.
  • 2.704751 %   assuming every 4th year is a leap year (1901-2099)
  • 2.713557 %   if we know no one's born on Feb. 29.

Does this result apply to 5 siblings?

No, it does not. Heck, it doesn't even apply to a random group ofreal people,because maternity wards are notoriously busier at certain times of the year... Various additional statistical biases apply tosiblings. One major observation is thattwins are not so rare,especially among large families. A minor observation is that the same woman cannot give birth inMarch and June of the same year... For completeness, two people born on the same dayof the same year may have thesame mother, even if they'renot twins. (Guess how.)

By itself, the possibility of twins (in about 2% of live births)overshadows and invalidates the above result when applied to siblings.

As far as the laws of mathematics refer to reality, they are not certain,
 andas far as they are certain, they do not refer to reality.

AlbertEinstein (1879-1955)


Jane (2007-08-22 
cov ( X, Y )   =  E( [XE(X)] [YE(Y)] )  =   E(XY) E(X) E(Y)

cov(X,X)   is the variance  of  X (i.e., the square of its standard deviation ).

By definition, the covariance of two random variables vanishes if and onlyif those two variables are statistically independent (i.e., the mathematical expectation of their product is the product oftheir respective mathematical expectations).

The notion can be illustrated by the example of two random variables X andY obtained from three independent  variables  (A, B, U) and two constants  (x,y).  Without loss of generality,we'll assume that the variance of U is 1.

X   =   A + x U
Y   =   B + y U

The covariance of X and Y is then seen to be  cov(X,Y)  =  xy. 


deweydog (2001-03-24) 
If you have a binomial distribution with n=200 and p=0.47,what would be the variance? How do you work this out?

If n independent random samples are either equal to 1 (with probability p)or to 0 (with probability 1-p), the sum of their values is arandom variable whichis said to have abinomial distribution;its average is np and its variance is np(1-p). Here, this means ,or 49.82. (The standard deviation is the square root of this, roughly 7.0583.)

The explanation for this simple formula repays study.  Here it is:

To obtain a binomial distribution (both in theory and in practice),you may consider the sum Y of n independent random variables (X1, X2, ... Xn),each of which being equal to 1 with probability p and to 0 with probability q = 1-p.The sum is equal to k with probabilityC(n,k)(1-p)n-kpk.The "binomial" distribution derives its name from thebinomial coefficientsC(n,k) which appear in this expression.

The average ("expectation" or "expected value") E(Y) of a sum being the sum of the averages,we have simply E(Y)=np.(The expectation E is a linear function.)With n=200 and p=47%, the sum Y will have an expected value of E(Y)=94.

The variance V(Y) of Y is the expectation of the random variable(Y-E(Y)),namelyV(Y)=E([Y-E(Y)]=E(Y-2E(Y)Y+E(Y))=E(Y)-E(Y).(The last equality in this relation is known as Koenig's theorem.It is obtained simply by noticing that E(Y) is just a constant number.The expectation of a constant number is itself and the expectationof a random variable multiplied by any constant number is simply that constantnumber multiplied by the expectation of the random variable.)

For twoindependent random variables A and B,the relationE(AB)=E(A)E(B) holds(which is not generally the case for dependent variables).You may consider the variance of the sum A+B:V(A+B)=E([A+B]-[E(A+B)].V(A+B) may thus be expressed asE(A+B+2AB)-[E(A)+E(B)].Since we haveE(AB)=E(A)E(B) for statistically independent variables,this boils down toE(A)+E(B)-E(A)-E(B),which you may recognize as equal toV(A)+V(B).In other words, if A and B are independent,V(A+B)=V(A)+V(B).

Therefore, the variance of the sum Y is n times the variance of each independent term X.What is the variance of X? Well, as X is either 0 or 1,X=XandE(X)=E(X)=pso thatV(X)=E(X)-E(X)=p-p=pq.
All told,V(Y) = npq, as advertised.


(Seetharaman, United Kingdom.2000-10-31) 
In standard deviation calculations, why are we using N-1 instead of N?
There are some books where I find N being used instead of N-1.

Both formulas are correct but they apply to different situations.Basically, you use N when you know the theoretical average of the sample(for example, you may know it's zero because of some symmetry in the phenomenon),whereas you use N-1 when you are working with an estimate of the average,obtained by averaging the sample at hand.

This latter use of (N-1) comes from the fact that you want what's called an"unbiased" estimator of the standard deviation,namely you want the calculations to yield a result which doesnothave a systematic built-in error...

Consider n samples X1, X2, ... Xnobtained from an unknown random variable X. The expected value of the sum is the sum of the expected values.Therefore, if you want to estimate the mean of X, your best shot is to divide by nthe sum of the samples. Call this the "sample average". It's an "unbiased" estimate of the mean in the sense that the expected valueof the "sample average" equals the true mean of the random variable X. So far so good.

Now, if you want to estimate the standard deviation butdo not knowthe true mean of X,  you'll have to use the best estimate of the mean at your disposal,namely the sample average. The problem is that this sample average is obtained from the sample itselfand is therefore not independent of each individual sample. The quadratic deviation ofX1 from thesample average is:

(X1-(X1+...+Xn)/n)2

The expected value of that quantitymay be computed from the fact that all the samples are independentand have the same expected value  E(X).  We obtain:

(1-1/n)2 E(X2)+ (n-1)/n2 E(X2)- 2(1-1/n)(n-1)/n E(X)2+ (n-1)(n-2)/n2 E(X)2

This boils down to   (n-1)/n [E(X2)-E(X)2].  Now, the quantity E(X2)-E(X)2 equals the squareof the standard deviation . In other words, the square of the deviation of X1 from thesample averageis expected to be (n-1)/n 2

What's true of  X1 also applies to  X2,...,Xn  and,therefore, the sum of the  n  samples has an expected value of (n-1) 2.

That's why you have to divide the sum by (n-1) instead of n when you're workingwith thesample average because the true mean is unknown.

When the true mean is used, there are no such complications from interdependenciesof the quantities involved and the divisor n should be used.

In other words, we may estimate the standard deviation of a random variable X froma set of n samples X1, ..., Xnusing either of the followingunbiased formulas:

  •  2 = [ X12 + ... + Xn2 - nm2 ] / n
  •  2 = [ X12 + ... + Xn2 - nA2 ] / (n-1)

In this,m is the true mean of X, whereas A = (X1+...+Xn)/n is an estimate of m based on the sample at hand.

The relevant nontrivial factor   1-1/n   is known as Bessel's correction.


(2007-08-28) 
If  Y  is anon-negative random variable, then  P( Y ≥a)  ≤  E(Y) /a

Proof :  If Y ≥a > 0,  then 1 ≤ Y/a. So, the functionwhich equals 1 when Y ≥ a and 0 elsewhere hasa lesser mathematical expectation than  Y/aQED


(2007-08-28)  P( |X-m| ≥ ks) ≤ 1/k2
For any  random variable  X of mean  m  and standard deviation  s.

Proof :  ApplyMarkov's inequality to the random variable  Y = (X-m)2

P( |X-m| ≥ ks)   =  P( Y ≥ k2s2)   ≤  E(Y) / k2s2   =   1 / k2   QED

The French mathematicianIrénée-Jules Bienaymé (1796-1878; X1814) was a personal friend ofPafnuty Chebyshev(1821-1894) whose work he translated from Russian into French. However, the inequality which now bears both names was actually first published by Bienayméin 1853.  Chebychev would use it only 14 years later, in a generalized proof of theLaw of large numbers.


MIMI192002 (2002-02-24 
What is the probability P(AUBUC) of the union of 3 events A,B,C?

P(AUBUC)   =  P(A) + P(B) + P(C) - P(AB)- P(BC)- P(CA)+ P(ABC)

You may prove this using the relationP(AUE) = P(A) + P(E) - P(AE), with E=BUC,namely:P(AUBUC) = P(A) + P(BUC)- P((AB)U(AC)).The last two terms may be expanded using the formula for the probalitity of a union again:
P(AUBUC) = P(A) + P(B) + P(C)- P(BC)- P(AB)- P(AC)+P((AB)(AC)).The last term of this expression is clearlyP(ABC).

This identity is a special case of a relation which is worth committing to memory:The probability of a union is equal to:

  • the sum of the probabilities of the individual events,
  • MINUS the sum of the probabilities of the intersections of 2 events,
  • PLUS the sum of probabilities of the intersections of 3 events,
  • MINUS the sum of probabilities of the intersections of 4 events,
  • PLUS etc.

This is easily proved by induction; the formula for n+1 events is derived from theformula for n events just as we went from 2 to 3 events in the above.

This type of computation is often called aninclusion-exclusionenumeration. It holds either for the probability of events, or for the number of elements in sets. Here are a few great examples:

Among equiprobable permutations of  n  elements, the probability that p given elements are fixed points is   (n-p)! / n!  (since there are  (n-p)!  ways to choose a permutation ofthe elements other than those fixed points).  Thus, the sum of theprobabilities  of all such events is simply  1/p! (namely, the above probability multiplied into the C(n,p)  ways to choose  p  elements).

Clearly,there's at least one fixed point  when point  i  is fixedfor some  i  between  1  and  n. The probability of the union of those  n nonexclusive  eventsis thus readily obtained by inclusion-exclusion enumeration  using theremark presented in the previous paragrah:  The probability that there is at least one fixed point  in a random permutation of  n  elements is thus:

1/1!    1/2!  + 1/3!    1/4!  +   ...    (-1)n / n!

Except for very small values of  n,  that expression is extremely close to a numberwhich all electrical engineer memorize as 63.2% for daily use:

1-1/e   =   0.632120558828557678404476229838539...

This is to say that the probability that there are no fixed points in a permutation of many elements is very nearly equal to:

1 /e   =   0.367879441171442321595523770161460867445811131...

The reader may want to use the same reasoning to obtain the probabilitythat a function (not necessarilybijective)  from {1...n}  to  {1...n}  has no fixed point  (using thefact that  p  given elements are fixed points with probability 1/n ). The result is a binomial expansion which turns out to be equal to:

( 1 1/n ) n

Of course, that expression is more readily established by observing that afunction without fixed points is merely obtained by choosing an image among (n-1)  acceptable points for each of the  n  elements.

The limit of that expression as  n  gets large happens to be alsoequal to  1 / e but the convergence is much slower than in the case of permutations:

( 1 1/n ) n  =   e n Log(1-1/n)  =  1/e  [ 1   1/2n   5/24n2   ...  ]

What is the number of permutations of the integers 1 to 100 which leaveexactly  3  of the  25  primes unchanged? Answer :   [by inclusion-exclusion]

C(25,3)    (-1)n C(22,n) (97-n)!   =    1.761863476208905... 10155

The probability that a random permutation has the above propertyis equal to that 156-digit integer divided by  100!  (namely: 0.00188785484103034...).

What is the number of squarefree integers not exceeding  N ?

Let's exclude from the total count  (N)  all the multiples ofthe squares of primes, using a straightforward inclusion-exclusion  approach:

For  q2  no greater than  N,   we're dealingwith floor (N/q)  multiples of q2. That number is either excluded  (minus sign)  when  q  is a squarefree integer with an odd number of prime factors orincluded  (plus sign)  if  q  is a squarefree integerwith an even number of prime factors. If  q  is the multiple of a square, it's simply ignored,because the multiples of  q  are already dealt within the above scheme  (as multiples of squarefree numbers). All told, the desired result may be very neatly expressed usingthe moebiusfunction    which isprecisely equal to -1  in the first case and  +1 in the second  (it's  0  for a multiple of a square):

    (q)  floor ( N / q)

For  N = 2 50, the value of this expression  (namely, 684465067343069) can be computed in minutes (assuming   to be decently implemented).

  for millions of integerscan be generated extremely fast as a large array of two-bit entries (4 possible codes stand for the 3 legitimate values -1, 0 and +1 anda "not yet computed" place-holder, if needed) This involves a slight modification of the Sieve of Eratosthenes which can be carried out without any multiplications or divisions,as describedelsewhere on this site.

A computation based directly on the following naive expression would be hopeless (it involves  1125899906842624 terms, instead of  33554432).

    | (q) |
1
7
61
608
6083
60794
607926
6079291
60792694
607927124
6079270942
60792710280
607927102274
6079271018294
60792710185947
607927101854103
6079271018540405
60792710185403794

The numbers of squarefree integers not exceeding  10n (for n = 0, 1, 2, ... 17)  appear on the vertical list at left (A071172). This reveals the string of digits (A059956) given on the last line which is just the decimal expansion of the ultimatedensity of squarefree integers among natural integers (about 60.79% of integers are squarefree)  namely:

6 / 2  =   0.607927101854026628663...
=   (1 -1/22) (1 -1/32) (1 -1/52) ... (1 -1/p2) ...

...
607927101854026628663276779258365833426152648033479293...

The same approach would yield  (even more efficiently) the number of cubefree  integers not exceeding N, which is givenby the formula:

1/3    (q)  floor ( N / q)

N 1/3   =  floor ( (N+0.5)1/3)

In particular, when  N  is equal to the successive powers of 10  we obtain the following sequence (A160112) in whose digits appear the decimal expansion of the density of cubefree integers (namely, the reciprocal of Apéry'sconstant).

1,9,85,833,8319,83190,831910,8319081,83190727,831907372,8319073719,83190737244,831907372522,8319073725828,83190737258105,831907372580692,8319073725807178,83190737258070643,831907372580707771,8319073725807074649,83190737258070746354,831907372580707468393,8319073725807074687961,83190737258070746868817,831907372580707468685592,8319073725807074686838076,83190737258070746868310774,831907372580707468683127869,8319073725807074686831257909,83190737258070746868312631845 ...

1/(3)   =  0.831907372580707468683126278821530734417... A088453


WiteoutKing (Lowell, MA.2002-07-17)  [ Cf.abridged answer. ]
What are theodds in favor of being dealt a given poker hand?

There are C(52,5) = 2598960 different poker hands and each of them is dealt with thesame probability. [Thechoice number C(52,5) is pronounced "52 choose 5" andis equal to the number of ways 5 objects can be picked among 52 when the order is irrelevant,as explainedabove.]

Therefore, it's only a matter ofcounting how many such hands belong to a given typeto determine theprobability of that type(namely, the ratio of that number to 2598960, the total number of possible hands). When the probability of an event is the fractionP = x / (x + y),its so-calledodds are said to be eitherx to y in favorory to x against. We pay tribute to this popular way of expressing probabilities in the list below(which assumes some familiarity with poker hands). Note that there are normally 10 different "heights" for astraight andthat theace (A) belongs to the lowest (A,2,3,4,5) and the highest (10,J,Q,K,A),which is traditionally called aRoyal Flush if all cards belong to the same suit.

  • Royal Flush: C(4,1)C(1,1) = 4;  P = 1/649740("1 to 649739 in favor") 
  • Straight Flush: C(4,1)C(9,1) = 36;  P = 3/216580("3 to 216577") 
  • 4 of a Kind:  C(13,1)C(48,1) = 624;  P = 1/4165("1 to 4164") 
  • Full House: C(13,1)C(4,3)C(12,1)C(4,2) = 3744;  P = 6/4165("6 to 4159") 
  • Flush: C(4,1) [C(13,5) - 10] = 5108;  P = 1277/649740("1277 to 648463") 
  • Straight: C(10,1) (45-4) = 10200;  P = 5/1274 ("5 to 1269")
  • 3 of a Kind: C(13,1)C(4,3)C(12,2) 42 = 54912;  P = 88/4165 ("88 to 4077")
  • Two Pairs: C(13,2)C(4,2)2C(44,1) = 123552;  P = 198/4165 ("198 to 3967")
  • Pair: C(13,1)C(4,2)C(12,3) 43 = 1098240;  P = 352/833 ("352 to 481")
  • High Card: (C(13,5)-10) (45-4) = 1302540;  P = 1277/2548 ("1277 to 1271")

A word of explanation for the last count. "High Card" means that the hand is "none of the above" (two such hands would be comparedhighest card first to decide who wins). These hands are uniquely determined from twoindependent choices: First, pick 5distinct values in one of the [C(13,5)-10]  ways which aren'tstraights,then assign suits in one of the [45-4]  ways that aren'tflushes.

The total of all of the above is 2598960 = C(52,5), becauseevery hand is of one and only one of the 10 types listed. You may want to check this...

Should your own local rules disallow the 10thstraight sequence(A,2,3,4,5), the above counts for straights and/or flushes should be changed(and the "High Card" count should be modified as well),replacing 4, 36, 5108, 10200 and 1302540 respectivelyby 4, 32, 5112, 9180 and1303560 = (C(13,5)-9)(45-4).


Don Anglen(2004-01-26)   
I'm told there are 41584 seven-card hands [out of C(52,7)] containing one of the40 five-card straight flushes.  Why not 40 C(47,2) = 43240 ?

Let's first count how many ways there are to get a royal flush(A,K,Q,J,10 in the same suit) when you are dealt q cards. Among the C(52,q) hands of q cards, the following number contain aroyal flush (recall that C(n,p) is 0 for a negative p):

C(4,1)C(52-5,q-5) - C(4,2)C(52-10,q-10)
+ C(4,3)C(52-15,q-15) - C(4,4)C(52-20,q-20)

The first term corresponds to a choice of one of the 4 possible royal flushesfollowed by q-5 cards among the 47 remaining cards. This would countmore than once any hand with more than one royal flush in it,so a negative adjustment must be made... What you must do is a proper "inclusion-exclusion" enumeration(as presentedabove) which is where the 3 additional terms come from.

The same thing goes for straight flushes (let's consider a royal flush to be a particular caseof a straight flush) except the alternating terms are more complex, and more numerous [as many as 20 straight flushes could coexist in a hand of q = 26 cards]. Clearly, the "naive" 40 C(47,2) count  (for q = 7) tallies more than once any hand containingmore than one straight flush...

Below is a correct enumeration. The n-thsquare bracket corresponds to the total number of handscontaining n straight flushes. The bracket contains up to 4n-3 terms, each correspondingto a given total number of cards used by then straight flushes under consideration(this number can be anything from 4+n to 5n). The coefficients in front of the binomial numbers add up to C(40,n):

  [ 40 C(52-5,q-5) ]- [ 36 C(52-6,q-6) + 32 C(52-7,q-7) + 28 C(52-8,q-8) +    24 C(52-9,q-9) + 660 C(52-10,q-10) ]+ [                  32 C(52-7,q-7) + 56 C(52-8,q-8) + ... ]- [                                   28 C(52-8,q-8) + ... ]+  ...

For example, the second of the above brackets corresponds to two given("featured") simultaneous straight flushes (there may be more, we don't care): Among the C(40,2) = 780 suchfeatured pairs, 36 use 6 cards,32 use 7 cards, 28 use 8 cards, 24 use 9 cards, and 660 pairs are disjointand use 10 cards.  Many of the terms cancel out (we'remissing a shortcut here) so the formula can be greatly simplified,but there's no need for sophistication in the case whereq = 7, since the terms already given explicitelyinclude all the nonzero ones. For q = 7, the thing boils down to the advertised result:

40 C(47,2)  -  36 C(46,1)   =   41584


Don Anglen(2004-01-26) 
What's the probability of getting a straight [or royal] flush with 26 cards?

The enumeration presented in the previous article is only easy for small handsorvery large ones: For example, in a "hand" of q = 45  cards there's always at least one straight flush. Onlyone hand of 44 cards iswithout a straight flush.

However, no such shortcut applies to the case  q = 26. We'll use a simple computer program to do the actualcounting fairly efficiently, in two steps:

Step 1:

First, let's consider the C(13,q) hands consisting of q cardsof the same suit. Let's call N(q) the number of these which contain at least one straight. There are only 8192 different such hands for q between 0 and 13 (that's 2 to the power of 13)so it's easy to tabulate N(q) in a fraction of a second with a computer.

To do so, we assign each hand a pattern of 13 bits(corresponding to the integers from 0 to 8191) with the most significant bitset if we hold an Ace, the next one for a King, and so on,down to the least significant bit for a deuce. The number 31 (i.e, 5 consecutive bits set to 1) multiplied byany power of two, from 1 to 256, gives a so-calledmaskcorresponding to one of the 9 regular straights,while themask for the tenth straight (A,2,3,4,5) is 4096+15 = 4111. The tiny table below may thus be built by counting the number q of nonzero bits in eachof the 8192 patterns whose "bitwise and" with at least one of the 10 acceptablemasks is equal to that particular mask. Here's a piece of code to do just that:

   dim N(13)   for I=0 to 8191      Q=bitcount(I)      if 4111=bitand(4111,I) then *TALLY      M=31      while M<8192         if M=bitand(M,I) then *TALLY         M=2*M      wend: goto *SKIP      *TALLY: N(Q)=N(Q)+1   *SKIP: next I
Number of combinations of q cards from the same suit
(of 13cards)  which contain at least one straight flush:
q 55678910111213 13
 N(q) 01071217371384234771310

Step 2 (using several methods):

Now, for theentire pack of 52 cards, we may consider the 4nonexclusivepossibilities of having straight clubs, straight hearts, straight diamonds,or straight spades... Thus, a straightforwardinclusion-exclusion enumeration givesthe desired result as the sum of the following expressions  [of four terms] over all the nonnegative indicesq1 q2 q3 q4whose sum is equal to q:

C(4,1) N(q1) C(13,q2) C(13,q3) C(13,q4)
- C(4,2) N(q1) N(q2) C(13,q3) C(13,q4)
+ C(4,3) N(q1) N(q2) N(q3) C(13,q4)
- C(4,4) N(q1) N(q2) N(q3) N(q4)

Such terms are zero when an index is more than 13 or when the function N appears with anargument below 5, so there are relatively few nonzero terms to add (or subtract): For  q = 26, the 4 above types of terms are nonzero in 1209, 709, 334 and 84 cases, respectively. A grand total of 2336 nonzero terms...A priori, C(q+3,3) ordered sets of indices of sum q,and 4 terms to each set could have meant 14616 terms for q = 26. All told,  255774304012724 hands contain astraight flush out of  495918532948104 possible hands of 26 cards. Thus, the probability to have a straight [or royal] flush among 26 cards is:

9134796571883 / 17711376176718   =   0.5157587124082935...

Numberof hands of q cards with at least one straight flush (A143314)
and percentage of that to the total number of combinations  C(52,q) :
q=                   (%)  4               0   0  5              40   0.001539077   6            1844   0.009057633  7           41584   0.031082810  8          611340   0.081237077   9         6588116   0.179069883 10        55482100   0.350708060 11       380126920   0.629310354 12      2177910310   1.055294393 13     10644616240   1.676281723 14     45049914588   2.546680140 15    167011924492   3.726795587 16    547315800984   5.281342552 17   1597026077496   7.277207845 18   4173458163098   9.780325218 19   9813490226056  12.851547041 20  20841357619302  16.541465273 21  40096048882028  20.884249209 22  70043238025686  25.890741583 23 111299858400784  31.541291220 24 161084365419139  37.779089838
q=                   (%) 25 212534592698472  44.505092157  26 255774304012724  51.575871241 27 280828262657348  58.805898612 28 281310102228657  65.975612201 29 257052287198104  72.846103901 30 214209339496536  79.180215104 31 162748148903084  84.768275047 32 112708315365631  89.454857917 33  71138289660672  93.161256080 34  40921413681848  95.897626995 35  21453967174040  97.759817712 36  10250154666092  98.909218234 37   4460732889232  99.539237677 38   1766089532348  99.837373263 39    634724725868  99.954515344 40    206360120020  99.990654664 41     60402956200  99.998720874 42     15820006672  99.999889077 43      3679075192  99.999994346 44       752538149  99.999999867 45       133784560 100

The above summation can be simplified into the following expression,which saves multiplications.  It involves only 508 nonzero terms forq = 26,  and never more than1195 nonzero terms for any q  (this maximum is reached for q = 35):

i N(i)[ 4 C(39,q-i)j N(j)[ 6 C(26,q-i-j)k N(k)[ 4 C(13,q-i-j-k) N(q-i-j-k) ]] ]

We could also use the elegant approach presentedbelow andintroduce the following polynomial S(x) which encodes the result of the above "first step":

10 x5 + 71 x6 + 217 x7 +371 x8 + 384 x9 + 234 x10 +77 x11 + 13 x12 + x13
=   x5(1+x) (10 + 61 x + 156 x2 + 215 x3+ 169 x4 + 65 x5 + 12 x6 + x7)

The number of combinations of q cards containing at least one straight [or royal]flush is then equal to the coefficient of  xq in the following expression:

4 S(x) (1+x)39    6 S(x)2 (1+x)26  +   4 S(x)3 (1+x)13    S(x)4

This expression may be rewritten in a much more compact form:

(1+x)52   [ (1+x)13 S(x) ] 4

The hands without  a straight flush are thus enumerated by

[ (1+x)13 S(x) ] 4

This is easy to prove:  The inside of the bracket counts thecombinations of cardsof the same suit without a straight. A combination from the whole pack without a straight flush is justa juxtaposition of four such combinations; one in each suit.

Similarly, the formula givenabove for the number ofcombinations of q cards containing at least one royal  flushis equal to the coefficient of   xq   in:

(1+x)52   [ (1+x)13 x5 (1 + x)8 ] 4

So, the following difference counts handswith straight flushes butno royal ones:

[ (1+x)13 x5 (1 + x)8 ] 4   [ (1+x)13 S(x) ] 4

This is equal to 36 x5 + 1656 x6 + 37260 x7 + 546480 x8 +5874656 x9 + 49346350 x10 +337176880x11 +   ...  + 490000 x47+ 25000 x47 + 625 x48.
These coefficients appear on the second line of the table in the next article...


(2004-02-06, updated 2006-07-28)
What's the probability of a poker hand appearing highest among q cards?

Among q cards, there are 13 nonexclusive  ways to have at least one4-of-a-kind hand  (4 aces, 4 kings ... 4 deuces). Therefore  (cf.previous article) the number of such q-cards combinationsis the coefficient of  xq  in the polynomial:

(1+x)52 [ (1+x)4 x4 ] 13

However,when  q  is 8 or more, there's a possibility of having both a 4-of-a-kind and a straight flush, in which case the existence of the latterovershadows the former  (according to the careful wording of the above question).

For example,the coefficient of  x8  in the above (i.e., 2529462) includes200 straight (or royal) flushes: Each such hand is obtained from any of the 40 possible straight flushesby singling out one of its5 cards [and including all other cards of its kind]. So, only 2529262 eight-card hands are counted as 4-of-a-kind.

Some of the data tabulated below may thus be surprising at first. For example, with 8 cards or more, a full house is more likely than just three-of-a-kind...

Theprobability is the ratio of the tabulated numberto thetotal on the last line.
q-Card Studq = 5q = 6q = 7q = 8q = 9
Royal Flush4188432464860713460
Straight Flush361656372605464805874656
4 of a Kind62414664224848252926222247616
Full House3744165984347318445652128423908824
Flush5108205792404764450850320453008864
Straight10200361620618002067072620509071920
3 of a Kind54912732160646162038493000151728780
Two Pairs1235522532816314334002577609001442570040
Pair1098240973074058627800236092500600163200
High Card13025406612900232944605347608069788040
TOTAL2598960203585201337845607525381503679075400

With 11 cards, what's really difficult is toavoid getting at least a pair, for you must hold  AKQJ9876432  (the only set of 11 different values which does notcontain a straight) without holding more than 4 cards of any suit. There are as many ways to do this as there are arrangements of 11 suits where no suitappears more than 4 times. As explainedelsewhere on this page, this amounts to:

The coefficient of   x11/ 11!     in    ( 1  +  x2/ 2!  +  x3/ 3! +  x4/ 4! ) 4

This coefficient is 11! times 25/432, which is 2310000 (whereas there are 411, or 4194304 unrestricted arrangements). All told, there are thus 2310000 combinations of 11 cards that do not include apair or better.  Out of a total ofC(52,11) = 60403728840equiprobable combinations, this is a probability of only 0.000038242672... With 12 cards, this probability would be zero,since you would always hold either a straight or several cards of the same kind.


(Lizzie of United Kingdom.2000-10-29)
There are 3632428800 different possible arrangements of the lettersin the word "". How can I show that there are 457228800 arrangements of the lettersso that no two vowels are next to each other?

Let's first count the unrestricted arrangement of the letters in.There are 14 letters(3 N's, 2 O's, 2 T's, and a single copy of each of the 7 letters C,S,A,I,P,L,E). If all these letters were different (say the N's are colored red white or blue, whereas boththe O's and the T's are either red or blue), you would have 14! different arrangements. To each actual arrangement of the (uncolored) letters corresponds exactly 3!2!2! arrangementsof the colored letters. Therefore, there are 14!/(3!2!2!) or 3632428800 possible arrangementsof the (uncolored) letter in .  So far so good.

What happens when you don't allow adjacent vowels? You have 5 vowels and 9 consonants. In how many ways can you put P vowels in 2P-1+K positions?

Well, if K is negative you can't do it.If K is zero, you've got only one choice (think about it).In general, you have C(K+P,P) choices,because that's the number of ways you could place the vowels in P+K positionsif you did not have any restriction. With the restriction, each vowel is in effect occupying two spaces(itself and the position to its right) except for the last one which is only occupyingone space.  So, you may as well mentally ignore the P-1 "dead spaces"and see the exact correspondence between the two situations.

Here, you have P=5 and K=5, which means C(10,5) = 252 ways of choosing the positionsof the vowels. Once this is done, you have 9!/(3!2!) choices for placing the consonants(since there are 3 identical N's and 2 identical T's)and 5!/2! choices for the vowels (there are two O's).All told, you have252 9! 5! / 24 =  457228800  possibilities, as advertised.

Incidentally, the probability that no two vowels are adjacent in an arrangementof P vowels among N letters(N = 2P-1+K) depends only on N and P,because it's the same as the probability of having no adjacent markswhen P squares are randomly marked in a row of N squares. (Putting equiprobable arrangements of vowels in the marked squares andequiprobable arrangements of consonants in the unmarked ones won't change the odds.) This probability is:

C(N-P+1,P) / C(N,P)

With P=5 and N=14, this ratio is simply 252/2002, or 18/143 (about 12.59%) which isan easier way to find the ratio of the above pair of large numbers...


(Lizzie of United Kingdom.2000-10-31)   
From the 9 letters of the word "POSSESSES",show that there are...
a)   12 possible selections of 4 letters,  and
b)   115 different arrangements of 4 letters in a straight line.

The 9 letters include:  5 S's, 2 E's, 1 P, 1 O.

Let's use this question to present a very interesting general approach...

To make a selection,you have to chose a certain number of S's from 0 to the maximum allowed, which is 5(the fact that you will eventually use at most 4 S's is irrelevant at this point),then you choose the number of E's from 0 to 2,and the numbers of P's and O's each from 0 to 1.

The four numbers you pick must add up to  4. Well, the coefficient of x4 in the following expression is obtained withexactly the same breakdown, so both quantities are equal  (think about it)!

(1 + x + x2 + x3 + x4 + x5)(1 + x + x2) (1+x) (1+x)

In the expansion of this polynomial, the coefficient of  xp is thus the number of selections of  p  letterstaken from  :

1 + 4x + 8x2 +11x3 + 12x4 + 12x5 +11x6 + 8x7 + 4x8 + x9

In particular, the coefficient of  x4  is  12, the answer to question (a).

Now, let's try to count arrangements with the same polynomial idea.Well, if all the letters were different,you could rearrange each of the above basic selections in 4! different ways.They are not different, though, and that means that for each setof k identical letters in a basic selection, you've overestimated the true countof arrangements by a factor of k! All told, you'll see that the number of possible arrangementsis 4! times the coefficient of x4 in the following polynomial(it's more convenient to describe this as "the coefficient of x4/4! "):

(1 + x + x2/2! + x3/3! + x4/4! + x5/5!)(1 + x + x2/2!) (1+x) (1+x)

Now, expand this polynomial and you get:

In particular, the coefficient of x4/4! is 115and that's the answer to your second question.

Incidentally, notice that, if you had an unlimited supply of the 4 letters,the above polynomial would become a series equal to the product of 4 identical series,each equal toexp(x).Therefore, the whole thing would simply be the series forexp(4x), namely:

1 + (4x) + (4x)2/2! + ... + (4x)n/n! + ...

This is one (devious) way to prove that there are 4n arrangements ofn letters from an "alphabet" of only 4.(4 choices for the 1st position, 4 for the 2nd, 4 for the 3rd, 4 for the 4th, etc.)

I encourage you to do the same thing to count basic selections (not arrangements)of n letters of 4 possible differents kinds (whose supply is unlimited).What, then, is the coefficient of xnin 1/(1-x)4 ?  [Answer: C(n+3,3)]


Anonymous Query via Google (2004-11-10) :    How many positive integers less than 1000000 have the sum of their digits equal to 19?

The answer is 30492.  The approach introducedaboveshows that this is the coefficient of x19 in the expansion of ( 1 + x + x2 + ... + x9 ) 6.

In UBASIC:   print coeff(((_X^10-1)\(_X-1))^6,19)

(2004-07-17)  
How many sequences of n bits are there without p consecutives zeroes?

Equivalently, you could ask about the number of ways to flip a coin n timeswithout ever getting p consecutive tails.  Same problem.

Let's call a bit sequence [of zeroes and ones] without p consecutive zeroes"satisfactory" and let F(n) bethe number of suchsatisfactory strings of length n.

Since all sequences of length less than p are satisfactory, wehave  F(n) = 2n, for n<p.  On the other hand, if n is at least equal to p,a satisfactory sequence starts with exactly k zeroes (k = 0, 1, ... p-1),followed by a "one" bit and thenany satisfactory sequence of length (n-k-1). Therefore, the following relation holds, which defines F(n) recursively:

F(n)   =   F(n-1) + F(n-2) + ... + F(n-p)

In particular, for p=2, we're counting the number of flip sequences wheretailsnever occurs twice in a row, and obtain as F(n) the Fibonacci number of rank (n+2). For p=3, it's the so-called "Tribonacci" number of rank (n+3). For p=4, we have "Tetranacci" numbers, for p=5 "Pentanacci" numbers, etc. Note that, for p=1, F(n) = 1, because there's only one string of n bitswithout zeroes...

Number of stringsof n bits without p consecutive zeroes : (A048887)
n =0123456789101112Sloane's
p = 11111111111111A000012
p = 2123581321345589144233377A000045
p = 31247132444811492745049271705A000073
p = 4124815295610820840177314902872A000078
p = 5124816316112023646491217933525A001591
p = 6124816326312524849297619363840A001592
p = 71248163264127253504100420003984A066178
p = 81248163264128255509101620284048A079262
p = 91248163264128256511102120404076A104144
1248163264128256512102420484096A000079

As there are 1024 equiprobable ways to flip a fair coin 10 times,the probability you'll do so without ever gettingtailstwice in a row is /1024 (about 14 %).


Michael J. Wales(2010-09-24; e-mail)  
If I win  when I flipmore consecutive  heads than I've ever flipped tails,what's my probability of winning?

Losing sequences are endless.  Winning sequences include:

H,  THH,   TTHHH,   THTHHH,   TTTHHHH,   TTHTHHHH, ...

Theoretically, you never have to concede defeat:  Even if you have already flipped 1000 tails,there's a very slim chance thatyou will flip 1001 heads in a row, starting with the next throw. In practice, it would be silly not to give up after accumulating 30  tails or so... As such an artificial bound tends to infinity, the probability of winningtends rapidly to a value of  0.7112119...

Let's analyze the situation without assuming that the coin is a fair one: p  is the probability of heads and  q = 1-p is the probability of tails.

We may bypass the elementary considerations of the above introductionby dealing directly withtheuncountable set of infinite sequences of flips. The subset of all such sequences sharing a prescribed prefix consisting of n  heads and m  tails has a probability measure  equal to  pqm.

Let's call  P(n)  the probability of the set of all strings that start witha winning string with  n  tailsstripped from its  n+1  trailing heads. Such a string with  n+1  tails is uniquely obtained by appending to a string ofthe same type with  n  tails a string consisting of at most n consecutive heads,followed by one final tails. Therefore:

P(n+1)   =   P(n) q   pi    =   P(n) ( 1-pn+1)

So,  P(0) = 1,  P(1)  =  (1-p),  P(2)  =  (1-p)(1-p2),   etc.

The probability of the set of winning strings with  n  tails being  pn+1 P(n)   we obtain the followingexpression for the overall probability of winning:

f (p)   =   p  +    pn+1   ( 1-pk)

The above probability of winning may also be expressed as:

f (p)   =  p [ 1 + p (1-p)[ 1 + p (1-p2)[ 1 + p (1-p3)[ 1 + p (1-p4)[ ... ]]]]]

As advertised, for a fair coin (p = ½)  that expression is equal to:

f (½)   =   0.711211904913397578721100278070769219911088...

On 2010-09-25,Michael Waleswrote:   [ edited summary ]
This is the greatest site ever.   I've forwardedyour linkto others to whom I've asked the same question.

Thanks for the kind words, Michael.

The above function f  has an interesting expansion as a power series :

f (x)   =  x + x2 x5  x7+ x12 + x15 x22  x26+ x35 + x40 x51  x57+ x70 + x77 x92  x100+ x117 + x126 x145  x155+ x176 + x187 x210  x222+ x247 + x260 ...

The exponents of  x  are the generalized pentagonal numbers (A001318). The terms are grouped by pairs, with alternating signs.  More precisely:

f (x)   =    x (2k+1)(3k+1)  + x (2k+1)(3k+2)   x (k+1)(6k+5)   x (k+1)(6k+7)

That formula yields a fast way to compute f (x) and a peculiar decimal expansion for f (0.1)  that features only4 digits  (0, 1, 8 and 9)  namely:

Incidentally:   ½  = f ( 0.3705997158021455417170957127716712...)


( Brad of Schaumburg, IL.2000-11-03)
How many ways can you make change for a dollar?

If you only allow quarters, dimes, nickels and pennies, the answer is 242.If you also allow dollar coins and half-dollars, the answer is 293.

Note that the number of ways you can obtain a sum of 100 by adding 25,10,5,and 1 is the coefficient of in the expression:

also equal to:1 / [ ]

Thepractical way to do it is via a small computer program.In , this may be something as simple as the following(which prints "242"):

s = 0FOR q = 100 TO 0 STEP -25  FOR d = q TO 0 STEP -10    FOR n = d TO 0 STEP -5      s = s + 1    NEXT  NEXTNEXTPRINT s

It's easy to change the above to account for half-dollars(the result is 292). Add the unique way corresponding to a single dollar coinfor a total of 293.

The above simple-minded program can be made far more efficient if wenotice that there are  1+floor(p/5)  ways to make change for an amountof  p  cents with nickel and pennies only (that's what the inner loop computes). The same idea is easy to extend to get rid of the next innermost loop bycounting the waysto make change with pennies, nickels and dimes; thereare  (1+d)(1-d+n)  such ways, where n=floor(p/5) and d=floor(p/10). The following program is indeed much faster for large values of p (well beyond p=100):

INPUT "Amount in cents p=";ps=0FOR j = p TO 0 STEP -25  s = s + (1 + INT(j/5))*(1 - INT(j/5) + INT(j/10))NEXT jPRINT s;"ways; with pennies, nickels, dimes & quarters"

It's more difficult to get rid of this "quarter counting"loop with a closed formula, but it can be done (seebelow). When we are faced with a large number of weird denominationsit may not be practical to derive suchclosed form formulas. On the other hand, programs like the above tend to be too slow [their running time is roughly proportional to the result,which grows exponentially with the number of denominations]. A more efficient approach isbased on the actual computation of the product of the polynomials described above. This may be done with a number of additions which is roughly proportional tothe number of denominations, and also to thesquare of the amount p...

Given below is a implementation of that approach. As is, the program is written for pennies, nickels, dimes and quarters, but you mayhave different and/or additional denominations by changingonly the first lineof the program to define other coins (in terms of the number of pennies they stand for). Two polynomials are used in the form of arrays (A and B). For each new coin denomination, Polynomial B is updated to reflect thenumber of ways to make change with such coins and/or the previously considered ones,knowing that the (previously computed) Polynomial Atells how many ways change could be madewithout the new denomination... At the end, Array B contains all the answers for any amount p, up to the built-inlimit M defined at the beginning of the program (M=200 is just an example here).It's then a simple matter to display interactively the answer B(p)for any desired amount p:

N=3: DIM c(N): c(1) = 5: c(2) = 10: c(3) = 25M=200: DIM A(M),B(M)FOR i = 0 TO M: B(i) = 1: NEXT iFOR d = 1 TO N  FOR i = 0 TO M: A(i) = B(i): B(i) = 0: NEXT i  FOR j = 0 TO M STEP c(d)    FOR k = 0 TO M-j      B(j+k) = B(j+k) + A(k)    NEXT k  NEXT jNEXT dMain:  INPUT "Amount in cents p=";p  PRINT B(p); "ways!"GOTO Main
See formulas below...
Number ofways to make change with given coin denominations.
Amount1,51,5,101,5,10,251,5,10,25,501,5,10,25,50,100
100 21121242292293
200 41441146324352728
500 1012601190065957698411
1000 201102011425118014512103596
2000 4014040111030211171210153995291
5000 1001251001168925514326992514587118976
10000 200110020011342351016794128501139946140451
(n+1)(n-d+1)(d+1)

Making change with US coins: Explicit formulas.

Let p be the amount in cents (¢) for which we have to make change. Let n be floor(p/5) which is the number of whole nickels(5¢) contained in that. Similarly, we'll call d,q,h and w the numbers of dimes (10¢)quarters (25¢) half-dollars (50¢) and whole dollars (100¢)in the amount p.

The number of ways to make change using only pennies and nickels is n+1,because all you have to do is decide on a number of nickels from 0 to n.

If you're allowed dimes as well,you first choose a number i of dimes from 0 to d, and are left with (p-10i) centsfor which you must give change usingonly pennies and nickels. Since floor((p-10i)/5) is n-2i, you have n-2i+1 ways to dothat. The total number of ways to make change is thus the sum of (n-2i+1) when i goes from 1 to d,which works out to be:

(n-d+1)(d+1)  ways to give change for p cents
using pennies, nickels & dimes,
where   n = floor(p/5)   and   d = floor(p/10)

The situation is more complicated whenquarters are allowed as well:

If we use aneven number 2j of quarters, we have to make change for p-50j centswithout quarters and have (n-d-5j+1)(d-5j+1) ways to do so...

With anodd number 2j+1 of quarters, we're left with (p-50j-25) pennies. Since floor((p-50j-25)/10) can be shown to be equal to (n-d-5j-3), we have(d-5j-1)(n-d-5j-2)  ways to complete the transaction.

When q = 2h, we sum up the first expression for j going from 0 to h and the second onefor j between 0 and h-1. When q = 2h+1, on the other hand, we sum the second one also up toj = h, which gives formally an additional term equal to(d-5h-1)(n-d-5h-2) .Thus, we obtain an expression valid when q is either 2h or 2h+1 by adding(q-2h)(d-5h-1)(n-d-5h-2) to the expressionobtained for q = 2h. The formidable result shows that there are 133333423333351000001 ways to make change for a million dollars in pennies, nickels, dimes and quarters:

(h / 6)  [ 100 h+ 6 d (2n2d1) 15 h (2n1) 7 ]
+   (nd+1) (d+1)  +  (q2h)(d5h1)(nd5h2)

Eliminating h  [using  q = 2h + (q mod 2) ] we obtain the following expression. (The last term is  0  or 1/8  and may thus be discarded if the resultis rounded  to the nearest integer.)

(q / 24)  [ 50 q+ 12 d (2n2d1) 15 q (2n1) 14 ]
+   (nd+1) (d+1)  +  (q mod 2)[ 2(n2d) 1 ] / 8

This formula was worked out and posted here (immediately) on February 8, 2004. This is the earliest source for it.  The relevant permanent  link ishttp://www.numericana.com/answer/counting.htm#uschange.


(2009-04-22)     (Project Euler,Problem 31)
Using 8 denominations of  1, 2, 5, 10, 20, 50, 100 and 200 pennies,how many ways are there to make change for  N  pennies?

A simple efficient program can be quickly designedasabove whichgives foolproof answerswhen  N  is less that the size  M of a reasonable array.

Mint=7: DIM c(Mint)c(1)=2: c(2)=5: c(3)=10: c(4)=20: c(5)=50c(6)=100: c(7)=200M=200: DIM A(M),B(M)FOR i = 0 TO M: B(i) = 1: NEXT iFOR d = 1 TO Mint  FOR i = 0 TO M: A(i) = B(i): B(i) = 0: NEXT i  FOR j = 0 TO M STEP c(d)    FOR k = 0 TO M-j      B(j+k) = B(j+k) + A(k)    NEXT k  NEXT jNEXT dMain:  INPUT "Amount in pence N=";N  PRINT B(N); "ways!"GOTO Main

However, mathematics is the art of patternsand we may want to go afterthe same type of closed formulas which were derived for Americanmoney at the end of the previous section. That would allow values of N  in thezillions.

To enforce a better computational discipline, we shall consider that the supplyof various coins is limited.  Let's introduce the notation:

Ni   =   min {floor ( N / i ) ,  number of available i-coins }

Assuming N1 = N, there's just one  way to make change for Nwith pennies only, isn't there? (With N1<N, there would be no way to make change.)

Using 1 and 2 denominations  (pennies and tuppences)  you may choose touse from 0 to N2 tuppences and the balance in pennies only.  There are 1+N2 ways to do so  (still assuming N1=N).

If you also have shillings (5p, five pence coins)  you may use any number s  of them, between 0 and N5.  You are then left with an amount N-s  for which the previous formula applies. So, the total number of possibilities is

   1 +  min ( N2 , floor((N-s)/2) )

 Come back later, we're still working on this one...


(L. S. of Canada.2000-11-20)
How many 5-digit numbers have their digits in a decreasing sequence?

There are 252 decreasing sequences of 5 digits (and 2002nonincreasing ones).

To build such a sequence, you must choose 5 digits among the 10 possible ones. Once you've done this, you've got no choice but to lay them out in decreasing order. Therefore, this can be done inC(10,5)=252 ways.

If you were interested in anonincreasing sequence instead,you would allow several adjacent copies of the same digit. This is only slightly more difficult to count; there are C(14,5)=2002 possibilities.

Why is that? Well, consider a row of 9+5=14 squares of which 5 are "occupied"and 9 are "empty". In each occupied square, just write the total number of empty squares to its right. The 5 numbers you wrote are between 0 and 9 and their sequence is nonincreasing. Conversely, each nonincreasing sequence of 5 digits may occupy(under the above rules) 5 of 14 such squares in a unique way;place them right to left to see that you have no choice in the matter. Therefore, there are just as many nonincreasing sequences of 5 digitsas there are ways to pick 5 squares among 5+9. That's C(14,5)=2002.


(2020-07-01)  
When G  is the cyclic group C12 those are all the chromatic subscales.

Because of the musical example,  we may call an element of 2G/G  a scale. Mathematically,  the empty scale  isthe equivalence class containing only the empty set. The dubious musical counterpart would be the scale of pure silence.

This entails the equivalence relation which says that two subsets A  and B  of G  are equivalent the following holds  (using Minkowski addition)

xG ,  A + x   =  B

A dundamental remark is that if  #A  is coprime  with the order  m  of G, then there are exactly  m  sets equivalent to A. Otherwise,  this is not necessarily so.

 Come back later, we're still working on this one...


(2020-07-01)  

An n-tonic key is related to exactly 12 other keys by transposition and to at most n keysby modal change.  Some pairs of keys are related both ways.

Rooted modes :

Musicians usually call this a "key", as in C-major or A-minor (respectively abbreviating "major mode in the key of C" or"minor mode in the key of A").  However, because they use"key", "scale" or "mode" almost interchangeably, I prefer to use slightly unusal locutions which are unambiguous. For exemple,  I view the major and minor modes as modes of the diatonic scale, which is an unambiguous term (there are seven such modes, commonly called modes of the major scale). The present discussion requires precision. Go back later to an approximative jargon,  if you must.

One way to choose a rooted mode is to first choose a tonic, then pick some  of the 11 notes at most 11 semitones above it.

This method showsthat there are just  211 = 2048  rooted modes in a given key (that's indeed the number of subsets  contained in a set of 11 elements).

The tonic  (root)  itself could be tuned to any frequency, standard  or not. This is utterly irrelevant to this first part of our discussion. Most humans can only perceive musical intervals. Very few of us ever had perfect pitch (an ability which is always lost gradually by the age of 50 or so,  anyway).

Included in this count are some pathological scales like the trivial scale, which contains only the tonic itself. It's arguably the scale played by a single percussion element; always at the same pitch orlack thereof  (e.g, triangle).

Musicians classify a scale according to the number  n  of tones in it (including the root). using standard numerical prefixes. The number of rooted  n-tonic modes is just a straight choice number:

11
 n-1 
    =    (13-n) × ... × 11      for   n ≥ 2
 Vinculum
(n-1)!

Those numbers form the eleventh line of Pascal's triangle.  We have:

  • 1 monotonic scale [sic!].  For percussions andpathologic Jazz solos.
  • 11ditonic scales. The symmetric  one is used by emergency sirens.
  • 55tritonic  scales.
  • 165tetratonic  scales.
  • 330 pentatonic scales.  Including the diatonic  "black keys"  scales.
  • 462 hexatonic scales.
  • 462 heptatonic scales.  Including the diatonic  "white keys"  scales.
  • 330 octatonic scales.
  • 165nonatonic  scales.
  • 55 decatonic scales.  Two missing chomatic tones.  (Unused.)
  • 11hendecatonic  scales.  Only one missing chromatic tone.
  • 1 dodecatonic panchromatic scale.  All chromatic tones allowed.

The binary code  of a chromatic scale is a string of12 bits  (binary digits; 0 or 1)  starting with a leftmost "1" correspondingto the root note,  which is always present. For example the common C-major scale in the Western tradition is101011010101 (you'll recognize this pattern as the layout of the seven white keys (1)and the five black keys (0) on a piano).

The more compact interval structure  of a chromatic scale is obtained fromits binary code by listing for each "1" bit the number of bit positionsbetween itself and the next "1" bit to its right. Thus, in the example of the major scale (binary code 101011010101)  we obtain the interval structure  2212221, knowing that to the right of the rightmost bit in any binary code, a "1" bit is always understood.

Musicians call a rooted scale a key  and routinelyprint it on sheet music.  Composers may put the keysin their titles,  often followed by an identifyingnumber for prolific composers who wrote several. (E.g.,  Many works of Mozart are called  "Piano Concerto in C major".)

Naming Modes and Scales :

In Music theory, we study scales  independently of roots. A scale is the n-th mode of another if it includesthe same tones but starts at the n-th note (n-th degree  of the base scale). For example, the natural minor scale is just mode VI of the major scale (that's the reason why A-minor and C-major use just the white keys on thepiano). Conversely,  the major scale is the second mode of the minor scale. If two heptatonic scales are modes of each other and the latter is the k-th modeof the former, then the former is the (8-k)th  mode of the latter. (The formula is n+1-k for n-tonic scales.)Roman numerals  are used to identify themodes of an n-tonic scale,  starting with I for the scaleitself, witout offset.

(6-1) + (2-1) + (4-1)   =   9   =   2 (mod 7)

Important modes are often called scales  by themselves.  Their modesare the same as those of the original scale, with a different numbering. The most basic example is the natural minor scale  (called Aeolian when considered as the sixth mode of the major scale). Another example is the Double-harmonic minor scale (Hungarian minor or Gypsy minor scale)  which is thefourth mode of the Double-harmonic major scale (Byzantine or Gypsy major scale).

When  n  is coprime  with 12,  an n-tonic scale (in particular pentatonic or heptatonic)  can't be invariant by a nontrivialtransposition  (i.e.,  by a number of semitones not divisible by 12) and it will have exactly  n  modes. Otherwise,  some  n-tonic scales will have fewer than  n modes  (that's the case for some  hexatonic or octatonic scales).

Unfortunately,  most practicing musicians pay little or no attentionto the purity of their jargon and many of them will sometimes usewords like scalekeyroot and mode  almost interchangeably. This makes teaching difficult.  especially when some teachersdon't even attempt to clear the confusion.

Counting scales and modes :

The above enumeration is of relatively little help. Instead,  we must first recognize that keys  (rooted scales) which are modes of the same heptatonic scale are playedwith the same keys on the piano.  For example, C-Major, A-Minor and F-Lydian are played using only the white keys.

There are  C(12,7) = 792  different ways to choose a setof 7 pitch-classes among the 12 possible ones. Each can be transposed in exactly 12 different ways within the same scale. Therefore,  there are  792/12 = 66 different heptatonic scales,  one of which is the majorscale  (the diatonic scale, of which the natural minorscale is just a mode).

This way of counting only applies when all n-tonic scaleshave exactly n-modes,  which is only the case when n  is coprime with 12,  as remarkedabove. In this case,  not surprisingly,  we find as manyscales as there are rooted scales.

For other values of  n  (2,3,4,6,8,9,10)  only thefirst step of the previous enumeration holds: There are always  C(12,n)  ways to pick  n≥1 chromatic tones.  That's a total of  4095 possible nonempy  sets of allowed tones.

4095   =   212 1

Those can be classified as follows,  as explained below:

  • 12 monotonic sets.  1 scale (the trivial percussion scale).
  • 66 ditonic sets,  in 6 scales  (including a symmetrical one).
  • 220 tritonic sets.
  • 495 tetratonic sets.
  • 792 pentatonic sets,  in 66 scales.
  • 924 hexatonic sets.
  • 792 heptatonic sets,  in 66 scales
  • 495 octatonic sets.
  • 220 nonatonic sets.
  • 66 decatonic sets,  in 6 scales  (including a symmetrical one).
  • 12 hendecatonic sets, 1 scale.
  • 1 dodecatonic set.  1 scale.

The above results can be obtained as follows:

When  n  is  1, 5, 7 or 11,  there are as many scales as rooted scales.  Done.

When  n = 2,  there are 5 scales with 2 modes each and a singlesymmetrical scale with only one mode,  for a total of  6  different ditonic scales. In the symmetrical scale, the two tones are separated by an interval of 6 semitones (a tritone)  which is notoriously unpleasant.

 Come back later, we're still working on this one...

Limited Transpositions of Olivier Messiaen :

Messiaen coined this term to indicate that some scales are invariantby a limited transposition  of less than 12 semitones. This is crucial in the proper enumeration of scales and their modes.

 Come back later, we're still working on this one...


(C.C. of Baton Rouge, LA.2000-10-08)
1. A deck of 52 playing cards are divided into 4 piles of 13 cards each.Find the probability that each pile has exactly one ace.
2. If a box contains 75 good IC (integrated circuit) chips and 25 bad chips,and 10 are selected at random, find the probability that there are exactly 2 defectivechips in the 10 selected.
3. An airline overbooks its flight with a capacity of 350 by 20(i.e. it makes 370 reservations).If the probability of a passenger not showing up is 5 percent, what are the chancesthat not every passenger that shows up will get a seat.

1. There is a total of C(52,4) equiprobable ways of choosing 4 positions for the aces in the(ordered) piles and 134 ways of choosing one position in each pile.The probability that each pile has one ace is thus 134/C(52,4)=2197/20825or about 0.105498199... just under 10.55%.

2. C(100,10) ways of picking 10 ICs and C(25,2)C(75,8) ways of picking 2 bad ones and8 good ones, for a probability of C(25,2)C(75,8)/C(100,10)=11002861125/37631107514or about 29.24%.

3. The probability of exactly k passengers showing up isC(370,k)(0.95)k(0.05)370-k.Add these up from k=351 to k=370 and you'll get the probability that more than350 passengers will show up, which is just under 60.7264% (0.6072639447).


( Erin of Edinboro, PA.2000-10-24)
Find the probability of getting two face cards (jack, queen, or king) when two cardsare drawn from the deckwithout replacement.

11 / 221   is your answer:

In a 52 card deck, there are 12 face cards.There are C(52,2) equiprobable combinations of 2 cards among which only C(12,2)are pairs of face cards. The probability of getting a pair of face cards is thusC(12,2)/C(52,2) which is1211/(5251)= 11/221, or about 0.04977...  In other words, there are "11 chances in 221" (exact result);a probability of about4.977%.

If you were to put the first card back in the deck before the second draw,the probability of getting a second face card would be higher,since you'd improve the chances of getting a "good" card on the second drawwhenever you were successful the first time around. (The result would be the probability of getting a face card twice in twoindependent events, namely(3/13)2,or about 5.325%.)


(J.O. of United Kingdom.2000-29-09)
How many rectangles can be found in a square grid of 14 x 14 squares?

11025 for a square grid of side N=14. This has been asked/answered many times for othervalues of N (N=8 for a chessboard).

My solution is to count the number of possible diagonals of such rectangles: Each diagonal is uniquely determined by a pair of extremities.The number of such pairs is the product of (N+1)2 (choices for the first point)and N2 (choices for the second point not on the row or the column of the first)divided by 2 (because there are two ordered pairs for every unordered pair). As there are 2 diagonals per rectangle, the above product is simply twice the numberof rectangles.Thus, the number of rectangles is N2(N+1)2/4, which is 11025 for N=14(and 1296 for N=8, by the way).


(Katie of Morton, PA.2000-10-15)  A000330
What is the total numbers of squares that are in a checkerboard?
I'm not looking for the answer 64, but more than that.
 16 ways to choose a 5 by 5  square on a chessboard

The answer is 204 for a regular 8 by 8 checkerboard. It's N(N+1)(2N+1)/6 for an N by N checkerboard. Here's one way to prove this:

A square of size P is uniquely determined by its lower left corner, which may be pickedanywhere on the (N-P+1) by (N-P+1) grid at the lower left of the chessboard.The total number of squares is thereforeN2+(N-1)2+(N-2)2+...+22+12,which is equal to N(N+1)(2N+1)/6.Namely:

  • 204 for a regular chessboard (N=8),
  • 285 for a shogi board (N=9),
  • 385 for the board ininternational checkers (N=10),
  • 1240 for a Scrabble(tm) board (N=15),
  • 2109 for a go board (19 lines in either direction; N=18).
 

Philip Brocoum  (2007-03-10; e-mail) 
10 people stand in a circle and look at the floor. On the count of three, everyone looks up to somebody else. Each person must choose to look at one of 3 people:The person to the right, the person tothe left, the person directly across the circle. When two people make eye contact, both scream. What's the probability that no one will scream?

Philip Brocoum presents this as a warm-up exercise which was actuallypractised by his former improv troupe at MIT, until nobody screamed. (2006-01-26)

As each of the 10 people has 3 choices, there are only 310  =  59049 equiprobable possibilities. By direct counting, only 4406 of these involve no direct "eye contact". So, the probability (p) that no one will scream is about  7.46 %. The expected  number (1/p) of times it would take torepeat the experience until nobody screams is thus slightly more than 13.4.

For an even number (n) of people, there are  3n  scenarios. The number of those for which nobody screams is given by the second row ofthe following table, whose third row gives the expected numberof tries needed to obtain a silent one.

n4681012141618
Silent Cases301568264406235621261046750743614142
1 / p2.74.77.913.422.637.963.8107.2

Brocoum's problem can be usefullygeneralized,to Hamiltonian cubic graphs. For Brocoum's original poser, Max Alekseyev found(on2008-06-13)  that the number of silent configurations for a circle of  2n  people(A141221) is given by the following recurrence relation, for  n>1. (seefull proof elsewhere).

an+4   =  8an+3   16an+2 +  10an+1  an

It's also  fully defined by a third order  recurrence (cf.A141385) :

an+3   =  7an+2   9an+1 + an   2
starting with:    a2 = 30   ;    a3 = 156   ;    a4 = 826

The sequence is best started at  n=2 (a circle of 4 people)  as the rules of the game do notreally apply to a "circle" of only two people. (Alekseyev's analysis does not apply to a circle of less than 4 people either.)


(2001-12-25)
What's the average distance between two random points on a segment?

In all questions that involve random variables which may assume a continuous range of values,we must carefully specify the probability distribution involved. This is often more delicate than in the discrete case.Here, it suffices to say that if 0<a<b<1, a "random number" between 0 and 1 fallsbetween a and b withprobability b-a. This is not a statement to be proven, it's a description of theLebesgue probabilitymeasure on the unit segment (the so-calleduniform probability distribution),which we choose to assume. With another choice of distribution, we would obtain other results. That's all.

Well, with this distribution, the average distance froma random point in a segment to either of its extremitiesis half the length of the segment. [The reader is encouraged to prove this.] If we consider a fixed point x on the unit segment [0,1], a random point y will beless than x with probability x, and it will be more than x with probability (1-x). The distance between x and y averages x/2 in the former case,and (1-x)/2 in the latter. The overall average distance to point x is obtained as the weighted average of the two cases(each case is weighted according to its own probability). It is thus equal to:

x2/2 + (1-x)2/2   =   x2 - x + 1/2  =   d/dx [ x3/3 - x2/2 + x/2 ]

If x is a random number uniformly distributed between 0 and 1, theaverage of the above quantity is equal to itsintegral from 0 to 1, namely 1/3.  Therefore:

The average distance between two points [uniformly] picked at
random on a segment is one third the length of the segment.

A nice introduction to continuous random variables and/or elementary calculus...


It'smuch more difficult to work out the average distance between tworandom points on a unitsquaregivenbyMark R. Diamond(2001-12-11):

[2 + 2 + 5 ln(1+2) ]  / 15  =   0.52140543316472067833...


AnonymousGoogle query  (2006-10-08)

Since all points on the surface of a sphere of radius  R are equivalent, the average distance between tworandom points is the same as the average distance from a fixed point to a random one (assuming, of course, that the probability of a set is proportional to its spherical area).

Average Distance Along a Great Circle :

R / 2

: That result is obtained immediately by noticing a symmetry about the equator (at a distance R/2 from either pole) concerning distances to the pole.

Average Euclidean Distance :

4 R / 3


Steve Blue442  (2011-07-26, e-mail)  
Jumping a distance  D < 2  from a random point inside aunit square, what's the probability of remaining inside it?

Let's assume that the random starting position is uniformly distributed withinthe unit square.  This is to say that the probability that the randompoint is within some patch is proportional to the area  of thatpatch  (actually, the probability is equal to the area since the totalarea of the square is unity).

Let's first assume that we are only allowed to jump along a direction at anangle    from a diagonal (WLG, is between 0  and  45°). A jump of length  D  stays within the unit square when the startingpoint is in a rectangle whose area is:

( 1 | D cos | )( 1 | D sin | )

That quantity is thus the probability that we stay within the square whenthe direction of the jump is prescribed.  If the direction is random (isotropically distributed)  the desired probability is the averageof the above, namely:

2 
Vinculum
0

Buffon's Needle :

 Come back later, we're still working on this one...

border
border
visits since Dec. 6, 2000
 (c) Copyright 2000-2023, Gerard P. Michon, Ph.D.

[8]ページ先頭

©2009-2025 Movatter.jp