It seems that the general population has a preconceived notion that mathematics and programming are an intertwined discipline. To be a great programmer, one also needs to be great at math. So, does programming require math? In short, yes programming always requires at least a small amount of mathematics. The degree to which math is used in programming, however, can vary greatly. It is my belief as a software developer, that you do not need to be a mathematician to be a great programmer. That being said, the practice of mathematics will always benefit you in programming. In this article, I hope to explain why.
Before we begin, I want to state that the type of math that is directly applicable to your job is going to vary immensely depending on the industry you want to work in. As a web developer, I have always found that typical business math has been more than sufficient to get the job done properly.
However, this is substantially different than working in a field such as data science. Where you need calculus, linear algebra, and statistics skills or you won’t even scratch the surface of what’s possible. In game development, even a basic arcade-style game like Pong required more mathematical knowledge than most advanced topics in Web Development.
On top of this, I have many friends in the financial and actuarial science industry that want to learn how to program to make themselves more valuable employees. Even if their mathematical jobs do not require much or any programming at all.
So, at this point, we have acknowledged that programming does have a rather intimate relationship with mathematics. However, you may be taking a sigh of relief that math isn’t a critical component of becoming a great programmer. Then why learn math with programming? Well, here are a couple of key reasons why learning math will make you a better programmer.
One of the main reasons that learning math is so valuable as a programmer is that it can directly improve your code quality. As programmers, we must try to find the simplest solutions to our problems. Solutions that are easy to understand, produce fewer lines of code, and reduce the likelihood of introducing bugs.
Math is a tool you use to solve problems. So a strong foundation in math can make this process much easier. Both in writing our code and understanding others.
For instance, let’s say that you want to write a function that can find the total number of digits in a positive integer. Given our programming toolset, we could think of many ways to do this. For instance, we could write this:
This code works perfectly fine. Although, there is a lot of unnecessary steps and requires converting data types multiple times. If you had a stronger foundation in math, you could probably think of a better solution mathematically. After some research, I discovered that the formula log10(n)+1 is used to find the number of whole digits within a positive integer. Let’s rewrite this with our math knowledge:
See how much cleaner our code is? With the same function structure, we wrote less code, needed fewer comments and never changed data types. I would also argue that it is easier to understand and is less likely to produce bugs. So our first discovery is that learning math with programming will result in cleaner code practices!
Another key reason why expanding your math skills can benefit you as a programmer is that it will open up job opportunities that otherwise would not be available to you. Not only that, but it also increases job security within the field. If you take a moment to think about it, many programmers are relieved and content with their lack of advanced mathematic abilities. Which is completely understandable.
However, this lack of understanding of mathematic principles creates a large group of programmers that do not fit the requirement for a lot of high paying, math-oriented programming jobs. Even worse, it leaves these developers in direct competition for the jobs that do not require math. Resulting in fewer jobs and higher competition.
Here is a biased ven diagram to help illustrate my point:
Side Note: This isn’t meant to be discouraging. There is still a high demand for developers all over the world and this thought shouldn’t make you feel like you can’t becoming a great programmer without math. Mathematicians also aren’t nerds (except they are).
Besides, even if your job did not require a lot of math skills, those skills look great on a resume. Your potential employer will inevitably view you as more intelligent (even if you’re not) and your qualifications will benefit you while applying for the job.
On that note, I wanted to pass along some wisdom that my grandfather gave me when I was young and refused to learn french in school. He asked, “If there were two exact versions of yourself going for a job interview but one version knew french and the other didn’t. Regardless of the position, who do you think has a better chance of getting the job?”.
It’s a simple and obvious statement. Even so, as a kid, it resonated with me. It demonstrated that your collection of skills can say more about your ability and wiliness to learn than, the tangible benefit it could bring to a team. Anyways, I still can’t speak french.
This is where the real power of math can help you as a developer/programmer. It can indirectly change the way you process information and solve problems. Essentially re-wiring your brain to view situations differently.
Clancy Blair, a professor of psychology at NYU stated that math can improve reasoning and logic, problem-solving and analytical skills. All of which are the pillars for computer science. Becoming a great programmer means thinking abstractly and this will help develop skills that nurture this growth.
As programmers, we share the innate desire to explore, build and discover new things that both excite and challenge us. What I recently realized is that math is the obvious barrier for us that will unlock the hidden potential of code.
So many amazing fields require math. Robotics, machine learning, browser web application automation, graphics engines and game development are just scratching the surface of what you can do with well-developed math skills and programming.
That’s the beautiful thing about programming. It pushes your limits and makes you want to learn new things that you may have previously disregarded as being too hard or irrelevant to your life. But in the end, they all make you a better programmer.
Although this article has attempted to be very persuasive towards learning math (and I believe that it is very important). I want to address a few additional thoughts. No matter what we choose to do with our time, there will always be an opportunity cost. If we spend time on one activity, we can never get that time back to work on something else.
For that reason, we need to focus on our primary goals and spend the bulk of our time practicing the skills that will get us there the fastest. If you want to be a great programmer, you need to code a lot. Meaning the time you spend learning math might be better spent learning how to code if you are not already an adept programmer. Always keep that in mind!
This brings me to my second point. There is going to be a point of diminishing returns on any skill you practice. In simpler terms, it means that as you invest more time into something you begin to get less of a tangible benefit from that activity. So if you are already comfortable with programming, learning math may bring you more benefits than programming. I have recently tried to think of this as a sort of equilibrium where more importance should be placed on programming but as your coding skills improve, they should be offset with improvements in your math skills.
At least that’s one developer’s opinion.
To be a great programmer, It is essential that you practice your programming skills. That being said, studying mathematics is an incredible mental work-out that improves your core analytic ability.
Does programming require math? No. At least not really. You can be a great, employable programmer with some arithmetic knowledge and great logical thinking skills. However, that shouldn’t stop you from learning math. It can improve your code quality, make you more employable, change the way you problem solve and give you greater flexibility in what you can build!
So do yourself a favour and take the next step in becoming a better programmer by developing your mathematical skills.
If you are looking for some great free resources to teach you mathematics for programmers, this is an amazing place to start: Computer Science Courses.
I also wrote this article that summarizes all the skills you need to know to become a web developer in 2020. In addition, consider subscribing to the code bytes for updates on web development tips and ways to make money coding.
It helps me out a lot. Happy coding!