13

I need to solve the following question, but I got stuck. I would really appreciate it if someone could help me with it!

Here is the question:

A well-disciplined man, who smokes exactly one half of a cigar each day, buys a box containing $N$ cigars. He cuts a cigar in half, smokes half, and returns the other half to the box. In general, on a day in which his cigar box contains $w$ whole cigars and $h$ half cigars, he will pick one of the $w + h$ smokes at random, each whole and half cigar being equally likely, and if it is a half cigar, he smokes it. If it is a whole cigar, he cuts it in half, smokes one piece, and returns the other to the box. What is the expected value of $T$, the day on which the last whole cigar is selected from the box?

There is a hint provided:

Let $X_n$ be the number of whole cigars in the box after the $n$th smoke. Then $X_n$ is a Markov chain whose transition probabilities vary with $n$. Define $v_n(w) = E[T | X_n = w]$. Use a first-step analysis to develop a recursion for $v_n(w)$ and show that the solution is \begin{equation} v_n(w) = \frac{2Nw + n + 2w}{w + 1} - \sum_{k = 1}^w \frac{1}{k}, \end{equation} whence \begin{equation} E[T] = v_0(N) = 2N - \sum_{k = 1}^N \frac{1}{k}. \end{equation}

So far, what I have tried is the following:

According to the hint, $X_n$ is the number of whole cigars in the box after $n$th smoke.

If $X_n = w$, then $X_{n + 1} = w$ or $w - 1$, and \begin{align*} Pr\{X_{n + 1} = w | X_n = w\} &= \frac{h}{w + h},\\ Pr\{X_{n + 1} = w - 1 | X_n = w\} &= \frac{w}{w + h}. \end{align*} Moreover, \begin{align*} &v_n(w)\\ =\ &E[T | X_n = w]\\ =\ &E[T | X_{n - 1} = w] \cdot Pr\{X_{n - 1} = w | X_n = w\}\\ &+ E[T | X_{n + 1} = w - 1] \cdot Pr\{X_{n + 1} = w - 1 | X_n = w\}\\ =\ &\frac{h}{w + h} v_{n + 1}(w) + \frac{w}{w + h} v_{n + 1}(w - 1). \end{align*}

I am not sure whether my steps so far are correct, though I feel they should be alright. I don't know whether these steps are helpful or not. Anyway, I got stuck here and don't know how to proceed next and how to derive the answer provided in the hint. Thanks a lot in advance for any help!

Beerus
  • 2,939
  • I assume there is a misprint in the third line of the last equation. The subscript should be $n+1$ instead of $n-1$. – user Jun 05 '24 at 10:14

2 Answers2

2

Your recurrence relation is correct (apart from a small misprint) and being supplemented with the boundary condition $v_n(0)=n$ is in fact solved by the expression given as a hint.

Your expression: $$ v_n(w)=\frac{w}{w+h}v_{n+1}(w-1)+\frac{h}{w+h}v_{n+1}(w) $$ can be rewritten as: $$ v_n(w)-v_{n+1}(w)=\frac{w}{w+h}\big[v_{n+1}(w-1)-v_{n+1}(w)\big] $$ or $$ v_n(w)-v_{n+1}(w)=\frac{w}{2N-w-n}\big[v_{n+1}(w-1)-v_{n+1}(w)\big],\tag1 $$ where the identity $2w+h=2N-n$ was used.

Substituting into $(1)$ the proposed solution: $$ v_n(w)=\frac{(2N+2)w+n}{w+1}-\sum_{k=1}^w\frac1k\tag2 $$ one indeed obtains the identity: $$\begin{align} -\frac{1}{w+1}&=\frac{w}{2N-w-n}\left[\frac{(2N+2)(w-1)+n+1}{w}-\frac{(2N+2)w+n+1}{w+1}+\frac1w\right]\\ &=\frac{1}{2N-w-n}\left[\frac{-(2N+2)+n+1}{w+1}+1\right]=-\frac1{w+1}. \end{align}$$

Disclaim: In the previous version of the answer I misunderstood the given hint and assumed that $v_n(w)$ means the expected time to finish the process starting from the state $X_n=w$.

user
  • 27,958
  • Thank you veru much for your answer! But I have a question: You said that the required recursion is $$v_n(w)=1+\frac{w}{w+h}v_{n+1}(w-1)+\frac{h}{w+h}v_{n+1}(w),$$ with the boundary condition $v_n(0)=0$. But how does this expression satisfy $v_n(0)=0$? Shouldn't the required recursion be $$v_n(w)=\frac{w}{w+h}v_{n+1}(w-1)+\frac{h}{w+h}v_{n+1}(w)?$$ – Beerus Jun 04 '24 at 11:56
  • No, the required recursion is that one shown in my answer (I define $v_n(w)$ as expected time to finish the process if one starts with $w$ whole cigars and $2N-2w-n$ half cigars). $v_n(0)$ is certainly satisfied - try to substitute $w=0$ in $(1)$. – user Jun 04 '24 at 12:25
  • But what is wrong with my attempt \begin{align} &v_n(w)\ =\ &E[T | X_n = w]\ =\ &E[T | X_{n - 1} = w] \cdot Pr{X_{n - 1} = w | X_n = w}\ &+ E[T | X_{n + 1} = w - 1] \cdot Pr{X_{n + 1} = w - 1 | X_n = w}\ =\ &\frac{h}{w + h} v_{n + 1}(w) + \frac{w}{w + h} v_{n + 1}(w - 1)? \end{align} I couldn't see where the problem is .... – Beerus Jun 04 '24 at 12:43
  • If your understanding of $v_n(w)$ is identical with mine, then $1$ is missed on the r.h.s. because one time unit is spent to proceed to the next day. If your understanding of $v_n(w)$ is different please explain (I found no other plausible definition). – user Jun 04 '24 at 12:50
  • 1
    @Beerus After some thoughts I came to conclusion that the author of the problem indeed has a different definition of $v_n(w)=v'_n(w)+n$ ($v'_n(w)$ corresponds to my definition). Thus it is a conditional expected value of $T$. I never saw such a definition earlier. With this understanding your recurrence is correct and $v_n(w)$ is indeed its solution with the boundary condition $v_n(0)=n$. – user Jun 04 '24 at 19:47
  • Thank you very much! – Beerus Jun 04 '24 at 21:16
2

Here is an alternate proof that doesn't use the hint.
Label the cigars in order that they get selected for the first time.

Let $E_i$ be the event where the $i$th cigar gets selected a second time after cigars $i+1$ to $N$ are selected the first time.
I claim that $p(E_i) = 1/(N-i+1)$ :
From the moment $i$ is selected once, we are looking at cigars $\{i,\ldots N\}$ (we know the set of cigars even though we don't know yet which one is $i+1$ and so on), and we go through the selection process but we remove them once they get selected. Then $E_i$ happens when $i$ is selected last. That last cigar is uniformly random among them so the probability is $1/(N-i+1)$.

Then $T = \sum_{i=1}^N 1 . {\Bbb 1}_{E_i} + 2 . {\Bbb 1}_\overline{E_i} = \sum_{i=1}^N (2 - 1_{E_i}) = 2N - \sum_{i=1}^N 1_{E_i}$, and
$ E[T] = 2N - \sum_{i=1}^N p(E_i) = 2N - \sum_{i=1}^N 1/(N-i+1)= 2N - \sum_{k=1}^N 1/k$

mercio
  • 51,119