In this chapter theory of Hidden Markov Models is described. Specially the gradient based ML and MMI training is treated mathematically in detail. Finally it is shown how the idea of HMMs can be used in isolated and continuous recognition.