Boolean Algebra

Learn about different Boolean operations.

What is Boolean algebra?

Previously, we learned how the computer can represent data. Now, we have to find out how it processes it. To understand that, we must first dive into a corner of mathematics that is called Boolean algebra.

George Boole, who lived between 1815 and 1864, was a self-taught English mathematician and the inventor of Boolean logic, which is the basis of how all our computers work. Boolean logic, sometimes referred to as Boolean algebra, is a form of mathematics that works with only two values: true and false. It also defines three operations that we can perform on these two values: AND, OR, and NOT.

NOT: It’s the simplest of these operations because all it does is switch the value, so something that is not true is false, and something that is not false is true. For example, if we say, “It is raining today,” this statement can be either true or false. It’s true if it’s raining and false if it is not raining. If I instead say, “It is NOT raining today,” then the statement will be true if it isn’t raining and false if it is raining.

AND: It takes two statements that can be either true or false and evaluates them into a single value. The outcome will be true if both incoming values are true and false in all other situations. If I say, “It is raining today, AND I have a blue umbrella,” the statement will only be true if both parts are true, that is, if it’s actually raining and my umbrella is actually blue. However, if it’s raining and my umbrella is pink, what I say is false, even though half of it was technically true.

OR: It works in two parts, just like AND, but now, only one of the two must be true in order to make the statement true. If I say, “Today I will go to the beach OR I will go to town,” then the statement will be true if I either go to the beach or to town. It will also be true if I manage to do both.

How truth tables work

We can illustrate how these three operations work in something called a truth table. A truth table is a way to describe how the input of true and false values is transformed by an operation. The input is often referred to as P if we only have one input value, or P and Q if we have two. The result is shown in the last column.

If P is the input value, the truth table for NOT looks like this:

Get hands-on with 1200+ tech skills courses.