There are three basic logical operations that may be used in boolean algebra - NOT, AND, and OR. The first operation, NOT, does mathematical negation on its input. The AND operator takes two or more inputs, and returns the truth of whether or not all the inputs are true. Similarly, the OR operator takes two or more inputs and returns the truth of whether or not any of the inputs are true. NOT is represented by a bar over the boolean variable (\(\bar{x}\)), AND appears as implicit multiplication (\(xy\)), and OR appears as a plus sign (\(x + y\)). NOT has the highest precedence in order of operations, meaning that it gets evaluated before any other operators. AND is in the middle, and OR comes in last.
Because logical operations are deterministic (the same output is produced for each unique combination of inputs), their entire behavior may be definitively described by exhaustively listing all input combinations for the function and mapping them to the produced output. These mappings are known as truth tables. Here are truth tables for the NOT, AND, and OR operations:
Because logical operations are deterministic (the same output is produced for each unique combination of inputs), their entire behavior may be definitively described by exhaustively listing all input combinations for the function and mapping them to the produced output. These mappings are known as truth tables. Here are truth tables for the NOT, AND, and OR operations:
\(x\) | \(\bar{x}\) |
---|---|
0 | 1 |
1 | 0 |
\(x\) | \(y\) | \(xy\) |
---|---|---|
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
\(x\) | \(y\) | \(x+y\) |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |