text: Q:
  
  Find the probability that when a fair coin is flipped five times tails comes up exactly three times
  
  Find the probability that when a fair coin is flipped five
  times tails comes up exactly three times, the first and last
  flips come up tails, or the second and fourth flips come
  up heads.
  Here the answer of first portion of the question (a fair coin is flipped five
  times tails comes up exactly three times) is 5/16(not the required answer). I think this is a problem of inclusion and exclusion but i don't know how to proceed. Can anyone please help me out? 
  
  A:
  
  Hints:
  Inclusion-exclusion principle states that in the case of three events one has:
  $$Pr(A\cup B\cup C)=Pr(A)+Pr(B)+Pr(C)-Pr(A\cap B)-Pr(A\cap C)-Pr(B\cap C)+Pr(A\cap B\cap C)$$
  Let $A$ represent the event that exactly three of the flips are tails, $B$ the event that the first and last flips are both tails, and $C$ the event that the second and fourth flips are both heads.
  For each of the above probabilities they can be calculated using standard counting techniques and multiplication principle by noting that the sample space of all sequences of coin flips is in fact equiprobable.
  (if the coin was biased and not fair, then a more direct probability argument should be used, but the basis of the argument is the same)
  For example, $Pr(A\cap B)$ refers to the probability of having exactly three tails and of those tails one is the first flip and another is the last flip.
  $$T\underbrace{\underline{~~}\underline{~~}\underline{~~}}_{\text{1xT, 2xH}}T$$
  There are only three ways in which you can satisfy having exactly three tails with first and last flip being tails, namely the sequences $TTHHT,~THTHT,~THHTT$
  Since there are three valid sequences out of the $2^5=32$ equally likely sequences, we have $Pr(A\cap B)=\frac{3}{32}$
  The remaining terms can be calculated similarly.
  
  