Skip to content
IRC-CodingIRC-Coding
Boolean AlgebraLogic GatesTruth TablesSwitch AlgebraDigital Electronics

Boolean Algebra: Logic Gates, Truth Tables & Switch Algebra

Boolean Algebra with logic gates, truth tables, and switch algebra. AND, OR, NOT, NAND, NOR, XOR with practical examples.

S

schutzgeist

16 min read
Boolean Algebra: Logic Gates, Truth Tables & Switch Algebra

Boolean Algebra: Logic Gates, Truth Tables & Switching Algebra

This guide provides a comprehensive introduction to Boolean algebra, covering logic gates, truth tables, and switching algebra with practical examples.

In a Nutshell

Boolean algebra is the mathematics of logic using just two values: true (1) and false (0). It forms the foundation of all digital circuits and computers.

Core Definition

Boolean algebra is an algebraic system for describing logical operations. Developed by George Boole, it underpins digital technology.

Fundamental operations:

AND (Conjunction)

  • Symbol: ∧, ·, AND
  • Truth rule: True only when both inputs are true
  • Circuit: Series switch
  • Use cases: Safety functions, validation

OR (Disjunction)

  • Symbol: ∨, +, OR
  • Truth rule: True when at least one input is true
  • Circuit: Parallel switch
  • Use cases: Alternative decisions

NOT (Negation)

  • Symbol: ¬, ~, NOT, overline
  • Truth rule: Inverts the truth value
  • Circuit: Inverter
  • Use cases: Signal inversion

NAND (Not-AND)

  • Symbol: ↑, NAND
  • Truth rule: False only when both inputs are true
  • Circuit: AND followed by inverter
  • Use cases: Universal gate

NOR (Not-OR)

  • Symbol: ↓, NOR
  • Truth rule: True only when both inputs are false
  • Circuit: OR followed by inverter
  • Use cases: Universal gate

XOR (Exclusive-OR)

  • Symbol: ⊕, XOR
  • Truth rule: True when inputs differ
  • Circuit: Parity gate
  • Use cases: Error detection, cryptography

Key Exam Topics

  • Boolean algebra: Mathematics with two values (0 and 1)
  • Logic gates: Electronic circuits performing logical operations
  • Truth tables: Systematic representation of all possible input combinations
  • Switching algebra: Application of Boolean algebra to circuits
  • Universal gates: NAND and NOR can replace all other gates
  • Karnaugh map: Simplification technique for logical expressions
  • Industrial relevance: Foundation for digital circuits and programming

Essential Components

  1. Boolean variables: Only 0 or 1
  2. Logical operations: AND, OR, NOT, NAND, NOR, XOR
  3. Truth tables: Complete functional description
  4. Switching algebra: Laws and simplifications
  5. Logic gates: Electronic implementation
  6. Circuit design: Combinational and sequential circuits
  7. Minimization: Karnaugh maps, Quine-McCluskey algorithm
  8. Applications: Computer architecture, digital systems

Practical Examples

1. Basic Logic Gates in Java

public class BoolescheAlgebra {
    
    public static void main(String[] args) {
        // Input values
        boolean a = true;   // 1
        boolean b = false;  // 0
        
        System.out.println("=== Basic Logic Operations ===");
        System.out.println("a = " + a + " (1), b = " + b + " (0)");
        
        // AND (Conjunction)
        boolean and = a && b;
        System.out.println("a AND b = " + and + " (" + (and ? 1 : 0) + ")");
        
        // OR (Disjunction)
        boolean or = a || b;
        System.out.println("a OR b = " + or + " (" + (or ? 1 : 0) + ")");
        
        // NOT (Negation)
        boolean notA = !a;
        boolean notB = !b;
        System.out.println("NOT a = " + notA + " (" + (notA ? 1 : 0) + ")");
        System.out.println("NOT b = " + notB + " (" + (notB ? 1 : 0) + ")");
        
        // NAND (Not-AND)
        boolean nand = !(a && b);
        System.out.println("a NAND b = " + nand + " (" + (nand ? 1 : 0) + ")");
        
        // NOR (Not-OR)
        boolean nor = !(a || b);
        System.out.println("a NOR b = " + nor + " (" + (nor ? 1 : 0) + ")");
        
        // XOR (Exclusive-OR)
        boolean xor = a ^ b;
        System.out.println("a XOR b = " + xor + " (" + (xor ? 1 : 0) + ")");
        
        // Truth tables
        truthTables();
        
        // Switching algebra laws
        switchingAlgebraLaws();
        
        // Practical applications
        practicalApplications();
    }
    
    private static void truthTables() {
        System.out.println("\n=== Truth Tables ===");
        
        System.out.println("A B | AND | OR | XOR | NAND | NOR");
        System.out.println("---+-----+----+-----+------+----");
        
        for (int a = 0; a <= 1; a++) {
            for (int b = 0; b <= 1; b++) {
                boolean aBool = a == 1;
                boolean bBool = b == 1;
                
                int and = (aBool && bBool) ? 1 : 0;
                int or = (aBool || bBool) ? 1 : 0;
                int xor = (aBool ^ bBool) ? 1 : 0;
                int nand = !(aBool && bBool) ? 1 : 0;
                int nor = !(aBool || bBool) ? 1 : 0;
                
                System.out.printf("%d %d |  %d  | %d  |  %d  |  %d   | %d%n", 
                                a, b, and, or, xor, nand, nor);
            }
        }
    }
    
    private static void switchingAlgebraLaws() {
        System.out.println("\n=== Switching Algebra Laws ===");
        
        boolean x = true;
        boolean y = false;
        boolean z = true;
        
        // Commutative laws
        System.out.println("Commutative laws:");
        System.out.println("x AND y = y AND x: " + ((x && y) == (y && x)));
        System.out.println("x OR y = y OR x: " + ((x || y) == (y || x)));
        
        // Associative laws
        System.out.println("\nAssociative laws:");
        System.out.println("(x AND y) AND z = x AND (y AND z): " + 
                          ((x && y) && z == x && (y && z)));
        System.out.println("(x OR y) OR z = x OR (y OR z): " + 
                          ((x || y) || z == x || (y || z)));
        
        // Distributive laws
        System.out.println("\nDistributive laws:");
        System.out.println("x AND (y OR z) = (x AND y) OR (x AND z): " + 
                          (x && (y || z) == (x && y) || (x && z)));
        System.out.println("x OR (y AND z) = (x OR y) AND (x OR z): " + 
                          (x || (y && z) == (x || y) && (x || z)));
        
        // De Morgan's laws
        System.out.println("\nDe Morgan's laws:");
        System.out.println("NOT (x AND y) = NOT x OR NOT y: " + 
                          (!(x && y) == (!x || !y)));
        System.out.println("NOT (x OR y) = NOT x AND NOT y: " + 
                          (!(x || y) == (!x && !y)));
        
        // Idempotent laws
        System.out.println("\nIdempotent laws:");
        System.out.println("x AND x = x: " + (x && x == x));
        System.out.println("x OR x = x: " + (x || x == x));
        
        // Null element laws
        System.out.println("\nNull element laws:");
        System.out.println("x AND 0 = 0: " + (x && false == false));
        System.out.println("x OR 1 = 1: " + (x || true == true));
        
        // Identity laws
        System.out.println("\nIdentity laws:");
        System.out.println("x AND 1 = x: " + (x && true == x));
        System.out.println("x OR 0 = x: " + (x || false == x));
        
        // Complement laws
        System.out.println("\nComplement laws:");
        System.out.println("x AND NOT x = 0: " + (x && !x == false));
        System.out.println("x OR NOT x = 1: " + (x || !x == true));
        System.out.println("NOT (NOT x) = x: " + (!(!x) == x));
    }
    
    private static void practicalApplications() {
        System.out.println("\n=== Practical Applications ===");
        
        // Security system: Multiple conditions must be met
        boolean passwordCorrect = true;
        boolean biometricSuccessful = true;
        boolean accessGranted = passwordCorrect && biometricSuccessful;
        System.out.println("Access granted (AND): " + accessGranted);
        
        // Emergency exit: At least one condition must be met
        boolean fireDectected = false;
        boolean emergencyButtonPressed = true;
        boolean alarmActive = fireDectected || emergencyButtonPressed;
        System.out.println("Alarm active (OR): " + alarmActive);
        
        // Parity check: XOR for error detection
        int data = 0b1011001;  // 7 bits
        int parityBit = 0;
        for (int i = 0; i < 7; i++) {
            parityBit ^= (data >> i) & 1;  // XOR for parity
        }
        System.out.println("Parity bit: " + parityBit + " (even parity)");
        
        // Multiplexer selection
        int select = 2;  // 0, 1, 2, or 3
        boolean select0 = (select & 1) == 0 && (select & 2) == 0;
        boolean select1 = (select & 1) == 1 && (select & 2) == 0;
        boolean select2 = (select & 1) == 0 && (select & 2) == 2;
        boolean select3 = (select & 1) == 1 && (select & 2) == 2;
        
        System.out.println("Multiplexer selection " + select + ":");
        System.out.println("  Output 0: " + select0);
        System.out.println("  Output 1: " + select1);
        System.out.println("  Output 2: " + select2);
        System.out.println("  Output 3: " + select3);
    }
}

2. Logic Gates as Circuits (Python)

class LogicGate:
    """Implementation of logic gates"""
    
    @staticmethod
    def and_gate(a, b):
        """AND gate"""
        return a and b
    
    @staticmethod
    def or_gate(a, b):
        """OR gate"""
        return a or b
    
    @staticmethod
    def not_gate(a):
        """NOT gate (inverter)"""
        return not a
    
    @staticmethod
    def nand_gate(a, b):
        """NAND gate"""
        return not (a and b)
    
    @staticmethod
    def nor_gate(a, b):
        """NOR gate"""
        return not (a or b)
    
    @staticmethod
    def xor_gate(a, b):
        """XOR gate"""
        return a != b
    
    @staticmethod
    def xnor_gate(a, b):
        """XNOR gate (equivalence)"""
        return a == b

class CircuitDesign:
    """Design of digital circuits"""
    
    @staticmethod
    def half_adder(a, b):
        """Half adder: sum and carry"""
        sum_bit = LogicGate.xor_gate(a, b)
        carry = LogicGate.and_gate(a, b)
        return sum_bit, carry
    
    @staticmethod
    def full_adder(a, b, c_in):
        """Full adder: with input carry"""
        # First half adder
        sum_bit1, carry1 = CircuitDesign.half_adder(a, b)
        
        # Second half adder
        sum_bit2, carry2 = CircuitDesign.half_adder(sum_bit1, c_in)
        
        # Final carry
        carry_out = LogicGate.or_gate(carry1, carry2)
        
        return sum_bit2, carry_out
    
    @staticmethod
    def multiplexer(a, b, s):
        """2-to-1 multiplexer"""
        # When s=0, output=a; when s=1, output=b
        not_s = LogicGate.not_gate(s)
        output_a = LogicGate.and_gate(a, not_s)
        output_b = LogicGate.and_gate(b, s)
        return LogicGate.or_gate(output_a, output_b)
    
    @staticmethod
    def demultiplexer(d, s):
        """1-to-2 demultiplexer"""
        # When s=0, y0=d, y1=0; when s=1, y0=0, y1=d
        not_s = LogicGate.not_gate(s)
        y0 = LogicGate.and_gate(d, not_s)
        y1 = LogicGate.and_gate(d, s)
        return y0, y1
    
    @staticmethod
    def rs_flipflop(r, s, q_old):
        """RS flipflop (asynchronous)"""
        # Q_new = (S OR (NOT R AND Q_old))
        not_r = LogicGate.not_gate(r)
        temp = LogicGate.and_gate(not_r, q_old)
        q_new = LogicGate.or_gate(s, temp)
        q_bar_new = LogicGate.not_gate(q_new)
        return q_new, q_bar_new

def print_truth_table(gate_name, gate_function):
    """Prints truth table for a gate"""
    print(f"\n=== {gate_name} ===")
    print("A B | Output")
    print("---+--------")
    
    for a in [False, True]:
        for b in [False, True]:
            result = gate_function(a, b)
            print(f"{int(a)} {int(b)} |   {int(result)}")

def main():
    """Main program with demonstrations"""
    
    # Truth tables
    print_truth_table("AND", LogicGate.and_gate)
    print_truth_table("OR", LogicGate.or_gate)
    print_truth_table("NAND", LogicGate.nand_gate)
    print_truth_table("NOR", LogicGate.nor_gate)
    print_truth_table("XOR", LogicGate.xor_gate)
    print_truth_table("XNOR", LogicGate.xnor_gate)
    
    # Circuit design demonstrations
    print("\n=== Half Adder ===")
    for a in [False, True]:
        for b in [False, True]:
            sum_bit, carry = CircuitDesign.half_adder(a, b)
            print(f"{int(a)} + {int(b)} = Sum: {int(sum_bit)}, Carry: {int(carry)}")
    
    print("\n=== Full Adder ===")
    for a in [False, True]:
        for b in [False, True]:
            for c_in in [False, True]:
                sum_bit, carry = CircuitDesign.full_adder(a, b, c_in)
                print(f"{int(c_in)}{int(a)} + {int(b)} = Sum: {int(sum_bit)}, Carry: {int(carry)}")
    
    print("\n=== Multiplexer ===")
    for s in [False, True]:
        output = CircuitDesign.multiplexer(True, False, s)
        print(f"Select {int(s)}: Output = {int(output)}")
    
    print("\n=== RS Flipflop ===")
    q_old = False
    print(f"Q_old = {int(q_old)}")
    
    # Set
    q_new, q_bar_new = CircuitDesign.rs_flipflop(False, True, q_old)
    print(f"S=1, R=0: Q={int(q_new)}, Q_bar={int(q_bar_new)}")
    
    # Hold
    q_new, q_bar_new = CircuitDesign.rs_flipflop(False, False, q_new)
    print(f"S=0, R=0: Q={int(q_new)}, Q_bar={int(q_bar_new)}")
    
    # Reset
    q_new, q_bar_new = CircuitDesign.rs_flipflop(True, False, q_new)
    print(f"S=0, R=1: Q={int(q_new)}, Q_bar={int(q_bar_new)}")

if __name__ == "__main__":
    main()

3. Boolean Algebra with Bit Operations (C++)

#include <iostream>
#include <bitset>
#include <string>

class BooleanAlgebraCPP {
public:
    // Bit operations for logic gates
    static bool and_gate(bool a, bool b) {
        return a & b;
    }
    
    static bool or_gate(bool a, bool b) {
        return a | b;
    }
    
    static bool not_gate(bool a) {
        return !a;
    }
    
    static bool nand_gate(bool a, bool b) {
        return !(a & b);
    }
    
    static bool nor_gate(bool a, bool b) {
        return !(a | b);
    }
    
    static bool xor_gate(bool a, bool b) {
        return a ^ b;
    }
    
    // Boolean functions with multiple inputs
    static bool and_n(bool inputs[], int n) {
        bool result = true;
        for (int i = 0; i < n; i++) {
            result &= inputs[i];
        }
        return result;
    }
    
    static bool or_n(bool inputs[], int n) {
        bool result = false;
        for (int i = 0; i < n; i++) {
            result |= inputs[i];
        }
        return result;
    }
    
    // Parity check
    static bool even_parity(unsigned int value) {
        bool parity = false;
        while (value > 0) {
            parity ^= (value & 1);
            value >>= 1;
        }
        return !parity;  // Even parity
    }
    
    // Gray code conversion
    static unsigned int decimal_to_gray(unsigned int decimal) {
        return decimal ^ (decimal >> 1);
    }
    
    static unsigned int gray_to_decimal(unsigned int gray) {
        unsigned int decimal = 0;
        while (gray > 0) {
            decimal ^= gray;
            gray >>= 1;
        }
        return decimal;
    }
    
    // Karnaugh map helper
    static void print_karnaugh_map() {
        std::cout << "\n=== Karnaugh Map (2 Variables) ===\n";
        std::cout << "  AB\\CD  00  01  11  10\n";
        std::cout << "  -----------------------\n";
        
        // Example function: F = A'B + AB'
        for (int a = 0; a <= 1; a++) {
            for (int b = 0; b <= 1; b++) {
                std::string ab = std::to_string(a) + std::to_string(b);
                std::cout << "    " << ab << "   ";
                
                for (int c = 0; c <= 1; c++) {
                    for (int d = 0; d <= 1; d++) {
                        // F = A'B + AB'
                        bool f = (!a && b) || (a && !b);
                        std::cout << " " << f << "  ";
                    }
                }
                std::cout << "\n";
                break;  // Only one row for 2 variables
            }
        }
    }
};

int main() {
    std::cout << "=== Boolean Algebra in C++ ===\n";
    
    // Basic operations
    bool a = true;
    bool b = false;
    
    std::cout << "a = " << a << ", b = " << b << "\n";
    std::cout << "a AND b = " << BooleanAlgebraCPP::and_gate(a, b) << "\n";
    std::cout << "a OR b = " << BooleanAlgebraCPP::or_gate(a, b) << "\n";
    std::cout << "NOT a = " << BooleanAlgebraCPP::not_gate(a) << "\n";
    std::cout << "a XOR b = " << BooleanAlgebraCPP::xor_gate(a, b) << "\n";
    
    // Multiple inputs
    std::cout << "\n=== Multiple Inputs ===\n";
    bool inputs[4] = {true, false, true, false};
    std::cout << "AND of all inputs: " << BooleanAlgebraCPP::and_n(inputs, 4) << "\n";
    std::cout << "OR of all inputs: " << BooleanAlgebraCPP::or_n(inputs, 4) << "\n";
    
    // Parity check
    std::cout << "\n=== Parity Check ===\n";
    unsigned int values[] = {0b1011001, 0b1101101, 0b1110000};
    for (unsigned int value : values) {
        std::cout << "Value: " << std::bitset<7>(value) 
                  << ", even parity: " << BooleanAlgebraCPP::even_parity(value) << "\n";
    }
    
    // Gray code
    std::cout << "\n=== Gray Code Conversion ===\n";
    for (unsigned int i = 0; i < 8; i++) {
        unsigned int gray = BooleanAlgebraCPP::decimal_to_gray(i);
        unsigned int back = BooleanAlgebraCPP::gray_to_decimal(gray);
        std::cout << i << " -> " << std::bitset<3>(gray) 
                  << " -> " << back << "\n";
    }
    
    // Bit manipulation
    std::cout << "\n=== Bit Manipulation ===\n";
    unsigned int register_value = 0b10101010;
    
    std::cout << "Original: " << std::bitset<8>(register_value) << "\n";
    
    // Set bit
    unsigned int bit_set = register_value | (1 << 3);
    std::cout << "Set bit 3: " << std::bitset<8>(bit_set) << "\n";
    
    // Clear bit
    unsigned int bit_cleared = register_value & ~(1 << 5);
    std::cout << "Clear bit 5: " << std::bitset<8>(bit_cleared) << "\n";
    
    // Toggle bit
    unsigned int bit_toggled = register_value ^ (1 << 1);
    std::cout << "Toggle bit 1: " << std::bitset<8>(bit_toggled) << "\n";
    
    // Check bit
    bool bit_4_set = (register_value & (1 << 4)) != 0;
    std::cout << "Bit 4 set: " << bit_4_set << "\n";
    
    // Karnaugh map
    BooleanAlgebraCPP::print_karnaugh_map();
    
    return 0;
}

4. Boolean Algebra and Simplification

public class Schaltalgebra {
    
    // Boolesche Ausdrücke als Methoden
    public static boolean ausdruck1(boolean a, boolean b, boolean c) {
        // Original: (A AND B) OR (A AND C)
        return (a && b) || (a && c);
    }
    
    public static boolean ausdruck1Vereinfacht(boolean a, boolean b, boolean c) {
        // Vereinfacht: A AND (B OR C)  (Distributivgesetz)
        return a && (b || c);
    }
    
    public static boolean ausdruck2(boolean a, boolean b, boolean c) {
        // Original: (A OR B) AND (A OR C) AND (NOT B OR C)
        return (a || b) && (a || c) && (!b || c);
    }
    
    public static boolean ausdruck2Vereinfacht(boolean a, boolean b, boolean c) {
        // Vereinfacht: A AND (NOT B OR C) OR (B AND C)
        return (a && (!b || c)) || (b && c);
    }
    
    public static boolean ausdruck3(boolean a, boolean b) {
        // Original: (A AND NOT B) OR (NOT A AND B)
        return (a && !b) || (!a && b);
    }
    
    public static boolean ausdruck3Vereinfacht(boolean a, boolean b) {
        // Vereinfacht: A XOR B
        return a ^ b;
    }
    
    // Wahrheitstabellen für Vergleich
    public static void vergleicheAusdruecke() {
        System.out.println("=== Ausdrucksvergleiche ===");
        System.out.println("A B C | Orig1 | Simp1 | Orig2 | Simp2 | Orig3 | Simp3");
        System.out.println("-------+-------+-------+-------+-------+-------+-------");
        
        for (boolean a : new boolean[]{false, true}) {
            for (boolean b : new boolean[]{false, true}) {
                for (boolean c : new boolean[]{false, true}) {
                    boolean orig1 = ausdruck1(a, b, c);
                    boolean simp1 = ausdruck1Vereinfacht(a, b, c);
                    boolean orig2 = ausdruck2(a, b, c);
                    boolean simp2 = ausdruck2Vereinfacht(a, b, c);
                    boolean orig3 = ausdruck3(a, b);
                    boolean simp3 = ausdruck3Vereinfacht(a, b);
                    
                    System.out.printf("%d %d %d |  %d    |  %d    |  %d    |  %d    |  %d    |  %d%n",
                                    a?1:0, b?1:0, c?1:0,
                                    orig1?1:0, simp1?1:0,
                                    orig2?1:0, simp2?1:0,
                                    orig3?1:0, simp3?1:0);
                }
            }
        }
    }
    
    // NAND-NOR Implementierung (universelle Gatter)
    public static boolean andMitNand(boolean a, boolean b) {
        // AND = NOT(NAND(A,B))
        return !(!(a && b));
    }
    
    public static boolean orMitNand(boolean a, boolean b) {
        // OR = NOT(NAND(NOT(A), NOT(B)))
        return !(!a && !b);
    }
    
    public static boolean notMitNand(boolean a) {
        // NOT = NAND(A,A)
        return !(a && a);
    }
    
    public static boolean xorMitNand(boolean a, boolean b) {
        // XOR = NAND(NAND(A,NAND(A,B)), NAND(B,NAND(A,B)))
        boolean nand_ab = !(a && b);
        boolean nand_a_nandab = !(a && nand_ab);
        boolean nand_b_nandab = !(b && nand_ab);
        return !(nand_a_nandab && nand_b_nandab);
    }
    
    // NOR Implementierung
    public static boolean andMitNor(boolean a, boolean b) {
        // AND = NOR(NOR(A,A), NOR(B,B))
        return !(!a || !b);
    }
    
    public static boolean orMitNor(boolean a, boolean b) {
        // OR = NOT(NOR(A,B))
        return !(a || b);
    }
    
    public static boolean notMitNor(boolean a) {
        // NOT = NOR(A,A)
        return !(a || a);
    }
    
    public static void universaleGatterDemo() {
        System.out.println("\n=== Universale Gatter Demonstration ===");
        
        boolean a = true;
        boolean b = false;
        
        System.out.println("a = " + a + ", b = " + b);
        
        // NAND-Implementierungen
        System.out.println("\nNAND-Implementierungen:");
        System.out.println("AND mit NAND: " + andMitNand(a, b));
        System.out.println("OR mit NAND: " + orMitNand(a, b));
        System.out.println("NOT mit NAND: " + notMitNand(a));
        System.out.println("XOR mit NAND: " + xorMitNand(a, b));
        
        // NOR-Implementierungen
        System.out.println("\nNOR-Implementierungen:");
        System.out.println("AND mit NOR: " + andMitNor(a, b));
        System.out.println("OR mit NOR: " + orMitNor(a, b));
        System.out.println("NOT mit NOR: " + notMitNor(a));
    }
    
    public static void main(String[] args) {
        vergleicheAusdruecke();
        universaleGatterDemo();
        
        // Komplexere Schaltung: 4-zu-1 Multiplexer
        multiplexerDemo();
    }
    
    private static void multiplexerDemo() {
        System.out.println("\n=== 4-zu-1 Multiplexer ===");
        
        boolean d0 = true, d1 = false, d2 = true, d3 = false;
        boolean s0 = true, s1 = false;  // Select-Leitungen
        
        // Multiplexer-Logik
        boolean y = (d0 && !s0 && !s1) || 
                   (d1 && s0 && !s1) || 
                   (d2 && !s0 && s1) || 
                   (d3 && s0 && s1);
        
        System.out.println("Daten: D0=" + d0 + ", D1=" + d1 + ", D2=" + d2 + ", D3=" + d3);
        System.out.println("Select: S0=" + s0 + ", S1=" + s1);
        System.out.println("Ausgang Y: " + y);
    }
}

Truth Tables Reference

Basic Gates (2 Inputs)

ABANDORNANDNORXORXNOR
00001101
01011010
10011010
11110001

NOT Gate (1 Input)

ANOT
01
10

Boolean Algebra Laws

Commutative Laws

A ∧ B = B ∧ A
A ∨ B = B ∨ A

Associative Laws

(A ∧ B) ∧ C = A ∧ (B ∧ C)
(A ∨ B) ∨ C = A ∨ (B ∨ C)

Distributive Laws

A ∧ (B ∨ C) = (A ∧ B) ∨ (A ∧ C)
A ∨ (B ∧ C) = (A ∨ B) ∧ (A ∨ C)

De Morgan’s Laws

¬(A ∧ B) = ¬A ∨ ¬B
¬(A ∨ B) = ¬A ∧ ¬B

Idempotent Laws

A ∧ A = A
A ∨ A = A

Identity Laws

A ∧ 0 = 0
A ∨ 1 = 1
A ∧ 1 = A
A ∨ 0 = A

Complement Laws

A ∧ ¬A = 0
A ∨ ¬A = 1
¬(¬A) = A

Logic Gate Symbols

ANSI/IEEE Symbols

  • AND: D-shaped gate
  • OR: Curved gate
  • NOT: Triangle with circle
  • NAND: AND with circle
  • NOR: OR with circle
  • XOR: OR with additional line

DIN Symbols (European)

  • AND: Rectangle with &
  • OR: Rectangle with ≥1
  • NOT: Rectangle with 1
  • NAND: Rectangle with &
  • NOR: Rectangle with ≥1
  • XOR: Rectangle with =1

Combinational Circuits

Adders

  • Half Adder: 2-bit input → Sum + Carry
  • Full Adder: 3-bit input → Sum + Carry
  • Ripple-Carry Adder: Multiple full adders cascaded

Multiplexers/Demultiplexers

  • Multiplexer: Selects one of multiple inputs
  • Demultiplexer: Routes input to one of multiple outputs
  • Applications: Data buses, addressing schemes

Encoders/Decoders

  • Encoder: Multiple inputs → Binary code
  • Decoder: Binary code → Multiple outputs
  • Applications: Keyboards, 7-segment displays

Advantages and Disadvantages

Advantages of Boolean Algebra

  • Simplicity: Only two states
  • Reliability: Robust digital circuits
  • Optimization: Complex logic can be minimized
  • Automation: Well-suited for computer design

Disadvantages

  • Abstraction: Not intuitive for complex problems
  • Limitation: Binary logic only
  • Scalability: Large circuits become difficult to manage

Common Exam Questions

  1. Create the truth table for XOR. XOR is true when the inputs differ.

  2. What do De Morgan’s laws state? ¬(A ∧ B) = ¬A ∨ ¬B and ¬(A ∨ B) = ¬A ∧ ¬B

  3. Why are NAND and NOR universal gates? All other logical functions can be implemented using only NAND or NOR gates.

  4. What’s the difference between a half adder and a full adder? A half adder has 2 inputs, while a full adder has 3 inputs (including carry).

Key Resources

  1. https://de.wikipedia.org/wiki/Boolesche_Algebra
  2. https://de.wikipedia.org/wiki/Logikgatter
  3. https://www.tutorialspoint.com/digital_electronics/
Back to Blog
Share:

Related Posts