24
Well, the question is just this, I want to know what it is and for what purpose a truth table.
I don’t want to know all the details, just a basic definition and an example.
24
Well, the question is just this, I want to know what it is and for what purpose a truth table.
I don’t want to know all the details, just a basic definition and an example.
21
It’s like a table of tables, but in another context.
It demonstrates the results of Boolean algebra operations. Having only two input values and two possible results is always very easy to demonstrate in a table everything that can occur with a boolean expression.
Boolean expression is one that works with operands that only allow 0 or 1.
You can create the table for any Boolean expression, but there are already tables ready for basic logic operations and eventually some basic compound.
Main operators:
Conjunction
Disjunction
Implication
Equality
Exclusive disjunction
Nonconjunction
Nondisjunction
T = true, F = false
∧ = AND (conjunção)
∨ = OR (disjunção)
∨ = XOR (ou exclusivo)
∧ = XNOR (não ou exclusivo)
→ = condicional "if-then"
← = condicional "(then)-if"
⟺ = bicondicional "if-and-only-if" igual ao XNOR
8
First, let’s start with a simpler question: What is a multiplication table?
A table is a table that lists several possible values of an account to be held. For example, in the table of 3, we have 3 0 = 0, 3 1 = 3, 3 2 = 6, 3 3 = 9... Note that the format is always 3 a = n, where to is an input value and n is an output value.
Already in a complete table of what is learned in schools, we have all the values of a b = n, where to and b range from 0 to 10 and n is the exit. In this case, we have two entrances.
You can assemble tables of this type for any function, operator or mathematical expression. For example, here is the function table f(x) = x² + 2:
x | f(x)
----+------
0 | 2
1 | 3
2 | 6
3 | 11
4 | 18
5 | 27
6 | 38
...
Now, imagine that instead of numbers, you use boolean values to assemble these tables. The input and output values are now only sets of true and false. For example, here is the function table f(x) = NO x:
x | f(x)
---+-----
V | F
F | V
This table for boolean functions or operators is the truth table. It is the boolean logic equivalent for tabulated tables of mathematical operations.
There is something interesting to note here. Tables of mathematical tables are usually infinite. This is because the possible input values are also infinite. For example, in a tabular table of 3 (3 a = n), there are infinite possible values for to, and therefore, infinite lines in the table. In the case of truth tables, since each variable can only have a finite number of values (and this number is 2 - true or false), then the table size is finite.
The basic operators of Boolean logic are the NO (denoter by symbol ¬
), OR (denoted by ∨
) and E (denoted by ∧
). Other operators you will find are also OR-EXCLUSIVE (also called XOR, denoted by ⊻
), a EQUIVALENCE (denoted by ↔
) and IMPLICATION (denoted by →
). These are their truth tables:
x | ¬x
---+----
V | F
F | V
x | y | x ∧ y
---+---+-------
V | V | V
V | F | F
F | V | F
F | F | F
x | y | x ∨ y
---+---+-------
V | V | V
V | F | V
F | V | V
F | F | F
x | y | x ⊻ y
---+---+-------
V | V | F
V | F | V
F | V | V
F | F | F
x | y | x ↔ y
---+---+-------
V | V | V
V | F | F
F | V | F
F | F | V
x | y | x → y
---+---+-------
V | V | V
V | F | F
F | V | V
F | F | V
We can see that all the above truth tables (except NO) have the same variables as input. We can then build a table like this:
x | y | x ∧ y | x ∨ y | x ⊻ y | x ↔ y | x → y
---+---+-------+-------+-------+-------+-------
V | V | V | V | F | V | V
V | F | F | V | V | F | F
F | V | F | V | V | F | V
F | F | F | F | F | V | V
This is actually 5 truth tables placed side by side, because the entries are the same. This serves to be able to compare the different output values when the input values are the same, besides being simpler to look at.
An example of a more complicated truth table is a function f(x, y, z) = (x y) z:
x | y | z | f(x, y, z)
---+---+---+------------
V | V | V | V
V | F | V | F
F | V | V | F
F | F | V | F
V | V | F | V
V | F | F | V
F | V | F | V
F | F | F | V
As for the truth table size, we can see that the table lists in each row, a possible combination of input values. Knowing that each variable has two possible values, then a truth-table of a function/operator/boolean expression of n variables will need 2n table rows to list all possible input combinations.
One way to compare whether two or more functions/operators/expressions are equivalent is to compare truth tables. For example, let’s compare the expressions x y, y x and y x:
x | y | x → y | y ∨ ¬x | y → x
---+---+-------+--------+-------
V | V | V | V | V
V | F | F | F | V
F | V | V | V | F
F | F | V | V | V
Looking at these tables, we can conclude that the expression x y produces the same result as y x, because their truth tables are equal. If they are equal then they are equivalent expressions (such as c + c is equivalent to 2 c or how c c is equivalent to c2). However, they are different than y x.
8
A truth table is a tabular representation of all combinations of values for inputs and their corresponding outputs. It is a mathematical table that shows all possible results that will occur from all possible scenarios that are considered factual, hence the name. Truth tables are usually used for logic problems such as in Boolean algebra and electronic circuits.
Example of use
To test logical sentences like this in the image above, we refer to the truth table like the one below:
5
Like in that explanation if you need to focus your application on a single output, you can use the truth table to know which entries you need.
Let’s say you have a two-sensor alarm system and you need to encode that system:
^ = AND
V = OR
V_ = XOR
With this table you can know in which cases your alarm will sound, need to sound when two sensors are activated? use sensor1 AND sensor2
, only when one or more sensor is active? use sensor1 OR sensor2
,when only one sensor is active? use sensor1 XOR sensor2
It is a basic and easy to understand example.
Browser other questions tagged logic boolean-algebra
You are not signed in. Login or sign up in order to post.
Related: What is the difference between Tautology, Contradictions and Contingencies?
– rray