## 34 Replies - 3154 Views - Last Post: 13 October 2016 - 07:42 PM

### #1

# Is there a lot of math in CS classes?

Posted 23 July 2016 - 02:32 PM

I taking prerequisites right now in order to transfer into a CS program. I watched a video on CS classes, and someone said there is a lot of math in CS classes. Is it really true? If it is, how much math are we talking about? Just a little? Complete classes on the level of Calculus 1-3?

##
**Replies To:** Is there a lot of math in CS classes?

### #2

## Re: Is there a lot of math in CS classes?

Posted 23 July 2016 - 03:13 PM

There is a lot of math in computer science! Above and beyond Calc 1-3, you'll end up taking a discrete math class and a linear algebra class. These tools come up in your algorithms coursework, artificial intelligence, machine learning, and cyrptography. There are folks that also take the bare minimum for math and focus on areas like security or software engineering. The best computer science students are those who embrace the math, though.

Our Math resource thread is a good starting point, as is our Computer Science tutorials section.

Some other resources:

Why math is important for programmers

Which math courses you should take

An answer I posted on Mathexchange about the importance of linear algebra in computer science:

Our Math resource thread is a good starting point, as is our Computer Science tutorials section.

Some other resources:

Why math is important for programmers

Which math courses you should take

An answer I posted on Mathexchange about the importance of linear algebra in computer science:

Quote

Linear algebra is immensely useful in a wide variety of areas. I'll list a few:

Discrete Geometry: Polyhedral theory, in particular, is an application of linear algebra and a beautiful theoretical discipline in its own right. One application of polyhedral theory is to optimization. If you have a mathematical program and the constraints are linear, then they form a polytope. Linear programming (when you are dealing with continuous variables) is computationally easy to solve. Mixed Integer-Linear Programming is NP-Hard, but common approaches to solve MILPs efficiently utilize cutting plane algorithms (more linear algebra).

Stochastic Processes: The applications of statistical and probability theory are as numerous as those of linear algebra. And nearly all of the sophisticated techniques require linear algebra. I will mention a few here: machine learning and data science, econometrics, and mathematical finance, random walks on graphs.

Differential Equations: I believe this has already been mentioned.

Algebraic Combinatorics: In particular, linear algebra is useful when dealing with generating functions. Laszlo Babai, the famous complexity theorist, also has a manuscript called The Linear Algebra Method which you can order from the University of Chicago. His manuscript includes numerous applications to theoretical computer science and discrete geometry.

Automata Theory: There is a linear algebra-esque algorithm to convert a DFA to a regular expression, known as the Brzozowski Algebraic Method. This algorithm is closely related to the notion of a walk on a graph (exponentiating the adjacency matrix) and using matrices to solve recurrences with generating functions.

Graph Theory: Spectral graph theory is a beautiful and active area of research. Vector spaces of graphs are also quite useful. By the way- the max-flow min-cut theorem from graph theory follows from the fact that the max-flow and min-cut problems are dual in the linear programming sense.

Algorithm Design: Are you familiar with Matroids? Various structures that satisfy a generalized notion of linear independence are susceptible to greedy algorithms. Spanning tree algorithms are one such example of greedy-basis (Matroid) algorithms. Another (non-Matroid) example is an almost completely derandomized parallel bipartite perfect matching algorithm. This is a recent result which one of my professors recently published.

As a computer scientist, you should very much care about linear algebra. In fact, I would encourage taking the proofs-based vector spaces version. If you have to choose between the proofs-based version and a numerical version, take the proofs-based version. It will pay off more in the long run. It is also very different from what you have covered in Calc 3.

Discrete Geometry: Polyhedral theory, in particular, is an application of linear algebra and a beautiful theoretical discipline in its own right. One application of polyhedral theory is to optimization. If you have a mathematical program and the constraints are linear, then they form a polytope. Linear programming (when you are dealing with continuous variables) is computationally easy to solve. Mixed Integer-Linear Programming is NP-Hard, but common approaches to solve MILPs efficiently utilize cutting plane algorithms (more linear algebra).

Stochastic Processes: The applications of statistical and probability theory are as numerous as those of linear algebra. And nearly all of the sophisticated techniques require linear algebra. I will mention a few here: machine learning and data science, econometrics, and mathematical finance, random walks on graphs.

Differential Equations: I believe this has already been mentioned.

Algebraic Combinatorics: In particular, linear algebra is useful when dealing with generating functions. Laszlo Babai, the famous complexity theorist, also has a manuscript called The Linear Algebra Method which you can order from the University of Chicago. His manuscript includes numerous applications to theoretical computer science and discrete geometry.

Automata Theory: There is a linear algebra-esque algorithm to convert a DFA to a regular expression, known as the Brzozowski Algebraic Method. This algorithm is closely related to the notion of a walk on a graph (exponentiating the adjacency matrix) and using matrices to solve recurrences with generating functions.

Graph Theory: Spectral graph theory is a beautiful and active area of research. Vector spaces of graphs are also quite useful. By the way- the max-flow min-cut theorem from graph theory follows from the fact that the max-flow and min-cut problems are dual in the linear programming sense.

Algorithm Design: Are you familiar with Matroids? Various structures that satisfy a generalized notion of linear independence are susceptible to greedy algorithms. Spanning tree algorithms are one such example of greedy-basis (Matroid) algorithms. Another (non-Matroid) example is an almost completely derandomized parallel bipartite perfect matching algorithm. This is a recent result which one of my professors recently published.

As a computer scientist, you should very much care about linear algebra. In fact, I would encourage taking the proofs-based vector spaces version. If you have to choose between the proofs-based version and a numerical version, take the proofs-based version. It will pay off more in the long run. It is also very different from what you have covered in Calc 3.

### #3

## Re: Is there a lot of math in CS classes?

Posted 23 July 2016 - 04:54 PM

You sent me the following PM, which I read again and want to respond to it publicly.

Computer science is a branch of mathematics, really. Folks in areas that I mentioned above like theory, machine learning, and AI might be doing more of what you would recognize as pure mathematics. Scientific computing also falls within both math and CS departments. The line you want to draw of CS vs. mathematics seems arbitrary and rather pointless to me.

I'm also unsure why you would be asking a question if you're not going to bother investigating the answers.

Quote

Hi

Thanks for your help by responding to my thread. I do not have time to read the links you posted. Can you just tell me how much time in CS classes is solely devoted to high-level math? I am not taking about any classes outside of CS, such as Calculus or Linear Algebra.

Thanks!

Thanks for your help by responding to my thread. I do not have time to read the links you posted. Can you just tell me how much time in CS classes is solely devoted to high-level math? I am not taking about any classes outside of CS, such as Calculus or Linear Algebra.

Thanks!

Computer science is a branch of mathematics, really. Folks in areas that I mentioned above like theory, machine learning, and AI might be doing more of what you would recognize as pure mathematics. Scientific computing also falls within both math and CS departments. The line you want to draw of CS vs. mathematics seems arbitrary and rather pointless to me.

I'm also unsure why you would be asking a question if you're not going to bother investigating the answers.

### #4

## Re: Is there a lot of math in CS classes?

Posted 23 July 2016 - 05:14 PM

Thanks. I think you answered my question. I want to go more into software development.

### #5

## Re: Is there a lot of math in CS classes?

Posted 23 July 2016 - 07:05 PM

### #6

## Re: Is there a lot of math in CS classes?

Posted 24 July 2016 - 11:45 AM

Programming is math, just not dealing with numbers as you would think, takes some time to come to that conclusion.

Database design, sql queries, and algorithm design are math entities that you will deal with as a developer, as well as research and learning on the fly. If this is the path you want to take, get use to it, there are no shortcuts if you actually want to be good.

Database design, sql queries, and algorithm design are math entities that you will deal with as a developer, as well as research and learning on the fly. If this is the path you want to take, get use to it, there are no shortcuts if you actually want to be good.

### #7

## Re: Is there a lot of math in CS classes?

Posted 24 July 2016 - 11:59 AM

Most people think of math as "calculating a numerical result". This is what I would call arithmetic - it uses math, and in a sense it's a way of doing math, but it's not what math is. Math as I mean it (and as astonecipher means it) is the practice of concrete reasoning about rigidly defined abstract entities. Which, if you think about it, is exactly what programming is all about.

### #8

## Re: Is there a lot of math in CS classes?

Posted 24 July 2016 - 12:06 PM

### #9

## Re: Is there a lot of math in CS classes?

Posted 24 July 2016 - 12:49 PM

Thanks for all of your insight. Keith Devlin said that math is the science of patterns and modeling. I think you are all thinking of math in this way. When I talk about it, I am thinking that you are going to be doing all sorts of long calculus to get code running, which does not seem to be the case, except for some of those specific fields some of you talked about. I feel better now, and I definitely learned what the person in this video said that CS has a lot of math: https://www.youtube....h?v=80ga2twoIyU I just looked into some more of his videos. He apparently has AS.

### #10

## Re: Is there a lot of math in CS classes?

Posted 24 July 2016 - 01:01 PM

Upper level math is predominantly proofs-based and abstract. I do very little number crunching nowadays.

### #11

## Re: Is there a lot of math in CS classes?

Posted 24 July 2016 - 01:30 PM

NostraHistoria, on 24 July 2016 - 02:49 PM, said:

When I talk about it, I am thinking that you are going to be doing all sorts of long calculus to get code running, which does not seem to be the case, except for some of those specific fields some of you talked about.

No, you will not be doing that. In some fields, you might be asking the computer to do all sorts of calculus - though linear algebra is more likely - but you will rarely do this yourself.

You will do some calculus if you get into stuff like advanced algorithmic analysis, but don't worry too much about that.

### #12

## Re: Is there a lot of math in CS classes?

Posted 06 October 2016 - 04:37 PM

Consider all calculus and linear algebra pre-requite. After that CS is a fair amount of discrete math, big O analsis, and maybe some proofs. It is not as much math as other Engineering fields like EE or CE where you take a fire hose to the face.

This post has been edited by **jjl**: 06 October 2016 - 04:38 PM

### #13

## Re: Is there a lot of math in CS classes?

Posted 12 October 2016 - 06:18 PM

You can have a long software engineering career and hardly do anything strictly mathematical beyond basic math. There are huge areas of software development that will involve nothing more than that. It's really logic, it seems to me, not math, though some folks might consider logic a subset of math I guess.

That's been pretty much my experience. However, there have been times when I wish had more math skills. I very much prefer to implement my own tools, but in a few places have bogged down because it was a little heavy mathematically (in some cases maybe not to do, but to do in the highly optimized way necessary for real world use.)

One such was public key cryptography. It's not too hard to come up with a public cryptography algorithm. But to do one that's really fast is challenging. I couldn't afford from a business perspective to make it into to a thesis length project, so I had to suck it up and use the built in Windows secure channel stuff. I do understand it a LOT better having implemented it, however naively. But had I been a bit more skilled on the math side I could have probably actually done it myself in a reasonable time frame.

3D graphics is sort of the same for me. It's something I always had an interest in. But due to the effort required to master the math, I never had time to really get into it. There again, I could do a naive implementation, but not something polished and optimized for real world use, not in the sort of time I have available.

It would likely be similar in a number of interesting fields that aren't in and of themselves math for the sake of math, like voice recognition, encryption in general, AI, audio processing, graphics processing, virtual reality. In those areas, despite my formidable coding skills, I'd be limited to a user of tools, not a maker of them.

That's been pretty much my experience. However, there have been times when I wish had more math skills. I very much prefer to implement my own tools, but in a few places have bogged down because it was a little heavy mathematically (in some cases maybe not to do, but to do in the highly optimized way necessary for real world use.)

One such was public key cryptography. It's not too hard to come up with a public cryptography algorithm. But to do one that's really fast is challenging. I couldn't afford from a business perspective to make it into to a thesis length project, so I had to suck it up and use the built in Windows secure channel stuff. I do understand it a LOT better having implemented it, however naively. But had I been a bit more skilled on the math side I could have probably actually done it myself in a reasonable time frame.

3D graphics is sort of the same for me. It's something I always had an interest in. But due to the effort required to master the math, I never had time to really get into it. There again, I could do a naive implementation, but not something polished and optimized for real world use, not in the sort of time I have available.

It would likely be similar in a number of interesting fields that aren't in and of themselves math for the sake of math, like voice recognition, encryption in general, AI, audio processing, graphics processing, virtual reality. In those areas, despite my formidable coding skills, I'd be limited to a user of tools, not a maker of them.

### #14

## Re: Is there a lot of math in CS classes?

Posted 12 October 2016 - 07:24 PM

Quote

One such was public key cryptography. It's not too hard to come up with a public cryptography algorithm. But to do one that's really fast is challenging. I couldn't afford from a business perspective to make it into to a thesis length project, so I had to suck it up and use the built in Windows secure channel stuff. I do understand it a LOT better having implemented it, however naively. But had I been a bit more skilled on the math side I could have probably actually done it myself in a reasonable time frame

Just to comment- you should never implement your own security and cryptography tools for more than academic/personal purposes. The existing tools are written by teams of experts with a lot more experience in both the math and secure implementation than the vast majority of us have.

Quote

You can have a long software engineering career and hardly do anything strictly mathematical beyond basic math. There are huge areas of software development that will involve nothing more than that. It's really logic, it seems to me, not math, though some folks might consider logic a subset of math I guess.

Logic is a branch of math. The type of creative problem solving and structured design involved with programming is the same rigorous thought process used in higher level mathematics courses (i.e., proofs based courses). The training and axiomatic approach in these courses is quite useful in gathering requirements, designing systems, developing efficient algorithms, and debugging (especially with integrated components).

### #15

## Re: Is there a lot of math in CS classes?

Posted 12 October 2016 - 10:23 PM

macosxnerd101, on 12 October 2016 - 09:24 PM, said:

Just to comment- you should never implement your own security and cryptography tools for more than academic/personal purposes. The existing tools are written by teams of experts with a lot more experience in both the math and secure implementation than the vast majority of us have.

If I can't understand it well enough to implement it, I really don't assume I'm any safer using someone else's implementation. If I understand it well enough to implement it, then I feel a lot better. I mean, years of expert involvement didn't prevent one of the biggest bugs in network history in OpenSSL.

For most of these encryption algorithms, particularly the symmetrical ones, well known examples are published and they are not particularly complex, so it's not a stretch for a skilled developer to create a version of them that is fully integrated into their own frameworks, and that they know exactly the inner workings of. Leaving aside cryptographic errors, just to insure that there are not errors of the more mundane sort that could cause havoc in a highly multi-threaded system is reason enough for me.

I mean ultimately every program on your computer you could argue that it shouldn't have been done by anyone but the most skilled developers, because it could be a security hole in your system for the most non-cryptographic of reasons. I doubt that's stopped most folks here from writing them, right?

Anyway, I get the point, I just don't practice it myself, unless of course I know I don't have the time to do it right, which was the case in the example I mentioned, so I didn't do it.