Introduction to Boolean Logic
Learn the fundamentals of Boolean logic and how TRUE/FALSE values work in mathematics and computing.
Definition
- AND (): Both must be true
- OR (): At least one must be true
- NOT (): Reverses the value
Try it now
Worked Examples
You need both a ticket AND a valid ID to enter. If you have a ticket (TRUE) but no ID (FALSE), can you enter?
Identify the values
Ticket = TRUE (1), ID = FALSE (0) → Two Boolean values
Apply AND rule
AND requires BOTH to be TRUE → TRUE AND FALSE
Evaluate
Since one value is FALSE, the result is FALSE →
Answer: No, you cannot enter. TRUE AND FALSE = FALSE
Common Mistakes
Thinking OR means 'one or the other, but not both'
Why it's wrong: In everyday language, 'or' often implies exclusivity. In Boolean logic, OR includes the case where both are true.
Correct: In Boolean logic: TRUE OR TRUE = TRUE. OR means 'at least one is true'.
Confusing AND with OR
Why it's wrong: Both combine two values, so it's easy to mix them up.
Correct: AND is stricter (needs BOTH true). OR is more lenient (needs just ONE true).
Forgetting that NOT flips the value completely
Why it's wrong: Students sometimes think NOT makes something 'less true' rather than the opposite.
Correct: NOT is absolute: NOT TRUE = FALSE, NOT FALSE = TRUE. No middle ground.
Interactive Visual
Truth Table
| P | Q | P ∧ Q |
|---|---|---|
| F | F | F |
| F | T | F |
| T | F | F |
| T | T | T |
T= TrueF= False
Interactive Sandbox
Expression Calculator
Try these:
History
No calculations yet
Practice Problems
15 problemsIn Boolean logic, how many possible values are there?
Why It Matters
- Computers: Every computer operation breaks down to billions of TRUE/FALSE decisions
- Search Engines: When you search "cats AND dogs", the engine uses Boolean logic
- Video Games: If (player_health = 0) AND (lives = 0) then game_over = TRUE
- Everyday Decisions: "I'll go outside IF it's sunny AND warm"
- Passwords: Access granted IF (username_correct AND password_correct)
Real World Applications
Search Engines
Search engines use Boolean logic to filter results based on your query.
Example:
Searching 'pizza AND delivery AND NOT expensive' finds pizza places that deliver but aren't pricey.
You search for: 'cats OR dogs AND NOT fish'
Would a page about 'cats and fish' appear in results?
Step 1: Write the mathematical expression
Evaluate: cats = TRUE, dogs = FALSE, fish = TRUE
Video Game Logic
Games use Boolean logic constantly to make decisions about gameplay.
Example:
In a racing game: boost_available = (fuel > 50) AND (NOT already_boosting) AND (speed < max_speed)
A player can attack IF (has_weapon AND NOT stunned) OR has_special_power. The player has a weapon (TRUE), is not stunned (FALSE), but has special power (TRUE).
Can the player attack?
Step 1: Write the mathematical expression
Evaluate step by step
Security Systems
Security and access control systems rely heavily on Boolean logic.
Example:
Access granted IF (valid_badge AND correct_PIN) OR (is_admin AND emergency_override)
Building security: alarm_triggered = (motion_detected AND night_mode) OR (window_broken)
It's daytime (night_mode = FALSE), motion is detected (TRUE), and no windows are broken (FALSE). Does the alarm trigger?
Step 1: Write the mathematical expression
Evaluate the security expression
Key Takeaways
- 1Boolean logic uses only two values: TRUE (1) and FALSE (0)
- 2AND () returns TRUE only when BOTH inputs are TRUE
- 3OR () returns TRUE when AT LEAST ONE input is TRUE
- 4NOT () reverses the value: TRUE becomes FALSE, FALSE becomes TRUE
- 5Boolean logic is the foundation of all computing and digital technology
Frequently Asked Questions
Glossary
- Boolean
- A data type or system that has exactly two possible values: TRUE and FALSE
- AND ()
- A logical operator that returns TRUE only if both inputs are TRUE
- OR ()
- A logical operator that returns TRUE if at least one input is TRUE
- NOT ()
- A logical operator that reverses a Boolean value (TRUE becomes FALSE and vice versa)
- Truth Table
- A table showing all possible input combinations and their corresponding outputs for a logical operation
- Binary
- A number system using only two digits (0 and 1), closely related to Boolean logic