How Good at Math Does a Programmer Need to Be?
from anonymouse2@sh.itjust.works to programming@programming.dev on 08 Nov 11:52
https://sh.itjust.works/post/27784216
from anonymouse2@sh.itjust.works to programming@programming.dev on 08 Nov 11:52
https://sh.itjust.works/post/27784216
I’m working my way to a CS degree and am currently slogging my way through an 8-week Trig course. I barely passed College Algebra and have another Algebra and two Calculus classes ahead of me.
How much of this will I need in a programming job? And, more importantly, if I suck at Math, should I just find another career path?
threaded - newest
you can program without math, but it will be hard to pass a rigorous interview without math.
You should strive to learn symbolic math at least, and make sure you can do all the leet code problems and explanations using whatever math you are comfortable with.
It really depends on the role you are looking for. If working with data and doing analysis, you need some knowledge in stats and probability. If you are working on simulations, you will need basic calculus and algebra. If you are looking at game development, you will need basic trigonometry and vector arithmetic. The one thing you don’t need is mental arithmetic because you have a computer.
That being said, you can get by without these skills, it just becomes harder to see what you need to do, even if you would know how to implement it. This is alleviated if you are working in a team however.
Depends on the career path. Some need only the very basics - for example in frontend development, you’ll mostly use % and basic +/-.
tbh. Most of the useful programming related knowledge you’ll learn at yoyr first job, not at uni.
The curriculum sometimes will force you to learn something unrelated to your career and it has multiple purposes:
People learn the fastest in the topic where they already know a lot. And the slowest where they know very little.
Learning stuff outaide of your comfort zone literally works out your brain. You learn to learn. And your thinking becomes more flexible.
You should not become somebody who is only good at one narrow singular task and a complete idiot at anything else.
You never know if it becomes useful later in life. So I suggest still trying to do your best at any topic. And studying more for the exams where you are not as proficient.
As to which career path to go for:
Don’t be afraid to change midway, but make sure that you enjoy it. If you enjoy compsci, keep at it. (Or if you have student loan, put some more thought into the cost of switching).
IMO mathematical/logical/abstract thinking is critical for programming well, but IMO that’s different from “math degree” math.
Software as a means to an end can be used in almost every domain, so proficiency within that applicable domain is often either useful or necessary. That is to say, “math degree” math is likely needed for 3d rendering (certain games), scientific computation (incl machine learning), etc, but maybe not, otherwise. It depends on what software you’re trying to build.
To be more specific, general programming is definitely and specifically different from trig and calc. However, because math is also broad, “mathy” concepts like type theory, relational algebra, set theory are considered important for programming, even if only informally or indirectly so.
Anywhere from very important to not important at all, depending on your specific job.
There is some good news though, you’ve been lied to about sucking at math. Whether by yourself or other people I do not know, but the education research I have seen has been pretty clear that the main difference between people of normal intelligence who are ‘good at math’ and those ‘bad at math’ is how long they’re willing to work on a problem to ensure the correct answer before moving on.
I know ‘try harder’ sucks as an answer but it’s the best one I know of and at least in this case will actually make a difference.
Agreed. Math, for the most part, is very rule oriented and problems only have one answer and often one strategy to get to the answer. If you work on many different problems (in the same subject) you should start to get used to the rules.
Overall I would say a strong math foundation is important to CS but CS isn’t just about coding. You can absolutely get a coding job without strong math skills or even without a degree, it’s just a bit harder to get started. If the discipline still exists you might consider a Business Information Systems degree (we used to call it CS lite). Depending on the position a company might equally consider BIS and CS majors.
i would disagree that math problems only have one strategy for getting to the answer. there are many things, particularly in more abstract math, which can be understood in multiple different ways. the first example that comes to mind is the fundamental theorem of algebra. you can prove it using complex analysis, algebraic topology, or abstract algebra. all the proofs are quite different and rely on deep results from different fields of math.
i think the same thing holds in the less abstract areas of math, it’s just that people are often only taught one strategy for solving a problem and so they believe that’s all there is.
Totally disagree
You’re thinking of equations, which only have one answer. There are often many possible ways to solve and tackle problems.
If you’ll permit an analogy, even though there’s “only one way” to use a hammer and nail, the overall problem of joining wood can be solved in a variety of ways.
You’re absolutely right. I was referring to equations which, in my experience, is 90% of undergrad math.
Do you have a link to the research? I’m a math educator and I’d like some good materials for encouraging my students.
Well being able to figure out 1 complex math solution per day vs 1 complex solution per 1.5 days for the person who just has to work on the problem for longer is balloons a lot over the long term.
Like how the average calorie burning difference between people is only 400 per day out of ~2000, but over a month that is like 1.5kg difference of mass burned which is 18kg per year.
But I don’t know if I am interpreting the result you said correctly.
The field is incredibly broad. Choose a field or employer or project that’s not doing that an you’re fine.
Being comfortable with algebra is kinda essential, however you probably won’t make much use of calculus unless you go into certain parts of the industry such as game development.
Practice makes perfect though, you may suck at maths today, but there’s nothing stopping you from getting better at it if you work at it
Programming is Concrete Math and becomes more and more Math the less abstraction you expose yourself to.
Both are fields you have to engage in problem solving, the better you are in one, the better you are in the other.
Don’t confuse Math with pure arithmetic operations though, its just the base concept which provides the fundament you’re building upon as you dig deeper.
I for example was quite bad at Math up until I got interested in IT, because then I had a reason for learning and be excited about it, but I guess thats a heavily subjective thing.
Engaging with interpreted languages and solving problems on certain sites with those also helped in further developing my problem-solving skills, which made Math easier for me.
You often need to be pretty good at math. But not because you’re “doing math” to write the code.
In real world software systems, you need to handle monitoring and alerting. To properly do this, you need to understand stats, rolling averages, percentiles, probability distributions, and significance testing. At least at a basic level. Enough to know how to recognize these problems and where to look when you run into them.
For being a better coder, you need to understand mathematical logic, proofs, algebra/symbolic logic, etc in order to reason your way through tricky edge cases.
To do AI/ML, you need to know a shitton of calculus and diff eqs, plus numerical algorithms concepts like numerical stability. This is kinda a niche (but rapidly growing) engineering field.
The same thing about AI also applies to any other domain where the thing being computed is fundamentally a math or logic solution. This is somewhat common in backend engineering.
I’m not “doing math” with pen and paper at work, but I do use all of these mathematical skills all. the. time.
I am an SRE on a ML serving platform.
That’s one example of your particular programming job. Many real world software systems do not require handling monitoring and alerting especially not using statistics, rolling averages, etc.
For example, I once wrote the encryption code used on smart card chips. Writing statistics for smart card card transactions would be someone else’s job. Same with the modem code I wrote for a product.
So, I’d argue that “frontend” and “backend” are the default modes of software engineering these days, and that embedded is a more niche field.
That said, if you’re doing encryption code, you’re doing far more advanced math than backend monitoring and alerting.
Don’t need a degree, but computer programming is fundamentally logic and algorithms. You need to have internalise reasoning logically. In some ways critical thinking is closer to programming than trig is.
Math, despite being a great skill to have, is not mandatory for a large volume of programming roles. It may hurt you in some interviews but interviews are a fucking crap shoot / shit metric either way. Computers do most of the math, so you don’t have to!
Source: I’m dyslexic, suffered from dyscalculia and migraines until I was allowed to use a calculator, and barely passed high school math. No degree. No bootcamp. 8 years as a dev.
I’ve also excelled in multiple roles where colleagues were math or CS PHD’s, and become the senior or go-to on more projects than not. The key part is to know your strengths. I’m never gonna accept a role developing accounting software, or anything that would require me to code complex math on a regular basis. You’d be surprised how far you can get with Google.
You’ll encounter math eventually. It could be as simple as implementing linear interpolation for a custom type, or understanding why a type is not suited for a particular application (e.g. never use floating points to represent money). If you delve into low-level networking, you’ll need a good understanding of binary/decimal/hexadecimal conversions and operations. If you go into game development or graphics, you won’t survive without a deep understanding of vectors, matrices, and quaternions. Any kind of data science is just math translated to a machine-readable language.
In my opinion, knowledge of the basic concepts is more important than being good at actually performing mathematics with pen and paper. For example, if you need to apply a transformation to a vector, nobody expects you to whip up a program that does the thing. Instead, you should immediately know:
That abstract knowledge will give you a starting point. Then you can look up the particulars – the corresponding transformation matrices, the method to convert between inhomogeneous and homogeneous coordinates, and the process of matrix multiplication. I know because I failed calculus.
If you enjoy the work you’ll do well. There are a lot of different roles and specialties in CS with some of them being highly math focused and others quite divorced.
I tried to go to University for CS but never quite got the hang of the math part. Instead I got a Certification in Computer Science from an apprenticeship (idk if that’s the right Translation, in German we call it “Fachinformatiker für Anwendungsentwicklung”) within 1.5 years and with extreme ease, because it was way less math-heavy and more focused on actual programming.
I stayed with the company that I did the apprenticeship with and got promoted from Junior to Regular within a year. I work exactly in the field and position I wanted to work in when I was going for the CS degree. In fact, I have the exact same responsibilities and the same pay as my colleagues with CS degrees. It might not be like that in every company, but it did work out for me.
Just for fun, I actually went back to Uni this semester to try and actually finish one or two math modules, but dropped out within 2 weeks because I was hopelessly incapable of even understanding the basic concepts lol
Practical programming itself does not require this kind of math. The stuff you’re trying to make a program do might; but even then I don’t think you’ll have difficulty in that context. The stuff you’re learning now will have had time to “settle”, and you’ll be working towards a concrete goal, which makes it easier in my experience.
Another thing is that just because you’re struggling right now doesn’t mean you’ll be struggling forever. Math didn’t really click for me until I took calculus. I had a math professor who it didn’t click for until their junior year of college as a math major.
So don’t sweat it. But it’s always a good idea to have another career idea or two in your back pocket just in case. There are lots of reasons you might not want to be a programmer as a career. You might hate it. You might love it enough that you want to be able to do it freely instead of at the behest of others for money.
These kinds of anxieties are normal for someone your age (assuming you’re not nontraditional student). But one day you’ll look behind you in all these worries will seem unjustified. Everything will almost certainly turn out fine.
As others have mentioned, how much and what kind of math you need depends heavily on what you do. And while I wholeheartedly encourage you to do what you enjoy, be it with or without maths, I would like to offer another perspective: A loveletter to maths.
Math in general gets a lot easier and more fun the longer you do it and the more interest you can build. Often the people that teach math are extremely good at it, and maybe because of that they suck at explaining it. There is a lot to doing it right.
First of all, I think you need to build excitement. Math strives to describe the world! Math is the foundation of science, math is history, and many of the concepts and techniques arose out of necessity… Or sometimes spite! There are many funny stories or interesting people behind the formulars and concepts you encounter. Learning why the hell some math was even invented and how the guy or gal got the idea is 1000x more interesting than just getting an example for the application of it. It helps you remember stuff.
Then there are a dozen ways to explain every single concept and then some. You will find some much more intuitive than others and the sum of them will sharpen your understanding of them. Looking for different explanations for the same thing can be a great help. Did you know many things in maths where discovered multiple times? That happens a lot, because even brilliant mathematicians don’t properly understand each other, or even themselves.
Another thing you should do is to always develop your vocabulary for every domain/concept you encounter. People will throw around made-up words and symbols like no tomorrow. Often, there are simple concepts behind them, hence they are casually abstracted away. You need to understand the concept and then translate it into your own words and then draw a connection back to the made up stuff. Maths is a lot like programming. 1 + 1 is just a function, returning a result. So are integrals, formulas in vector algebra, and every single damn other thing in maths. Just follow the chain!
And finally, there are also some amazing insights hidden in maths. Gödel’s incompleteness theorems might send a chill down your spine once you grasp their implications. Computability and information theory will shape your view on the world and yourself.
I went from getting Ds to Bs to advanced theoretical CS courses and you can do it too. You don’t have to, but you can.
While I do agree that math gets much easier with interest, and that it gets more interesting the further you get into it, and that math is inherently beautiful, etc. I feel this argument has to fall flat to people who don’t already agree. It’s the education equivalent of when someone says they couldn’t get into an anime and then the fans tell them ‘oh it gets really good around season 9’. You could be completely correct, as you are here, but it’s utterly unconvincing if you don’t already “know.”
To be fair, I think this is mostly a problem with math curricula. Math classes up through high school and early college seem to focus on well trodden solutions to boring problems, and at some (far too late) point it flips around to being creative solutions to interesting problems. I think this could be fixed eventually, but such is the system we have now.
I totally agree. I think maths should start with games in elementary and cover history and applications as soon as you enter middle school. (Keeping games of course, how is there no redstone in the maths curriculum?!)
And I know that my rambling won’t convince people to immediately shake off the system induced maths fatigue, but I’ll never stop encouraging people to give it a second chance :)
As someone who studied math in college, but can hardly string a line of code together without making 4 trips to stack exchange or some documentation, this was a very good explanation of why math is actually really exciting.
90% of programming I have seen after a decade plus of doing it full time is minor changes being made to code that was already made by someone. Likely not documented. Likely already changed in a dozen little ways. Math isn’t the problem. Understanding what the guy who wrote it is often the problem.
Oh and you can’t ask them because they likely don’t work here anymore.
Being a programmer is more like being a detective than anything else unless you work for a small company.
Spot on. And I’ve found it’s even that bad at small companies too, if the company is more than five years old.
.
Calc 1 and 2 are going to be substantially harder than algebra or trig. People who consider themselves good at math still struggle with calculus. A lot of the people I knew who were not good at math ended up taking one or both calculus courses twice, and in many of those cases, switched their degrees.
More than math courses - logic courses in general helped me rethink and structure things in a variety of ways in how to approach problems. If nothing else it improves your “if-then-else”-fu to understand when you are not(not(not something))). My math degree required logic courses though at the same time so it made sense. For higher level math logic plays a heavy role and so leveraging that aspect helps in a lot of ways.
I failed calc2 and am gainfully employed as a mid/upper level software engineer.
One guy at work really saved the day because he’s good at math, and made a very slow process much faster because he knows … uh… vector math? He did magic with numpy
Depends on the industry and depth you want to go to, gamedev for example you can do without any, but all lower level custom graphics and physics are pretty calculus heavy.
Website dev can be entirely independent of math
Depends entirely on your definition of “gamedev”, IMO. If you’re trying to write a platformer in basic C with no external libraries, you will absolutely need to use algebra/geometry/etc. and maybe even some more advanced things like physics/calculus depending on what features/effects you want to put in your game.
I would uh consider that pretty in deep gamedev, even lower than some shader code lmao - so yes you would need to know some math.
Cracking open Godot and using a bunch of premade assets hardly even requires programming, much less mathematical knowledge
Be that as it may, I personally wouldn’t consider someone to be a very knowledgeable (on how games actually work) game developer if they didn’t at least know how to use things like linear algebra to make a character run and jump naturally and such, even if they’re not coding like that day to day and just using a higher level framework.
You don’t have to agree with me, and I still respect your opinion either way.
I agree with you. Even if you never touch it, it’s nice to know what the libraries you’re calling are doing under the hood.
That’s a really ridiculous example though. No one is doing that.
I’m doing that. I know several others who have as well.
But when you are talking about professional games development that is a very specific thing they almost no one is doing.
Ya, in gamedev you just need triginometry, lerp, quaternions, matrix multiplications and basic 3D math and maybe some more.
Me opening rpgmaker to do some matrix multiplication
Math skills can occasionally be useful, but I don’t see it as a dealbreaker.
The good thing about being good with math is that it usually means you’re a good problem solver, and problem solving is an important skill for programming. But the reverse isn’t necessarily true. You can be good at problem solving but still be bad at math.
I would say if you’re struggling with the programming courses, then maybe look somewhere else. Otherwise, go ahead.
I’d argue it’s a bad career path overall. You will get laid off working as a dev, it’s just how it works, and if you haven’t managed a 10+ headcount by your mid 30’s you will find yourself facing ever escalating ageism 35 on as an old man dev. It’s not a field that generally professionally rewards experience beyond 5-ish years.
That’s not my experience here in the EU.
I don’t think you necessarily need to have studied a lot of math to be successful in programming, but you will need it if you want to get a CS degree, which in turn can be a good lever to a fruitful programming career.
My advice when it comes to math - math skills build upon the concepts you’re expected to have learned before, meaning that if you didn’t fully get everything in the past, then your foundation is not in great shape and you will struggle at higher levels. Going back and repeating the fundamentals just so that you fully understand everything is very helpful in my experience.
I also think that understanding math is rewarding in itself, for what it’s worth!
There’s a lot of programming you can do with zero or very basic math skills. But some stuff can require a lot. But I’m quite sure you could manage a career very nicely without ever touching those areas. People who do that are probably seeking those things out.
Totally depends what you end up working on as a programmer. If it’s web apps, you’ll be totally fine. All you need is basic arithmetic. Writing a game engine? You’ll need to know some basic to moderate matrix maths…
If you’re doing formal verification using unbounded model checking… good fucking luck.
On average I would say most programming tasks need very little maths. If you can add and multiply you’ll be fine. Definitely sounds like you’ll be ok.
As others have said, It depends on what kind of programming you do. Some areas requite a lot. Others not so much. It’s logic, not math, that is needed the most.
You may want to check if your college has a different kind of programming degree. As I understand things, there are basically two kinds of programming degrees. “Computer Science” has much steeper math requirements and focuses on applications that deal with Science or engineering issues. “MIS (Management Information Systems)” degrees focus on actual programming that businesses need, not programs that are science or engineering focused.
If you’re doing really complicated stuff then you at least need to understand algebraic logic and concepts. You’ll also need to understand stuff like logarithmic scales for optimization. But it’s entirely possible to go years without using any math, especially as a website developer. I’m about as senior as you can get in the field, and I’ve only had one job for around 4 years where I used advanced mathematics on a regular basis. That’s 4 years out of a 25 year long career.
That said, a CS degree is going to require all of the math classes as part of the curriculum. My degree program involved fun classes such as finite mathematics, statistics, trig, etc… If you’re doing a program that requires advanced mathematics courses, for goodness sake do them all in a row!
TLDR: it depends entirely on the job. Jobs that are data intensive, with data manipulation, hardware interfacing, and automation type jobs will require more math than jobs like making cool-ass interactive websites.
Edit: PS, I suck at math. I’ve always sucked at math. Yet I’m what most people consider an amazing engineer. Weeee!
As many have already said, the math needed will depend on what type of work you’re looking to do. Writing business software, for example rarely requires more than basic arithmetic.
However, I think that the logical thinking skills that are needed for math are also necessary to be a good software engineer.
The most advanced math a typical developer needs is Fibonacci, and if you can’t remember it someone will show you a cheat sheet.
As a kid, I learned to write i = i +1, before school maths taught me it can’t. The point is, computers do iteration well, especially to model dynamics of real non-linear systems, while classical maths is good at finding algebraic solutions to equilibria - typically more theoretical than real. Calculus is great for understanding repeatable dynamics - such as waves in physics, also integrating over some distributions. But even without knowing that well you could still approximate stuff numerically with simple loops, test it, and if an inner-loop turns out to be time-critical or accuracy-critical (most are not), ask a mathematical colleague to rethink it - believe in iteration rather than perfect solutions.
If you really mean mathematics as in algebra and trigonometry, not much really. But arithmetic is a handy skill. A programmer should be able to at least add and subtract - especially doing UI stuff, which involves dealing with dimensions and positioning of elements on a page. You should be comfortable with numbers and not need a calculator to add up the widths of a few display columns, for example.
I agree with the other answers that it depends on the type of programming you end up doing…the nature of the program being developed, but having a background in discrete math is great to have just in case.
From my experience, there can be unexpected problems where you will advantage from having grasp at discrete math. I worked on a project for a telecom company where they wanted a simulation to predict the impact on network coverage if a specific cell tower (BTS) was uninstalled. I ended up relying heavily on the cross-product formula and some ray-casting algorithms to model how coverage would shift in the area.
unless programming something math intensive like 3d graphics, then basic arithmetic and just a general intuition of numbers is more than enough.
If you end up working in the medical/insurance field in the USA, you don’t even need basic math! The numbers the programs output are just all made up!
I had the audacity the other day to ask in what order we apply deductibles. (YOU want a deductible applied to something covered at 10%, not 100%. The insurance wants it applied to something covered at a100%) I was told it just picks some at random and hopes for the best, so we use the word “best effort” when it comes to estimating what insurance will pay, since they’ll make that up anyway.
So yeah, just another throwing in that it super matters where you work. At my job we plug in what is industry standard for medical accounting, and say it’s just an estimate on everything else.
Many things that are solved by brute force could be greatly improved in a mathematical way. I have worked with a mathematician on one application to get past a speed bottle-neck, but that was a rare case.
Math underlies programming in a similar fashion to how physics underlies automobile driving. You don’t ever need to know about newton’s laws of motion to pass your driver’s license and never get a ticket until you die. At the same time, I will readily claim that any driver that doesn’t improve after learning about newton’s laws of motion had already internalized those laws through experience.
Math will help your intuition with how to tackle problems in programming. From finding a solution to anticipating how different constraints (notably time and memory) will affect which solutions are available to you, experience working on math problems - especially across different domains in math - will grease the wheels of your programmer mind.
Math on its own will probably not be enough (many great mathematicians are quite unskilled at programming). Just as driving a car is about much more than just the physics involved, there is a lot more to programming than just the math.
Depends on what kind of programmer.
If you’re doing data engineering/science (more of an adjacent field), you need to know linear and probability pretty well to build models, or have data harvested in ways that can be put into vectors.
If you’re doing relational DB stuff (like SQL) set theory helps a lot.
Basic boolean operations in general is also good to know. You don’t need to go too deep in the weeds of boolean math unless you’re also doing a lot of hardware-level stuff.
Any field you go into (not just programming), I would say just basic math for regular financial competency is good to know. Also to analyze your budgeting, your costs, time spent, effort needed, etc.
If you’re a frontend programmer, you only need to understand rectangle width and height lol
I think folks saying you don’t need math are right. But if you are having trouble with college algebra you might have trouble with CS. Or the teacher is bad.
Math really builds on itself at the stage where you are. Without good algebra calculus isn’t going to work well.
I’d try a different teacher. Online courses or repeating the course with another professor or something.
I’ve been a full stack dev for about 11 years. I do some basic algebra but that’s about it.
Depends on the programming job.
In my amateur experience, the most difficult math I had to do was use the Pythagorean theorem to calculate a point that was spinning around an other point.
But I can see needing to be able to use matrices in some instances.
Being good at math allows programmers to code more efficient systems. Instead of doing multiple complicated lines, it could all be incorporated into a single efficient equation.
Most of programming is just logic based. Although math is also logic based. So take from it what you will.
Yep, truth tables mostly. Math is mostly useful in game programming.
And graphics.
Statistics is also important in a lot of areas if your doing data analysis.
I was doing full stack dev for 20 years until very recently. Never needed anything beyond basic algebra EXCEPT for while I was getting my CS degree…had 2 classes, i think, where we were doing matrix math/Fourier transforms, but iirc they were electives…one was writing a very basic 3d graphics driver and the other was working with very simple computer vision…things like recognizing handwritten letters.
the better you understand math the better you can understand cs in depth
Being comfortable with basic back-of-the-envelope math can be a huge benefit. (Full disclosure: i am a math major who is now a programmer)
Over my career I have several examples of projects that have saved weeks worth of dev time because someone could predict the result with some basic calculations. I also have several examples where I have shown people some basic math showing that their idea is never gonna work, they don’t listen and do it anyway, and I see them 1 month later and the project failed in the way i predicted.
A popular (and wise) saying is that “Weeks of work can save you hours of meetings”. I think the same is true for basic math. “Weeks of coding can save you minutes of calculation”.
You can definitely be a successful programmer career without great math skills. Math is a tool that can help you be more effective.
Can you share the full story of the projects that you could predict could fail using maths?
Programming and math are both heavily rule-based and logic-based, which is why people say if you’re good at math you may be good at programming.
I’m a front-end developer. I sometimes need to solve algebra problems. I’m pretty bad at it because I , but my knowledge that a problem is solvable by math comes in handy maybe once or twice a month. It’s just that on the few occasions that there’s algebra that I can’t figure out how to solve (maybe once a year), I may ask for help from a colleague.
Examples of cases where math comes in handy:
In summary, as long as you know what math is capable of, you probably won’t have major issues. There will pretty much always be someone around to help with the math part if necessary.
As for calculus… I forgot all about the one calculus class I’ve taken and I’ve never suffered for it.
Very much depends what kind of programming you’re doing. Graphics uses shittons of maths. Data analysis/data science is maths/stats heavy. Other types less so!
Depend on what programming you do. Graphics will be math out of the wazoo, whereas generic web or desktop app programming has very little math involved