Welsh town

The Welsh language amuses me because it seems unreal. There is a town in Wales with the name Llanfairpwllgwyngyllgogerychwyrndrobwllllantysiliogogogoch. It was renamed to that in 1860 to attract attention. So it is a bit tainted as an example of amusing Welsh.

The town is amusing for being so long. Ordinary Welsh words are amusing (to me at least) mostly due to the lack of vowels, that is English letters that we know as vowels. For example, “Bwlchgwyn” and “Cwmtwrch.”

Best of seven

OThe first round of the NHL playoffs ended earlier this week. There were 8 7-game series. Two were decided in 4 games, 2 more in 5 games, and the other 4 in 6 games. It got me thinking about the expectation. So I did some probabilities in my head on the way home. Then on paper and a program at home.

Assume Team A has a probability, p, of winning any game. Team B will win with probability (1-p).

Win in 4:

It is the probability of winning 4 straight.

Team A = p^4
Team B = (1-p)^4

If p = 0.5 (equally matched teams), then 1 in 8 series will end in 4 games (0.5^4 + 0.5^4).

Win in 5:

This is the probability of winning 4 of 5 games. But team must win last game. The prob of winning 4 games is p^4. The probability of losing a game is (1-p).

The answer (for Team A) is not = p^4 * (1-p) because the loss can occur in any of the first four games. The previous equation is the probability of winning 4 of 5 games. But there are 4 ways to win 4 of 5 games (cannot win the first 4 because the series is over before 5th game). More precisely, it is 4 choose 3 or combination(4, 3).

Combination(m, n) = m!/(n!*(m-n)!)

Team A = C(4, 3) * p^4 * (1-p)
Team B = C(4, 3) * p * (1-p)^4

If p = 0.5, then 1 in 4 series end in 5 games (4*p^5 + 4*p^5 = 8*0.5^5 = 2^3/2^5 = 1/4).

Win in 6:

In a 6-game series, the losing team has 2 wins. The winning team wins the last game but the first 3 wins can happen in any of the first 5 games.

We can generalize the formulae from above as

Team A = C(5, 3) * p^4 * (1-p)^2
Team B = C(5, 3) * p^2 * (1-p)^4

If p = 0.5, then 5 out of 16 series end in 6 games (10*p^6 + 10*p^6 = 20/64 = 5/16).

Win in 7:

In a 7-game series, losing team has 3 wins. Winning team has 3 wins in the first 6 games.

Team A = C(6, 3) * p^4 * (1-p)^3
Team B = C(6, 3) * p^3 * (1-p)^4

If p = 0.5, then 5 out of 16 series end in 7 games (20*p^7 + 20*p^7 = 40/128 = 5/16).

Check your math:

Always check your math: 1/8 + 1/4 + 5/16 + 5/16 = (2+4+5+5)/16 = 16/16. Adds up to 1. Check.

Program:

Naturally, I wrote a python method that computes this given the length of the series (bestof) and the probability of Team A winning any game (prob).

def analytical(bestof, prob):
 A = prob
 B = 1.0 - prob # prob(b) = 1 - prob(a)

 wins = bestof//2 + 1
 aprob = [0.0] * wins
 bprob = [0.0] * wins

 for i in range(wins):
     aprob[i] = m_choose_n(i+wins-1, wins-1) * pow(A, wins) * pow(B, i)
     bprob[i] = m_choose_n(i+wins-1, wins-1) * pow(B, wins) * pow(A, i)

 return aprob, bprob

Some results:
Best of 7; p=0.5

4: 0.0625 0.0625 = 0.1250
5: 0.1250 0.1250 = 0.2500
6: 0.1562 0.1562 = 0.3125
7: 0.1562 0.1562 = 0.3125
   0.5000 0.5000

Best of 5; p=0.5

3: 0.1250 0.1250 = 0.2500
4: 0.1875 0.1875 = 0.3750
5: 0.1875 0.1875 = 0.3750
   0.5000 0.5000

Best of 7; p=0.6

4: 0.1296 0.0256 = 0.1552
5: 0.2074 0.0614 = 0.2688
6: 0.2074 0.0922 = 0.2995
7: 0.1659 0.1106 = 0.2765
   0.7102 0.2898

Best of 7; p=0.75

4: 0.3164 0.0039 = 0.3203
5: 0.3164 0.0117 = 0.3281
6: 0.1978 0.0220 = 0.2197
7: 0.0989 0.0330 = 0.1318
   0.9294 0.0706

Quote of the day

“Everyone knows what attention is. It is the taking possession by the mind, in clear and vivid form, of one out of what seem several possible objects or trains of thought. …It implies withdrawal from some things in order to deal effectively with others.”

— William James (1842-1910)

Is bigger better?

Universities are in an amenities arms race. Our university is no exception. In fact, it may be one of the most effected. Read this brief article. There is no question that we are improving our national reputation regarding amenities. However, it is not clear that all will end well. Our numerous capital improvements are driving costs up at a time when students and families may be least able to absorb the increase.