Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

For a Computer Science (CS) degree at many colleges and universities, certain math courses are required: Calculus, Linear Algebra, and Discrete Mathematics are few examples.

However, since I've started working in the real world as a software developer, I have yet to truly use some the knowledge I had at once acquired from taking those classes. Discrete Math might be the only exception.

My questions: Should these math classes be required to obtain a computer science degree? Or would they be better served as electives?

I'm challenging even that the certain math classes even help with required CS classes. For example, I never used linear algebra outside of the math class itself. I hear it's used in Computer Graphics, but I never took those classes-- yet linear algebra was required for a CS degree. I personally think it could be better served as an elective rather than requirement because it's more specific to a branch of CS rather than general CS.

From a Slashdot post CS Profs Debate Role of Math In CS Education:

'For too long, we have taught computer science as an academic discipline (as though all of our students will go on to get PhDs and then become CS faculty members) even though for most of us, our students are overwhelmingly seeking careers in which they apply computer science.'

share|improve this question

closed as primarily opinion-based by Martijn Pieters, ChrisF Mar 10 '14 at 8:52

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.

Don't forget it's called "computer science". In theory, this is preparing you do to science, not just programming. Computer science undoubtedly requires lots of math. As you probably noticed, college isn't required to simply learn how to program. –  Ken Sep 15 '10 at 13:15
I agree with Ken. For example: Algorithm subjects are obviously programming related. In those subjects I needed statistics (e.g. randomized algorithms). For that I needed calculus. It is not required to be a programmer, but it is useful if you want to become a computer scientist. –  Matthijs Wessels Sep 23 '10 at 10:44
"Computer science is no more about computers than astronomy is about telescopes." Edsger W. Dijkstra –  bluebill Mar 13 '11 at 14:49
I think you are confusing computer science with programming. If all you want to do is coding, you do not need a computer science degree. –  Giorgio Jun 16 '13 at 14:07
@Izkata: Of course, knowing Computer Science does make you a better coder. What I meant is that Computer Science is not about learning the latest programming language and web framework so that you can find a job as soon as you are out of college, even though this is what the industry would like it to be. –  Giorgio Jun 17 '13 at 5:03

23 Answers 23

There is a math ceiling. If you can't get math, you will never move into the really sophisticated areas in computer science beyond the math ceiling.

Most basic business programming is under the math ceiling, however.

If someone wants to be all they can be, they will have taken the math courses( Linear, Calc 1, Discrete, and Calc 2). And, as a corollary, a university should provide the theoretical foundation, and thus require the math courses.

As a note, one problem at work(yes real professional work. :P) is mathematical and reducible to 3SAT, and I am putzing around with figuring out how to solve it in a practical fashion.

share|improve this answer
I would personally add a probability/statistics course to that list. –  Tikhon Jelvis Apr 20 '11 at 8:56

As far as Computer Science is concerned- yes, they are relevant, regardless of what you will end up researching. It's kind of like studying Assembly in a Software Engineering degree. Will you necessarily use it? No. Should you be familiar with it? Absolutely.

As far as software engineering is concerned- discrete mathematics are important: the logical world view of a lot of the practical programming and software construction topics draw from set theory. Just look at the whole class hierarchy thing in Object Oriented Programming. Combinatorics also show up a lot. How much bits do you need to represent your data? Depends on how many options there are.

Linear Algebra has the concepts of modulo arithmetic, which pops up a lot in programming, and relations, which again are deeply nested in the logical world view of some programming topics (for example- equivalence classes in software testing, or database querying). Also, a strong algebraic "muscle" in your head is definitely important in practice, because Algebra inevitably pops up. Just calculating run time complexity is enough for that to be true.

Calculus, as others mentioned, is very useful for 3D stuff.

Do these courses teach you above and beyond? Sure. Can you learn this stuff ad-hoc? Maybe. But when you need to train yourself for a specific physical task, do you only train the specific muscles that are involved, or do you also train the muscles around them and that are connected to them? Even without the above, just the shift in the way you solve problems that these classes will cause in you is worth taking them.

Also, you may be interesting in knowing that there are many companies, Blizzard for example, that list "excellent math skills" in their jobs listings.

share|improve this answer
@Casebash: Not really. Sorry. Linear algebra and calculus are the most basic 'advanced' math class offered. –  Paul Nathan Sep 13 '10 at 16:41
Modular arithmetic is taught in abstract algebra (group theory), not linear algebra. –  kevin cline Sep 27 '11 at 17:07

These classes should be required. For computer scientists, they are the building blocks of the field. For software engineers, they help to form an understanding of the science that is the basis for your engineering discipline.

Just a few examples from fields of mathematics that you named:

  • Discrete mathematics is probably themost useful form of mathematics forany software engineer or computer science. This includes logic, set theory, and graph theory. These come up again and again. Logic - every time you use an if statement. Graph theory can be used to describe networks and complex systems.

  • Calculus shows up in a number of fields of computer science - computational geometry, computational physics, and statistics (which leads into data mining, artificial intelligence, machine learning, and natural language processing).

However, you say that you haven't used the knowledge you learned in these classes. That's probably because as a developer, you are using more software engineering knowledge than computer science knowledge. Computer science isn't programming - in fact, most of what computer science entails should be described mathematically or in some other programming language-agnostic method.

share|improve this answer

There are many, many, programming jobs that don't need more then basic business math. If that's the kind of job that you know you want, and you are willing to lock yourself into that sort of work, then the math requirements for a good CS degree do look like overkill. But the CS degree itself is probably wild overkill for those jobs, so why just complain about the math?

Computer science is a big field. Most students have no idea what kind of programming they are going to like, or what sub-field they are going to end up working in. In fact, the type of programming job you do is almost certainly going to change over the course your career. One of the goals of a good CS program should be to expose you to a variety of subjects, so that as you need to switch fields over the course of your career you'll at least have been exposed to the basics. Linear algebra and calculus are needed as a background to in several of those subjects. You may end up not being interested in any of the subjects that requires the math, but you can't really know that until you've tried them. Maybe you'll find out that you have an undying love for speech recognition or, god forbid, financial engineering.

share|improve this answer
"But the CS degree itself is probably wild overkill for those jobs, so why just complain about the math?" Exactly. –  Zaphod42 Mar 12 '11 at 21:42

The problem is what classes would be useful?

Vector and matrix arithmetic and trigonometry are really useful if you are doing any graphical work - particularly 3D graphics.

Percentages, compound interest etc. would be useful for accountancy and financial software.

and so on.

There wouldn't be enough time to cover anything but the basics in these. Now while the basics might be useful the phrase "a little learning is a dangerous thing" springs to mind. If you know something about the maths behind a new field you might be tempted to steam right in rather than doing more research and getting yourself up to speed before you start.

share|improve this answer
  • Do you not see De Morgan's law everytime you turn if (!(a || b)) { /* ... */ } into if (!a && !b) { /* ... */ }
  • Do you not see set theory everytime you write a table join.
  • Do you not see the striking similarities between int[3,3] and an 3x3 matrix?
  • Do you choose an O(n) algorithm over an O(n^2) algorithm for 0 < n < 1?

There's many other examples, and these might seem contrived, but I suspect that most programmers take for granted the math that they know without ever even realizing it. So much so that most people here would probably agree that these are part of 'the basics' of progrmaming. Ask these questions of a layperson however and you'll be surprised with the answers you get.

So to answer your question: Yes.

share|improve this answer
Looks like it should have been 0<n<1. Sadly, I haven't the points to edit answers. Yeah, those algorithms that work best when you have half an item are just fantastic! –  DarenW Dec 6 '10 at 22:51
@SnOrfus: Last time I checked asymptotic notation only works for large values of n. So I have absolutely no idea what any of you guys are talking about. The only time it is used for small values is in approximations like Taylor series and it is completely unrelated to complexity bounds. –  davidk01 Mar 17 '11 at 0:20

Personally I believe that far more math should be required. But then I'm tired of dealing with people who can't figure out the order of operations in simple algebra or set theory or basic statistics or why they can't divide by 0 and I want them eliminated from my profession before they get get a chance to mess up someone's code base. Math courses also teach abstraction and logic and those are critical skills in programming. If you can't hack upper level math, you don't belong in the profession except at the lowest levels and why would you want to spend the money to get a degree if you intend to stay at the lowest levels?

share|improve this answer

I think that many computer science educations are formed with scientific computing in consideration. That is good, but some times I think it would be good to also take in consideration that many of the computer science jobs in the industry is about line of business applications that are more database driven.

share|improve this answer
If the jobs are in the line of business applications then they are not computer science jobs. –  Carlos Muñoz Sep 12 '10 at 21:35
Odd, at my university, "scientific computing" refers to the sort of thing physicists and mechanical engineers do with Matlab rather than actual CS. There is even a "Computational Engineering Science" major that is completely separate from CS (although they are thinking of getting rid of it). –  Tikhon Jelvis Apr 20 '11 at 9:00

Algebra is a MUST for anybody going into CS. You need to have rock-solid algebra, and should probably be very comfortable with basic mathematics. Enjoying math certainly doesn't hurt when you're reading code all day. The idea of order of operations needs to be understood on a completely fundamental level.

Propositional logic IS Computer Science. Strong logic is a MUST.

As some people have said, thats really all you "have" to know for CS. You could learn basic programming from there, and go on to design website code and work on UI and all sorts of things like that. However, you're going to be very limited.

After that, different areas require different skills. Very quickly you're going to need a very solid understanding of pretty heady math.

Any sort of graphics programming is going to require you to be AMAZING at trigonometry, geometry, vectors, matrices and working in 3D space. Calculus would likely be useful.

CS Research or Scientific Computing / Programming is going to require a very solid understanding of Statistic, Calculus, Physics, and DiffEq.

Anything beyond Calc 2 or DiffEq is unlikely to be useful in CS.

Here's the thing, the way I see it. You don't need Calc 2 to be able to learn enough CS to program a Hello World. With a solid graphics API, you could even get away with coding asteroids or a chat program. But your understanding of what that API is doing is going to be limited. More importantly, though, is that CS != programming. There's more to CS. On the one hand, you could get by without being good at math if you were really good at the other parts of CS: lateral thinking, software design and objects and things like that.

However: If you're not good at math, its likely because you don't like math. If you like math, then just go study it some more, learn it, and you'll enjoy it, so you'll just get better and better. It seems to me most of the people who aren't good at math must be a subset of those who don't like math. And while not knowing advanced math may not be a problem, if you don't like math, odds are you aren't going to enjoy computer science. They're very similar. Complex abstract logic, formulas, functions, numbers, etc. Its indicative that you probably shouldn't be doing this. I think a good understanding of math would be helpful to programming in an abstract way too; seeing an axiomatic system of mathematics taken to such a high level of proofs helps you visualize complicated systems later on.

If you want to be a programmer, you don't need math, but it helps situationally.

If you want to be a Computer Scientist, you absolutely need math.

Colleges teach to academics, so they should absolutely require math. Colleges also require a general education; I assure you my Texas History courses never helped in my CS work at all. If anything, math is a million times more relevant than other core classes.

That said, I'm sure you can learn programming at night school or community college without being forced to take math. Its just if you want a Computer Science Degree. And a computer science degree implies that you know how to handle complex functions.

share|improve this answer
I completed a graduate program in computer science without ever using calculus. The two big advanced areas of mathematics that are used in a computer science research are discrete math/combinatorics and abstract algebra. I have yet to read a CS research paper in which integration and differentiation were used. –  bit-twiddler Mar 13 '11 at 7:47
+10000 if I really could. The most practical answer I read. ---->If you want to be a programmer, you don't need math, but it helps based on the situation. but if you want to be a Computer Scientist, you absolutely need math. –  Karthik Sreenivasan Jan 27 '12 at 7:29

I took weightlifting, swimming, and tennis classes in college. I have yet to use any of those skills in my job.

The brain is a muscle and like all other muscles it needs to be exercised regularly and in different ways to keep it healthy. Math is mental weightlifting for the brain.

share|improve this answer
How can I resist? theonion.com/articles/… –  user16764 Mar 13 '11 at 1:47

I hold undergraduate and graduate degrees in computer science (CompSci). I think that engineering Calc I and Calc II were a complete waste of time. CompSci graduates would be better served by taking a one-semester elementary Calc course and using the extra three semesters to take an abstract algebra course, as the two most important areas of mathematics that a computer scientist should learn are discrete mathematics and abstract algebra. A computer scientist is more likely to be involved in the development of cryptographic or coding algorithms than he/she is to work with differentiation or integration. All computer scientists should master number theory as undergraduates. Yet, most receive a ten thousand foot view of this critical area of mathematics.

share|improve this answer

A lot of the math requirements on modern CS degrees are holdovers from the days when CS was just a branch of mathematics. You didn't take Calc 345 because your CS degree required it- you took CS 234 because your Calc degree allowed it.

As the field evolves, I expect you'll see fewer and fewer math requirements for CS degrees. That said, there are a few that are directly useful:

  • Calculus and related courses can be useful in physics-related programming (eg, game engines).
  • Discrete math is pretty important to algorithm creation.
  • Graph theory is hella important to any algorithm that deals with graph traversal (obviously)
share|improve this answer
If that happens (fewer math requirements), then people with serious problems will just stop interviewing pure CS graduates and start hiring math majors with a CS minor. –  kevin cline Sep 27 '11 at 17:33

After reading all of the posts here, and combining it with what I already knew, these are my thoughts on how math should be taught and required for CS:


  1. Some math is useful, how much depends on what you are going to do.
  2. Math as it is taught for CS is backwards.
  3. Of existing math courses, discrete math is by far the most useful.

Regarding 3, note that practically every relationship between math and CS mentioned by everyone here is actually discrete math, including---graph theory, basic number theory, sets and logic, algorithm complexity. This is all introduced in a discrete math class!

Regarding 2, see how many responses/experiences support it.

Regarding 1, let's assume that you do want a CS degree, you're not just learning to program, but at the same time you don't plan on being an academic or research scientist. Let's assume that some math is reasonable, but not too theoretical: imo, even relatively applications-oriented math can be more theoretical than necessary (sometimes).

More Notes

  1. Some calculus is probably useful, calculus is a building block of any scientific education, so introductory calculus is a reasonable requirement.

  2. There exist already "math for computer science" classes.

  3. I am currently taking discrete math, and by the time we finish, it won't have covered enough of the discrete structures (eg graphs and trees) supposedly useful in CS.


There should be a 'math for computer science' class. One possibility is that it could be eclectic and largely introduce concepts: it could cover bits of calculus and linear algebra (like vectors and matrices) as well as probability and anything else with known and common applications. This plus calculus plus a two-course sequence in discrete math would be more than adequate for a CS degree. Note that Discrete Mathematics is pretty much a catch-all for not continuous, all it refers to a distinction between discrete vs continuous, and is very broad. Optional courses could be diff eq/linear algebra or abstract algebra or computing theory.

share|improve this answer

True Computer Science is about developing theory/concepts/approaches/algorithms/etc. Software Engineering on the other hand tends to lean more toward implementing these things. There are people who are hired not to be software engineers but to be computer scientists. Their job is to research discover and create... then the software engineers implement. Do do a computer scientists job often MORE math than what is required for the degree is needed. Many mathematicians are hired to fill computer scientists roles because of the huge amount of overlap in their fields. That being said, even in the software engineering field it'll be the math (depending on the situation/environment you're working in) that really lead to you being able to develop great new software.

share|improve this answer

I would not put them as required. Math knowledge helps greatly for some specific programming issues. However, these math classes usually go way overboard on math theory.

They have their place, but I would keep them as electives.

share|improve this answer
Discrete Math I found to be useful to the CS degree in general. I can understand how that would be a good requirement. But Calculus and Linear Algebra I think is more specific to a CS class (example Computer Graphics or AI), which I think it fits better as an elective. –  spong Sep 1 '10 at 22:33

Math is taught completely backwards in the university. My math teachers used to tell me I will not be able to write anything without math, theorems and stuff. In reality, in everyday job, I need zero math. (Ok, De Morgan's Law doesn't count). And we had around 50% of the course based on math, united with math students.

This is so damn wrong I can't even describe.

At the same time, I used to love developing rendering engines, and I actually learned analytic geometry and linear algebra whole year earlier than it was taught, and when actual courses stared, it seemed very simple and easy to grasp. Although, every solution professors gave, seemed to be wrong, complex, overly academical and approached from wrong direction.

So my point is:

  • Learning math has given me little in terms of computer science
  • Learning computer science has given me a lot in terms of math
share|improve this answer

Computer science is a branch of mathematics. These mathematical topics are fundamental to the study of computer science. If you don't want to study computer science, but just want to get a job as a programmer, choose a different program. Attend a two-year program and get an Associate's Degree in Information Technology. There are many employers that just want coders, but some do expect developers to know and apply computer science theory to practical problems.

share|improve this answer

As a physicist who does scientific computing, I would say that math comes in quite handy- you can't do that kind of programming without having taken courses in linear algebra and differential equations (it is assumed that you've gone through a calculus sequence, e.g. calc I - IV, or something similar, depending on where you went to school). You could probably write, say, code for numerical solutions to a nasty partial differential equation, or perhaps code that solves a large system of equations using LU factorization without having had the mathematics first, but it would probably be much more difficult to do. Haven't yet coded much outside of physics/astronomy stuff, but it sounds like it is indeed possible to get by without the math in a lot of areas of programming/developing.

share|improve this answer

Consider these points:

  1. The math knowledge is extreamly important for a programmer. Once your code brings you to a deadend, and nothing else will work, your math knowledge will make your program work again.
  2. Most of the stuff in programming languages are possible because of math
  3. But you SHOULD NOT use advanced math anywhere. Next person who needs to create the same thing you did 10 or 20 years ago will fail if your solution uses some advanced math. Then the world will have problems since existing stuff that is everywhere will no longer be available.
  4. Knowledge of math is essential, but using it should be reserved only for difficult problems which prevents your product to work at all.
  5. Good pattern is to make your product work first and once it works, never again use math in it.
share|improve this answer

Those classes aren't meant to be useful in your day to day programming life. They are meant to teach you abstractions and how to make use of abstractions and mathematics is currently the best discipline for doing so.

share|improve this answer

In my experience, linear algebra and discrete mathematics are important elements of computer science, and should be required courses.

I don't see the need for calculus. Except that two course in it is "typically" (and wrongly, in my opinion) considered a prerequisite for the other two.

share|improve this answer
Calculus is the fundamental tool for modelling continuous processes. Maybe you don't use it, but there are many programming problems where a knowledge of calculus is quite handy. –  kevin cline Sep 27 '11 at 17:30
possessing a computer science degree should mean that a person has facility with basic computer science theory. Much of algorithmic analysis rests on calculus. If you can't do calculus, you may be a programmer, but you are not a computer scientist. –  kevin cline Sep 28 '11 at 1:02

Math teaches you logical reasoning and problem-solving skills, skills that can be transferred to any domain of work. I think Algebra+Geometry+Trigonometry+Calculus are absolutely fundamental, and physics is great too. That is IF you want to work anywhere you choose and on anything you prefer. The broader your knowledge, the more you can do. Math is far more complicated than programming, but the logic and reasoning from it will make you a better problem solver. The essence of CS is not can I write a lot of code, it's can I analyze requirements/problem and implement a solution that addresses those needs.

This is why I started focusing on problem solving (rather than just programming) a ways back. I realized what math would give me.

share|improve this answer

I vote no, absolutely not. Outside of a research position or scientific application it is absolutely unnecessary. There is very little math involved when programming at the application layer and with higher level programming languages. If you plan to take an IT position within a corporation and never plan on let's say working for NASA or doing research (theoretical work), much of the math that's taught is absolutely unnecessary. But god only knows what type of research outside of cryptography would require such math as far as real world programming is concerned.

I swear all math teachers believe students will go on to develop CAS systems or become master cryptographers. I've heard math teachers ramble on about udder absurdities when trying to discuss what it is they think programmers actually do, of course they're not programmers, but you'd be amazed at how many math teachers think they know what it is they're talking about. So much so to the point that you now have math teachers, who don't know how to program, trying to tell programmers how much math is going to be involved in their job as a programmer... this is absolutely absurd. I swear they're just desperately trying to justify their existence in a world that is finding less and less use for them. That is, in an age were computers do all our calculations and calculations by hand are inefficient and largely unnecessary. Leibniz himself made it very clear that if he did have such a machine in his day, he would have delegated the task of calculation to someone else, because the task of calculation becomes arbitrary when the machine is used (such as a computer).

I thoroughly blame Hollywood for a lot of this bullsh!t... I swear everyone now thinks programmers have literally 'Rainman' like memorization and math abilities and they have all these complicated algorithms memorized in their heads (like Hugh Jackman in the movie Swordfish) and can spew them out without ever consorting any kind of documentation at all... complete insanity! And it's getting more blown out of proportion as the years go by!... More and more people think programmers are these geniuses and that's just nonsense. It's a skill that can be taught like any other and it is no more astonishing than the skills an automotive repairman possesses.

Another misconception, is the assumption that new developers have to rewrite the wheel, these ideas are absurdities. With all the myriad of function libraries available in modern programming languages, it is absurd to even consider rewriting these functions at all. Lest you spend your entire life replicating the work of many groups of developers who did spend their entire lives to create said functions, so you can have these vast function libraries... hello!

Another thing I noticed is that there are special interest groups who desire or need programmers with more math abilities for research, whether it be aerospace or other industry application. But you know, many of these types of positions don't pay much more than let's say working as a corporate IT developer or in IT Sec, but are much more difficult line of work. I'd prefer the gentleman's club atmosphere than the industrial coding farm type labor, but to each his own and where ever their paths may lead them. And I may have a 'wild man in the wing' philosophy here, but I know that I will never need to use calculus or much of discrete math ever again in the real world. And I think that even most hackers (ethical or otherwise) would agree with these views, I mean they surely understand the large discrepancies between theoretical and practical knowledge, after all that's what allows them to outsmart their competition and achieve success in their field.

share|improve this answer
This is little more than a (verbose) rant. Do you have anything to back up your personal opinion at al? –  Martijn Pieters Mar 10 '14 at 7:49

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