Welcome. In this video, we will talk more about logic elements. So, in the last series of videos, we’ve seen the NOT logic gate, the AND logic gate and the OR logic gate, and we talked about truth tables. So here’s a quick summary. Here’s a schematic of the NOT gate, the Boolean expression, Y equals A with a bar over it. So that’s how you write Y is not A, and here’s the truth table for the NOT. Similarly, the AND gate, the equation for the Boolean expression for the AND gate and the truth table. The truth table has a one, if and only if both A is true and B is true. So, A is true right here and B is true. That’s the only time when Y is true. For the OR gate, the output Y is a one, if either A is one or B is one. So in this case, we have one for the last three rows of the truth table. Now, these three logic gates can be used to express any logical situation. Any kind of logical situation that we might be able to describe, we can use these three gates, and they’re called universal logics set. So AND, OR and NOT can be used to combine any set of input to provide a desired output, and hence they’re known as a universal set of logic gates. Now, consider an expression such as this, for example, Memorial Day weekend would be perfect if it was not hot and not humid. This is something that we wish every year here in Minnesota. So, Memorial Day weekend would be perfect, that’s if it was not hot and not humid. So let’s take a look at this particular expression in a little more detail. Let’s design a perfect weather machine. Here’s our perfect weather machine that will tell us whether the weather is perfect or not. What are the inputs to this machine? Well, some kind of sensor that measures the heat and provides a one when it’s hot, zero when it’s not hot. So the input is whether it’s hot or not. Then another humidity sensor measures the humidity, and when it’s humid it says humid is true or one, and when it’s not humid it says false or zero. That’s our another input. The output of this machine is determination of whether the weather is perfect or not. So perfect is one or not. Okay, so we can write this as we’ve seen before, as a Boolean expression in this form, perfect weekend is equal to not hot and not humid, it’s not hot and not humid. That was a logical expression for this particular perfect weather machine right here. How would we draw that? So we have this expression right here. We learn how to draw logic gate and cascade them. Here’s our inputs, hot and humid, not hot. This is not hot and not humid. That not humid is being done right here, and then this AND gate right here takes not hot, that’s this location, not humid at that location and creates an AND output to create a perfect weather. If I have to think of this in terms of a truth table. Let’s consider truth table. There are two inputs, hot and humid. It can either be hot, hot can be either zero or it could be a one. Humid could be either zero or it could be a one. So since there are two inputs to this system, each of the inputs can be either true or false, we can have a total of four separate logical conditions. So here are the four conditions. It’s not hot, not humid. All based on this description that if it’s not hot and it’s not humid, then the weather’s perfect, so that becomes a one. If it is not hot but it’s humid, then the weather is not perfect. That’s a zero. If it’s hot but not humid it’s still hot, so it’s not perfect. If it’s hot and it’s humid, then weather is definitely not perfect. This particular truth table represents this case which describe that the weather was perfect if it was not hot and not humid. Let’s take a look at this table. Let’s do a quick flashback to a OR gate. Here’s my OR gate right here. That’s my OR gate. The truth table of the OR gate was 0111, and take a look at this particular truth table with a perfect 1000. So, it looks like this particular perfect is basically exactly the opposite of the output of the OR gate. In other words, perhaps I could draw this as an OR gate, and then followed that with a NOT gate. Because if I look at the truth table, that’s a NOT gate. So if I look at the truth table of this guy right here with the hot and humid, and compare that with the truth table of OR, I see that the output is exactly opposite of what the OR was. This particular statement that said Memorial Day weekend would be perfect if it was not hot and not humid. Another way of saying that exact same statement is, Memorial Day weekend would be perfect if it was neither hot nor humid. So NOR is basically not OR. So OR gate followed by a NOT gate. Instead of drawing the full OR and the NOT gate, we simply combine those two into a single gate. So it still looks like a OR shape. That’s still the OR shape, but instead of drawing a full NOT gate, we just put a bubble on the nose of the OR gate, and that is called the NOR gate. Let’s take a look here, here’s the NOR gate, A, B, Y so that’s the OR shape with a NOT gate compressed into it, so just the bubble there, and we basically write the Boolean expression of that as Y equals A or B with a bar over it. Remember the bar indicates a NOT. So the truth table of this gate is when it’s exactly opposite of the OR, neither A nor B needs to be true. Neither A is true nor B is true, then Y is one. That’s a NOR gate. Similarly, we can combine a AND gate and cascade that with a NOT gate and compress that into what is called a NOT AND or a NAND gate. Here’s a AND gate with a bubble on its nose, that bubble means a NOT. That basically means a NOT, and the Boolean expression for that is Y equals A and B with a bar over it. The truth table is exactly opposite of the AND gate. So that particular type of gate is called a NAND gate. We just saw that logical expressions can be can be rewritten, not just as AND or NOT, everything can be built with AND or NOT, but in some special cases we can create new types of gates called NANDs and NORs, that also help us express the same sentiment as the original logical expression. Now, not all logic gates have just two inputs. So far we’ve been looking at logic gates have one or two inputs, one in the case of a NOT gate, and two in the case of AND or NAND and NOR gates. Well, consider a machine that indicates whether or not I’m happy. Let’s say there’s a machine that tells you whether I’m happy or not, and here’s machine one. Machine one says I will be happy if I get a pizza and a taco and a salad. Well, I’m hungry and it’s really hard to make me happy, I’m happy only if I get a pizza and a taco and a salad. Now consider another machine, machine two, where I will be happy if I get a pizza or a taco or a salad. This second machine it’s a lot easier to make me happy than the first machine. The first machine requires me to have a pizza, a taco as well as a salad. If you say that these three were the inputs to my happiness machine, I would have to have a one on pizza meaning true, a one on taco meaning true and a one on salad also meaning true. I would have to have all three conditions satisfied for me to be happy. Whereas, if you consider this machine where the input pizza, taco and salad. If I get just one of those, I don’t need to eat much. I’m perfectly happy just eating one of those three things. This brings us to a three-input AND gate. AND gate, this is an example of the first machine where I’m happy if all three inputs conditions are met, only if a pizza, taco, and a salad conditions are met I’m happy. A three-input AND gate is written as N3 typically, same shape as a two-input AND gate but with multiple inputs, and the expression is simply Y equals A and B and C. Similarly, the machine two that I was talking about, where I’m happy if I get a pizza or a taco or a salad. Look at this case. In this case, I’m getting a salad, perfectly happy. In this case I’m getting a taco, perfectly happy. In this case I’m getting a taco and a salad, I’m overjoyed. Here I’m getting just a pizza. That’s okay. I’m still happy. Here I’m getting a pizza and a salad, so I’m still happy. In the final case, I’m getting all three stuff, pizza, taco and happy, I’m just jumping up and down so I’m very very happy. This is an example of a OR gate drawn exactly as a simple OR, and then the output is a one if any of the input is true.