OK, I’m wigging out again. The debate has come up *again* as to whether or not programmers need to know math. The answer, in my mind, is an unarguable “yes”. If you don’t, then many things will be extremely hard, and some things impossible, which people who do know the math will find quite easy. But rather than take the high road, and make vague and unconvincing general arguments, I thought I’d dive down into the details and list the higher level mathematics I’ve found useful in my programming career. Note that the high school level mathematics- algebra, geometry, trigonometry, I’m going to ignore. This is the higher level stuff- stuff mathematicians think is mathematics. This is a personal list, and off the top of my head, so it is no doubt incomplete.

Let’s start with graph theory. If there is on branch of mathematics a programmer can’t live without, this would be it. It’s about things (nodes) that have relationships (edges) with other things. Like cities connected by roads. Or- in the more programaticaly useful, objects with pointers to each other. Pretty much all data structures are graphs. Run the standard graph theory algorithms to find out which objects can be reached from some set of root objects, and you have a garbage collector. Or how about this: functions that call other functions- the functions are the nodes, edges represent that one function calls another. Reachable algorithms tell you what functions can be dispensed with. Do a clique finding algorithm, and this determines which sets of functions for recursive loops. And so on. ‘Cmon, people- damned near everything we do as programmers is dealing with things that have relationships to other things.

Next up is linear algebra. Want to do 3D programming? Welcome to linear algebra. Lots and lots of linear algebra. Learning quaternions and geometric algebra is probably a good idea too- but linear algebra is a requirement. But linear algebra is useful for way more than that. Lots of other forms of mathematics (for example, graph theory) tend to reduce to linear algebra. Machine learning also uses linear algebra heavily- if you want to write an algorithmic trading platform or a search engine, better brush up on your linear algebra. Add in a dash of calculus, and you’re solving systems of non-linear equations (via Newton-Kantorovich).

Numerical analysis is how to implement linear algebra is the real world (i.e. on computers). Also, it covers the care and feeding of floating point numbers. If I were king, programmers would be required to pass a class on numerical analysis before being allowed to use floats.

Abstract algebra and number theory are useful for cryptography, random number generation, hashing, error detection, and a couple of other things. For example, 2′s complement arithmetic makes perfect sense once you realize that it’s just arithmetic modulo 2^{n}.

Statistics. How could I forget statistics? There is more to statistics than Bayes theorem (and Bayesian reasoning), but for that alone it is indispensable.

I’m not sure what branch of mathematics Fourier transform falls over, but it’s another one that shows up all over. Including weird places, like multiplying large numbers.

There are a lot of “little branches” of mathematics, which aren’t full disciplines themselves, but are still worth learning. Knowing the relational calculus makes SQL make a more sense, knowing the Pi Calculus makes Erlang make a lot more sense, knowing the Lambda Calculus makes Lisp and Haskell make a lot more sense, and so on. Being able to at least read and follow the mathematicians gives insights into the fundamentals of what is going on.

For the record, I don’t know category theory, and don’t feel any deep seated need to learn it either. I haven’t got my head around geometric algebra yet, and I want to take a swing at algebraic topology at some point (to take a deep approach to relativity and quantum mechanics). Speaking from experience, it’s certainly not necessary to learn Haskell or figure out monads.

But, at the end of the day, there’s this. Programming is about solving problems- that why anyone cares about it. What’s important isn’t the code produced, it’s the problems solved. And mathematics is about *how to solve problems*. How do these two things not go together like peas in a pod? Richard Feynman once compared knowing different mathematics to having extra tools in your tool chest. Not all mathematics is applicable to all problems, granted- but learning mathematics is like learning new APIs, or new languages. It allows us to solve problems we otherwise couldn’t.