Home

›

Concepts

›

The Complete Guide to Boolean Logic

The Complete Guide to Boolean Logic

Key Points:
• Boolean logic strictly focuses on binary variables that typically come in 1s and 0s which represent “true” or “false.”
• Where standard algebra manipulates numbers using addition, subtraction, multiplication, division, etc., Boolean algebra utilizes logical functions like negation, conjunction, and disjunction.
• The simplest gate imaginable is called a NOT gate or an inverter. It simply flips whatever input you give it to produce the opposite as its output.

What Is Boolean Logic? – Complete Explanation

Boolean logic is a subsection of algebra that describes a set of simple rules and gates to help compare and manipulate logical statements. What sets Boolean logic apart from other logical systems is that it focuses strictly on binary variables, which usually come in the form of 1s and 0s representing true and false.

Where regular algebra covers numerical operations, Boolean algebra tackles logical operations. Regular algebra manipulates numbers using addition, subtraction, multiplication, division, and other mathematical functions. Boolean algebra maneuvers its subjects using logical functions like negation, conjunction, and disjunction. Both systems use the same relational operators as regular mathematics, including the symbols for equal to (=), greater than (>), and less than.

Ordinary algebra and Boolean logic follow many of the same basic rules. These include:

• Commutative laws, which allow you to swap the positions of your variables when adding and multiplying
• Associative laws, which allow you to switch up the order of operations when adding and multiplying
• Distributive laws, which allow you to distribute multiplication operations over addition operations

These and a few more simple rules and gates for logical manipulation enable us to map a surprising amount of ideas and statements directly onto digital bits and bytes. Boolean logic is the backbone of most computer programming languages today. In the finance world, it’s used by investors to evaluate options and risks. It also provides an easy way to fine-tune searches of large databases of information.

Boolean Logic: An Exact Definition

Boolean logic is a system used to analyze the truth value of any binary statement, as well as the relationships between sets of binary statements, by using algebraic rules combined with logic gates to execute logical operations.

How Does Boolean Logic Work?

Boolean logic starts with typical mathematical functions and adds a few of its own. The main ideas of Boolean logic revolve around three simple logic gates as well as a few more advanced gates. You can combine these gates with the standard mathematical relational operators and basic algebraic rules to build branching idea trees that you can implement onto any binary digital system.

The three simplest logic gates include:

• NOT
• AND
• OR

NOT

The very simplest gate imaginable is called a NOT gate or an inverter. All it does is flip whatever input you give it to produce the opposite as its output. In a digital system based on binary variables of 1s and 0s, inputting a 1 into a NOT gate will output a 0 and vice versa.

We call this logical function the NOT gate because the input state is not the same as the output state. To denote this operation of inversion, most definitions of Boolean logic use an overline, which is a simple bar over the given input symbol (¯). For example, if we use X to signify that a switch is closed, then “NOT X,” or X with an overline above it, means that the switch is open.

In Boolean logic, the NOT gate has only one input and one output. Two NOT gates connected back to back produce a double inversion, which will give you back your variable with its original value.

AND

The AND gate will only produce an output action if all the statements or variables connected to it are present simultaneously. The output of an AND gate will be true only when all the variables joined by the AND gate are true. If one of them is false, the output will be false.

The AND gate is similar to addition in that it follows the simple rules of commutation, allowing any variable it connects to change position. One of the simplest examples is “X AND Y = Y AND X.” The order of the variables doesn’t affect the end result so is considered unimportant.

We usually represent the AND gate with a dot or period symbol (.). An AND gate with two inputs of X and Y translates into the Boolean expression “X.Y,” which many programming languages simplify to just “XY.”

OR

The Boolean OR gate produces an output if any of the variables it connects are present. The output action of this kind of gate will have a value of true if one or more of its inputs are true. In the world of electronics, an OR gate is known as a parallel circuit.

Just like the AND gate, the OR gate has commutative properties, allowing any of its input variables to change order without affecting the output. The full name of the OR gate is actually “inclusive OR,” which contrasts it with a more complex Boolean logical gate, “exclusive OR” (XOR). An XOR gate performs the opposite function, excluding all its inputs and only producing an output if none of them are present.

Counterintuitively, the symbol we use for an OR gate is the plus sign (+). An OR gate with two inputs of X and Y can be represented by the Boolean expression “X+Y.”

If we go one level deeper into our system of Boolean logic, we get more advanced logic gates. These are basically just combinations of the three simplest gates. Here are a couple of the most important ones.

NAND

The NAND gate combines two of the simple logic gates, the NOT gate and the AND gate, to form a NOT AND function. NAND is a complement of AND, as you might guess, performing the exact inversion of the AND gate’s rules. The output of a NAND gate will only be false if all the inputs that connect to it are true. If one or more of its inputs are false, the output will be true.

The symbol we use to represent NAND is sometimes called the Sheffer stroke. It looks like an arrow pointing upward (↑) but is sometimes simplified to just a vertical line (|). Examples of Boolean expressions involving NAND gates to join X and Y variables include “X↑Y” and “X|Y.”

NOR

The NOR gate connects two simple logic gates, NOT and OR, to create a NOT OR function. This acts exactly the same as a simple OR gate with its output inverted. The NOR gate will only give you an output when none of its variables are present. The output variable will have a true value only if all of its input variables are false.

There are two symbols we can use for a NOR gate. The first one combines the symbols for the NOT and OR gates. Using the variables X and Y, this will look like “X+Y” with an overline on top. The second one is a more simplified symbol known as Peirce’s arrow, which looks like a downward arrow (↓). When joining our two favorite variables, this looks like “X↓Y.”

How Do You Create a Boolean Expression?

Boolean expressions are how programming languages like Java, C, and Python implement Boolean logic. By definition, a Boolean expression must be a simple logical statement that can be represented as either true or false.

You can use these expressions to compare any kind of data as long as you input the same data type in all parts of all expressions. They can act as a kind of logical calculator to test statements and other data inputs and check if they are equal to, less than, or greater than other statements or data.

Simple Boolean expressions need at least three parts: the first item you want to compare, the gate or comparison operator you want to perform, and the second item for comparison. You can also make more convoluted Boolean expressions by joining any simple expression with any other using NOT, OR, AND, NAND, NOR, or other logical gates.

Make sure that any expression you connect is a complete Boolean expression on its own. This may mean you have to specify the same variable in multiple places.

Where Did Boolean Logic Originate From?

The origins of Boolean logic can be traced back to a book published in 1854 by George Boole, a mathematician, and philosopher. Boole was a quiet young Englishman with working-class parents. His knowledge of mathematics was mostly self-taught. At the age of 34, he ended up becoming Ireland’s first math professor in the country’s first secular college, Queen’s College.

Boole introduced his logical concepts in his first book, “The Mathematical Analysis of Logic,” and went on to explore them further in a later publication, “An Investigation of the Laws of Thought.” These books were some of the first to seriously explore the idea of logic and its relationship to mathematics. In them, he argued that, instead of a kind of philosophy, logic could be classified as a mathematical discipline that could provide results to logical problems just as accurately as a calculator solved math problems.

He’d noticed that there were many deep similarities between algebraic symbols and rules and the syllogisms and logical forms we use in our heads when reasoning. He started on an ambitious journey to try to devise a logical system based on algebra that would model the way we think. Boole spent years developing his ideas on how to encode logical arguments made naturally by the human brain into a mathematical language. Boolean logic is the linguistic algebra he came up with.

In 1864, Boole died at only 49 years old. His work sat for years without many practical applications until an American electrical engineer and mathematician named Claude Shannon breathed life into it 70 years after Boole’s death. Shannon recognized that Boole’s symbolic logic could be used in electromechanical relay circuits to form the basis of real-world problem-solving mechanisms, or as we call them today, computers.

In hindsight, many historians regard George Boole as one of the forefathers of computer science. His contributions to the conceptual structures of modern digital circuits and programming languages have earned him well-deserved credit as one of the most important founders of the information age.

What Are the Applications of Boolean Logic?

Underlying all of today’s digital computers is the basic idea that binary electrical switches can be used to process logic. What started off as a glimmer in George Boole’s eye has turned into the concrete foundation behind the design of all digital circuits and the conceptual grounding wire of the computer age.

Calculators to CPUs

If we use different voltage levels to symbolize binary bits, we can turn extremely basic Boolean gates into the components needed to make simple mechanical calculators, including counters, adders, and other mathematical tools. From there, it’s only a small step to design circuits that use Boolean logic to subtract, multiply, divide, and more. Since it wasn’t too long ago that Homo sapiens were the only machines capable of conceptual math, that on its own is a big deal.

Once we’ve used these circuits and their Boolean concepts to make a pocket calculator, a full-blown CPU is not too far away.

Random Access Memory

Another useful thing you can create with Boolean logic gates is the idea of memory. The concept of memory relies on feedback.

When a gate’s output is fed back into its input, you get a memory. All you have to do to get Boolean logic gates to remember an input value is organize them correctly. This embarrassingly simple concept is what gives us the random access memory (RAM) in our computers.

Examples of Boolean Logic in the Real World

Your brain uses Boolean logic every day. We call the Boolean concepts in our heads “conditionals.” The idea of branching decision trees that depend on certain conditions is an important tool we use to think clearly.

Here are a couple of examples of the Boolean logic you might encounter in your mind:

• If I sneeze and I’m in a dusty room, I’m fine. If I sneeze or cough and I have a fever, go to the doctor.
• If I’m thirsty, have something to drink. If I’m thirsty and hungry, order drinks and a meal. If I’m neither thirsty nor hungry, go to bed.

In Search and in Research

You can use Boolean terms in research. They can help you narrow or broaden the scope of your search when browsing through databases or library catalogs. Boolean logic can also help you get better at searching the web.

The Boolean term AND lets you target your search to look for more specific results. AND will narrow down your search.

The Boolean term OR lets you include related concepts. You can use it to tell your search engine to find any one of various synonyms. OR will broaden the scope of your search.

The Boolean term NOT lets you exclude unrelated results. For instance, if you’re looking for information on taxes in America but you keep getting results for Latin America, you can hone in on the right results by using the Boolean search expression “taxes AND America NOT Latin.” If you use Google, NOT is represented by a minus sign.

Up Next…

What is the difference between Boolean logic and fuzzy logic?

Every statement described in Boolean logic must be binary, with a value of either true or false. Boolean logic imposes strict absolute values on the variables it can manipulate.

Fuzzy logic works much better with the ambiguity required to think about continuums. It allows its variables to be partial members of multiple sets on a rolling scale in the grey area between true and false.

Where Boolean logic requires its variables to be fixed and discrete, fuzzy logic lets you work with ideas on a spectrum. Boolean logic has its roots in probability theory, while fuzzy logic represents possibility theory.

How do you explain Boolean logic?

Boolean logic is a kind of logical math used to determine the truth value of a statement or combination of statements in the same way that math is used to figure out the validity of numerical equations. Where math uses addition, subtraction, multiplication, and division as its primary operators, Boolean logic and the digital circuits it enables use NOT, AND, and OR as their basic building blocks.

What is an example of Boolean logic?

Boolean logic is an important concept in research on Google and other search engines. Here are a few examples:

• If you get too many hits for a given keyword, you can add AND plus a related search term to narrow the results.
• If you get too few hits, you can add OR and a related term to get more hits.
• If you get mixed results with a lot of irrelevant websites, you can use NOT to exclude the off-topic hits.

How do you use Boolean logic?

Start with a statement that can be determined as either true or false, and use Boolean logic’s fundamental operators, NOT, AND and OR, to compare it or combine it with other binary statements to create more complex sets that can also be classified as either true or false.

Who invented Boolean logic, and what was his occupation?

Boolean logic was invented in the 1800s by George Boole, a British philosopher, and professor of mathematics.

Abby, Author for History-Computer

Abby has a B.A. in English, and has written short and long fiction, with a published novel, lyrics and poetry. She's also done interviews and pieces on the folk music industry. Besides writing and editing for A-Z-Animals and History-Computer, she writes for an entertainment e-zine, and educational materials. She's built multiple websites from scratch and provided content to them. In her spare time, she enjoys sci-fi and social gaming.