Possible Duplicate:
Is mathematics necessary for programming?

I'll try to carefully phrase this because these types of questions always turn into academic debates on computer science degrees, or such, and that's not what I'm looking for.

I know Perl, I know Unix systems, I know shell. Advanced-levels. Some C. But I never got a very deep math background; math wasn't emphasized strongly in high school, and I never did CS. Basic understanding of CPU architecture.

Let's say that I wanted to get into systems programming; say, obtain kernel-level understanding, and be able to modify and write userspace programs that do things like file and network IO, as a starting example.

How much, as a systems programmer, would you say that advanced levels of math are important? And how hot does knowledge of things like calculus need to be? Does one need to be intuitive with math to be successful?

Follow-up question: how much and what types of math are necessary for one to go one step further and learn assembly?



I guess I am going to be the first person to say you do need math. As others have said math is not all that important for certain aspects of development, but the fundamentals of critical thinking and structured analysis are very important.

More so, math is important in understanding a lot of the fundamentals that go into things like schedulers, optimizations, sorting, protocol management, and a number of other aspects of computers. Though the math involved from a calculation level is not complex (its mostly High school algebra) the theories and applications can be quite complex as a solid understanding of math through calculus will be of great benefit.

Can you get by without it, absolutely, and you shouldnt let a less then thorough knowledge of math hold you back, but if you had the chance, or the inclination I would study as much math as you could, calculus, numeric theory, linear algebra, combinatorics, practical applications, all of it has both practical and theoretical applications in a whide range of computer science.

I have known people who were highly successful on both sides of the fence (those without a strong focus on math, and those who went to school for physics or math), but in both groups they enjoyed numerical problems and learning about algorithms and math theory.


If you find the subject fascinating enough to post this, just go ahead and start learning. The rest will come naturally.


In my experience math is required in programming, you can't get away from it. The whole of programming is based on math.

The issue is not black and white, but more colorful. The question is not whether or not you need math, but how much. The higher levels of math will give you more tools and open up your mind to different paths of though.

For example, you can program if you only known addition and subtraction. When multiplication is required, you will have to perform a lot of additions. Multiplication simplifies repetitive additions. Algebra allows one to simplify math before implementing it into programs. Linear Algebra provides tools for transforming images. Boolean Algebra provides mechanics for reducing all those if statements.

And don't forget the sibling to mathematics, Logic and Philosophy. Logic will help you make efficient use of case or switch statements. Philosophy will help you understand the thinking of the guy who wrote that code you are modifying.

Yes, you don't need much math to write programs. Some programs may require more math than others. More math knowledge will give you an advantage over those who have lesser understanding. In these times, people need every advantage they can get to obtain those jobs.


I think it really depends on what you're trying to do, but IMHO, the CS and OS theory are more important than math here, and you really need only the math that they involve.

For example, there's a lot of CS background of scheduling theory and optimization that stands behind many schedulers in modern OSs. That is an example of something that would require some math, though not something super complicated.

But honestly, for most stuff, you don't need math. What you need is to learn the ability to think in base 2 and 16, such as the ability to mentally OR/AND. For example, if you have a byte and within that byte there are two 3-bit fields and 2 wasted bits, knowing which bits are in which fields are active when the byte value is something like 11 will make things slightly faster than having to use pen and paper.


I began programming about the same time I entered my pre-algebra class.. So I wouldn't say math is all that important, though it can help in certain types of programming, especially functional.

I haven't taken Discrete Math yet, but I see a lot of theory stuff with programming written in a math-notation that is taught in this class.

Also, make sure you know how to calculate anything in any base, especially base 2, 8, and 16.

Also, one class that really brought home some concepts for me was this pre-programming class. We got taught unions, intersections, and all that happy stuff and It almost exactly parallels bitwise math. And we covered boolean logic very heavily. What I considered the most useful was when we learned how to reduce complex boolean statements. This was very handy:

(x|y) & (x|z) & (x|foo)

can be simplified to

x | (y & z & foo)

Which I previously did not quite grasp.


Well you generated a number of responses, and no I did not read them all. I am in the middle on this, no you certainly do not need math in order to be a programmer. Assembler vs device drivers in linux are no more or less complicated than the other and neither require math.

In no way shape or form do you need to take or pass a math class for any of this.

I will agree that the problem solving mindset for programming is quite similar to that of math solutions, and as a result math probably comes easily. or the contrary if math is hard then programming may be hard. A class or a degree or any pieces of paper or trophies are not required, going off and learning stuff, sure.

Now if you cannot convert from hex to binary to decimal quickly either in your head, on paper, or using a calculator you are going to struggle. If you want to get into networking and other things that involve timing, which kernel drivers often do but dont have to. You are going to struggle. I know of a very long list of people with math degrees and/or computer science, and/or engineering degrees that struggle with the rate calculations, bits per second, bytes per second, how much memory you need to do something, etc. To some extent it may be considered some sort of knack that some have and others have to work toward.

My bottom line is I believe in will power, if you want to learn this stuff you can and will, it is as simple as that. You dont need to take a class or spend a lot of money, linux and qemu for example can keep you busy for quite some time, different asm langauges, etc. crashable environments for kernel development, embedded, etc. You are not limited to that, but I dont believe that you have to run off and take any classes if you dont want to. If you want to then sure take some ee classes, some cs classes and some math classes..


You don't need to learn math for programming.

But learning math trains you in thinking discipline. Therefore I would consider math to be good for the developers.


You don't need much math. Some combinatorial thinking can help you frame and reduce a problem for fast execution. Being able to multiply is good. You're an engineer, approximations are fine.


I think for tasks you described not too much math is needed. but generally i think for real advanced system programming you:

  • Don't need calculus at all
  • Need good undestanding of computer internals
  • Need CS a LOT and OS theory
  • Need Discrete math (incl. algorythms and combinatorics)

No, you don't need to know any math (except maybe binary/oct/hex/dec representations) for system programming and stuff like that.


Systems programming is not rocket science :-) IMHO, any good programmer can approach system programming. However, one need to know

  • Algorithms (this requires little math, but not too much to scare a good programmer),
  • Data structures, and
  • Some (not all) domain knowledge e.g. OS, Architecture, Compilers.

I think the most sought after qualities would be to write precise code and ability go in depth, if required, in any of the above items.

BTW, this is my personal theory, YMMV; I don't consider myself a good programmer yet! :-(


In my experience the Math requirement for a Computer Science degree exists simply to weed out those who will fail. If you cannot pass Calculus I and II you will most definitely not pass an advanced course on compiler construction, database or operating systems theory.


Discrete math I found very helpful. I took Calculus, and there are some times it might have been very helpful too, but I don't remember any of it. For instance, the time I was trying to implement a DIS interface (which deals with things like rotational velocities and coordinate transformations). I spent a day driving all over town looking for a book to explain quaternions to me (this was pre-WWW). There was also a time I ended up needing to write a facility for some engineers to impliment n-linear interpolation. If you have no clue what that means, believe me I didn't either. Fortuntely, that was post-WWW.

My advice is to not sweat it. You may be hamstrung on a project or two, but not all that badly these days.


As a self taught programmer who started working on games about 30 years ago I would definitely say you need to get as much math as you can. Things like matrices, quaternions, ray tracing, particle systems, physics engines and such do require a good level of math comprehension and I only wish that I had learned all those things much earlier.


To do what you want, you do not have to know math, but you have to like it a lot.


At the university we read the book "Concrete Mathematics" by Knuth, Graham and Patashnik. This is a math book with topics selected for computer science students. Several year later, I checked the book again and noticed that I've used every single topic in the book at least once (with the exception of Stirling numbers).

In most cases knowing some math helps to solve problems with less work, more elegant or to implement faster solutions. It also depends on the kind of work you are doing. I.e. math is more important when you concentrate on algorithms, than when you concentrate on engineering problems.