On my last birthday, in September, I gifted myself a big stack of mathematics books. All carefully chosen over a long period of time. For past 4 years or so, I have been trying to get back into learning math. And when I say “learning”, I don’t mean memorizing a bunch of formulas. What I wanted to do was understand all the magical stuff math seems to promise.
Ever since I could understand them, I have been both fascinated and awed by mathematics (and physics). Maybe that awe was the reason I didn’t start putting more efforts into learning math sooner; thinking that the field is just too exotic and hard to be studied in part time. Well, it might be if you want to become a professional mathematician. I don’t. It’s more like a hobby for me; and if it helps me professionally, all the better.
I started learning math sometime in 2010. A few hours every week. That petered out in about 3 months. After that, sometime in 2012, I read a post by Steve Yegge, titled Math Every Day and decided to try that strategy. At least half an hour everyday for math. Considering that I was giving too much time to my job, this too was ill fated and after a few weeks, I was back to no-math. There were several occasions when I took up math on a weekend, determined to do it every weekend. After one or two weekends, it just never happened.
The single biggest factor that was getting in the way was the fact that I was trying to dive head first into math. Doing a lot of exercises and learn everything about the given topic. Unless that’s your full time occupation, that is just never going to work out. It leads to the frustrating feeling that you are not making any progress.
A few months ago, after leaving the job, I was getting desperate to get back into math. This time, I decided to try out a different strategy. One that I have been using successfully for a lot of other things, but for some reason, never applied it to learning math. The strategy was to take math like a hobby that it is. Not getting caught up in too many details at once. The strategy was going to work something like this:
- Get a lot of books, including the paper ones if possible.
- Find lots of online resources, including videos and articles.
- From all of the above, pick whichever one that catches your fancy at the moment and start reading/watching.
- If at any point, if you get tired or bored, pick another resource, or just go wild on Google/Wikipedia.
- It’s okay to learn things that are only tangential to math, like the history of math, or the story of prominent mathematicians, physicists and computer scientists.
Just around the same time I was diving into math, I came across a post titled “Mathematicians are Chronically lost and confused”. It said that all of the things that I had concluded were okay. Getting lost and confused while getting into a large and seemingly infinite field is alright. Then, to top it all off, I found another gem by Steve Yegge. This one was titled “Math For Programmers”. I liked what these guys said and got even more relaxed about learning math. That post by Steve says pretty much every thing I could have said in this post. It’s just amazing.
I am a freelance programmer. I have a couple of friends who do freelance work and we get together on a regular basis, sometime to work together, sometime just to hang out. I knew that both of them were interested in math so I suggested this idea to them and we decided to put aside at least 4 hours every week for math. Now comes the reason for writing this post. The strategy works. Just like it worked for Steve Yegge, it worked for three ordinary programmers like us. It’s been about 4 months and we are even more motivated than we were at the beginning. Math has now become a habit.
In September, I shared all the resources with them. We don’t do it like a class. I did suggest some possible pathways for learning, but all of us do it at our own pace and liking. Now, we get together every week. And every week, we exceed our quota of 4 hours; sometimes by 5-6 hours. We are having a lot of fun.
In the process, I have gained a lot of confidence. Math doesn’t seem intractable anymore. I know that I won’t be able to learn everything about math, but I will be able to know a lot of useful and incredible stuff.
Why Do Programmers Need Math
If you read those Steve Yegge posts I mentioned above, I guess you might have seen enough to answer that question. However, I still want to present two more arguments.
Math is literally everywhere
Pretty much all the technologies that make our lives better are either aided by math or exist because of it.
Every single time you do anything that involves the use of encryption, math is involved. More specifically, it’s number theory. Every time you log in to facebook, buy something on amazon, send a message on WhatsApp, do online banking, or send money on PayPal, math is at work, making them secure. The basic ideas behind this math are not that hard to understand.
When those CDN services deliver the content to you, the most likely candidate for optimizing that experience is graph theory. Pretty much all of the popular services, including facebook, Apple iTunes store, Microsoft, Rackspace, Adobe, NASA, Yahoo, Airbnb etc. use CDNs to deliver data faster to you.
The reason Google (and now pretty much every search engine) is so successful at finding relevant result is the use of graph theory for analyzing back links. And at least the basic graph theory is not very hard.
Almost everything related to machine learning and artificial intelligence is completely dependent on math. Math is the reason amazon can suggest you relevant items, facebook can recognize you in the photos, Google can give you more relevant results and Siri can understand you. Again, at least the basics of the math involved are not that hard to understand.
The entire paradigm of functional programming originated in mathematics. And as Joel Spolsky says
Without understanding functional programming, you can’t invent MapReduce, the algorithm that makes Google so massively scalable. The terms Map and Reduce come from Lisp and functional programming.1
The world as we know it wouldn’t exist without math. I think I can go on and on about the utility of math. But let me get to the second argument.
Computer science thrives because of people who know math.
Notice how I didn’t say “mathematicians” instead of “people who know math”?
Pretty much everyone who has made an impact in the field of computer science is either a mathematician or at least knows math well.
As Steve so rightly suggests in his post, almost everything that we associate with computer science originated with John Von Neumann, who was primarily a mathematician. Have you ever read this wikipedia entry for John Von Neumann? It’s mind boggling to think that a single person could do all of that. Remember that all the commonly used computer architecture and programming models are called “Von Neumann Models”.
Alan Turing, the man who formalized the concepts of algorithms and computation with his Turing Machine and who is generally considered to be the founder of theoretical computer science and artificial intelligence, is also a mathematician.
Donald Knuth, the “father” of algorithm analysis, is a mathematician. You just can’t analyze algorithms without math.
People like John McCarthy, Edsger Dijkstra, Alan Kay, Dennis Ritchie, E. F. Codd, Richard Hamming, Rich Hickey, Tim Bray, Peter Norvig, Niklaus Wirth, John Hopcroft, Fred Brooks Jr., Adi Shamir, Joe Armstrong, Brian Kernighan, John Backus, Guido van Rossum, Stephen Cole Kleene, Martin Odersky are all known to be either good at mathematics or are actual mathematicians. This list can actually go on for a while. And if you haven’t heard of some of those, look them up; be prepared to be impressed.
And if you think you never need to go to their levels, you could be right. I know I am probably never going to reach their levels even if I try. But that’s not the point. The point is that math is the ultimate tool that you can have in your toolbox. It’s the one ring that rules them all, combined with the lightsaber.
What worked for me
The whole point of writing this post was to convey that it’s possible for everyday, run-of-the-mill programmers like me to learn math. Also, I wanted to share some of the resources that I found very useful.
Stop taking math too seriously. Yes, math is supposed to be rigorous, but that part comes after you become comfortable with it.
Read these articles and try to adapt the things Steve is telling in his posts to your needs.
- Mathematicians are chronically lost and confused: Jeremy Kun
- Math Every Day: Steve Yegge
- Math For Programmers: Steve Yegge
Try hard things and try easy things. When you get stuck, jump somewhere else and come back to it later, after you brain had some time to get adjusted to the new ideas. If you read something that you don’t fully understand, you might still be able to grasp the central ideas there. And even if you don’t see the big picture right away, keep digging around and when the time is right, the brain will connect all the dots for you. Do not ever fall into the trap that you need to grok something right away, unless your job depends on it.
There are a lot of resources available online, but following are the ones that I found to be the most useful.
- Mathematics Books. This is a good collection of book titles by fields. Most of the suggested books are the de facto standards in those fields. I have purchased some of the math books based on this list (of course, after doing a lot more research on them).
- MIT OCW. Math for Computer Science. This is the single best course that you can take for learning a lot of the stuff required for computer science. The course includes number theory, graph theory, asymptotics and probability. The video lectures are amazing and they are accompanied by full lecture notes as well as problems and their solutions. Taking this course would be the single biggest service you could do to yourself as far as math and programming are concerned.
- MIT OCW. Highlights of Calculus. Taught by the legendary Gilbert Strang, this is a great introduction to Calculus.
- Coursera. Calculus One. Taught by Jim Fowler, this is another amazing introduction to calculus. Jim Fowler is infectiously enthusiastic about calculus.
- http://betterexplained.com/. This is an amazing site with articles that explain a lot of math stuff in a very intuitive manner. The guy who runs this site, Kalid Azad, has an amazing knack for teaching stuff in a way that just sticks in your brain.
- Ten Must Read Books about Mathematics. A list of books that is not directly related to actual math, but are very interesting nonetheless. They can serve to deepen your interest in math even further. Also, they are a great tool to keep you from feeling guilty when you are not in the mood to do any actual math. Browse around this site and you will find a lot of interesting lists and other material related to math.
A few other recommendations.
- What Is Mathematics. A superb portrait of the math universe, written in a very accessible manner. The chapters are largely independent of one another and all of them begin with some light material. I use it as leisure reading, jumping from topic to topic.
- Godel, Escher and Bach. This is tangential to the study of mathematics, but the ideas presented in this book do explain some really fundamental stuff about math; things like the difference between the symbols and their interpretations, or why no powerful mathematical system can be complete and consistent. Even with all that serious stuff, the book is virtually unputdownable. Read some of the reviews on Goodreads or Amazon.
- Vi Hart’s YouTube channel: Vi Hart is a self-described “recreational mathemusician”. Her videos are incredibly fun, informative and insightful, all at the same time.
So far, I have become quite comfortable with a lot of topics in math. That includes number theory, graph theory, and almost all of pre-calculus. I have just begun to understand what calculus is all about. And I know what sin, cos and the exponential constant e mean. I can even solve a few problems using various types of induction.
Of course, even in these topics, I don’t understand everything yet, and I am okay with that. Not only because I don’t need to understand everything, but also because I am getting better every week.
I know that Google retired map-reduce some time ago. ↩