My first book.
Mathematics in University--What the hell is it?
This marks the beginning of a new sector, I hope.
ALL-R-MATH BLOG
Friday, May 16, 2014
Saturday, June 1, 2013
When the game ends? (I)
Question: Consider a two-players' game. Both players have equal chance of winning at each round. The game ends if one player wins two more rounds than the other. What is the probability function for the number of rounds?
AA
BB
ABAA
ABBB
BAAA
BABB
ABABAA
ABABBB
ABBAAA
ABBABB
BAABAA
BAABBB
BABAAA
BABABB
......
Possible scenarios
Answer: Let N be the number of rounds. N cannot be odd, otherwise the difference of rounds won by the two players could not be 2.
Therefore N is even, say N=2k. Each player has to win exactly one of 2r−1-th and 2r-th round for 1≤r≤k−1 and then one player has to win the last two games.
In other words, the pattern should be [..][..]...[..](..), the first k−1 [..]'s should be AB or BA, and the last (..) is AA or BB.
Summing up, we know
P(N=2k−1)=0,P(N=2k)=(1/2)k for k=1,2,…
The game most likely ended in 2 rounds, but the expected number of rounds is ∑∞k=12k2k=4.
AA
BB
ABAA
ABBB
BAAA
BABB
ABABAA
ABABBB
ABBAAA
ABBABB
BAABAA
BAABBB
BABAAA
BABABB
......
Possible scenarios
Answer: Let N be the number of rounds. N cannot be odd, otherwise the difference of rounds won by the two players could not be 2.
Therefore N is even, say N=2k. Each player has to win exactly one of 2r−1-th and 2r-th round for 1≤r≤k−1 and then one player has to win the last two games.
In other words, the pattern should be [..][..]...[..](..), the first k−1 [..]'s should be AB or BA, and the last (..) is AA or BB.
Summing up, we know
P(N=2k−1)=0,P(N=2k)=(1/2)k for k=1,2,…
The game most likely ended in 2 rounds, but the expected number of rounds is ∑∞k=12k2k=4.
Wednesday, May 22, 2013
Probability again, a ball game.
If you are in Hong Kong and you need help for university mathematics courses, please visit www.all-r-math.com.
Question: Player A and Player B compete in a ball game. Player A has a chance of p to earn a point, and Player B has a chance q=1−p to earn a point. The game ends whenever a player gets 10 points. Now Player A has 7 points and Player B has 5 points. What is the probability that Player A wins the game?
A tennis game
Answer: Player A has to win 3 more points. Before Player A wins the last point, Player B can only wins no more than 4 points.
Method 1. Let n be the number of further games. n can be 3,4,5,...,7. If n=3, then Player A wins all the games, the probability is p3. If n=4, then Player B may win one of the first 3 games, the probability is C31p3q. For general n, Player B may win any n−3 of the first n−1 games, and the probability is Cn−1n−3p3qn−3. Summing up, we have P(A)=(7∑n=3Cn−1n−3qn−3)p3=(1+3q+6q2+10q3+15q4)p3.
Method 2. If we use a to represent the event that Player A earns a point and we use b to represent the event that Player B earns a point, then (1+b+b2+…)a(1+b+b2+…)a(1+b+b2+…)a=(1+b+b2+b3+b4+…)3a3=(1+3b+6b2+10b3+15b4+…)a3
The two methods are essentially the same. In the second method, the counting is hidden behind the algebra and we do not need to consider case by case.
Question: Player A and Player B compete in a ball game. Player A has a chance of p to earn a point, and Player B has a chance q=1−p to earn a point. The game ends whenever a player gets 10 points. Now Player A has 7 points and Player B has 5 points. What is the probability that Player A wins the game?
A tennis game
Answer: Player A has to win 3 more points. Before Player A wins the last point, Player B can only wins no more than 4 points.
Method 1. Let n be the number of further games. n can be 3,4,5,...,7. If n=3, then Player A wins all the games, the probability is p3. If n=4, then Player B may win one of the first 3 games, the probability is C31p3q. For general n, Player B may win any n−3 of the first n−1 games, and the probability is Cn−1n−3p3qn−3. Summing up, we have P(A)=(7∑n=3Cn−1n−3qn−3)p3=(1+3q+6q2+10q3+15q4)p3.
Method 2. If we use a to represent the event that Player A earns a point and we use b to represent the event that Player B earns a point, then (1+b+b2+…)a(1+b+b2+…)a(1+b+b2+…)a=(1+b+b2+b3+b4+…)3a3=(1+3b+6b2+10b3+15b4+…)a3
consists of all the cases that Player A earns 3 more points. It is easy to see that only up to b4 corresponding to that Player A wins the game. Therefore we have
P(A)=(1+3q+6q2+10q3+15q4)p3.
The two methods are essentially the same. In the second method, the counting is hidden behind the algebra and we do not need to consider case by case.
Sunday, May 12, 2013
Winner becomes the dealer
If you are in Hong Kong and you need help for university mathematics courses, please visit www.all-r-math.com.
Question: There is a card game between a dealer and a non-dealer. The odds that the dealer wins to that the other player wins is p:q. In a scenario, a poor guy with 1 coins play against a rich guy with N−1 coins such that (1) initially the poor guy is the dealer, (2) after each game the winner gets 1 coin from the loser and becomes the dealer in the next game and (3) no more games if one of the guys collect all the N coins. What is the probability that the poor guy gets the final laugh?
Two-player mahjong is such a winner-becomes-the-dealer game.
Answer: Just like the usual gambler's ruin, we consider the moment that the poor guy having n coins and calculate the probability that he will be the final winner at this moment. However, the chance of winning the current game depends on whether he is the dealer or not, we have to separate the two sub-cases, therefore we have Pn be the probability that he will be the final winner if he is now the dealer and Qn be the probability that he will be the final winner if he is not the dealer.
We have Pn=pp+qPn+1+qp+qQn−1...(1)Qn=qp+qPn+1+pp+qQn−1...(2)
Now Pn+1=pp+qPn+2+qp+qQn=pp+qPn+2+qp+q(qp+qPn+1+pp+qQn−1).
Question: There is a card game between a dealer and a non-dealer. The odds that the dealer wins to that the other player wins is p:q. In a scenario, a poor guy with 1 coins play against a rich guy with N−1 coins such that (1) initially the poor guy is the dealer, (2) after each game the winner gets 1 coin from the loser and becomes the dealer in the next game and (3) no more games if one of the guys collect all the N coins. What is the probability that the poor guy gets the final laugh?
Two-player mahjong is such a winner-becomes-the-dealer game.
Answer: Just like the usual gambler's ruin, we consider the moment that the poor guy having n coins and calculate the probability that he will be the final winner at this moment. However, the chance of winning the current game depends on whether he is the dealer or not, we have to separate the two sub-cases, therefore we have Pn be the probability that he will be the final winner if he is now the dealer and Qn be the probability that he will be the final winner if he is not the dealer.
We have Pn=pp+qPn+1+qp+qQn−1...(1)Qn=qp+qPn+1+pp+qQn−1...(2)
with initial conditions P0=Q0=0,PN=QN=1.
Now Pn+1=pp+qPn+2+qp+qQn=pp+qPn+2+qp+q(qp+qPn+1+pp+qQn−1).
Rearranging the terms,
(1+qp+q)Pn+1=Pn+2+qp+qQn−1=Pn+2+(Pn−pp+qPn+1).
Hence
2Pn+1=Pn+2+Pn.
Using standard technique we have
Pn=a+bn
for some fixed a and b. Substitute it back, we have
Qn=a+b(n+q−pq).
Now we turn our eyes to the initial conditions, and we will find that there are no a and b that can satisfy all four! What happens? It turns out that in this scenario, it is not logical to the poor guy to lose all the coins but wins the last game or to win all the coins but lose the last game. Indeed P0 and QN could not enter equations (1) and (2). It means we only consider PN=1 and Q0=0, and so
a=p−qq(N+p−qq)−1,b=(N+p−qq)−1
Putting all together,
Pn=n+p−qqN+p−qqQn=nN+p−qq
The final answer is P1=1+p−qqN+p−qq.
Friday, May 10, 2013
Nine squares
If you are in Hong Kong and you need help for university mathematics courses, please visit www.all-r-math.com.
Question: There are 9 squares, 3 black and 6 red. In each turn, a square is chosen randomly and its color is then switched. The process continues until all squares have the same color. What is the probability that all squares are red at the end?
Answer: Let Pk be the probability of all red at the end if currently there are k red squares. Note in that turn, there are k9 chance that a red square turns black and 9−k9 chance that a black square turns red. Therefore Pk=k9Pk−1+k9Pk+1,k=1,2,…,8.P0=0,P9=1
Question: There are 9 squares, 3 black and 6 red. In each turn, a square is chosen randomly and its color is then switched. The process continues until all squares have the same color. What is the probability that all squares are red at the end?
RED | RED | BLACK |
BLACK | RED | RED |
RED | RED | BLACK |
Answer: Let Pk be the probability of all red at the end if currently there are k red squares. Note in that turn, there are k9 chance that a red square turns black and 9−k9 chance that a black square turns red. Therefore Pk=k9Pk−1+k9Pk+1,k=1,2,…,8.P0=0,P9=1
Or in matrix notation,
(P0P1P2P3P4P5P6P7P8P9)=(10000000001/908/9000000002/907/9000000003/906/9000000004/905/9000000005/904/9000000006/903/9000000007/902/9000000008/901/90000000001)(P0P1P2P3P4P5P6P7P8P9)
Hence
(P0P1P2P3P4P5P6P7P8P9)=(035/83315/664325/664165/332167/332339/664349/66448/831).
Therefore the required probability is P6=339664 is just barely greater than 1/2.
Friday, May 3, 2013
A probability game
If you are in Hong Kong and you need help for university mathematics courses, please visit www.all-r-math.com.
Question: At each turn, if Player A has p coins and Player B has n−p coins, then the chance of A wins to the chance of B wins is p:n−p and that whoever wins gain 1 coin from the loser. The game ends if a player gets all the n coins. If currently A has nA coins and B has n−nA coins, what is the probability that A is the final winner?
Answer: Let Pp denotes the probability that A is the final winner if A has p coins. Then Pp=pnPp+1+n−pnPp−1,P0=0,Pn=1.
The wealthier or more powerful A is, the higher the chance A wins each battle. A reasonable model, isn't it?
Question: At each turn, if Player A has p coins and Player B has n−p coins, then the chance of A wins to the chance of B wins is p:n−p and that whoever wins gain 1 coin from the loser. The game ends if a player gets all the n coins. If currently A has nA coins and B has n−nA coins, what is the probability that A is the final winner?
A | B |
---|---|
Wealth: p coins | Wealth: n−p coins |
Winning chance: p/n | Winning chance: 1−p/n |
Answer: Let Pp denotes the probability that A is the final winner if A has p coins. Then Pp=pnPp+1+n−pnPp−1,P0=0,Pn=1.
Then
n−pn(Pp−Pp−1)=pn(Pp+1−Pp)
and thus
Pp+1−Pp=n−pp(Pp−Pp−1)=(n−p)(n−(p−1))⋯(n−1)p(p−1)⋯1(P1−P0)=Cn−1pP1.
Sum over all Pp from p=0 to r−1, we have
Pr=r−1∑p=0(Pr+1−Pr)=r−1∑p=0Cn−1pP1.
Consider the case r=n.
1=n−1∑p=0Cn−1pP1=2n−1P1
and hence
P1=12n−1.
The final answer is therefore
PnA=∑nA−1p=0Cn−1p2n−1.
The wealthier or more powerful A is, the higher the chance A wins each battle. A reasonable model, isn't it?
Friday, April 26, 2013
bogus numbers?
If you are in Hong Kong and you need help for university mathematics courses, please visit www.all-r-math.com.
I have read an article who claims that complex numbers does not exist and any physics based on complex numbers are bogus science!
I am surprised that in 21st century there are still such idiots dare to write like that. Anyway, his key argument is the following:
Consider the system of two equations {(x−1)2+(y−1)2=1x+y=0
Question: What is wrong with his argument?
Answer: Only when we consider x and y as real numbers, the two equations correspond to the two geometric objects.
There are three ways to understand complex numbers.
The simplest way is that a+√−1b is the point (a,b) on a plane. In this case (x−1)2+(y−1)2=0 and x+y=0 each describes a relation between two points and therefore both are equations for a two-dimensional figure in a four-dimensional space. We cannot visualize four-dimensional space!
The second way is to consider a+√−1b as the polynomial ax+b in the space of polynomials in such a way that we identify the polynomials x2 and −1. The two equations are therefore relations among two polynomials.
The third way is to consider a+√−1b as the matrix (ab−ba). The sum and product of two complex numbers are the sum and prodcut of two matrices.
Why does the author write such article? Because Stephen Hawking talks about complex numbers in physics and he also argues that we do not need God in science!
I have read an article who claims that complex numbers does not exist and any physics based on complex numbers are bogus science!
I am surprised that in 21st century there are still such idiots dare to write like that. Anyway, his key argument is the following:
Consider the system of two equations {(x−1)2+(y−1)2=1x+y=0
the first of which is a circle centered at (1,1) of radius 1 and the second of which is a straight line passing (0,0) and (1,-1). The system has complex roots, but the geometric objects have no intersection. Therefore, the complex roots are bogus.
Question: What is wrong with his argument?
There are three ways to understand complex numbers.
The simplest way is that a+√−1b is the point (a,b) on a plane. In this case (x−1)2+(y−1)2=0 and x+y=0 each describes a relation between two points and therefore both are equations for a two-dimensional figure in a four-dimensional space. We cannot visualize four-dimensional space!
The second way is to consider a+√−1b as the polynomial ax+b in the space of polynomials in such a way that we identify the polynomials x2 and −1. The two equations are therefore relations among two polynomials.
The third way is to consider a+√−1b as the matrix (ab−ba). The sum and product of two complex numbers are the sum and prodcut of two matrices.
Why does the author write such article? Because Stephen Hawking talks about complex numbers in physics and he also argues that we do not need God in science!
Subscribe to:
Posts (Atom)