The Impact of Mathematics on Programming

June 17, 2020

Programming is the art of telling the computer what to do using some set of laid down rules and principles to make digital applications, e.g software, apps, websites, and operating systems. The argument of whether programming is an art or science will be a topic to be discussed another day, but for now, let’s just call it an art since programmers write code.

Paradigms

We are aware that there are various styles of writing programs. The kind of problem you’re solving will determine which style you are to use. These styles are also sometimes called paradigms. In case you’re not clear what these styles are, they’re:

  • Object-oriented
  • Functional
  • Logical
  • Imperative

Abilities to do different things

These paradigms offer us different abilities.

Object-oriented

The object-oriented paradigm offers us the ability to have objects which we can give methods and properties peculiar to only that object.

Functional

The functional paradigm allows us to write programs in the form of mathematical equations or functions.

Logical

The logical paradigm allows us to write programs that draw conclusions or deduce results from given values through comparisons.

Imperative

The imperative paradigm allows us to write programs in a step by step sequence and have the program change some of its values while working.

All of these paradigms are borrowed from mathematics. Let’s explore some of the significance of mathematics on programming/development.

Bring on the Math

Mathematics teaches the usage of algorithms, which helps to develop logical thinking. Analytical thinking, which is the way of breaking down problems from unknown to known, can be quickly achieved through mathematics. Let’s take a deeper dive.

What is an algorithm? An algorithm is a process or set of rules to be followed in a calculation or other problem - solving operations, especially by a computer. Solving math problems relating to algebra requires you to use the algebraic process, and that in itself teaches the usage of algorithms. Solving math problems bends your mind to think critically and analytically at the same time and this helps in developing your brain to think logically.

Analytical thinking is studying a particular problem to develop more ideas about it or find a solution by breaking it down to the smallest pieces of information known about the problem. This is called the First Principle. Analytical thinking can help you investigate problems and find solutions to them.

Analytical thinking requires the following steps:

  1. Identify the problem.
  2. Give detailed information about the problem.
  3. Provide a solution to the problem using the known information about the problem.

Applications of mathematics in computer science

Looking at the steps listed above, let’s relate them to how they’re used in solving mathematical problems. Below are some of the uses of mathematics in various fields of computer science.

  • Game development
  • Artificial Intelligence
  • Machine Learning
  • Simulation
  • Cryptography

Game Development

Games employ math for most of their functionalities. In big games like PUBG and EVE online, and even little games like Pong and Pacman, mathematics is needed for the actions and movements between characters, with geometry and trigonometry underpinning the angles at which characters move.

Mathematical topics employed in Game Development are:

  • Algebra
  • Trigonometry
  • Geometry
  • Calculus

In advanced fields of programming like AI and ML, mathematics is essential. A very extensible part of mathematics found in AI and ML is statistics. Data is the basis of AI and ML and how that data is analyzed and consumed is statistics. Other mathematics used in AI and ML include:

  • Algebra
  • Calculus
  • Simulation & Cryptography

Simulation & Cryptography

Random numbers are used for simulation, cryptography, and some other areas. The way these random numbers are generated is purely mathematical. These random numbers are used in data encryption. The popular topics used in the field of simulation and cryptography are:

  • Number Theory
  • Calculus

Summary

Mathematics is the underlying foundation of programming. For you to build a solid career in programming, it’s helpful to have a solid foundation in mathematics.


About the author

Dominic Nshimba is a Web Developer at All1Zed and currently a Hack Club Facilitator for HackClub in Zambia. He is pursuing a degree in computer science and applied mathematics. Dominic’s key interest lies in systems programming.