This book looks at the mathematical foundations of the models which is crucial for correct interpretation of the outputs of the models. A bioinformatician should be able not only use software packages, but also 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 bioinformatics. The author wrote this book based on his lecture notes for his courses. It combines several topics in biological sequence analysis with mathematical and statistical material required for such analysis.