A sophisticated field in philosophy that examines the relationship between math and reality, the philosophy of mathematics also looks at the underlying assumptions and implications of math. Sometimes referred to as mathematical philosophy, the term "philosophy of mathematics" is more precise, as the prior term has other meanings, such as the philosophy a particular mathematician takes in his calculations. This is not the same thing as examining the underlying philosophical foundations of math.
Philosophy of mathematics and related fields have been around for thousands of years, since Ancient Greek times at least. The followers of Pythagoras — Pythagoreans — thought deeply about mathematics and even formed a sort of cult around it. These ancient Greeks thought that math was a beautiful, self-consistent system of looking at the world, and practically magical in its predictive capacity. This view was slightly disturbed by the discovery of irrationality — that is, numerals that extend indefinitely without ever terminating, such as pi and the square root of two.
The Ancient Greeks had other peculiar qualities in their philosophy of mathematics. For instance, they doubted the existence of zero, asking, "How can nothing be something?" They even debated over the existence of 1, or whether it was a real number. It was not until the Hindu-Arabic numeral system that the modern zero was introduced, including its function as a placeholder at the end of a numeral. This was a step forward in philosophy of mathematics as well as its practical application.
There are numerous schools of philosophy of mathematics. Some contemporary examples include mathematical realism, intuitionism, constructivism, fictionalism, and embodied mind theories. These generally vary on a continuum depending on how abstract and eternal one thinks math is, versus how human contingent, psychological, and pragmatic its uses and definitions should be. The old Platonists thought that mathematical forms were eternal and unchanging, and we "discover" new theorems rather than inventing them.
Some modern schools in cognitive psychology suggest that our conception of math is a uniquely human conception, derived from our evolved sense of numbers, and that different conceptions could arise, for example, among aliens with a different evolutionary history than our own. Today, thousands of philosophers make their careers in this field.