2: Boolean logic | Course - StudyGenius | StudyGenius

Course Progress

Victories 0/71
Finished 0/71

StudyGenius Logo

2: Boolean logic

Choose your name

QuantumQuill

Your opponent is:

QuantumQuill

2,155 pts

7 days ago

Choose your name

QuantumQuill

Your opponent is

QuantumQuill

2,155 pts
7 days ago
The quiz will be on the following text — learn it for the best chance to win.
Boolean Logic: The Simple Rules Behind Computing Decisions

Imagine you're deciding whether to go outside. You might think: "If it's sunny AND not raining, I'll go." Or, "If I have an umbrella OR it's not too hot, I might go anyway." These everyday decisions use a type of reasoning called Boolean logic—a core concept in computing. Named after mathematician George Boole, this system uses only true and false values (or 1 and 0) to make clear, unambiguous choices—exactly what computers need to operate.

The Three Key Operators

Boolean logic relies on three basic operations:

  1. AND (\land)

    • Both inputs must be true for the result to be true.
    • Example: "I have a ticket AND the concert is today" → Only true if both are true.
    • Truth table:
      ABResult
      000
      010
      100
      111
  2. OR (\lor)

    • At least one input must be true for the result to be true.
    • Example: "I’ll drink coffee OR tea" → True if either (or both) are available.
    • Truth table:
      ABResult
      000
      011
      101
      111
  3. NOT (¬\lnot)

    • Reverses the input (true becomes false, false becomes true).
    • Example: "I do NOT like broccoli" → If "like" is false, "dislike" is true.
    • Truth table:
      AResult
      01
      10
Combining Operators

Like building with LEGO blocks, you can combine AND, OR, and NOT to create logic gates. For example:

  • XOR (Exclusive OR): "Either A OR B, but not both." Made by combining NOT, AND, and OR gates.
  • NAND: "NOT AND" — Only false when both inputs are true.
Why Computers Love Boolean Logic

Inside every computer, millions of tiny switches called transistors use Boolean logic to control electricity. They form physical logic circuits that:

  • Add binary numbers (e.g., 1+1=101 + 1 = 10).
  • Compare values (e.g., "Is A>BA > B?").
  • Store data in memory.

Even in programming, Boolean logic helps make decisions:

if (is_raining == True) and (has_umbrella == False):  
    print("Stay indoors!")  

Here, and ensures both conditions must be true to trigger the message.

Real-World Analogy

Think of two light switches controlling one bulb:

  • AND setup: Both switches must be "ON" for the light to turn on.
  • OR setup: Either switch can turn the light on.

This simplicity makes Boolean logic universal—from your phone’s processor to internet searches!