Mathematics in Computer Science
Arma Sahar
Fellow at CS.CODE.IN (Cohort 2024) | CGI.ad | Invests.ai | Smartinvestments.ai
Discover why mathematics is crucial in computer science through real world examples and personal insights. Learn how binary systems power modern computing and impact everyday programming challenges.
Have you ever wondered why math is important in computer science or why it’s so heavily emphasised? I mean, isn’t programming all about writing code and building cool applications? Why do we need to know about binary, hexadecimal, and other Mathematical concepts?
Well, as I recently practiced number systems the very first and basic concept in our CS.CODE.IN classes, I started to see how deeply they’re connected to the very foundation of computing. Number systems are ways of representing numbers to computers. In our daily lives, we use the decimal system (base 10), which has 10 digits (0 to 9). But computers don’t think like us they operate in binary system (base 2), which uses only two digits: 0 and 1.
Why do computers use binary?
The answer lies in the physical nature of computing hardware. Computer circuits are built using electronic components that can exist in two stable states: ON or OFF, high voltage or low voltage. Think about a regular light switch on your wall. It can only be in one of two positions - either on or off. There's no "kind of on" or "halfway off." This makes things very clear and prevents confusion. Computers work in a similar way, and here's why inside a computer, information travels through tiny electronic circuits using electricity. It's much easier and more reliable to work with just two clear states:
- ON: Higher electrical voltage (like when your flashlight is on)
- OFF: Lower electrical voltage (like when your flashlight is off).
This is why we say computers "think" in binary - they process everything using these simple on/off patterns. Even though this might seem limiting, computers can combine these binary signals in incredibly complex ways to do everything from displaying this text you're reading to playing 4k videos.
领英推è
Let's get back to Mathematics. Math isn’t just about solving equations or converting numbers, it’s about precision and accuracy, especially when dealing with real-world problems. I'll give you an example from our class to help you understand better:
Imagine you're working in a FinTech company that processes millions of transactions every day. If you’re asked to build an algorithm or application that handles financial calculations, even a tiny error can lead to huge losses. For instance, consider this simple calculation:
Let's say a customer makes two transactions: depositing $0.10 and $0.20. Basic math tells us 0.1 + 0.20 should equal $0.30.
0.10 + 0.20 = ?
If you think the answer is 0.30, but for your surprise the actual answer is $0.30000000000000004 instead! But where did 0.0000000000000004 come from? Now you see why without a strong foundation in math, you might not understand why this happens or how to fix it.
Learning number systems might seem like a small step in your computer science journey, but it’s one of the most important. It’s like learning the alphabet before you can write a story. As I continue my journey, I’m excited to see how these foundational concepts will help me tackle bigger challenges in programming and beyond.
(After all Math is intimidating :p )
Conclusion
As the great computer scientist Edsger Dijkstra once said, "Computer science is no more about computers than astronomy is about telescopes." At its core, it's about mathematical thinking and problem-solving – skills that will serve you well throughout your career in technology.