# Calculating the distribution of states in a Markov Chain at each step given an initial/final state.

I have a Markov matrix with 45 states; 27 transient and 18 absorbing. The way the Markov Chain is constructed I know all states will be absorbed within 27 steps.

I know how to use my initial state vector $$p_0$$ and multiply it by my transition matrix $$P$$ to get the distribution of states for all 27 possible steps. I also was able to get the state distribution per step when assuming the total duration of the chain was exactly 1, 2, ... or 27 steps by modifying and normalizing my probability vector at each iteration.

My question is, how can I get the state distribution per step if I limit the absorbing states to a subset of all of them? In my case I want to condition on the final absorbing state being one of the first 9 out of the 18 total absorbing states.

So, assuming the total duration of the chain is $$n$$ AND that the final absorbing state is one of the first 9, how can I get a distribution of states for each step $$1$$ ... $$n$$?

I was reading an article on the Forward-Backward algorithm which looked related, but I wasn't getting a realistic answer (perhaps my mistake.) I think I'm having trouble connecting my initial vector $$p_0$$ with the expected final state vector.