What Math Subjects Do You Need For Computer Science?

So, you want to know what major math subjects you need to know to be a great computer scientist? Is math even required in learning how to code? Well, that answer is actually a lot more difficult to answer than you might think!

Computer science is a vastly large field that encompasses many different subjects in mathematics. However, if you are new to the field of computer science and want a generalized list of important math subjects in all the major fields, you’ve come to the right place.

Today I am going to break down the main subjects in mathematics that you need to know in these 6 main subdivisions of computer science: General Computing, Algorithms, AI / Machine Learning, Networking, Computer Graphics, and Cryptography / Security.

By the end of this article, you should have a very good, basic understanding of all of these fields and their relation to mathematics. So you can understand what you personally need to know to advance in your computer science pursuit of knowledge.

So without wasting any time, let’s jump right in!

1. Discrete Maths: General Computer Science

First and foremost, we should discuss discrete mathematics. A branch of math that centers around the study of objects that can be represented countable or finitely. This branch of mathematics covers topics such as logic, number theory, counting, probability, recurrences, and graph theory.

You can think of discrete mathematics as theoretical programming. It provides a foundation for essentially every area of computer science and a strong knowledge of discrete maths would translate to a strong understanding of core programming topics.

If you are brand new to programming and want to learn core math topics for computer science, discrete mathematics is the best place to start. It not only sets you up for success as a programmer, it will also help tremendously with your logical thinking and problem solving skills.

Discrete Mathematics with Applications by Susanna S. Epp is a great book that I recommend. It is a straight forward textbook with good explanations. I find it perfect for self-taught programmers that don’t have a ton of mathematics background but want a deep dive into the topic.

2. Logic & Proofs: Algorithms Design

Next on our list of important math topics to know in computer science is the subject of logic and proofs. Logic and proofs are a critical part of algorithm design because when you are creating complex algorithms, there will be times you will need to prove they will never fail.

This may not be the most important aspect of programming to your average web developer but if you’re building something that cannot fail like a medical laser, you better be sure it never fails!

Even if you do want to get into a field where you don’t need to prove your algorithms, logic and proofs are critical for learning algorithms and data structure concepts, such as space-time complexities. Which are critical for getting a good programming job!

Ultimately, logic and proofs develop your critical thinking skills as well as your background in computer science. It is an important skills to learn and it will help you set up your career in computer science.

It is really hard to find a good, entry-level book on proogs because most books (unjustly) assume more advanced mathematics knowledge from their readers. However, I have heard incredibly good things about The Book of Proof by Richard Hammack. The book is a great entry-level approach to proofs from someone that has no prior knowledge and is tailored toward self-study! Better yet, it’s also pretty affordable.

3. Statistics and Probability: AI/Machine Learning

Statistics and Probability are an integral part of machine learning and its subset AI. If you want to be a data scientist or work with ML, you need to have a solid understanding of statistics and probability.

Stats and ML often time use the same techniques but with a different goals. Statistics are used for inference, to check a bunch of assumptions. While machine learning is used for predictions, which is a lot more pragmatic.

Modern-day ML generally involves taking big data and utilizing statistical algorithms to reach an end goal programmatically.

If you are serious about getting into machine learning, there are two books I would recommend reading to get you started. The first is An Introduction to Statistical Learning by Gareth James and the second is Introductory Statistics with Randomization and Simulation by David M Diez.

4. Graph Theory: Networks

Graph theory is a really important topic in computer science. It is a subdivision of math that underlies the entire internet, is used extensively in networking code, and plays an integral role in software such as search engines and social media platforms.

Not only this but almost anything can be modeled as a graph! It is one of those topics that will completely change the way you look at a specific problem and how to solve it.

One key takeaway, however, is that learning graph theory from a math perspective and a computer science perspective can be pretty different. You also don’t need to deep dive into the topic and read an entire textbook on it. The book I recommended above, Discrete Mathematics with Applications by Susanna S. Epp, should be more than sufficient for getting your toes wet with graph theory!

5. Geometry: Computer Graphics

What about if you want to learn about the interesting world of computer graphics? Well, you’re most certainly going to need to know about math for that as well. More specifically, you will need to know about geometry.

A solid basic understanding of linear algebra and trigonometry can be a big boost in your pursuit of learning about computer graphics. Vectors and matrixes are everything in computer graphics. Understanding them will allow most of your work in this field to be much easier to understand.

Even when you start using a framework to build your graphics like OpenGL or DirectX11, you are going to want to have this knowledge.

Luckily, there are many great resources out there to teach you about Geometry. My personal recommendation is Geometric Algebra for Computer Science by Leo Dorst. It is very approachable from a beginner’s perspective and will give you a great foundation on the topic!

6. Number Theory: Cryptography & Security

Finally, I wanted to touch on our sixth and last important math subject in computer science, number theory.

Number theory is an important subset of math used in cryptography, computer security, random number generation, graphics, and hash functions. Since number theory is used in most modern cryptography, a strong knowledge of this mathematical subject is very useful for any work within this field.

In addition to its practical benefits, I find number theory to be a really interesting topic to delve into. It’s amazing how easy some problems are to explain in the field, but incredibly difficult to solve. Here are 10 of them explained in under 6 minutes.

I did a bit of research, and it seems like Elementary Number Theory by Burton is the go-to book for beginners getting into number theory. However be warned, that it can be a bit complex for the average self-taught developer!

Summary

So that about wraps things up. The math subjects you need to know for computer science! As you can see, computer science is a lot more than just programming. Although programming allows us to apply computer science theories in practice, it is really only a tool.

To quote Dijkstra, “Computer science is no more about computers than astronomy is about telescopes”. If you want to be a great computer scientist you need to learn about math! So get out there and start improving your math knowledge.

If you’re a self-taught developer and are looking for ways to improve your skills, here and here are great places to start.

Grant Darling

Grant is a full-stack / frontend software developer passionate about writing & coding. He has many years experience working in the tech industry both as a freelancer and as an employee.

The Code Bytes is all about providing people with honest information about programming. To learn more about Grant, read his about page!

If you’re interested in freelance coding / writing services or want to partner with The Code Bytes, you can get in touch with me here!