# Hidden Markov Models states

i have a simple question, let's imagine we have a system with 3 states, room 1, room 2 and corridor. Thanks to some bluetooth receiver i'm able to understand if somebody is in the room 1 or 2, not in the corridor. So i built an hidden markov models where i have 3 states (2 rooms and 1 corridor) and 2 observations (2 rooms only).

Let's suppose that i can go from room1 to room2 only passing through corridor, so the transition matrix will be something like the following:

R1 [0.8 0.2 0

CO 0.1 0.8 0.1

R2 0 0.2 0.8]

My question is: following a set of observation, for instance [R1 R1 R1 R1 R1 R2 R2 R2 R2], will the hmm forces the state to pass through the state corridor? Is it possible that the inferred state of the hmm will pass from state room1 to room2 even if the transition matrix does not "allow" it?

Thank you very much!

No, if you set some transitions to $$0$$ as you have done, this will be respected by any correct inference algorithm. For example, if you are going to use the forward and the backward quantities to recover the posterior marginals, you can see that "true" $$0$$s appear, preventing some posterior transitions because of the $$0$$s in the prior transition matrix.