5 Useful Maths Concepts for Software Engineers
Tags: learning
Published: 2023-05-15 08:40:00


Maths is an essential tool in the field of software engineering.

As a software engineer, having a good grasp of maths, you will develop efficient software.

Not all maths concepts are equally crucial for software engineering.

This article will discuss the top 5 useful maths concepts for software engineers.

Let's start.

## Boolean Algebra

> _Boolean algebra is a form of mathematics that deals with statements and their Boolean values._[_[Cambridge International]_](https://www.cambridgeinternational.org/images/285024-topic-3.3.2-boolean-algebra-9608-.pdf)

A **_boolean_** is a binary variable with two conditions: true or false (which can also be interpreted as 1-0 or HIGH-LOW, respectively).

A real-world example of boolean algebra is when we discuss the weather: "It's sunny outside". You usually reply to this statement as "true" or "false".

In programming, if statements represent boolean algebra.

Boolean algebra also has other basic operations: `AND` , `OR` , or `NOT`.

Let's take the following two statements:

- **It's sunny.**

- **It's rainy.**

The `AND` operator returns true if both statements are true.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684075736287/9a2406c2-5bb8-475b-949a-d9e1bf882e01.jpeg)

The `OR` operator returns true if either one of the statements is true.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684075869191/d052a390-1ed0-4a80-ab56-6b8e31664958.jpeg)

The `NOT` operator returns the opposite of the statement.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684076018335/7687d07d-58de-4cef-a657-2176f61718a1.jpeg)

The `XOR` operator returns if either one of the statements is true **_but not both_**.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684076195359/5afd6ff5-67ee-42b6-8708-26a5aace2fe7.jpeg)

## Set Theory

Another useful maths concept for software engineers is set theory.

> Set theory is the branch of mathematics where objects (also known as "members") are divided into sets (or collections).

A real-world example of set theory is a musician having a collection of classical vinyl records.

To make a collection, you must first understand if a member can belong to a set or not.

For example, a hip-hop vinyl record cannot belong to a collection of classical vinyl records.

In software engineering, relational databases apply the set theory to describe the relationship between two tables.

Inner, Outer, and Left/Right joins are great examples of set theory.

**Inner join** to select records that match both tables.

### <mark>A B</mark>

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684078526219/318fa3ab-3396-4f6f-b2d6-bfbabeacc2cd.jpeg)

**Outer join** to select all matching records from both tables.

### <mark>A B</mark>

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684079173987/4bb97599-6f79-4a25-91a9-8030813c783b.jpeg)

**Left join** returns all records from the first table whether or not there's a match in the second table.

### <mark>(A B) (A - B)</mark>

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684079068034/386fbb0c-e839-4dd1-a787-aa422318111a.jpeg)

> **Related** : [Data Business Logic In Java: jOOQ VS SPL](https://dev.to/maddy/data-business-logic-in-java-jooq-vs-spl-1dfn)

## Floating Points

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684081986732/ed8692eb-8103-4e7b-a780-12133367e5f3.jpeg)

Floating point is a type of numerical representation that allows both flexibility and precision.

Floating points can represent large numbers (to describe astronomical numbers) or small numbers (to describe molecules and atoms).

"Floating" because the decimal number can "float", and it's not fixed.

> **Related** : [Java Interview Questions](https://techwithmaddy.com/java-interview-questions)

## Binary Number System

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1684081709179/92847be1-0258-471b-b213-0079b30bb884.jpeg)

The binary number system is a mathematical expression that only uses 0 and 1.

Each digit in the binary number system represents a bit.

**_Why do we need a binary number system?_**

It's because computers don't understand language as humans do. Computers only understand "on" or "off". Plus, it's the simplest counting method.

The binary number system is simple because we only have two symbols available: 0 and 1. Therefore, each place gets multiplied by 2.

## Complexity Theory

The computational theory is a useful maths concept often tested d

uring coding interviews.

> The theory of computation is a branch of computer science and mathematics combined that "deals with how efficiently problems can be solved on a model of computation, using an algorithm".[[Carnegie Mellon University]](http://www.contrib.andrew.cmu.edu/~hebah/Theory%20of%20computation.html)

Complexity theory helps with explaining the performance and complexity of an algorithm.

In the graph above, green is the most efficient time, with red being the least efficient.

[![freeCodeCamp](https://cdn.hashnode.com/res/hashnode/image/upload/v1684082634454/0c541d12-6227-472a-a1c1-170d5565c4fc.jpeg)](https://www.freecodecamp.org/news/all-you-need-to-know-about-big-o-notation-to-crack-your-next-coding-interview-9d575e7eec4/)

**_Why do software engineers need to know about complexity theory?_**

If, for example, a program is written as O(n!), it means that the program is inefficient and, therefore, should be rewritten to make it more performant.

Complexity theory allows software engineers to understand why a program takes too much time (or space) and, as a result, write a program with more optimal performance.

> **Related** : [Java Phone Interview Questions - Beginner Level](https://techwithmaddy.com/java-phone-interview-questions-beginner-level)

## Key Takeaways

After reading this article, you know five maths concepts for software engineers:

- Boolean Algebra.

- Set Theory.

- Floating Points.

- Binary Number System.

- Complexity Theory.

Maths is an essential tool for software engineers.

It provides the foundation for developing efficient and effective algorithms.

If you enjoyed this article, you'd benefit from subscribing to my [FREE weekly newsletter](https://techwithmaddy.com/newsletter).

Until next time!

🙋🏾

## Resources:

- [BBC: Boolean logic](https://www.bbc.co.uk/bitesize/guides/zqp9kqt/revision/1)

- [freeCodeCamp: All you need to know about Big O Notation to crack your next coding interview](https://www.freecodecamp.org/news/all-you-need-to-know-about-big-o-notation-to-crack-your-next-coding-interview-9d575e7eec4/)