This is a textbook on the history, philosophy, and foundations of mathematics. One of its aims is to present some interesting mathematics, not normally taught in other courses, in a historical and philosophical setting. The book is intended mainly for undergraduate mathematics students, but is also suitable for students in the sciences, humanities, and education with a strong interest in mathematics. It proceeds in historical order from about 1800 BC to 1800 AD and then presents some selected topics of foundational interest from the 19 th and 20 th centuries. Among other material in the first part, the authors discuss the renaissance method for solving cubic and quartic equations and give rigorous elementary proofs that certain geometrical problems posed by the ancient Greeks (e.g. the problem of trisecting an arbitary angle) cannot be solved by ruler and compass constructions. In the second part, they sketch a proof of Gödel's incompleteness theorem and discuss some of its implications, and also present the elements of category theory, among other topics. The author's approach to a number of these matters is new.