C++ Programing for Financial Engineering Online Certificate. Join hundreds of graduates from over 35 countries on 5 continents.

Advanced C++11/C++14 and Multidisciplinary Applications Online Certificate. Launched in January 2017.

  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Choosing TT vs TH problem

Discussion in 'Quant Interviews' started by tuanl, 8/18/12.

  1. tuanl

    tuanl Member

    Suppose you roll a fair coin 5 times. You can either be paid the number of consecutive tails "TT" or the number of "TH"'s. Which one would you choose and why? For example, the sequence "TTHTT" would count 1 instance of "TH" and 2 instances of "TT."

    Generalize your result for n flips. Is the result different now?
  2. IlyaKEightSix

    IlyaKEightSix Active Member

    TT. Think about it. If you choose TH, then at most, you can have 2 sequences in your 5 flips. But if you choose TT, consider the case of getting lucky with five tails in a row: TTTTT.

    How many instances of TT are there? Not 2, but 4. The reason for that is when you roll TH, then the next combination can't possibly be another TH. However, when you have TT, then the second T can be the first T in the next sequence. This basically gives you twice the chance.

    Now if it was TH AND HT vs. TT (or HH for that matter), we'd have another discussion.
  3. tuanl

    tuanl Member

    I think "TH" is the answer based on calculating the P(getting at least one TH out of 5 tosses)\(= 26/32=13/16\)>P(getting at least one TT out of 5 tosses)(\(=19/32\)). Notice that expected payoff of TT=the expected payoff of TH=1. So if you're less risk averse, we can choose TT and hope to get lucky with TTTTT.

    I haven't worked on the general case yet, but I'm pretty sure the same result still holds(we should still choose TH).
  4. amanda.jayne

    amanda.jayne Active Member

  5. pruse

    pruse Active Member

    It ain't about googling, it's about sharing and discussing; I'm sure that's why tuanl posts his problems here.

    Use indicator variables: For each of the first \(n-1\) tosses, out of \(n\), let \(X_1=1\) if that toss and the next are TH, 0 otherwise. Then the expected number of TH's is equal to \(E(X_1+\cdots+X_{n-1})=(n-1)E(X_1)=(n-1)P(X_1=1)=\frac{n-1}{4}\). The same argument shows that the number of TT's is expected to be the same. So it's the variance that will decide.

    Now for the variance. \(Var(X_1+\cdots+X_{n-1})=E((X_1+\cdots+X_{n-1})^2)-\left(\frac{n-1}{4}\right)^2\). \(E((X_1+\cdots+X_{n-1})^2)=(n-1)E(X_1^2)+2\sum_{i<j}E(X_iX_j)\). Clearly \((n-1)E(X_1^2)\) will be the same in both the TT and the TH cases. We need to see how the \(\sum E(X_iX_j)\) part differs.

    1) TH case. When \(j-1=1\), \(X_iX_j\) clearly must equal 0. In all other cases, disjoint pairs of tosses are involved and these are independent, so \(E(X_iX_j)=P(X_iX_j=1)=P(X_i=1,X_j=1)=P(X_i=1)P(X_j=1)=\frac{1}{4}\cdot\frac{1}{4}=\frac{1}{16}\).

    2) TT case. This is clearly larger as the disjoint pairs of tosses give the same \(E(X_iX_j)\) as in the TT case, and the overlapping pairs give a positive \(E(X_iX_j)\), whereas in the TH case these are 0.

    So it's better to pick TH.
  6. IlyaKEightSix

    IlyaKEightSix Active Member

    How is P(TT) < P(TH)? P(T)=50%. P(H)=50%. P(T)*P(T)=25%. P(T)*P(H)=25%.

    Is there something biased about this coin?
  7. tuanl

    tuanl Member

    I said P(getting AT LEAST 1 TT)<P(getting AT LEAST 1 TH). And no, the coin is definitely fair.
  8. IlyaKEightSix

    IlyaKEightSix Active Member

    Well, what about the probability of getting 2 TTs vs. 2 THs? With 2 TTs, you can have TTTHH HTTTH, HHTTT, TTHTT, HTTTT, and so forth...

    With TH, you can only get two of them at MOST on five flips.
  9. tuanl

    tuanl Member

    Nice solution, but the computation of the variance really bothers me. I know it's a common technique to compare the variance of two events to make a decision when the expected values of these events are equal. But I wonder if my reasoning above also works in this case, since we clearly see that probability of not getting any money when choosing TT is greater than that of TH.
  10. tuanl

    tuanl Member

    But HTTTT counts as 3 TTs. In fact, probability of getting exactly 2 THs=probability of getting exactly 2 TTs. But we have to calculate the total probability of all the possibilities that can happen with TH and TT. Basically, choosing TH always give you a better chance to get some money than choosing TT. Notice that this reasoning works, in my opinion, since the expected value of TT=expected value of TH. The proof for this, for general value of n, was presented above by pruse above.
  11. pruse

    pruse Active Member

    The probability of not getting any money doesn't tell the whole story, as it's possible for the cases that do make money to make disproportionately larger amounts.

    Your expected winnings, as well as the volatility of those winnings, are what matter. Now, between two alternatives with the same expected value, the one with the smaller volatility is generally preferred since your confidence interval is smaller.
  12. IlyaKEightSix

    IlyaKEightSix Active Member

    Hmmm, I did a dirty computational solution in R and it seems no matter what happens, when you add up the sum over all the combinations, the sums of both THs and TTs come out identical, but the variance of the THs are lower.

    Seems I'm mistaken.
  13. pruse

    pruse Active Member

    Yeah, that's already been established.
  14. Kangxi

    Kangxi New Member

    Hey, my answer for 5 tosses is as follows:
    1 TT: 3+2+2+3 = 10
    2 TT: 1+(2+1+2) = 6
    3 TT: 1+1 = 2
    4 TT: 1
    So the expected money received if choosing TT will be (10*1 + 6*2+2*3+4*1)/(2^5)=1

    1 TH: (2^3-4) + (2^3-2)+(2^3-2)+(2^3-4) = 20
    2 TH: 2+2+2 = 6
    So the expected money received if choosing TH will be (20*1 + 6*2)/(2^5)=1

    Therefore, no matter what I choose, I will be paid $1 in expectation.
  15. tuanl

    tuanl Member

    But choosing TH gives you smaller variance than TT, which means TH is less volatile than TT. So you should choose TH
  16. Kangxi

    Kangxi New Member

    Yes, I think so.