Do you like math?
Maybe you were a star math student in high school or university. Or maybe it’s been years, or even decades since your last math class.
If you’re interested in learning how to code, by now you’ve probably realized that you need to be comfortable with math. Being self-taught means teaching yourself everything, and that includes the basic mathematical operations used in programming.
I’ve recently realized that so much of my initial aversion to math really stemmed from fear. If this sounds like you, know that by committing yourself to becoming better at math, you’ll accelerate your learning and gain a newfound sense of confidence.
Today I’m sharing the five strategies I used to get over my fear of math and become a better, more capable coder.
1. Don’t overthink it
As someone without much academic experience in math, I used to totally freeze up whenever I saw an equation. I’d also rack my brain trying to remember minute details about the math I learned in high school. Many of these details, I'd later realize, weren’t actually important in the long run.
High school math puts a big emphasis on teaching material that can be easily graded. It puts far less emphasis on abstract thinking or discrete mathematics, both of which are important in coding.
But they’re also harder to grasp, and as a result, can lead to overthinking.
Overthinking can trigger the flight-or-fight response in your brain, which leads to a bunch of undesirable symptoms such as increased heart rate and brain fog.
It can also lead to what's called "analysis paralysis", which happens when you've analyzed a problem so much that you're actually paralyzed from making any decisions.
As you can see, overthinking can cause a lot of problems when you are studying math. Instead, try to relax and project confidence when you are learning. Pay attention to your thought patterns, take regular breaks, and don't beat yourself up if you don't understand something on the first pass.
As you gain more confidence in math, you’ll become more reliant on your past experiences and realize you probably know a lot more than you think.
2. Investigate your language’s Math library
A library is essentially a database of common math functions, such as square root, rounding, and finding the minimum and maximum between two values. These functions build upon your knowledge of different variable types, such as integer, float, and double.
The following list shows some of the common operations you’ll be using as a programmer. The syntax differs between programming languages, but the basic functionality is the same. These operations are a good place to start if you are a beginner.
- Round- rounds the value to the nearest integer
- Ceiling- rounds the value up to the nearest integer
- Floor- rounds the value down to the nearest integer
- Random- returns a random number within a range
- Max- finds the highest value
- Min- finds the lowest value
- Abs- returns the absolute value
- Sqrt- returns the square root
Here are two examples of basic syntax, just to get you started:
C# (Unity) example: Mathf.Min(1, 3); // returns 1
The best way to practice your coding math is to simply code. Try creating a simple app or game around a basic equation, like finding the average between two numbers. You'll be surprised at how much you can do with such a simple operation.
There are many online resources for practicing math that are also worth checking out if you want to brush up on your skills. Here are some good ones:
Scripy Lecture Notes (Python specific)
If you’re looking for structured courses in math, it’s worth visiting the MIT open courseware site , browsing the Math section on Khan Academy (note that this site starts with very basic math and progresses from there), or checking out some of the math courses on EdX. The YouTube channel by Professor Leonard is also a popular choice for coders brushing up on their math skills.
4. Look for the everyday uses
Math seemed far less foreign and intimidating when I considered how often I used it in my everyday life. So much of my fear of math was really fear of the unknown. But then I got to thinking about the measuring I did in my baking, or the budget management, or even home maintenance like hanging shelves in my garage.
In case you need a refresher, here are some everyday uses of math:
Exercise: setting target heart rate, counting reps, calculate calories burned
Leisure: calculating a tip to leave at a restaurant, planning and budgeting for a vacation, playing or composing music, gardening and landscaping
Finance: comparing interest rates, calculating car or mortgage payments, creating a grocery budget, managing investments
Cooking: measuring ingredients, converting recipes between two units of measurements (ie. grams to mL)
5. Change your mindset
I didn't have a lot of confidence as a coder at first, especially since I didn’t start coding until my thirties . Even when I took my first Udemy course on C# I remember feeling like a total impostor during the math-heavy lectures.
Eventually I realized I needed to start seeing myself as a woman in STEM if I wanted to become one professionally. The more active I became in the world of tech, the more comfortable I felt exploring the math I’d previously been so afraid of.
I took active steps to become a member of the online coding community and I suggest you do the same! This could include:
Joining Discord groups
Participating in Twitter chats on coding or tech-related topics
Becoming active in the tech community on Instagram
In your social media bio, you can be honest about what you don't know, but don't sell yourself short! Remember that there is no 'end' to learning and everyone you meet is a beginner in something.
I hope these tips will help you on your coding journey. Remember: learning takes time so you shouldn’t expect to master a subject in just a few weeks of work. Experienced programmers have been working with math for years, and they still learn something new all the time. Keep an open mind and always remember to have fun!