## Coding and Mathematics

### How are they related?

Whether you call it programming, coding or computer science, this field is fundamentally similar to mathematics in logic and reasoning. When we encounter problems in mathematics, we need to strip away any unnecessary information and focus on the important bits. This is known as abstraction. We do this too in coding. Sometimes, to solve questions in mathematics, we need to look at the problem from a different perspective. We need to make substitutions. Programming requires us to do that too. Most importantly, when solving complex problems in general, we need to manage this complexity by breaking the problem down into simpler sub-problems. Again, this is applicable in both computer science and mathematics. In most cases, solving a problem in algebra is simply a matter of following a routine set, much like how computers process our input.

If you feel ready to master these concepts and more, contact us for details on how to start learning coding here at SNCA.

### Sequential thinking

To find a solution to an algebraic expression is actually an exercise in sequencing. If we are to solve for "x", we first move all the "x" terms over to one side and combine them. Next we gather up all the constant terms on the other side. Finally, we divide the expression by the coefficient of "x", leaving behind the solution. Coding is exactly like that. When we code a robot to navigate through a maze, we provide the step-by-step events. The robot follows our instructions to the digit.

### New Perspectives

Mathematics demands some mental gymnastics on our part when faced with complicated problems. For example, when asked to find the original amount of sweets after a series of events, it is often hard to approach the question directly. In essence, we will find it easier to view the events in backward chronological order. This shift in perspective is present also in programming. Sometimes a problem that cannot be solved easier by iteration is easily expressed using recursion. Being able to re-cast problems in a different light is an essential skill in both mathematics and programming.

### Complexity Management

When posed with a long problem in mathematics, it is almost always better to break the original problem down into simpler sub-problems. In coding, we make use of concepts such as divide-and-conquer and wishful-thinking to simplify a hard problem into many easier ones. Being able to manage complexity is a useful and transferable skill in any aspect of life.

### Abstraction of details

In a question where the ages of Ali and Beng are given, we are supposed to find some useful information about them in a few years time. Our teachers will tell us to focus on the important bits, such as their ages, and the constant difference in their ages as time passes. In computer science, this is known as abstraction. Computer scientists use it all the time when faced with large amounts of data to process. They drop away the peripherals and focus on the main points.

### Real-world applications

Programming requires the use of sequential thinking, logical reasoning and mathematical topics (depending on the level of programming involved). Here are some examples of mathematics being used in conjunction with coding.