This book looks at the mathematical foundations of the models currently in use. This is crucial for the correct interpretation of the outputs of the models. A bioinformatician should be able not only to use software packages, but also to know the mathematics behind these packages. From this point of view, mathematics departments throughout the world have a major role to play in bioinformatics education by teaching courses on the mathematical foundations of the subject. Based on the courses taught by the author the book combines several topics in biological sequence analysis with mathematical and statistical material required for such analysis.