Ask HN: Is learning math useful to be a good computer scientist?

47 points by matnar ↗ HN
A few days ago, I read that math is not that much important of you want to be a computer scientist.

I read this sentence as a provocation and caught me so much that I'm still thinking about it.

I studied math and computer science and I strongly believe that having a math background helps you a lot to reason about a problem and formalize the solution. I do believe math can help you to implement some clean code, e.g., that solves a problem without a bunch of if else statements (or to identify state machines where they are not so easily spotted).

In my experience, math helped me a lot, even though so far I never implemented compilers, interpreters or defined new languages (tasks where most of scientists agree that having a math background helps).

What do you think: is learning math useful to be a good computer scientist?

67 comments

[ 3.9 ms ] story [ 149 ms ] thread
Math is useful to be a good "anybody".

Even if you don't apply math knowledge directly in your profession — this is one of the best way known to humanity of teaching your brain abstract thinking, logic and reasoning.

And CS is the field where those 3 things are the core of profession.

Logic is essential, (advanced) math is not. Technically logic is a branch of math but do people learn logic from the math that is taught in schools? I dont think so.
Math itself- not always needed as i said.

But learning math (any math) is crucial.

And "street" logic that people pick up from life is much lower quality than logic you get from learning math, philosophy etc.

It doesn't mean everyone need math logic to succeed in life, but hi quality logic is critical for CS professions.

> philosophy

that's not math

The "logic" that most people use for reasoning comes from philosophy, not formal logic.

Yes. Especially if it's theoretical computer science. Computer science is but a branch of mathematics.
A lot of people studied computer science and ended up being programmers. As a prof once said, "This is like studying architecture and then working as a bricklayer.".

Luckily we're very well paid bricklayers...

That's true. Bricklayers are in demand. But all bricklayers should consider revising their fundamentals occassionally.
Another way of looking at it is that later in you career it seems to be a lot easier to pick up CS concepts while it's a lot harder to pick up math if you don't have it from the start.
Is learning whole encyclopedia and 10 natural languages useful to be a good computer scientist?

Yes, of course! Is it the best way to spend your time having the goal in mind? Maybe not.

The issue with "learning math" is that there is more math being created than you are able to learn.

"a good computer scientist" is very broad.

Does it mean "a good 3D engines programmer" - then probably you want to know linear algebra, things like quaternions etc.

Does it mean "a good browser front end developer" - then probably you want to invest your time somewhere else, maybe web design, learning how to sketch.

I came here to say this. It depends on how you define Computer Scientist.

In the academic sense of the word, and in "low level" software development fields like game engines, databases, systems, embedded, etc knowing math is invaluable.

In "high level" software development like web frontends, apps, scripting and automation math is not essential. Knowing math helps but it's not a requirement.

Something has always irked me about the broad use of terms like Computer Scientist or Software Engineer. For example, I have a bachelor degree in "Applied Information Technology" with a focus on software development. Math was never a priority in my education. From age 16 until I graduated at 22 I never had more than 2 hours of math classes in any given week.

I am not an "engineer" in any way and I don't call myself that. But when I describe what I do (mostly backend, api, cloud architecture and systems programming) I somehow always get lumped in the "software engineer" category.

What do you call yourself?
Software developer
No one means "3D engines programmer", "browser front end developer" nor anything ending with "engineer" when they use the word "computer scientist". The fact that I have to explain this is rather shocking.
So what do they mean when they use the word "computer scientist"?
research, the hint is "scientist".
There is plenty, probably majority, of people doing computer science degrees because they want to become software developer without any intention of pursuing tenure.

The same way as data scientist position has mostly nothing to do with publishing in peer reviewed venues with high impact factor.

"data scientist" is an conflated title created by business people in this industry. The word scientist has a specific meaning which is doing original research.

Also people in this thread seem to think a "computer science" undergrad degree is somehow related to computer scientist the working title. My understanding is that you start the pathway to a science career with a grad degree, like you start an engineering career with a job. Before the job or the grad degree you're no engineer/scientist

Computer Science is a very wide field. You can be a successful Computer Scientists with very little math background. For example you can invent new network protocols without too much math. If on the other hand you want to invent new approaches for solving Linear Programs, you'd better be very good at linear algebra.
It's critical. You can't do computer science without understanding math.

However, it's also important to note that the overwhelming majority of developers are not computer scientists. You don't need particularly good math skills to write software. Most developers aren't doing things like implementing compilers, interpreters or defining new languages. If your job is essentially taking input events, figuring out what they mean, putting the result in a database, and then pulling the data out and displaying it in a specific format on request, then you can get away with very little math at all.

As I found with my own career, you can also get through graduate level computer science, and publish AI papers while still being really quite bad at basic math.
In my field, you could publish decent results by applying a dull CNN just 2 years ago. The only math you had to know was arithmetic to calculate TP and FP.
How should ww feel about this? On the one hand if math is the thing that intimidate people from pursuing science then this is encouraging. On the other, papers are supposed to be useful and truthful and I don't know if that can be achieved if the authors are mediocre at math.
> Is learning engineering useful to be a good civil engineer?
To be a good computer scientist, math is critical. If the writer meant programmer, then it's more debatable. Some of the best programmers I've known have been perfectly mediocre and even bad at math. However, that also cut off large categories of programs from them. Or, they could do it but it was more as a plumber or applying ideas rather blindly, or getting someone to explain it in enough detail that they could code it (guided, but still no real understanding).

But computer science isn't (just) programming. Many areas of discrete mathematics are highly applicable to the field of CS. Particularly number theory, graph theory, probability, combinatorics, logic, and set theory. And those are just the discrete math topics I've used in my own career (which isn't that long, approaching 15 professional years).

Algebra, calculus, linear algebra, and trigonometry have also been part of my work, though that's been more as a programmer than as a computer scientist (translating mathematical formulas and such into code).

I was once asked casually by someone I had just met what are good resources for computer science. I started listing MIT OCW and was about to recommend a bunch of math textbooks that I thought were relevant before I realized he was asking how to create a phone app.

I would argue that there are large tracts of computer science that are indistinguishable from mathematics and so learning math is critical.

I would argue in the affirmative for learning math for computer programming even though I agree that the utility is debatable. Software architecture is more akin to engineering or even construction...math might underpin those areas and may even be needed but often many people in those fields get by without deep math knowledge.

Increasingly it's becoming more of a good idea to have some math knowledge with GPUs, neural networks, machine learning, etc. but as with many deeper mathematical concepts, they'll no doubt get "black boxed" into something more digestible for people who don't want or need a deeper understanding of the inner workings.

Someone who is building a phone app benefits very likely from modeling their data with relational algebra. Good fundamentals in that category will help the longevity and quality of an application more than anything else.
Great point. The advantage to learning CS concepts via maths is that it teaches you to think in a completely different, more abstract way. And because it's just 'maths', the skills you learn are widely transferable.

My favourite example of this is graph theory, which you can find deep applications of just about anywhere in programming.

> Increasingly it's becoming more of a good idea to have some math knowledge with GPUs, neural networks, machine learning, etc. but as with many deeper mathematical concepts, they'll no doubt get "black boxed" into something more digestible for people who don't want or need a deeper understanding of the inner workings.

That's already happened. My wife teaches data science, including machine learning, and it's always surprising to me the extent to which modern industrial practice is about picking the right pre-coded tools from toolkits and combining them. Even though such would be up her alley (she has a PhD in astrophysics), in seven years of working in industry before teaching, she never had to translate from math to code (which I did a lot of earlier in my career).

The first category of math topics I would call fundamental to abstraction and modeling. The second category I would call domain math, that is the application of math to a given problem that requires it.

As being merely a programmer myself I would say both are important. The first as a fundamental thinking tool and the second depending on a project.

But that’s only one part. In some of Alan Kay’s recent talks he emphasized the importance of combining math, science, engineering, art and something he calles tinkering. I think craftsmanship ought to be in there too, or maybe that is between tinkering, engineering and art?

In any case I’m not sure, whether he addresses mere programmers with these. But thinking about the possible application of these concepts to any given project or creative activity really helps.

So yes, I think mathematics is important, but it’s also just beautiful and fun. There are also many ways to learn it, from historical to visual and practical.

to be any scientist math is critical. We should be very dubious of "science" in which there is no formal proof nor statistics to support ideas.
I don't think most sciences use "formal" proof. Maths & Computer science do.
Microeconomics uses formal logic and deduction, typically given assumptions and definitions around rational actors. I’m a layman but my partner is studying economics and I help her out a bit with logic and math stuff when it comes up, but I don’t know how prevalent these concepts are beyond academics.
Every hard science uses statistics, a formal branch of pure maths, in order to justify why its models are decent at predicting real-world phenomena. The proofs usually flow backwards from how you're imagining; statisticians create new proofs which put constraints on modeling, and those constraints are used to rule out bogus scientific results.
Yes, but the scientists aren't trained to create those proofs. But they use them.
What kind of math do you use to identify state machines?
Books on discrete mathematics address the topic.
There's a new video on the math channel numberphile "math is all about shortcuts". Imho that sums it up.

A lot of "skills" talk seems to be oriented towards justifying hiring underskilled people in IT, that's probably where this also is coming from, more HR babble than anything else.

Math is huge. Perhaps the author could summarize which branches of math have been most useful to them.
I saw a lot of people talking about programer/developer vs computer scientists. I just wanted to add to that that CS/maths doesn't make you a good engineer either.

Some of the smartest computer scientists I know are just horrendous engineers (what's worse a lot of them lack awareness and have big egos and insecurities to boot). They seem to see code as a means to an end, and they only know how to think in terms of some primitives, and lack the ability to think in bigger pictures.

On the other hand one of the best engineers was one who didn't study math or computer science in his career. He designs elegant/simple systems that have maintainability and DX baked into them.

Of course this isn't a rule, just anegdota.

Learning math is useful to become a better Human.
I came here to say the same thing. Maths ought to be up there with reading + writing as basic/required skills.
How?
It makes you understand the world. It can help you appreciate the beauty of nature and the universe. Probability and statistics makes you understand science and helps you make better decisions (see pandemic and vaccinations). Understanding Finance can help you be more wealthy. Chaos theory can help you be more relaxed about certain things.
How about puzzle solving? I've been asked this:

If you enjoy solving puzzles, might that indicate you'll enjoy programming?

I think so, debugging often feels like problem solving and sometimes I spend a lot of time debugging.
I enjoy programming from time to time(less than in my early career), but absolutely hate puzzles.
I think programming is one of the least puzzle solving like activities in our industry.

Want to do incident response to figure out which 15 factors came together in perfect harmony to take down the site for 6 hours? That's a lot like puzzle solving imo.

Want to do security "research" (aka find vulns), i think that is a lot like puzzle solving.

Normal programming? Not so much. Maybe if you are debugging a complicated bug.

Not essential for large chunks of business software.

But math can open up lots of new domains for programming, and extend your abilities.

I'd argue you're pretty limited to boring software without it.

> But math can open up lots of new domains for programming

Ironically, most scientific computing pays less than b2b or b2c. I think finance is where money is(sic).

Even standard business problems might have to tackle the complexities of scale, e.g. seemingly boring things like web crawling can get difficult fast without knowing the fundamentals.

At the very least, knowing maths gives you a new perspective in tackling the problems you face even on boring CRUD apps.

Is math useful for computer science? Absolutely. For developing websites or apps in a sweatshop or your “Next big thing” startup? I’ve seen many people who got by without it.
Define "computer scientist". Computer science is a big field but those parts of computer science that I have learned have been heavily underpinned by mathematics, especially those parts concerned with analysing the correctness and complexity of algorithms.

Having said that, I personally waved goodbye to academic computer science after I finished my degree. I work as a software engineer and I find software engineering to be very different discipline to computer science. While mathematics has proven useful to me on occasion, I'm of the opinion that I'd be able to do much of what I do day to day without much in the way of advanced mathematics. Much, but not all. When one encounters certain types of problems, for example problems around performance, I find it helpful to be at least _acquainted_ with mathematical tools that can help, even if my mathematical chops are not as strong as they used to be.

As a mostly self-taught programmer without a CS degree, I think your math skills put you in a league above me. I decided to take a shot at learning linear algebra a year ago, and was pleasantly surprised to see that “vectors” are basically “arrays” as I know them from Ruby.
Wanna solve P=NP? Math is important.

Wanna make some react app look pretty? Not so much.

There is a whole bunch of things between these two which doesn't require that much math.
Computing an optimal layout for automatically-placed GUI widgets can be NP-complete, by reduction to a knapsack problem. Our profession benefits greatly from a basic knowledge of computational complexity theory.
What is "maths"?

At least four things come to mind:

(1) Basic ability with arithmetic and algebra (simplifying equations etc.),

(2) Gifted with numbers; ability to do calculations quickly in the head, strong intuition etc.,

(3) Fluency in the language of mathematics; ability to communicate with other mathematicians and evaluate literature for new results,

(4) Creative ability required to produce proofs of new results.

A mathematician is primarily concerned with (4). This almost certainly requires good grasp of (1) and (3) as well and possibly (2) as well.

A computer scientist in the academic sense is actually a mathematician, so it's the same.

A programmer is where it becomes more fuzzy. I can say with certainty that (4) is not necessary, but I think (1) is necessary. I mean, I don't think anyone seriously believes a programmer doesn't have a basic "high school" ability with numbers do they? As for (2) and (3), no I think it's clearly not necessary, but it's definitely useful, and in some ways inevitable, depending on which area you go into.

There is also some extension of (1) that is particularly useful for programmers. Obvious examples are Boolean algebra, discrete maths (like modular arithmetic) and base systems (binary numbers). It's all useful. Not necessarily every day, but it's inevitable that they will become useful eventually (or you will have to learn them).

I did math in undergrad and I am now going the computer science PhD route. I think basic math really helps and some fields like combinatorial optimizations are good as well, but most of mathematics is only useful for pure mathematicians and physicists. Except for niche fields like topological data analysis, I have yet to see any application of homological algebra, algebraic geometry or PDEs in computer science.
There is not a lot of math involved in working on compilers and programming languages (My PhD was on compilers).

Sure there is some, but it is all easily learned on a case by case basis without a heavy math background.

(comment deleted)