Introduction: Connecting Circuits to Math

Welcome back! In the last lesson, you learned how to use truth tables to predict the outputs of basic logic gates like AND, OR, and NOT. Now, let’s take the next step and see how we can represent these gates using math. This branch of math is called Boolean algebra.

Boolean algebra lets us write the behavior of logic gates using symbols and equations. This is helpful because it makes it easier to describe, analyze, and simplify circuits — especially as they become more complex. By the end of this lesson, you’ll be able to write logic gate operations as Boolean expressions and use some basic rules to make those expressions simpler.

Math Representation of Logic Gates

Let’s start by looking at how the three basic logic gates — AND, OR, and NOT — are written in Boolean algebra. You’ve already seen these gates in truth tables and circuit diagrams. Now, let’s see their mathematical side.

  • AND Gate

    • Symbol: · (sometimes just written as nothing, like AB)
    • Boolean expression: A · B or AB
    • Example: If A = 1 and B = 0, then A · B = 0
    • Explanation: The AND gate only outputs 1 if both inputs are 1.
  • OR Gate

    • Symbol: +
    • Boolean expression: A + B
    • Example: If A = 1 and B = 0, then A + B = 1
    • Explanation: The OR gate outputs 1 if at least one input is 1.
  • NOT Gate

    • Symbol: '
    • Boolean expression: A'
Key Boolean Identities

Boolean algebra has some important rules, called identities, that always hold true. These identities help you simplify and understand logic expressions. Here are some of the most useful ones:

  • Identity Law

    • A + 0 = A
      (OR with 0 changes nothing)
    • A · 1 = A
      (AND with 1 changes nothing)
  • Null Law

    • A + 1 = 1
      (OR with 1 always gives 1)
    • A · 0 = 0
      (AND with 0 always gives 0)
  • Inverse Law

    • A + A' = 1
      (A OR NOT A is always 1)
    • A · A' = 0
      (A AND NOT A is always 0)
  • Idempotent Law

    • A + A = A
    • A · A = A

Let’s look at a quick example:

Suppose you have the expression A + 0.
According to the Identity Law, this simplifies to just A.
Explanation: OR-ing any value with 0 doesn’t change the value.

Another example:
A · 0 simplifies to (Null Law). AND-ing any value with 0 always gives 0.

Simplifying Logic Expressions with Identities

Now, let’s see how you can use these identities to make logic expressions simpler. This is useful because simpler expressions often mean simpler circuits.

Example 1:
Simplify A · 1 + A · 0

Step 1: Use the Identity Law: A · 1 = A
So, the expression becomes A + A · 0

Step 2: Use the Null Law: A · 0 = 0
Now, the expression is A + 0

Step 3: Use the Identity Law again: A + 0 = A
So, the final simplified expression is just A.

Explanation:
We started with a longer expression, but by applying the identities, we reduced it to a single variable. This means the circuit can be built with just a wire from input A to the output — no gates needed!

Example 2:
Simplify B + B' · A

Step 1: Use the Distributive Law (not listed above, but useful):
B + B' · A = (B + B') · (B + A)

Step 2: Use the Inverse Law: B + B' = 1
So, the expression becomes 1 · (B + A)

Step 3: Use the Identity Law: 1 · (B + A) = B + A

Explanation:
Again, we simplified a more complex expression to a simple OR operation.

Summary & Practice Preview

In this lesson, you learned how to write logic gate operations as Boolean expressions and how to use key Boolean identities to simplify those expressions. This is a powerful skill for designing and optimizing digital circuits, as simpler expressions often lead to simpler, more efficient circuits.

Next, you’ll get to practice writing Boolean expressions for logic gates and using identities to simplify them. This hands-on practice will help you become comfortable with these new tools and prepare you for more advanced circuit design. Good luck!

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal