This is a textbook on the history, philosophy and foundations of mathematics. It proceeds in historical order from about 1800 BC to 1800 AD and then presents selected topics of foundational interest from the 19th and 20th centuries, including topics such as Godel's incompleteness theorem.