Introduction to Boolean Logic

Learn the fundamentals of Boolean logic and how TRUE/FALSE values work in mathematics and computing.

Intermediate20 minLesson

Definition

Boolean logic is a branch of mathematics that deals with only two values: TRUE and FALSE (also represented as 1 and 0).
Named after mathematician George Boole (1815-1864), Boolean logic forms the foundation of all digital computers and modern technology.
Boolean logic uses special operations called logical operators:
  • AND (): Both must be true
  • OR (): At least one must be true
  • NOT (): Reverses the value

Try it now

In Boolean logic, how many possible values are there?

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?

1

Identify the values

Ticket = TRUE (1), ID = FALSE (0)Two Boolean values

2

Apply AND rule

AND requires BOTH to be TRUETRUE AND FALSE

3

Evaluate

Since one value is FALSE, the result is 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
PQP ∧ Q
FFF
FTF
TFF
TTT

T= TrueF= False

Interactive Sandbox

Expression Calculator

Try these:

History

No calculations yet

Practice Problems

15 problems
Problem 1 of 15
Easy

In Boolean logic, how many possible values are there?

Why It Matters

Boolean logic is everywhere in our digital world:
  • 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)
Understanding Boolean logic helps you think more precisely and is essential for programming!

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.

1Try It Yourself

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)

2Try It Yourself

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)

3Try It Yourself

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

It's named after George Boole, an English mathematician who developed this system of logic in the 1840s. His work laid the foundation for digital computing.
It's named after George Boole, an English mathematician who developed this system of logic in the 1840s. His work laid the foundation for digital computing.
Computer circuits can easily distinguish between two states: electricity flowing (1/TRUE) or not flowing (0/FALSE). This binary system is efficient and reliable.
Not quite! In everyday speech, 'Would you like coffee or tea?' usually means one or the other. In Boolean logic, OR includes both - if both are TRUE, the result is still TRUE (called 'inclusive or').

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

More in This Topic