Generally computer programmers who are mathematicians or have mathematics background are very good in terms of algorithms and computer programming in general.

What I am not saying:

Mathematics is needed to be a good computer programmer. Mathematics is necessary for programming. Good mathematicians are good programmers and vice versa

What I am saying

I would like to learn some mathematics because I believe it will make me a better programmer. What areas/topics of mathematics will help me to become a better programmer? Answers of the form math topic - corresponding cs area will be appreciated.

NB: I asked this on StackOverflow where it was declared off-topic. I want to learn it during my spare time just the way I have been doing with computer programming. Thanks in advance.

  • 1
    $\begingroup$ I am surprised StackOverflow declared this question is off-topic. From my (a retired programmer) point of view, this question should be one of the most important questions for SO. $\endgroup$
    – Nobody
    Aug 30 '17 at 3:09
  • 1
    $\begingroup$ StackOverflow's really more about specific programming problems. This'd be best on CSEducators, and may've worked on SoftwareEngineering. $\endgroup$
    – Nat
    Aug 30 '17 at 3:24
  • 1
    $\begingroup$ We have had questions like this before, and they all have the same problem: they are too broad, and too subjective. The only consensus answer is: all of it. $\endgroup$
    – Raphael
    Aug 30 '17 at 5:43
  • $\begingroup$ @Raphael First, I respect Mod's decision. However, I'd like to ask a question on behalf of the OP. Is there anyway to improve the question so it can be re-opened? If no way to improve it, is there any other SE the OP can go to ask this question? (Obviously, the OP already tried SO and I know it may not fit on Academia SE because it's not closely related to Academia.) $\endgroup$
    – Nobody
    Aug 30 '17 at 7:24
  • $\begingroup$ Questions that ask for formal solutions to specific problems would be fine. Study advice questions are generally unsuited for the SE format; the "opinion-based" close reason applies to all sites! $\endgroup$
    – Raphael
    Aug 30 '17 at 11:00

So, there are many fields of math that are relevant to the Science of CS, but for programming specifically:

  • Graph theory: this is the big one. Graphs and trees are everywhere. Networks, maps, paths in video games. Even things like solving a Rubiks cube can be modelled as a graph algorithm and solved with A*.

  • Discrete math: aside from graph theory, knowing this area in general is helpful. It's full of proofs by induction, which are very useful for understanding recursion, which is very useful in programming, particularly with data structures. Knowing about sets, counting, inclusion-exclusion, boolean logic, etc. can come in handy once in a while.

  • Type theory: unsurprisingly, knowing type theory helps with understanding programming in typed languages, and more broadly, with using types as a way of ensuring certain correctness properties. Knowing about the theory of subtyping helps you to understand covariance and contravariance in Java-like languages. Knowing about things like parametric polymorphism is obviously helpful when learning a type-heavy language like Haskell or Purescript, but langauges like Scala, TypeScript, and Rust are becoming more prevalent in industry, and types are at their cores.

    If you take this one to its extreme, you get things like Coq and Agda and Idris, which can be used to prove extremely precise correctness properties about programs.

  • Computability and Complexity Theory: knowing when a problem is either unsolvable, or NP-hard, is useful, because you won't waste hours racking your brain for a fast way to do it. Likewise, knowing some of the theory behind approximation algorithms, fixed-parameter tractability, or low-base exponential algorithms, can help when you really need to solve an NP-hard problem.

  • Automata theory: many problems can be modelled with various state machines, so understanding their properties is useful.

There are also some field-specific areas:

  • Statistics: If you're doing machine learning or big-data, this is a must.

  • Linear algebra/vector calc: both of these are important for machine learning, graphics, simulations, or image/audio processing.

  • Lattice theory: if you're doing any work with compilers or program optimization, this one comes up all the time. Fixed points everywhere!

  • Category theory: not needed to code, but useful for anything deeply drenched in type theory.

Edit: can't believe I forgot:

  • Cryptography: if you're interested in security, hashing, digital signatures and such, then make sure to learn some number theory, Group Theory, Field theory, elliptical curve Theory, etc.

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