# Recommended Math knowledge for programming

I wasn't sure if this is a math or programming question so I suppose I flipped a coin.

I'm just learning programming thanks to my IT Support degree and was just wondering what the minimum recommended level I should try and get my math up to would be.

I know the Math class in .NET gets rid of a desperate need to be Math proficient but I'm sure it would help. So far I have a secondary school level math education (up to 16 years of age) but that was 16 years ago.

Thanks.

-
I'm of the opinion that this is a programming question. – Hans Parshall May 4 '11 at 18:01
What kind of programming do you intend to do? – Aryabhata May 4 '11 at 18:02
Im learning c# at the moment but i would like to look at lower level stuff sometime in the future. The fact thtat most programmes require math of some kind just made me think of it. Maybe i should post this on another exchange. – Dylan Jackson May 4 '11 at 18:05
@Dylan: The language will be mostly immaterial. I was asking what kind of applications you intend to write. Perhaps some examples... – Aryabhata May 4 '11 at 18:15
One key course, required by most programming degrees I'm aware of, is some sort of class in Discrete Math (AKA Discrete Structures)...it encompasses a wide range of topics: symbolic logic (first order, sentential and predicate logic, with quantifiers), some basic combinatorics, modular arithmetic. But you'll probably want to be up to speed with algebra (College Algebra), e.g. the level of algebra reflected in the algebra-pre-calculus tags, first and foremost. – amWhy May 4 '11 at 18:48

In his famous essay How to Become a Hacker, Eric Raymond says that you need basically zero mathematical training. Now this essay is talking about hacking as in writing open-source system-level software; for example if you wanted to write a disk backup utility or a network monitoring program.

The range of software can vary from fairly straightforward (web page scripting) to very complex (airline reservation systems), with a rich spectrum in between. For most of it, you don't need any math training at all. However a few points:

• I can think of no instance in which having some mathematical training hurts you. Math teaches us how to think carefully and critically, which is a central skill for good scientists, including computer programmers. We still require calculus, linear algebra, and discrete math classes for a B.S. in Computer Science for a reason.
• There are programming careers where math knowledge is essential. These include most HPC jobs, optimization, physical simulation, cryptography, finance, weather forecasting, traffic routing, etc
• If you want a job at a top-level place (eg, Google) you will be expected to know something about math. Or rather about complexity, data structures, and algorithms which really are math. For example, if you don't realize that your algorithm running in $T(n)=2T(n/2) + O(n)$ is considerably faster than another running in $O(n^2)$, then you will probably be shown the door.

Even working as a database developer years ago, I found my math training useful (I had to implement arbitrary-precision arithmetic in software for the DECIMAL datatype that is part of standard SQL... doing division correctly and efficiently is non-obvious).

Finally, a lifelong passion for math has helped me engage better with like-minded programmers. I don't find as much affinity with coders whose preoccupation is minutiae about syntax or language fads. The beautiful part of programming, at its core, is really just mathematics.

-
Another beautiful part of programming is maintainability: extensibility, testability, modularity. How can you architect your system so that changes to one part will require the fewest overall changes to the system? You need a basic understanding of complexity, and algorithms will help (learn to recognize them and look them up), but I think the majority of craft for working programmers is architectural. – theazureshadow May 4 '11 at 19:03
I think that the main issue is that mathematical thinking is critical thinking which revolves around solving problems. This is the essence of mathematical thinking and is very useful for any form of work whose essence is problem solving, e.g. programming. (This comment is due to the fact you can only give one +1 vote :-)) – Asaf Karagila May 4 '11 at 19:15
The most important point from the above post is that "it depends". I've been programming for 20 years and rarely use any of the math I learned aside from set theory (helps understand relational DBs). With that said, I've met very few good programmers who don't have at least a passing interest in math. – Todd Chaffee May 6 '11 at 14:22

If you are entering a field such as finance, game development or other heavily quantitative area then the more math you know - especially applied maths such as statistics, probability, computational geometry, etc - the better. Basic knowledge of set theory will also help if you plan to do database application development. On the other hand, if you intend to develop typical business applications then you will find very little direct application of mathematics beyond simple arithmetic. You will find though that serious mathematical training will significantly enhance your thought processes and analytical capabilities. Compared to mathematics, general programming is truly childs-play. I have developed professional business applications for over fifteen years and I can count the number of times I have directly applied mathematics on one hand; but, I use the basic skills I developed while earning my undergraduate degree in math every day. So, bottom line, if you want to be a programmer, you can't go wrong learning math - any kind of math.

-

I agree with the others that any maths knowledge is good, however in my experience, the actual amount required in programming is usually minimal. Nonetheless, it is essential to have a feel for what computers can do with numbers if you intend to work in this area.

My work is primarily engineering, but I write programs to implement engineering concepts. I basically turn equations into progams.

Now, engineering maths is pretty basic. However, implementing it efficiently and correctly in a program may not be straightforward, often due to the finite precision of number storage.

So you can be caught out, even when relying on existing libraries (like .Net Math) if you don't understand the practicalities of even simple maths when done on a computer.

Best of luck!

-

It really depends on what you intend to create (in the future). For example, matrices can be used for cryptography. To be honest, some mathematical rules might end up being worthy to know(like progressions, statistics), rather than using a lot of computer/server resources. It's always worthy trying to see patterns which can be described by mathematical formulas in specific areas.

-