Math Applications Flashcards
(49 cards)
[4 Prob] Connecting noodles
Given 100 noodles, pick two ends randomly and connect, repeat until no ends exist. What’s the expected number of loops?
What’s the probability of forming 1 loop?
Given n noodles, we want to know L[n].
There are (2n)C2 = 2n(2n-1)/2 = n(2n-1) ways to choose 2 ends:
n of which will form loop of length 1, in addition L[n-1]
n(2n-1)-n of which only lengthens one of the noodles, thus reduces to L[n-1]
L[i] = n/(n(2n-1)) (1+L[i-1]) + (1-n/(n(2n-1))) L[i-1] = 1/(2n-1) + L[i-1]
Now L[1] = 1, thus L[i] = 1 + 1/3 + .. + 1/(2i-1)
P[n noodles, 1 loop] = (1 - 1/(2n-1)) P[n-1 noodles, 1 loop] = (1-1/3).. (1-1/(2n-1))
[4 Prob] Coupon collection
Each box comes with 1 of N types of coupons:
- How many boxes expected to collect all N types?
- Given k boxes, what’s the expected number of distinct types?
- 1 box to get 1st type + N/(N-1) boxes to get 2nd type + .. + N/1 boxes to get last type = Σi=1..N N/(N-i+1) boxes to get N types
- ((N-1)/N)k probability that no boxes have nth type, 1<=n<=N –> 1 - ((N-1)/N)k probability that at least one box has nth type –> N(1 - ((N-1)/N)k) expected number of types
[2 Brainteasers] Infinite sequence
f(x) = x^x^x^x… = 2, what’s x?
x^f(x) = x^2 = x –> x = sqrt(2)
[4 Prob] cubic of integer
If 1 <= x <= 1012, x integer. What’s the probability that the cubic of x ends with 11?
By binomial theorem, x3 = (a+10b)3 = a3 + 30a2b + 300ab2 + 1000b3. So we require a = 1 and 3b = _1 –> a = 1, b = _7 –> x = _71 –> 1% probability
[2 Brainteasers] Rainbow hat
Hat colors: 7. Prisoners: 7. They can see but not hear each other. How to ensure at least 1 correctly guesses own hat color?
Since Σi=0..6 xi must be in {0, 1, 2, 3, 4, 5, 6},
guessk = yk s.t. (yk + Σi=k xi) mod 7 = k
[4 Prob] 100th digit
What’s the 100th digit after the decimal of (1+sqrt(2))3000?
By binomial theorem and matching terms, (1+sqrt(2))3000 + (1-sqrt(2))3000 is an integer. Since 0 3000 << 10-100, the 100th digit of (1+sqrt(2))3000 is 9.
[4 Prob] E[max] E[min] of RVs
Yn = min(X1,..,Xn)
Zn = max(X1,..,Xn)
if X ~ Unif(0,1): E[Yn] = ? E[Zn] = ?
P(Yn >= x) = P(Xi >= x)n –> 1 - FY(x) = (1 - FX(x))n –> fY(x) = n fX(x) (1 - FX(x))n-1
P(Zn <= x) = P(Xi <= x)n –> FZ(x) = FX(x)n –> fY(x) = n fX(x) FX(x)n-1
if X ~ Unif(0,1): FX(x) = x, fX(x) = 1
fY(x) = n(1-x)n-1 –> integratex=0..1 xfY(x) dx = 1/(n+1)
fZ(x) = nxn-1 –> integratex=0..1 xfZ(x) dx = n/(n+1)
[2 Brainteasers] Counterfeit coins II
A coins weighs 0g, 1g, or 2g. Given 5 bags, 100 coins each (same type within each bag). How many weighings (digital scale) to determine weight by bag?
One weighing: 3i coins from each bag, i=0..4
Express total weight in base 3: w4w3w2w1w0
[4 Prob] Dice order
Roll 3 dice one by one, what’s the probability that they end up in strictly ascending order?
probability to get 3 distinct numbers 6*5*4/63 x probability that they are in ascending order 1/3! = 5/54
[3-1 Calc] ** what’s E[X|X>0] for X~N(0,1)?
integration by substitution: 1/sqrt(2π)
[5 Stochastics] Drunk man
On a line 0 to N, you start at i. Every subsequent period, P(i++) = P(i–) = 0.5. What’s the probability that you get to N before 0? How many steps does it take to reach either N or 0?
let x+ = N-i, x- = i
Martingale:
E[Sn] = p+x+ - (1-p+)x- = S0 = 0
E[Sn2 - n] = E[p+x+2 + (1-p+)x-2] - E[n] = S02 - 0 = 0
–> p+ = x<span>-</span>/(x++x<span>-</span>), E[n] = x+x<span>-</span>
Can also use Markov Chain with 2 absorbing states, or treat it as a special case of gambler’s ruin with p = 0.5
[3-2 LinAl] correlations
corr(x,y) = corr(y,z) = 0.8 –> corr(x,z) in what range?
- Geometry (n=3): max=1, min=cos(cos-1(0.5) + cos-1(0.5)) = -0.5
- Cauchy-Schwartz (n=3): bc + sqrt((1-b^2)(1-c^2)) >= a >= bc - sqrt((1-b^2)(1-c^2))
- Pos semi def (any n): det(C) >= 0 or all eigvalues >= 0
[2 Brainteasers] Door to offer
Two doors: offer and no offer. Two guards: truth teller and liar. How to ask one guard one question to get offer?
“Would the other guard say that you are guarding the door to the offer?”
No: open that door
Yes: open other door
[4 Prob] Russian roulette series
Gun has 6 chambers
- 1 bullet, spin once then take turns, better 1st or 2nd?
- 1 bullet, spin every time, better 1st or 2nd?
- 2 bullets random, 1st empty chamber, better re-spin or not on 2nd?
- 2 bullets adjacent, 1st empty chamber, better re-spin or not on 2nd?
- doesn’t matter; outcome has been fixed since the spin
- 2nd; 1st gets hit with probability p = 1/6 + 5/6 (1-p) = 6/11
- re-spin; get hit with probability p = 2/6 if re-spin else 2/5
- not re-spin; get hit with probability p = 1/4 if not re-spin else 2/6
[2 Brainteasers] Trailing zeros
How many trailing zeros are in 100!
24
[5 Stochastics] Coin triplets
- What’s the expected number of tosses to get HHH? THH?
- What’s the probability that you get HHH before THH?
- Given triplet abc, find triplet xyz such that xyz is most likely before abc?
- By Markov Chain, HHH 14, THH 8
- By Markov Chain, P(HHH before THH) = 1/8 (can only have HHH if start with HHH)
- xyz = _ab
[4 Prob] Dice game
You roll a dice and get its face value each time. If you roll 1,2,3 game ends, 4,5,6 you can continue to roll. What’s the EV?
EV = 1/2(2) + 1/2(5+EV) –> EV = 7
E[Sn] = E[X]E[n] = 7/2 * 1/(3/6) = 7 (Wald’s Equality)
[3-1 Calc] integratex=0..inf e-x^2/2 dx
recall Normal pdf: integratex=-inf..inf 1/sqrt(2π) e-x^2/2 dx = 1
–> integratex=0..inf 1/sqrt(2π) e-x^2/2 dx = 1/2
–> integratex=0..inf e-x^2/2 dx = 1/2 * sqrt(2π) = sqrt(π/2)
[5 Stochastics] World series
Teams A and B are playing best 4 out of 7. How to bet on each individual game such that the overall bet that A wins is +100/-100?
f[i,j] = payoff that A has i losses and j wins, 0<= i,j <=4
boundary conditions: f[i,4] = 100, f[4,j] = -100, 0<= i,j <=4
DP:
f[i+1,j] = f[i,j] + bet[i,j]; f[i,j+1] = f[i,j] - bet[i,j]
–> f[i,j] = 1/2(f[i+1,j] + f[i,j+1]); bet[i,j] = 1/2(f[i+1,j] - f[i,j+1])
[4 Prob] Basketball scores
Player will shoot 100 times, 1=score, 0=miss.
Let S[i] = 1/0 on ith shoot and T[i] = Σj=1..i S[j].
S[1] = 1 and S[2] = 0. P(S[i+1]==1) = T[i] / i, 2<=i<100.
What’s P(T[100]=50)?
P(T[3]=1) = P(T[3]=2) = 1/2
P(T[4]=1) = P(T[4]=2) = P(T[4]=3) = 1/3
guess: P(T[n]=k) = 1/(n-1), 1<=k
induction:
P(T[n+1]=k)
= P(S[n+1]=0|T[n]=k) P(T[n]=k) + P(S[n+1]=1|T[n]=k-1) P(T[n]=k-1)
= (1-k/n) 1/(n-1) + (k-1)/n 1/(n-1) = 1/n
[5 Stochastics] Ticket line
A random walk X[t]: X[0] = X[2T] = 0; dX[t] = +/-1 for 0= 0 for all 0<=t<=2T?
Total number of paths: (2T)CT
Total number of paths that reach X[t] = -1 = total number of paths where X[0] = 0 and X[2T] = -2, by reflection principle: (2T)C(T-1)
1 - (2T)C(T-1)/(2T)CT = 1 - n/(n+1) = 1/(n+1)
[2 Brainteasers] Prisoner problem
Hat colors: 3. Prisoners: 100. They line up and can only look in front. How to maximize number of prisoners that correctly guess own hat color?
E[num correct] = 99.33
R, G, B = 0, 1, 2
100th: guess100 = Σi=1..99 i mod 3
kth: guessk = (guessk+1 - Σi=1..k-1 i) mod 3
[3-1 Calc] e^pi vs pi^e
Which is larger, eπ vs πe?
ex > 1 + x –> eπ/e-1 > 1 + π/e-1 –> eπ/e/e > π/e –> eπ > πe
[4 Prob] Gambler’s ruin
On a line 0 to N, you start at i. Every subsequent period, P(i++) = p, P(i–) = q = 1-p. What’s the probability that you get to N before 0?
Markov Chain transition matrix:
p[0,0] = p[N,N] = 1
p[i,i-1] = q and p[i,i+1] = p for 0
absorption probabilities:
x[N] = 1, x[0] = 0
x[i] = qx[i-1] + px[i+1] for 0
P[i] = i/N if p = q = 0.5, else (1-q/p)/(1-(q/p)N) (1-(q/p)i)/(1-(q/p)N)