I've seen questions of this kind a lot on HN, and I think they really deserve a better answer than what I can come with. Here's my best shot at an answer:

Mathematics is a bit like art. There is no functional purpose to art, people just do it for the sake of itself, and for the intellectual stimulation. Likewise, mathematics deals with building theory on top of previous theory, with no real purpose other than for the sake of building theory and getting intellectual stimulation.

Think of this: Where did that previous theory come from? It was built on top of previous theory, etc. Mathematics is pretty much a never-ending stack of things built on top of each other for the sake of building things on top of each other.

Every now and then (quite often actually), there is some really useful stuff that can be done with this enormous stack of theory, with applications in practical fields like computer science or engineering. In fact the computer was invented as a result of a lot of merely theoretical contemplations about the nature of logic. But for a "pure" mathematicians, the applications are not the main focus of mathematics. For a forum like HN where a lot of folks are driven by doing stuff, this idea might seem rather strange, but it is the same motivation that drives artists and probably many other things.

Then there's of course the applied mathematicians who try to use everything they know about math to work on some real-world problem. Theoretical computer science is often a good example, where we build algorithms that try to improve performance for some practical problem by using mathematical insights into the properties of the problem. But there's also less applied computer science, where algorithms are built merely because they are interesting or beautiful or whatever, and then maybe someone finds a need to apply them, or not.

For those without any formal education in mathematics, here's a little problem that will help you understand what a mathematical proof actually is: Consider some set S containing some elements (anything really, just some stuff). For any elements a, b in S, we define an operation: a + b yields some other element of S (+ here is just a symbol, not necessarily addition). The operation + has only the following properties:

- (0) a + b is another element of S
- (1) For any c in S, we have (a + b) + c = a + (b + c)
- (2) There exists a special element in S, written as 0, such that a + 0 = a, for any a in S

Note that we did not assume that b + a = a + b. In particular, 0 + a might not be a. Assume that there exists an element 0' such that 0' + a = a = a + 0. Use only the properties stated above to argue that 0 = 0'. If it helps, replace "+" with any other symbol.

----

Solution: This structure (a set with an associative operation and a neutral element) is called a monoid. We are proving that the neutral element of a monoid is both "left-neutral" and "right-neutral". The proof proceeds as follows:

By (1), we have 0' + 0 = 0', but also 0' + 0 = by our assumption of 0. Hence 0' + 0 = 0' = 0, which was to be shown.

This solution is fairly straightforward. The next step is to try your hand at something a little more complicated: Define a second operation (-a) which takes an element of S and returns an element of S called the inverse of a, with the property that a + (-a) = (-a) + a = 0, for any a in S. Prove that (-(-a)) = a.