Defective Cat Plushie

Expectation · Medium · Free problem

A factory produces cat plushies one at a time. Each plushie is either good or defective, and the quality of each plushie depends on the one before it:

  • If the current plushie is good, the next one is also good with probability $\frac{4}{5}$ (and defective with probability $\frac{1}{5}$).
  • If the current plushie is defective, the next one is also defective with probability $\frac{3}{5}$ (and good with probability $\frac{2}{5}$).

The factory just produced a defective plushie. What is the expected number of plushies produced until the next defective one (including that next defective plushie)?

Hints

  1. This is a two-state Markov chain. Define the expected hitting time to the defective state from each state separately.
  2. Condition on what happens in one step: use the law of total expectation to write $E_D$ in terms of $E_G$ and vice versa.
  3. Solve for $E_G$ first -- from state G, each step has a $\frac{1}{5}$ chance of producing a defective, so $E_G$ is the mean of a geometric random variable.

Worked Solution

How to Think About It: This is a first-passage-time problem on a two-state Markov chain. The states are D (defective) and G (good), and you want the expected number of steps to return to D starting from D. The key insight is that if the very next plushie is good, you have shifted into the good state, and from there you need to figure out how long it takes to get back to defective. So you set up two unknowns -- the expected hitting time from each state -- and solve a small linear system.

Quick Estimate: From state D, there is a $\frac{3}{5}$ chance you get a defective immediately (1 step). If you escape to G, the good state is sticky ($\frac{4}{5}$ self-loop), so you expect to stay there about $\frac{1}{1 - 4/5} = 5$ steps before a defective appears. So a rough estimate is $\frac{3}{5}(1) + \frac{2}{5}(1 + 5) = \frac{3}{5} + \frac{12}{5} = 3$. That is actually exact here because the system is small enough that the quick estimate IS the formal solution.

Approach: Define $E_D$ and $E_G$ as the expected number of plushies produced until the next defective, given the most recent plushie was defective or good, respectively. Condition on the next plushie and apply the law of total expectation.

Formal Solution:

Let $E_D = E[N \mid \text{current is D}]$ and $E_G = E[N \mid \text{current is G}]$.

From state G:

$$E_G = \frac{1}{5}(1) + \frac{4}{5}(1 + E_G)$$

The first term: with probability $\frac{1}{5}$ the next plushie is defective, taking 1 step. The second term: with probability $\frac{4}{5}$ the next plushie is good, taking 1 step and then you are still in state G. Solving:

$$E_G = 1 + \frac{4}{5} E_G \implies \frac{1}{5} E_G = 1 \implies E_G = 5$$

This makes sense: in state G, each plushie has a $\frac{1}{5}$ chance of being defective, so the waiting time is geometric with mean 5.

From state D:

$$E_D = \frac{3}{5}(1) + \frac{2}{5}(1 + E_G)$$

With probability $\frac{3}{5}$, the next plushie is defective immediately (1 step). With probability $\frac{2}{5}$, the next plushie is good (1 step), and then you need $E_G$ more steps from state G. Plugging in $E_G = 5$:

$$E_D = \frac{3}{5} + \frac{2}{5}(1 + 5) = \frac{3}{5} + \frac{12}{5} = \frac{15}{5} = 3$$

Answer: The expected number of plushies produced until the next defective one is $E_D = 3$.

Intuition

This problem is a clean example of first-passage times in Markov chains, which show up constantly in quantitative finance -- modeling default times, regime switches, or how long a strategy stays in a drawdown. The technique is always the same: define the expected hitting time from every state, condition on one transition, and solve the resulting linear system. For a two-state chain the system is trivial, but the method scales to any finite number of states.

The subtle point people miss is the role of the good state's stickiness. The good state has a $\frac{4}{5}$ self-loop, so once you escape from defective to good, you are trapped there for an expected 5 steps. That is why $E_D = 3$ rather than something close to $\frac{5}{3} \approx 1.67$ (which would be the answer if defective were an absorbing state with no memory). The persistence of quality -- good begets good, bad begets bad -- is exactly the kind of serial correlation you see in real production processes and financial time series.

Open the full interactive solver →