Boolean Expressions
Learn to write and evaluate Boolean expressions with 1 and 0, use the order of operations NOT, AND, OR, and build their full truth tables.
Advanced25 min18 problems
Definition
A Boolean expression is a formula built from Boolean variables (letters such as , , ), the values (true) and (false), and the operators AND (), OR () and NOT (). Just like in arithmetic, a Boolean expression has exactly one value, but that value is always or .
The three operators with 1 and 0:
- flips the value: and
- is only when both and are
- is when at least one of them is
Order of operations: first parentheses, then NOT, then AND, then OR.
So means , and means .
Example: evaluate for , , :
An expression with variables has input combinations. Its truth table lists the value of the expression for every one of them, starting with the row where all variables are . Two expressions are equivalent when their final columns match in every row. (The Truth Tables lesson started with the all-true row instead; any fixed order works. The interactive truth tables in this lesson also use and .)
Try it now
In (no parentheses), which operation is done first?
Interactive Visual
Truth Table
ExpressionA ∨ B ∧ ¬C
| A | B | C | ¬C | B ∧ ¬C | A ∨ B ∧ ¬C |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 1 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 0 |
| 0 | 1 | 0 | 1 | 1 | 1 |
| 0 | 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 0 | 1 | 0 | 1 |
| 1 | 0 | 1 | 0 | 0 | 1 |
| 1 | 1 | 0 | 1 | 1 | 1 |
| 1 | 1 | 1 | 0 | 0 | 1 |
1= True0= False
Truth Table
ExpressionA ∨ ¬A ∧ B
| A | B | A ∨ ¬A ∧ B |
|---|---|---|
| 0 | 0 | |
| 0 | 1 | |
| 1 | 0 | |
| 1 | 1 |
1= True0= False
Interactive Sandbox
Expression Calculator
Try these:
History
No calculations yet
Practice Problems
18 problemsProblem 1 of 18
Easy
In (no parentheses), which operation is done first?
Glossary
- Boolean variable
- A letter such as , or that can only take the values 1 (true) or 0 (false)
- Boolean expression
- A formula made of Boolean variables, the values 1 and 0 and the operators , ,
- Order of operations
- The rule for which operator is done first: parentheses, then NOT, then AND, then OR
- Truth table
- A table that lists the value of an expression for all combinations of its variables
- Equivalent
- Two expressions are equivalent when they have the same value in every row of the truth table
Formula Card
Order of operations
Parentheses first, then NOT, then AND, then OR
NOT
Flips the value of what comes directly after it
AND and OR
AND is 1 only if both are 1; OR is 0 only if both are 0
Number of rows
$n$ is the number of variables: $2^2 = 4$, $2^3 = 8$