Mental block on concept of PDF for a duration

#1
I'm reading "A Tutorial on Hidden Markov Models and Selected Applications in Speech Recognition" and I am having a problem conceptually understanding equation 5 which defines the discrete probability density function of remaining in a state for a given duration.

The probability of an observation sequence, O, given a model, M, and initial state Si is given as:

P(O|M, q1 = Si) = (aii)^(d-1) * (1 - aii)

The first part, (aii)^(d-1), makes perfect sense to me but for some reason I can't realize the second part. Why do you multiply by (1 - aii), which is the probability of leaving the state?

I'm going to go take a bike ride and hope to lower the probability of me being dense. :)
 
#2
It's mostly notation (I'm guessing) that is tripping you up. You are already in state "i". To be in state "i" for exactly d days given you are currently in state "i" would mean there are d-1 "transitions" to state "i" and on the dth transition you move out of state "i" (1-a_ii).
 
#3
Ah, yes, that's what I was missing. In order to be in a state for d days implies that you must also leave that state after d days otherwise you would be in the state for more than d days. The first term only tells you the probability of getting to that state without regard for whether your next transition is to another state.

Thank you very much for pointing that out. :)