Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It seems that conventional wisdom suggests that good programmers are also good at math. Or that the two are somehow intrinsically linked. Many programming books I have read provide many examples that are solutions to math problems, or are somehow related to math as if these examples are what make sense to most people.

So the question I would like to float is: do you have to be good at math to be a good programmer?


locked by World Engineer Jul 20 '13 at 5:04

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

closed as primarily opinion-based by World Engineer Jul 20 '13 at 5:04

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

@Mark Not necessarily. Learning a subject and liking it are two very different things. – Maxpm Mar 7 '11 at 8:09
Are you a king? Or conjoined twins? If no, I suggest you stick to "I" when referring to yourself. – drxzcl Mar 7 '11 at 9:57
@jk - you're correct most likely still think there's a good amount of art to programming ;p – Garet Claborn Sep 27 '11 at 4:44
I thought I never liked math. Later in life, I realized I just wasn't happy with the syntax. – MrFox Oct 31 '12 at 17:19
All of programmers use math all the time, they just don't realize it because it is so much different than math taught at school. Discreet math, lambda calculus, Boolean algebra, logic (!) are really advanced math concepts that we use every day. – rotman Nov 16 '12 at 18:41

67 Answers 67

Depends. Enterprise CRUD (Create, Read, Update Delete) apps usually don't need exceptional math skill. On the other hand if you are designing algorithms a background in math will help and in many cases be necessary.


Ditto Tim. There are some areas, like 3D graphics, where you'll want to understand, for example, physics, but for the most part you can get by with just arithmetic and some simple algebra.


Not maths as such, but arithmetic comes into play a lot.

Unless the application you're writing is heavily mathsey, then you don't need it to be a good programmer. If you're just starting out and want to get into games or graphics programming, then that can often be quite maths oriented.


If you are not very good at math then your answer will undoubtedly be "no, math skills are not required". If you are one of the small percentage of people that actually know math and use it everyday, then you realize how valuable your math skills are and how they enable you to quickly develop routines. You will not spend countless hours debugging using trial and error methods. Your functions and classes will be "reduced" allowing for more complex functionality. Given enough time and motivation, anyone can program. Will the code that person writes be any good?? I guess if it works, right?

Bottom line. A programmer with good math skills will be a far better programmer than the one who lacks. They will be much more productive and will save the company oodles of money in development costs, both in the present and future when the application needs to be expanded upon.

The most basic program is an exercise in Algebra. If a programmer does not recognize this, the result is code that is not reusable. You get lots of repetitive "almost the same" code. Another word for this type of programming is "non-scalable"!

"Hello, World!" is an exercise in algebra? :) – Will Mc Dec 30 '08 at 22:31

Yes, of course. They are entirely different.

I know many good programmers, when I say good they know design patterns have degrees from good universities and now work in commerce (finance sector). And have a number of large released successful products. They know A-level maths I would say (a-level is exam you take when you are 18 in uk, generally).

It may be somewhat unusual to be a good programmer and not be interested maths. But I think a lot of people are prejudice in thinking one must like/be good at both. They are not dependent on one another.

How can they be "different" if programming (a coding part of it) is just a branch of math and nothing more?!? – SK-logic Mar 8 '11 at 12:58
We probably should have asked what "type" of math he's talking about. @Dan said it best, in that there are many types of programming projects that don't involve mathematics. If you want to be in the games sector or simulation world (dept of defense), then you won't be able to get in without some computer science and/or computer engineering degree, which takes you through a ton of math. However, if you want to be a "programmer," then there are many jobs out there that just want you to be proficient in a particular programming language or framework, rather than a domain. – Rick Sep 10 '11 at 2:48

It's more about problem solving. How much do you like solving story problems? Or maybe how much do you like fixing things? Do you give up quickly or spend all day trying to put your $5.00 headphones back together?


Nice try. You already know the answer if you're asking. Stop avoiding math and get a good foundation, otherwise prepare for a life of having this issue repeatedly haunt you...


Depends on the math. Not all math is created equal.

I'd say it's pretty hard to be good at programming if you don't understand some basic concepts in Discrete Mathematics like set theory and Boolean logic. Graph Theory and Networks has some pretty obvious applications.

That said, there's a lot of math that is useful to programmers only if it is useful to the problem domain of what you are building software for. It's fairly dependant on the field you are working for, however. I can say I honestly have never cracked a stats book for my work. I'd say Calculus, Statistics, Numerical Analysis, and Linear Algebra all fit into this collection.

And then there's a few caveats:

  • Math is, however, directly relevant to graduating college - I don't know of any school in the country that allows CS majors to pass without at least a year of math. And college diplomas are directly connected to the ease with which you can get a job programming. Also, good GPAs are similarly relevant.
  • I found math of many types EXTREMELY helpful when doing a grad course in Algorithms. Both the algorithms and the methods for analyzing them were extremely math dependant, and from a variety of mathematic topics. As the only math degree holder in the class, I had a serious leg up and the gang who had barely squeaked through math, and who managed to successfully wipe all undergrad math out of their heads had the worse time of it.

That said, I don't do that kind of analysis very often. There's too much chaos in the real world of integration and development to let me get that pure and mathematically perfect on the job.

@Job - who said I was a PM? Also... I didn't quite say I liked it. Good at it does not equal liked it. And I was good at it only in a relative sense. – bethlakshmi Mar 7 '11 at 14:53

Yes. Because most of the people who doesn't like math, think about theorical, formula math, instead of applied math to real world. Most of the programmers are not mathematicians, and still, use a lot of math, and it comes naturally.

For example, there are several math subcategories / branches, very specifical to programming. Automatons & Grammars & DFA, for programming language & compiler design. Relational Algebra & Relational Calculus for Databases. Boolean Algebra for conditions in programming.

In University, I watched that architects students didn't struggle with calculus, as others students did, because they applied all the time, to real world stuff. I see the same for math, for programmers.


Math is not one "thing". It's a large subject area with many components, a huge portion of which most programmers can an do forget in their professional careers (e.g. not every programmer creates statistical data mining, DSP, 3D, and aerodynamics modeling software, etc.)

Furthermore, one doesn't have to like math to be good at it, or good at just the portions required for most programming tasks.

I could easily see hiring an enthusiastic puzzle solver who never took calculus over someone who aced diffEQ but hated any kind of logic puzzle.


Well I was having lessons at a math teacher several months ago and I can say that if you have some mathematical knowledge you can benefit from it. For example: I was writing some javascript code and I had to simulate acceleration and deceleration. I heard about the fibonacci sequence from my math teacher so I was able to simulate this behavior easily with it. If I haven't had lessions however I don't know what I would have done. I think the point is obvious from this example.


For me, it was the other way around

because i liked programming, i was good at math, because for most concepts, i had a practical application, starting simple with logic (x and y or z), to simpler analysis ("ok, f(x) is a function. i know that, that even looks exactly like the functions in Pascal. go on"), to higher stuff (a mapping |R -> |R? ah, thats like a Dictionary with floats as keys and values).

I was often surprised, that math was not just not that hard, but instead provided me a much easier way of thinking about my programming problems than those clumsy, pragmatic languages i was coding in ever could.


No. You do need to be good at logic though, which isn't exactly the same thing. Me, I'm great with the logic, but the numbers generally throw me for a loop. I can work it out, but it takes me longer to do the mathy bits.


I think it obviously depends on what sort of programming you're talking about.

If you want to write the rendering engine for a video game, you're going to need stellar math ability to have any hope. If you want to develop data structures and sorting algorithms, math is very important.

If you want to develop websites and line of business applications, complex math really does not come into play that often (excluding the problem domain).

Either way, I think the most important thing is that it's never too late to learn.


I say this as someone who is neither great at math nor necessarily a remarkable programmer, so perhaps you can take my opinion with a little grain of salt.

When you know continuous and/or discrete math a bit better, you'll find that problems you encounter benefit from that knowledge. Similarly, when you at least understand how algorithms like breadth first search work, you'll discover applications for that more readily than before you understood it. Some problems that seem intractable when you only know about simple data structures like arrays and linked lists suddenly seem relatively simple when you understand a little bit about graph problems.

The point is, almost all kinds of knowledge will make you a better programmer.

I'm not sure that the inverse is true: that you MUST be good at math to be a good programmer. But I suspect that the difference between good and great may be a question of math skills.

Steve Yegge's blog has at least one argument in favor of shoring up one's math skills. It's an interesting read.

Basically, almost any kind of domain-specific expertise can be useful as a programmer. I probably wouldn't be in this industry had it not been for my German and Japanese skills; it was a question of right place, right time, right foundation. I suspect knowing even trivia-level details about biology (ant colony optimization?) can open your eyes to more ways of solving problems.


Short answer: It depends on what kind of programming you're doing.

Longer answer: If you mean specific mathematics courses that you do, then it very much depends on what kind of programming you're doing. Some kinds will be useful to all programmers (see Concrete Mathematics by Graham, Knuth and Patashnik, for example), whereas some can get by without using, say complex analysis (which I have used in programming).

More generally, the kind of logical thinking that mathematics needs, particularly in finding flaws in bogus proofs (e.g. that 1=0) hones the kind of thinking needed in debugging.

Personal suggestions:


  • Calculus - general purpose. More advanced courses in it may be useful (e.g. complex analysis is used in electronic engineering).
  • Statistics - general use, have used it personally in my career.
  • Logic - converting logical expressions into equivalent but simpler expressions, checking the validity/nonvalidity of a proof.
  • Computability theory - see proof of Halting Problem being unsolvable for Turing machines - you may find yourself trying to solve something equivalent to it some day, then rewrite the code to solve a possible task, depending on the domain.

First in trying to come up with a meaningful answer to that question it should first be acknowledged that mathematics and computer science as subjects are both large and diverse in terms of the concepts that they cover. One common thread that unites the two are that they both deal with abstract concepts. An ability to deal with abstract concepts would imply that some areas of both Mathematics and Computer Science should be accessible to you. Put another way, a situation where someone is able to write programs but not solve any maths problem or where someone can solve maths problems but is unable to grasp any aspects of programming both seem implausible. A fairly basic abstract concept that human brains are generally able to comprehend and one that a fairly major component of both subject is numbers. Above and beyond your ability to understand numbers. the extent of your natural talent for wrestling with abstract concepts with determine the complexity and variety of the mathematics or algorithms you are able to understand.

Beyond natural talent however both solving maths problems and programming both require enormous amounts of dedication, practice and study to become proficient. So if you have an agile brain and commitment you probably have the potential to be good at either. However having the potential to be good at something and actually being good at something are usually determine by confidence which is a different beast entirely.

Plenty of good programmers get nervous when confronted with too many equations. This is usually more due to a combination of not having invested the same amount of time and previous bad experiences which leads to a lack of confidence rather than an inability to understand them.


I use to say "No, you don't (necessarily) need to be strong in maths to program".
And I immediately mitigate the sentence..

Pro: As a programmer, I rarely do more math that incrementing variables, doing some operations you do on a desk calculator (+ - * /), sometime go as far as doing a modulus and a percentage...

Con: Actually, you have to apply some branches of math, particularly logic... Some other maths can be useful: concepts around floating point numbers, Boole algebra, theory of sets, etc.
And of course, if you do some graphics, you better know some trigonometry, sometime integration theory, probability, etc.
If you go into functional programming (a domain I discover), you might find it strongly mathematically oriented, with algebraic types, and other algebra theory which can be simple or go to some difficult theoretical highs...


I have not found in practice that programmers need to be mathematically inclined to become great software developers.

Jeff Atwood - creator of this and all other stackexchange sites (the guy is a brilliant programmer).

Source -

Here's a related question:… – Emanuil Rusev Mar 9 '11 at 10:43

No, as long as you are talking about math apptitude and not grades and include all subjects: logic, algegra, geometry, trig. I did much better in geometry than algebra because I think I understand things 'spacially' and my teacher did not require any memorization which is good because I have none. Probably why I like working with databases.

Also, it may have depended on your school system's math curriculum. Doing nothing but computations and memorization would have put me off.


I think it's a matter of how much math.

I can't imagine being a good programmer if you're not very comfortable with algebra. However, there is little need for math beyond this. I've never used anything beyond basic calculus and that only very rarely. I've used a moderate amount of trigonometry but that was almost entirely due to work on CAD/CAM stuff.

So, you've never used logic? Never used state machines, never learned any formal language, never programmed? It is all beyond algebra. Yes, calculus, linear algebra and so on are pretty much irrelevant in most areas. But the whole huge body of a discrete math is mandatory for programming (probably excluding the dreaded number theory). Probability theory and statistics are also extremely relevant to almost all of the programming. – SK-logic Mar 9 '11 at 10:00
@SK-logic: I've never really considered this stuff a field of math. – Loren Pechtel Mar 9 '11 at 16:56
but formally all this stuff is a math: – SK-logic Mar 9 '11 at 17:01

To be good at programming you can be good at math, however the two disciplines are completely unrelated to each other. The people with the highest aptitude for programming are people who are also gifted in the compositional arts such as music, painting, writing, film or theater directing or even choreography.

In the 1960's an insurance company did a study to find out who they should hire to train to program their mainframes (as computer science as a college major did not exist yet). They found that musicians and English teachers made the best programmers (in that order).

I've been working professionally as a software developer since 1982. And indeed the best programmers were those people who were good at music, in particular composition and arranging. The very worst programmers I ever worked with had PhD's in math. I've worked with two such people and they had zero knack for programming.

I was always good at math, but I'm also a musician, composer and writer. It is these latter talents that allow me to be a good programmer.


I think math would help. I have an undergraduate in applied math and a master's in MIS. I did get an MBA sequentially - but for the most part what has helped me stay in the IT field, most of which has been a developer (database and datatwarehouse programming), was the math.

I see computer programming as a "logical math" - but then again I see math as a language. As someone earlier stated, it helps in communicating complex ideas. The first programmers were actually mathematicians and engineers. A lot of people I know who are great programmers have an engineering degree.

If you want to be a programmer/analyst, math will help. It's the logic set necessary, and the discipline. I see relational databases as more of linear algebra anyway. There is a great paper on "Fast Monte Carlo Algorithms for Matrices: Approximating Matrix Multiplication". It is math-based.

Computer Science Majors are often part of the Mathematical Sciences Dept. at Universities. There is a reason for that.
Ultimately, there's not a "one size fits all" approach. I think they are a good compliment to one another - math and computers.
The most fundamental attribute for being a great computer programmer is being able to solve puzzles. There's always some bit of information missing, or information that is ambiguous.

Ask yourself this: "Would you rather have a 10,000 piece jigsaw puzzle with all the pieces there and no picture on the box to guide you, or would you rather have the same jigsaw puzzle with the picture on the box and have 10 pieces missing?"

I hope this helps !

Hi George and welcome to Programmers! As a rule of thumb avoid answering on questions when there are so many answers already (your's is the 31st), if you are not adding something unique and significant to the discussion. If you find earlier answers helpful, please consider up voting them instead of adding yet another answer. Your answer is helpful, I'm not saying it isn't. I'm just trying to steer you towards answering less popular questions, where your contribution will matter a lot more. – Yannis Jan 17 '12 at 7:39

Mathematics is an abstract notation for modeling real world situations, and this is exactly what programming is.

If you can't visualize and figure out how to build an accurate working model of the world then you won't be a good programmer (or mathematician), and there's no getting around that. That said you could probably pound out some JavaScript and Bash and make a fine living at it without knowledge of advanced mathematics, but I assure you knowing math will only add to your ability to think abstractly and create better models.

Learning to be a good programmer is a ton of work, and I suggest that you simply consider learning mathematics to be a part of that workload because it can be the difference between being a fantastic programmer and merely being a competent one.


It does depend on what you want to do. You to need know American high school math at least. Trig, logs, etc. If you can't solve the problem "Mark can mow the lawn in 2.63 hours and Mary can mow the lawn in 1.87 hours, how long will it take to mow the lawn if Mark and Mary work together?" I don't think you could do much programming.

Also, what is math? Is converting from decimal to binary to octal to hex math? You can find calculators to do that easily. I think a programmer should be able to convert 49 to base 7 rather quickly.


I disagree fairly strongly with Daniel (to a point). To be a capable with the programming languages, api's and tools that you use, it strong math skills aren't necessarily required. However, if your goal is to go beyond the level of coding to other people's specifications being able to apply math and more complex algorithms to a problem (I consider these to be very similar) will take you a long way toward that goal.

Now for the why. In my experience, it's usually not hard to come up with programming solutions to many propblems that meet the requirement of producing the required output and keeping to a few restrictions. Where the math will really help you is when you have to take an existing solution and make drastic improvements to it. For example, if you need to write you own text comparison code, it isn't hard to use the search text to generate a simple regex to account for some spelling differences, but if you want to be able to emulate the behavior of Google Suggest, you need to understand algorithms like Soundex, Levenstein Distance and others. For a more mathamatical problem, consider a cache for keeping commonly used objects in memory instead of hitting the DB every time. How can you generate hash values in such a way that two objects with trivial differences have the same hash value?

At the end of the day though, the type and amount of math you need really depends on the field you're in. If you working with computer graphics, strong calculus and algebra skills are pretty important, but developers of financial software can probably get manage without. On the other hand, in any application where you have to deal with floating point arithmetic, having a strong understanding of number theory is a necessity, otherwise you'll constantly be faced with running totals that no longer add up correctly (due to rounding, truncation, and number representation issues).


I found an interesting article and ensuing discussion regarding this question:

Slash7: Got Math?


Pretty much repeating what everyone else has said. The more graphics you are doing the more math you will need. 3D stuff gets kinda hairy with the trig and matrix stuff, but like everything else, you learn the idioms and you're good to go


I am pretty bad at general math. However I am very very good at logic and problem solving.

It helps that I started programming BASIC when I was like age 10 though.

I consider myself to be a "good" programmer. I know however that I will probably never write a 3D engine or face recognition algorithm or anything like it. And that is the key. Everyone has limitations. I know there are certain areas in software that I will never be able to go. But likewise those people that are exceptionally good at math aren't always the best software engineers/architects either.

Just last week we interviewed a guy that could probably write you a face recog' algorithm in the space of a week. However he knew nothing about design patterns or architecture. Nor did he display any interest in them at all.

So no. I don't think you need to be "good" at math in order to be a "good" developer. There are many different types of developer.

OTOH, knowing about design patterns may not be a way to detect good programmers. I met many guys that used design patterns in place of brain. Trying to fit ready to use solutions to actual problems is not always such a good idea. – kriss Jul 1 '11 at 11:47

Maybe, most programming jobs are about plumbing stuff together. You could be a good programmer in that field.

Hmm, on one hand I agree, but on the other hand I think:"Is a guy who only plumbs stuff together a good programmer? (even though he plumbs them together very well)" I don't know really. It all depends on the definition of good programmer. – Matthijs Wessels Sep 17 '10 at 9:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.