TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Did studying proof based math topics make you a better programmer?

30 pointsby jobhdezalmost 2 years ago
Hello, Hope all is well. I love math but haven’t studied much of it.<p>I have only studied up to real analysis. But definitely not a whole semester worth; my experience with analysis has been analogous to Poor performance in a quarter based analysis course. I did some exercises but not many.<p>I have heard from an mit professor[1] that math is the way to learn to think rigorously. So I’m curious about this and I’d like to improve my thinking skills in the hope that I will become a better programmer.<p>In an article a math professor said that there was some evidence that math improved logical skills[2].<p>So I’m wondering if any of you noticed that your thinking skills improved thereby making you a better programmer after studying analysis or topology or some other proof based math course.<p>Also which math other than the math required in CS programs should one study to be a better programmer and thinker? Thanks [1] https:&#x2F;&#x2F;m.youtube.com&#x2F;watch?v=SZF0MFm9pqw&amp;pp=ygUTQWR2aWNlIHJ1c3MgdGVkcmFrZQ%3D%3D [2] https:&#x2F;&#x2F;www.nytimes.com&#x2F;2018&#x2F;04&#x2F;13&#x2F;opinion&#x2F;sunday&#x2F;math-logic-smarter.html

29 comments

williamsteinalmost 2 years ago
I received a Ph.D. in pure math (number theory) from Berkeley, and then worked as an academic mathematician for 20 years, so wrote a few dozen research papers and some books. My ability to write software for <i>doing mathematics</i> was obviously better as a result of studying mathematics, e.g., I started SageMath (<a href="https:&#x2F;&#x2F;sagemath.org" rel="nofollow noreferrer">https:&#x2F;&#x2F;sagemath.org</a>) and wrote a big chunk of it.<p>Now I mostly do full stack web development (I have goals that require doing it), and I do often think about my programming informed by intuitions from topology and algebraic geometry (e.g., scopes in programming are like neighborhoods in topology). Having experience with formal logic and proofs also helps in reasoning about what code I&#x27;m looking at will do. Experience with rigorous mathematics also makes me more humble about just how difficult it is for anybody to ever reason correctly about anything.<p>I taught mathematics to many undergrads over the years, and I would recommend anybody interesting in a career in programming also learn at least the basics of group theory and abstract algebra. It&#x27;s extremely beautiful, and probably different than the other mathematics you encountered, e.g., in high school or engineering courses. There&#x27;s just so many beautiful and deep ideas in an intro abstract algebra course that aren&#x27;t very difficult to learn. I initially got into mathematics when I was an undergrad browsing the programming section of a used bookstore, and found an abstract algebra book that was misfiled in the programming section.
评论 #36464023 未加载
评论 #36464009 未加载
评论 #36472211 未加载
评论 #36464324 未加载
JamesLeonisalmost 2 years ago
I lie to people about programming all the time.<p>I tell them it&#x27;s not about math, you just have to think logically through every step.<p>With more steps comes more scrutiny, so you study how to optimize.<p>You will read papers about optimization to reduce the number of steps.<p>Those papers have a suspicious amount of math.<p>By the time you discover, &quot;...wait, its all math?&quot;<p>&quot;Always has been.&quot;<p>What I personally found helpful was the book <i>The Algorithm Design Manual</i> [0]. It starts right off with math, but in a way that connects it to basic primitives of programming. You start building up an algorithmic understanding as you increase the computation complexity. It was very intuitive for me, both for understanding the math and understanding Big O in a rigorous manner. From there it dives into actual algorithms and code, but the math returns periodically.<p>[0]: <a href="https:&#x2F;&#x2F;www.algorist.com&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.algorist.com&#x2F;</a>
评论 #36464426 未加载
评论 #36463821 未加载
nimihalmost 2 years ago
I have an undergraduate degree and a couple years worth of graduate school in pure math (and continue to read&#x2F;work through math texts on occasion when the urge strikes me), and can say with pretty high confidence that my ability as a programmer over my life has been relatively uncorrelated with the amount of math I&#x27;ve learned and my proficiency with understanding and writing mathematical proofs.<p>I do believe that having some baseline ability to think carefully, logically, and rigorously, while being able to shift your perspective between levels of abstraction as you analyze a problem, is very useful as a computer programmer, but I don&#x27;t think mathematics is the only route (or even the best route) to acquiring that skill; I&#x27;ve had a number of colleagues over the years with no formal training or education in any sort of &quot;STEM&quot; field who were nevertheless quite adept programmers.<p>At the end of the day, based on both my own experience and what I&#x27;ve observed in friends and colleagues, the way to become a better programmer is the way to get better at most things in life: do a lot of it, find other people who are good at it and get their feedback, and stay humble enough that you&#x27;ll be able to learn from your mistakes and change your thought processes. But mainly just do a lot of it.<p>That&#x27;s not to say you shouldn&#x27;t learn some serious math, of course: there&#x27;s a lot of cool and interesting stuff to learn, and some of it even has useful applications. But the thing you get good at when doing math is, well, doing math, and if you really want to be a better programmer, your time is likely better spent writing software.
ivanechalmost 2 years ago
If your goal is become a better programmer, your time is better spent working on challenging programming problems.<p>If you enjoy math, go do some math. It might help you see problems differently. If you don&#x27;t enjoy math, don&#x27;t grind through it.<p>In general, the best advice for the question &quot;I want to get better at $skill, should I study $subject?&quot; is &quot;just do $skill&quot;
评论 #36463882 未加载
评论 #36464212 未加载
评论 #36464105 未加载
mattbgatesalmost 2 years ago
I never studied any type of math, but I was always great at logic, taking at least a half dozen philosophy and theology courses throughout my univeristy experience. I did take a few programming classes in place of several math courses, just to avoid mathematics... I think my highest math class was Algebra II. I didn&#x27;t go the route of a computer science major because I didn&#x27;t care about trigonometry or calculus classes, though still managed to land a science degree of psychology. I can see why college cirriculums may require computer science to have certain math courses, but if you can figure out the logic of how things work, you can get out of math courses and still be a programmer ;)
jopolousalmost 2 years ago
Yes, though any subject which trains you to think with mathematical rigor will help.<p>I switched my major from CS to math midway through my undergrad studies. I have worked at startups and FAANG as a SWE so I have seen these skills in different engineering environments. A few things I’ve seen:<p>1. My later classes used the Moore Method which made whiteboard interviews much less stressful 2. I can spar with our data scientists and call out BS metrics rigorously in a very political environment at my current company 3. I can sometimes find pathological execution scenarios and bugs faster than my CS coworkers<p>The one caution is that time spent studying things that aren’t programming needs to be balanced with time spent programming<p>As for math outside of CS that’s helpful for programming and thinking, modern algebra and category theory can really help in understanding type systems and their limitations. They’re also very accessible when compared to stuff like differential equations and analysis IMO
NoZebra120vClipalmost 2 years ago
No. In fact, I didn&#x27;t study any of that. I&#x27;m bad at math. I took a required Calculus course (again) about 5 years ago, and struggled mightily, although I did achieve an &quot;A&quot;.<p>For the things I&#x27;ve programmed, I barely needed any math. I found it more beneficial to study things like systems architecture and computer science. Knowing theories behind data structures, functional&#x2F;imperative programming, algorithms, networking, file manipulation and more, that was the sort of thing I studied and exercised in my programming days.<p>For the record, I programmed Unix systems and services in C, Bourne shell, Perl, and similar languages. That was my professional career. Of course I got a real early start with BASIC, LOGO, and a little bit of assembly.
评论 #36464114 未加载
gmusleraalmost 2 years ago
Mathematical proofs are in some way algorithms put in practice. And another useful thing they have is not leaving possibilities out.<p>I think that those two things are useful mental models to have when learning programming, things that would be useful to have more as built in patterns than thinking step by step. And in that sense is useful to have a background in math. Maybe it doesn’t need to be too advanced, but at least at the level of thinking naturally in that way.
kzz102almost 2 years ago
I think &quot;learn B because it will help you do A better&quot; type of advice often doesn&#x27;t work. But &quot;learn adjacent fields if they are interesting to you, time and energy permitting&quot; may work, as they sometimes do yield unexpected benefits.<p>I am doing the opposite of what you are asking, as my day job is a mathematician, and I found my hobby of programming sometimes helpful.
sjruualmost 2 years ago
They overlap so much that it doesn&#x27;t matter too much. Computer science is based on formalist logic. You&#x27;d probably get more out of learning breadboard computer engineering.
评论 #36463381 未加载
crotealmost 2 years ago
No, I would not say it has.<p>Having a basic understanding of math can provide some value. For example, things like understanding Big O notation, or the fact that algorithms can be proven <i>at all</i>. Stuff like that provides you the right tooling to select the right algorithms for your problem.<p>However the actual <i>proving</i> part is mostly busy-work, and due to the Halting problem provides relatively little value in general programming. It might be useful if you want to develop a compiler or something, but most people don&#x27;t.<p>Proof-based maths is the main reason why I dropped out of my Computer Science M.Sc. course. After a while it became painfully obvious to me that it didn&#x27;t teach me anything I could actually <i>use</i> as a developer, and it was a waste of time if I didn&#x27;t want to go into academics.<p>You&#x27;ll learn more about programming by <i>actually doing programming</i>.
agomez314almost 2 years ago
It did not. Learning git in-depth beats any amount of proof-solving skills you might have in traditional, day-to-day software engineering. Doing proofs makes you a better thinker _in general_, but doing it in isolation (i.e without communication skills or team skills) can actually be detrimental.
yazzkualmost 2 years ago
Propositional and first-order logic along with Algebra and basic proofs by induction, reduction to absurdity, etc, should beat the logical, pedantic motherfucker out from your inner self. At least that is what we did at uni -- along with physics, calculus, discrete mathematics, and theory of computation -- but I&#x27;d argue the first list should be a sufficient starting point.<p>Not really sure about &quot;better programmer&quot;, but I think it makes you at least more logical and helps develop a keener attention to detail. &quot;Better programmer&quot; entails an array of many other qualities outside of the scope of &quot;better thinker&quot;.
ironSkilletalmost 2 years ago
My math PhD has helped me be a better programmer in several ways. The first is in terms of reasoning above the behavior of complex systems, which mathematical domains and programs are both instances of. Another is in terms of problem solving via abstraction. Mathematics advances by building new abstractions that serve to encapsulate a set of ideas that can then be reasoned about efficiently and in new ways. The same way abstraction layers in programming allow you to build up more and more sophisticated behavior while &quot;hiding&quot; lower level details and not having to even think about them.
analog31almost 2 years ago
In my case it would be hard to separate cause and effect because math and proofs came before programming. &quot;Back in my day,&quot; the public school that I attended had a K-12 math curriculum that included sets, proofs, and problems that had no answer. (You were supposed to write down &quot;no answer&quot;). I was kinda slow at memorizing my arithmetic, but proofs and weird stuff made math come alive for me.<p>Then my first programming class, in BASIC (in 1981), was taught by my high school math teacher, so there was a math perspective, plus my love of math probably biased my interests in programming. Today, I&#x27;m not employed as a programmer <i>per se</i>, but use programming and math as problem solving tools as a physicist.<p>I know programmers who are great at math, but most are not, and the ones who are take care of the math stuff in a team. Likewise with most engineers. So I&#x27;m hesitant to claim that math is a particular boon to learning programming. Rather, it is or it isn&#x27;t, and that might influence what <i>kind</i> of programming you get into.<p>Like Joel Spolsky&#x27;s article about programmers, I think there&#x27;s a two humped distribution in terms of ability to grasp proof based math. If you discover by accident that you have a facility for it, then you might just try a few more courses because it&#x27;s a boatload of fun.<p><a href="https:&#x2F;&#x2F;blog.codinghorror.com&#x2F;separating-programming-sheep-from-non-programming-goats&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;blog.codinghorror.com&#x2F;separating-programming-sheep-f...</a>
beyondCriticsalmost 2 years ago
If you are not passionate about it, than you should probably not study it. Also, studying Informatics should give you a lot of opportunities to showcase your extra skills, e.g you can study functional programming from the ground up. IMHO the much more interesting question is: How to cope with the upcoming of AI? This will probably make programming much cheaper and more less skilled people will come to sit right before your nose, tending to devalue higher education.
colomonalmost 2 years ago
I think the proof mindseet was a huge help to me as a beginning programmer, BUT that was in the context of high school Euclidean geometry, not analysis, around the same time I was first learning a programming language that let you write functions. As I recall (long time ago now!) the two things kind of fed off of each other very nicely.<p>Then it got a bit of reinforcement in my honors &quot;1st semester calculus but we&#x27;re proving everything&quot; course.
sfpotteralmost 2 years ago
Learning math helps develop your ability to hold large, complicated logical edifices in your head and to analyze them. There are different ways to develop this skill, <i>doing</i> math is one way to go about it. Programming is fundamentally about reasoning about large logical structures, so the skills carry over. The specific topics may not help, but then again, they might. Learning multivariable calculus and linear algebra will help you if you work in graphics, machine learning, etc. Note that these are huge subjects, and there’s always more to learn—much more than you can pick up in a semester or two at college.<p>How crucial it is for you to be able to accurately analyze large logical systems depends on the kind of programming you do. In many cases, it isn’t that important. I think I being comfortable with ambiguity, understanding how to satisfy multiple conflicting constraints, how to be political, etc. are probably much more valuable skills. Many programming jobs simply do not require you to be that technical to get your tasks done.
BeetleBalmost 2 years ago
I did a lot more math before focusing on programming, so it&#x27;s hard for me to say.<p>Doing a lot of math definitely helps you think rigorously. Doing programming <i>forces</i> you to think rigorously.[1] So it&#x27;s not clear if math is a value add in that direction.<p>I think the only way math has helped me is that mathematicians tend naturally to think &quot;functionally&quot;, so for me switching from C&#x2F;Python to more abstract functional programming (be it in Scheme or ML based languages) was fairly easy. In fact, I was already trying to program functionally in Python before I knew what that even meant.<p>On the whole, I would say: Study more math if that&#x27;s what interests you - but not with the expectation of becoming a better programmer.<p>[1] See also my prior comment that discusses a Field&#x27;s medalist&#x27;s comparison between math and programming: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=36344681">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=36344681</a>
评论 #36464687 未加载
Madmallardalmost 2 years ago
Programming is improved by programming. Work on things increasingly out of your comfort zone and slowly grind your way up. Consume all programming related content you can that is written by experts. 5 years later you&#x27;re much better. It&#x27;s going to be a lot of mental blood and sweat though.
wisneskyalmost 2 years ago
Yes, in the sense that &quot;math is programming paper instead of computers&quot;, being better at one translates to being better at the other. This intuition can even be made precise via the &quot;Curry-Howard isomorphism&quot;, upon which &quot;proof assistants&quot; such as Coq are built.
评论 #36463580 未加载
000ooo000almost 2 years ago
Not all programming is equal, and there&#x27;s a big difference between programming alone&#x2F;as a hobbyist and programming for profit. I think studying most any topic is likely to give one new or interesting perspectives in programming, but the question is: is the juice worth the squeeze?<p>If you asked me to describe a &#x27;better programmer&#x27; in a professional setting, it would probably be:<p>* writes understandable code<p>* knows when to optimise&#x2F;dedupe &#x2F;abstract, and more importantly, when not to<p>* treats it like a craft, but knows that pragmatism is also key<p>* can communicate about code, explain concepts and just be generally helpful and pleasant to others in or outside the team<p>Thats IMHO anyway, and those things don&#x27;t seem to have much to do with math.
prplalmost 2 years ago
The problem is the premise of the question.<p>Is “better programmer” a useful metric to problem solving? For a class of problems, probably.<p>Math and other hard sciences will probably give you a different perspective than a traditional CS education which may help with solving certain types of problems. Those may be programming related, or may be something else. Of course it may depend on the kind of person you are too.<p>In my opinion it’s worth pursuing whatever feels hard in terms of education, even if there’s not a rigorous CS education. You can always go into CS later.
dkjaudyeqooealmost 2 years ago
Thinking about your code is constructing an informal proof in your mind. Making this more rigorous and thus more formal involves the same trade off of accuracy&#x2F;ease&#x2F;speed versus correctness&#x2F;tedium&#x2F;slowness that any other formalism entials.<p>I&#x27;d say studying mathematical proof is helpful for developing your proof making skills, but then it is best largely forgotten after you&#x27;ve internalised those skills.
ldehaanalmost 2 years ago
I didn&#x27;t graduate high school and I can program in multiple programming languages, and picking up a new one is pretty easy. I had to convert &quot;math functions&quot; into code before I could understand what the symbols meant when I was learning how to write ML software.<p>Imo you learn the academic lingo, and it can make it easier to communicate with other programmers, but you can just pick it up. School is for chumps.
TillEalmost 2 years ago
I don&#x27;t think so. I remember most of my required math (for a CS degree) was proofs, and I mostly hated it. Discrete math was great, and anything else with practical applications in CS would be good too.<p>If you have a choice, I&#x27;d rather spend the time further studying algorithms and data structures instead of proofs. There&#x27;s a ton to learn, and working through algorithms in pseudocode is always useful.
monster_groupalmost 2 years ago
If you want to get good at something, you will get far more return on your time and effort investment if you just practice that thing rather than something tangentially related to it. If you want to get good at programming, practice programming not math. Math may help you but it won&#x27;t help as much as practicing programming.
throwaway81523almost 2 years ago
Yes, and studying some mathematical logic also helped. Neither math people or programmers really study logic enough. It is a rabbit hole, but just some understanding of the basics changes your whole approach to math.
mathgeekalmost 2 years ago
Not generally, although proofs around set theory were useful in grokking databases.