# Having trouble understanding the truth table?

Discussion in 'Homework Help' started by pfelectronicstech, Aug 2, 2012.

1. ### pfelectronicstech Thread Starter Member

Jan 18, 2012
178
4
Hey guys I'm having trouble understanding the overall concept of the "truth table". Anyone have a simple way of explaining it, or simpler explanation of the overall theory? Is this used a lot in Electronics? Thanks for the help.

2. ### MrChips Moderator

Oct 2, 2009
12,449
3,364
It is used a lot in digital electronics.

A truth table is a tabular representation of outputs given all the possible inputs.

If you have one input variable, there are four possible logical outcomes.

For two input variables, there are four possible input conditions. Yet there are 16 possible outcomes.

A truth table shows all possible inputs and the resulting output.

Try doing a truth table for one input.
Try doing a truth table for two inputs.

pfelectronicstech likes this.
3. ### skusku Active Member

Aug 9, 2009
63
1
Are you referring to normal boolean gates for the truth table. AND OR NOR EX-OR etc...?

pfelectronicstech likes this.
4. ### pfelectronicstech Thread Starter Member

Jan 18, 2012
178
4
Yes I should have mentioned that, sorry. Normal Boolean gates for AND, OR NOR, EXOR, Thanks again, its just confusing the hell out of me.

5. ### WBahn Moderator

Mar 31, 2012
17,769
4,804
Perhaps this will help.

We use Boolean logic all the time in everyday conversation, though we can get a bit sloppy with it. Still, it forms the basis of formal Boolean logic.

For instance, you tell your 6-year old son that he can go out and play if he finished his homework AND cleans his room.

So we have two T/F inputs and one T/F output:

Input A: Did you finish your homework?
Input B: Did you clean your room?
Output Y: Can you go out and play?

Using what we mean in everyday usage should convince you that the following is the truth table:

AND
 A B Y F F F F T F T F F T T T

Now consider the case in which you tell your son you can go out and play as long as you finish your homework OR clean your room (possibly with the caveat that he has to do the other after he comes back in, but that's irrelevant).

Again, using our understanding of everyday usage, you should be able to convince yourself that this is what is now meant:

OR
 A B Y F F F F T T T F T T T T

But what about the following case: You tell your son that he can go to the movies OR go to the arcade. Does this have the same every day meaning as the word 'OR' above? No. Here we mean that he can do one, or the other, but not both.

It turns out that humans use the word 'or' two very different, though related, ways (I don't know if that is true in all languages, or if it is just an artifact of some languages). We use it when we mean 'at least one' and we use it when we mean 'exactly one'. While humans are pretty good about determining which is meant based on the context, in a formal logic situation we need the definitions to be exact and unambiguous. So we use two different logic OR, the inclusive-OR and the exclusive-OR. The inclusive-OR is the one that means 'at least one of the inputs is True' and the exclusive-OR means 'exactly one of the (two) inputs is True'. By convention, if we just use OR, we mean inclusive-OR while we are always explicit and use XOR to indicate exclusive-OR. You will also sometimes see IOR to explicitly indicate inclusive-OR.

XOR
 A B Y F F F F T T T F T T T F

As for the NAND and NOR, that simply means that whatever the AND or OR would have given you, you take the opposite:

NAND
 A B Y F F T F T T T F T T T F

NOR
 A B Y F F T F T F T F F T T F

We can do the same thing with the XOR, namely make a gate that produces the opposite result. That could be called an NXOR, but by convention we call it an XNOR. If you look at the truth table for the NOR, you should see that calling the NXOR an exclusive-NOR (or XNOR) is perfectly reasonable and consistent.

XNOR
 A B Y F F T F T F T F F T T T

As an aside, consider how many different truth tables you can have for two-input Boolean logic gate. Turns out there are sixteen, since you have four distinct input possibilities and each has two possible output assignments, so you have 2^4 = 16.

If we want to only consider symmetric gates, meaning gates in which the order or A and B doesn't matter, then we have eight possibilities. Two of these are trivial cases, namely when the output is always F and when the output is always T. So we have six remaining. These six are: AND, OR, XOR and their inverted-output variants NAND, NOR, and XNOR.

XNOR
 A B AND NAND OR NOR XOR XNOR F F F T F T F T F T F T T F T F T F F T T F T F T T T F T F F T

Adding the 1-bit gates, INV and BUF, we have eight fundamental gates that you should become completely comfortable with:

1-INPUT
INV - Produce the opposite of the input
BUF - Produce the same as the input (not really useful in Boolean logic, but very useful in practical circuits in which you want to isolate or improve the drive strength without changing the underlying logic)

2-INPUT
AND - Produce a True output if BOTH inputs are True (otherwise produce a False).
OR - Produce a True output if ANY input is True (otherwise produce a False).
XOR - Produce a True output if exactly ONE input is True (otherwise produce a False).
NAND - Produce a True output UNLESS both inputs are True (otherwise produce a False).
NOR - Produce a True output UNLESS any input is True (otherwise produce a False).
XNOR - Produce a Trye output UNLESS exactly one input is True (otherwise produce a False).

Notice how the definitions in the second group simply exchange the word 'if' for the word 'unless'.

Other meanings can be applied to the truth tables, such as:

XOR: Produce a True if the inputs are different.
XNOR: Produce a True if the inputs are the same.

XOR: Produce a True if an odd number of inputs are True.
XNOR: Produce a True if an even number of inputs are True.

Many times, casting a problem in terms of one of these alternate interpretations makes things a lot easier to wrap your mind around.

Last edited: Aug 2, 2012
pfelectronicstech likes this.
6. ### pfelectronicstech Thread Starter Member

Jan 18, 2012
178
4
Is there a BIG thanks command, because that was awesome. I think i was over thinking it, and believe me, I do that a lot. New ET's I would guess over think things, and gets them into trouble, but gains them experience. Thank you again, where did you find that? I hope you didn't have to write that whole thing out?

7. ### WBahn Moderator

Mar 31, 2012
17,769
4,804
I'm glad you found it useful. I wrote the whole thing out from scratch, which is what I do for nearly all of my posts.

pfelectronicstech likes this.
8. ### pfelectronicstech Thread Starter Member

Jan 18, 2012
178
4
Oh well I thank you, and I'm sorry you had to write that whole thing out. I only hope to find a veteran Tech. at my first job that will be as helpful. I heard some techs. are good and helpful, but some don't want to know who you are. Again I appreciate that VERY much, I was WAY over thinking the subject.

9. ### WBahn Moderator

Mar 31, 2012
17,769
4,804
Oh, I don't mind at all. If I did I wouldn't do it! If you thought that was long, you should see some of my others!

I definitely hope you find some helpful techs, but also hope you find some helpful engineers. We can be a pretty handy thing to have around, too.

10. ### pfelectronicstech Thread Starter Member

Jan 18, 2012
178
4
Ah ha you are an Engineer. Awesome, if I could go back in time to HS, I would have become an Electronics engineer. I look back and say what a big dummy, that is something i would love to be, and there is a shortage of. Oh well a Electronics tech. with some specialized training in either PLC's or fiber optics is not to bad. Hope to find an Engineer as helpful as you.