## 15 Nov 3 Useful Mathematics Lessons That Are Applicable in Programming by Mary Abiodun

Mathematics, the queen of the sciences has no doubt found a way into our lives by showing its application even in mundane things such as the transactions we make in trading goods and services in return for money. Everything we do is calculated. Even the use of our time is nothing but Mathematics.

Programming as it is today has its foundations in Mathematics. I have seen too many people fall in love with programming but are so much averted to Mathematics. The 0’s and 1’s of programming are purely numbers and numbers are only found in Mathematics.

We are usually unaware of mathematical principles we apply when coding or trying to build an application or doing anything related to programming. The whole essence of this article is to show you three ways in which programming and Mathematics are alike and the salient mathematical principles that are silently applied to programming with subtlety.

**1.** **Problem Solving**

Mathematics is full of problem-solving. As a matter of fact, Polya’s Problem Solving technique helps you to deconstruct problems in Mathematics to critically understand what is to be done to solve a problem.

You are either asked to simplify, calculate, expand, factorize, solve, construct, eliminate, substitute or even evaluate a mathematical problem. Problems come in the form of questions. Answering a question requires proper understanding. A problem well understood is a problem half-solved. As it is in mathematics, so it is in programming.

In programming, the solutions created in the form of web applications, mobile applications, software devices, and the likes are all answers to one problem or the other. In a way, we are solving problems like it is done in mathematics.

When user research is done, it is done to understand the problems that are faced by the user from the user’s perspective. The interventions to these problems are the solutions we, therefore, created to solve these problems. Believe it or not, mathematics is applied as we do this.

**2.** **Steps/algorithm**

According to Wikipedia, in mathematics and computer science, an algorithm is a sequence of instructions, typically to solve a class of problems or perform a computation. Think about a time you once solved a mathematical problem, be it a quadratic equation or even a simple equation. Did you employ some steps to arrive at your final answer? Of course, you did even though you didn’t state it.

There are always steps involved in the solution of any problem. Going through the steps helps you break down the problem in little bits and helps you reduce the complexity of the initial problem.

In programming, you write pseudocode. Pseudocode is a high-level algorithm that helps you simplify a problem before you write the main codes. It is written in steps. Steps are also important in flowcharts/workflows. They help you think about what really needs to be done and what needs to be eliminated to arrive at a concise solution. They also help you break down large problems into smaller units.

**3.** **Debugging/error checking**

Have you ever been in a situation where the presence or absence of a negative sign (-) completely changed the overall direction of your solution and made you arrive at a wrong answer in mathematics?

Let’s come to programming. Have you been in a situation where the absence of a comma or semicolon gave you sleepless nights for days and you were not able to arrive at the suitable solution you wanted?

Mathematics and programming are similar. You just have to look out for errors. Debugging is a skill that is learnt over time through experience. In mathematics, you go over your work several times to be sure that you have not mistakenly introduced an error into your solution. In programming, we have the console to help us track errors and retrace our steps.

If you ever fall into error or need to debug, just retrace your steps to get back on track. It might not be easy to do but with patience, you will get it sorted.

Problem-solving, steps/algorithm, debugging/error checking are the three mathematics lessons I have found to be generally useful in programming. Of recent, I have seen how functions in mathematics have been incorporated into functional programming but that can be a topic for another time. In the meanwhile, you can check out functional programming to see how it works.

Mathematics is the queen of the sciences including computer science and it cannot be separated from programming. So what should you do? Love mathematics!

* —-Written by Mary Abiodun*

Sorry, the comment form is closed at this time.