Math for computer science

LoLzMan picture LoLzMan · Feb 14, 2013 · Viewed 78.3k times · Source

I have read several answers on this topic , but I still have questions.. There are plenty of math courses, and I don't know which one to take first. Which math classes should every computer scientist take? And what class should be first one and why?

Answer

Andrew Mao picture Andrew Mao · Feb 14, 2013

Very good and important question! A good understanding of math is essential for every computer scientist, and the math requirement is starting to become more diverse.

  • Discrete Math is the most important and basic class for computer science, and for this reason it is usually offered in CS departments instead of math departments. This class will underpin your intro to algorithms to class and teach you how to prove things mathematically and give you the fundamentals for analyzing data structures and algorithms.
  • Calculus, while not directly used in intro-level computer science classes, is generally a sequence of courses offered by your university to buff up your math skills. As you start getting into things like numerical programming and machine learning, though, it will prove immensely useful. It's also a requirement for advanced probability/statistics courses.
  • Probability is usually covered in some extent in your discrete math class, but you'll want to take a class on continuous probability distributions and statistical inference, probably in the math and statistics department. This will give you a better understanding of how to do numerical computation and simulation, and is fundamentally necessary for machine learning, one of the most important applications of computer science.
  • Linear Algebra is a class that you will find primarily useful for machine learning and (advanced) algorithms classes, but its importance in computer vision, computer graphics, machine learning, and other quantitative sub-disciplines is paramount.

That said, if an intro to machine learning class is available, they will probably cover enough linear algebra and other stuff that you can get by with a basic probability class. However, for graduate study in computer science, a good understanding of all areas of math above is essential.

Beyond undergraduate math, higher-level math courses are useful for certain theoretical areas of computer science (e.g. algorithmic game theory, which intersects with economics) and especially in going beyond being a machine learning practitioner to developing new algorithms. These courses include:

  • Real analysis, including measure theory where you'll find that if you study probability and calculus for long enough, they converge again. Analysis is generally a useful thing to know when you start working with algorithms involving numbers.

  • Optimization, including linear optimization, convex optimization, gradient descent, and so on. In many cases, "learning" a machine learning model basically boils down to optimizing an objective function, and properties of this function such as whether it is convex have a big impact on how easy it is to optimize.

  • Numerical methods: some wouldn't consider this a math class per se, but in translating algorithms and theory into the imperfect representation of floating-point math, there are many practical problems to be solved. For example, the log-sum-exp trick.

  • For those who will be in "data science" and related fields, advanced statistics and especially causal inference are very important. There are a lot of things to know, mostly because having access to a lot of data tempts this problem for the uninitiated.