dmazzoni: There are lots of areas of programming that require only basic math. If you’re doing development for a moderate-sized web site or app, it’s quite possible you’ll almost never use any math, and never anything beyond things taught in high-school algebra.
More generally, some programmers use a lot of math all the time, some hardly use math at all.
There are many more specialized areas of programming that require a lot of math. Computer graphics uses a lot of trigonometry and calculus, so pretty much any game that requires physics or 3-d rendering uses a lot of math. Video and audio compression uses Fourier analysis. Cryptography uses number theory. Those are just a few examples – there are lots of specialties. Good programmers often need to have at least some familiarity with those areas, even if that isn’t their area of expertise.
Quite often large-scale software engineering requires more math – for example web sites that need to scale to millions of users. It’s hard to properly optimize sites to handle a lot of traffic without a good foundation in probability and statistics.
A degree in Computer Science typically covers many of those things, which is why there’s a math requirement. In addition, Computer Science involves a lot of mathematical analysis of programs, including determining what’s possible to compute, determining asymptotic runtime and memory usage, and mathematical proofs of bounds and of correctness.
Faleya: Programming is – in a sense – just applied math.
Math has a strong emphasis on:
– developing/applying algorithms
– defining stuff (classes, groups, etc)
I’m not saying you can’t become a great programmer without studying maths, I’m just saying since they share so many similarities it usually helps to learn both or that it is easier for you to learn the other if you find you have a talent for one of them.
jarjarginx: So there’s a lot of different kind of “programmers.” It’s a big field. Some people focus on front-end development like making websites and interfaces.
Turns out, a lot of UI programming is math-based. Animations or “tweening” (moving from A -> B) usually use basic quadratic, cubic, or sinusoidal equations to simulate speed. Anchoring parts of the UI so that the window reacts well when you change the screen size is another example that uses simple math principles to very complex effect. A lot of this kind of programming has been abstracted away, however.
But a more fundamental answer: computers, as we know them, are math machines themselves. You’ve probably heard that “everything to a computer is 1’s and 0’s” before, which is true. Everything you see and do _does_ eventually become a 1 or 0. This has implications for what we can do _with_ computers.
Alan Turing famously came up with the concept of a Turing Machine, a theoretical contraption that can compute things for us. From there, we can reason why, for example, it’s impossible to invent a “perfect antivirus” that can always detect whether a program is a virus or not. It also proves (mathematically) that we cannot generally analyze a program and say, “will it terminate, or loop and freeze?” (i.e., “will this work?”).
And on the back-end of things, you generally have to deal with data and things *at scale*. Let’s say, for example, I have a system for storing and retrieving customer reviews. If I have only ~100 customers, I could probably save them however I like (maybe I stuff them all in a folder with the date as the file name). If I then need to find a specific review, I _could_ just open them all up one by one until I find the one I’m looking for.
Now imagine if I’m storing millions or billions of reviews. Time complexity (how long does it take to do what I want?) and space complexity (how much _actual space_ do I require–RAM/Harddrive–to do what I want?) are fundamental concepts to understand for any modern computer scientist or programmer. Because small problems can suddenly balloon into very large ones if we’re not careful.
Understanding how complex these kinds of problems are directly relates to math. This gets into P and NP–namely whether something requires a polynomial- or nondeterministic polynomial-time algorithm to solve. But that’s a much more detailed subject. Put another way: If you’ve heard of the [traveling salesperson problem](https://en.wikipedia.org/wiki/Travelling_salesman_problem), we know from complexity theory that we can’t build a program that will do the following: Given any graph (map), we can find the shortest path that will visit every node (location). It’s just too complex and the problem becomes too large for larger inputs (i.e. big maps and many locations).
Of course, if you use Google Maps, you’re probably thinking that of course we can solve that problem, Google does it super effectively. Truth is, people come up with very clever algorithms that can very closely approximate answers to these problems.
EDIT: **WHY THIS IS SO IMPORTANT FOR A STRONG PROGRAMMER:** A lot of these super high level and super low level concepts aren’t used in all your programming. However, they inform a strong programmer’s intuition, and they can be used to “sniff out” bad code and design. It’s kind of like having a strong minimap and radar in a game: It might not tell you exactly what’s out there and where to go, but it makes it damn easier to figure it out (and easier to correct course if needed).
WRSaunders: Programs use math, a lot. Sure, there is logic, if’s and loop’s, but most of the work in a program is math. Want to calculate the path of the first-person shooter – that’s kinematics = matrix math. Want to recognize that product on the assembly line – that’s machine vision = Hough matrices. Want to understand why it’s hard to mine bitcoins, that’s a cryptographic use of set theory.
kouhoutek: Both math and programming are strongly based in logic, so there is going to be a lot of skill overlap. Writing a program is often very similar to constructing a mathematical proof. You need to create steps that both logically flow together, and that are valid in the general case, not just in special cases. The skills behind math often apply to programming in a sort of a vague way. I might not ever need to find the integral for a hyperbolic trig function, but the mode of thinking that let me do that often also apply to math.
Computers are often doing tasks that require higher level math to fully understand. If I am using a random number generator to perform a simulation, I had best understand probability and statistics to ensure the results are valid. I had also best have a little number theory so I understand how the RNG works. If I want to analyze how long that program will run for a given input and how much space it will require, that brings in abstract algebra, number theory, and calculus.
Also, computers are often used to directly solve math problems. If I need to invert a matrix or find an approximate solution to a complex equation, I need enough math to understand exactly what those things mean.
Finally, you never know what math you are going to need, so it is good to have a big toolbox. I learned what a Poisson distribution was in college, thinking I would never use it. More than a decade later it was the key to diagnosing a serious network problem.
mredding: Programming is a form of applied mathematics. A better understanding of the underpinnings can aid in their application.
Set theory, group theory, and category theory are underpinnings of computer science, and many white papers on computation and computability are described in these terms. Mathematical analysis is used heavily to measure properties of programs, typically focusing around efficiency and complexity. Lambda calculus is a formal system that describes computation. There are many other branches and systems of math that can be used to describe different aspects of computation itself. It’s not all just applied mathematics in terms of using X mathematics to solve a business problem. Knowing statistics, for example, would make a programmer very valuable at measuring performance, efficiency, and correctness of programs, and is typically an obtainable skillset to most developers.
You don’t necessarily need explicit knowledge of maths to be a developer. Lord knows, I’ve worked with mouth breathers who managed to do enough to not get fired. Kudos to them. Also a consideration is there’s plenty of software that can afford to be incredibly wasteful, which is actually most software.
Qwerty_Resident: The “math” that we learn in K-12 or pre-university or even pre-math degree is more accurately called “arithmetic”; that is, the study of numbers, which is a *branch* of mathematics, but isn’t indicative of the whole of mathematics.
Mathematics is concerned, on the whole, with finding solutions to problems. This is where calculus comes in, as it talks about general methods for solving problems, and learning this “higher-level” math is something that comes in handy when your whole job (as a programmer) is solving a problem using only a rock that we filled with lightning and tricked into doing arithmetic, and a series of codes that we invented to make talking to it easier.
When you can view your problems through the lens of an equation to try and solve, it can help break down the components of what you actually need to do.
That said, many people can do this decently well without any math training, and there are plenty of good self-taught programmers who aren’t good at the sort of math they teach in K-12 school. But they also aren’t going to be doing a lot of cutting-edge computing.
mannyv: Realistically speaking, most programmers never touch math except to increment counters. Maybe there’s some basic addition/multiplication/division occasionally.
To take a step back, most computer programs consist of a series of steps that need to happen more or less in order. If you can’t break things down into steps all the math in the world isn’t going to help you program. That’s probably where the “strong at math” part comes in, because that’s an obvious indicator that someone is good at deconstructing a problem. There are other indicators of good programmers which aren’t so obvious, like system-oriented thinking and algorithmic thinking. Those are a lot more difficult to describe and spot.
If you want a “real” programming skill, learn how to make a recipe then walk someone through it.
jsidewhite: It’s not really, for most types of programming.
90% of programming tasks are writing (hopefully) straightforward logic, like,
if user_clicked_resume_button(), then close_menu_and_resume_game()
Logic like this is considered ‘math’ by mathematicians, but isn’t normally what you and I would consider math (like calculus).
**Statistics probably won’t be useful** to a programmer unless that programmer is writing a program that must analyze a bunch of data – e.g. some research professor is doing a study which has a large amount of raw data, and she needs to draw conclusions by finding statistical patterns in the data – which the computer can be programmed to find (usually the programmer is just translating the professor’s math formula into computer code, which often isn’t too hard).
**Calculus isn’t useful** in everyday programming either, unless your program needs to do specifically do something with calculus – like calculate the volume of a 3D object. It’s useful if you’re doing very lowlevel graphics processing – or, say, writing a program to help students calculate a calculus equation.
**Addition and subtraction are used** a lot in programming, but again, usually only when the program needs to tally something. (Low-level computer operations may require +-*/ operations to implement algorithms to find new memory locations from old ones, e.g. if making a custom data layout in C++ – but again, programmers are doing these explicit low-level manipulations with math less and less because all this stuff is already done in libraries they include.)
**All kinds of math could be used in programming to _optimize_** the speed of your logic (algorithm) by doing fewer operations to achieve the same result – but if you really need that kind of optimization, you’re probably going to get the algorithm from a textbook written by a really smart dude, like Knuth. Even if you’re doing a math-intensive task, like graphics – in today’s world, you’re not likely going to implement the math part of a rotation, you’re going to call the rotation() function in a well-tested library.
tl;dr **Unless you’re making software that is specifically made to do mathematics/simulations/data-analysis, then you’re not going to need much math.** A programmer would need to know a lot about gardening if most computer programs were all about veggies.