### Video Transcript

In this video, we will be looking at a type of logic gate known as an OR gate.

Now a logic gate is a component with one or more inputs and one output, each of which can take on two values: zero or one. In other words then, each one of these inputs and outputs is known as a binary input or output. Bi- meaning two because it can take on one of two values, zero or one. Now, based on the values of the input or inputs as well as the behaviour of that particular logic gate, the value of the output is decided. Now before we discuss specific properties of OR gates, let’s just consider a generic logic gate, in this case one which has one input, and discuss some terminology first.

Now, as we’ve already said, the input or inputs as well as the output on a logic gate can take one of two values. For example, the value of the input could be zero or one and the same is true for the output, zero or one. However, sometimes, we use slightly different terminology. For example, instead of saying that the input or output in question is set to zero, we may say that it’s set to false. And conversely, if either one of them is set to one, we can instead say that it’s set to true. In other words, instead of saying that an input or an output is set to zero or one, we can instead say that it’s set to false or true. Or we could also say that instead of zero or one or false or ture that the input or output in question is set to off or on.

Now, these are just different terminologies. It doesn’t matter which set of terminology we use as long as we know what we’re talking about. Zero corresponds to false or to off and one corresponds to true or to on. It’s worth noting by the way that we most commonly use the off or on terminology when talking about logic gates in electrical circuits. We can say that an input to a logic gate is set to on if there is a current flowing through that input and it’s set to off if there is no current flowing through that input. And of course, the same applies to the output of the logic gate. In other words, based on whether or not there is a current flowing to the inputs of a logic gate, the gate will dictate whether there is a current flowing out of it as well.

So the way that we’ve drawn the diagram here, we can see that the top input is set to one, whereas the bottom input is set to zero. But then, the output of the logic gate that we’ve drawn here is set to one. Or conversely, we could say that the top input is set to on, but the bottom input is set to off and the output is set to on. Or we could use the true, false notation as well if we wanted to. But anyway, so the diagram that we’ve drawn here happens to be that of an OR gate. So let’s look at OR gates in more detail now.

The first thing to consider is that this is the symbol that we use to represent an OR gate. As we can see, it’s got two inputs which are traditionally represented on the left-hand side of any logic gate and one output which is traditionally represented on the right. As well as this, we can see that the gate itself is represented almost as a D shape, but the left-hand edge is curved rather than being a straight line. Now the whole point of a logic gate is that depending on the values of these inputs, a specific output would be produced. And each logic gate behaves in a slightly different way. So to truly understand the behaviour of an OR logic gate, let’s set up something known as a truth table.

Now, a truth table is just a table that shows us what the output value of an end gate will be for every possible combination of input values. And the reason it’s called a truth table is because it shows the particular combination of inputs that will result in a true output or an output of one or on. So to start building a truth table, we need to set up a column for each one of the inputs as well as a column for the output. So let’s say that the first input to our logic gate we will call input A and the second input we will call input B. And of course, the output we will call the output since there’s only one of them.

So here’s the skeleton of our truth table. We’ve got a column for input A, another one for input B, and one more for the output. So let’s start filling in this truth table by saying that the first instance involves both input A and input B, being set to zero. So we can put on our truth table that input A is set to zero and input B is set to zero. Well, in this situation, the behaviour of the OR gate is such that the output is also zero.

Now second scenario: let’s say we keep input A at zero, but we change input B to one. Well, in this situation, the output of the OR gate also becomes one. And so, we can put on our truth table that input A was set to zero, but input B was set to one, resulting in an output of one. Moving on to the third scenario then. Let’s now set input A to one but put input B back to zero. Well, in this case, the OR gate still returns an output of one. And so on our truth table, we can say that input A was set to one and input B was set to zero, resulting in an output of one.

And then, there’s one more combination of inputs that we can put on our truth table. This time, both input A and input B are set to one and the output is still one. And so in our truth table, we can say that input A is one, input B is one, and the output is one as well. Now, why is this? Why is it that an OR gate behaves in this particular way for these combinations of inputs? Well, the reason for this links back to why an OR gate is called an OR gate in the first place. The name of the OR gate comes about because an OR gate gives an output of one or true or on if either input A or input B is set to one or true or on. And we can see that that’s true from the truth table that we’ve set up.

In the first instance, both into A and input B are zero and so the output is zero. However, in the second instance, we switch one of the inputs to one. In this case, it’s input B. And immediately, the output of the OR gate becomes one as well. In the third instance, input A is set to one resulting in an output of one. And in the fourth instance, both inputs are set to one. And so, we have an output of one. In other words, if either input A or input B is set to one, then the output becomes one as well. And in the final instance, both are set to one and the output is still one.

Now in order to clarify our understanding a little bit more about how OR gates work, let’s think about a very simple situation in which an OR gate can be used. Let’s say that we have an OR gate here connected in an electrical circuit. And the output of this OR gate is connected to a lamp. Now, recalling the truth table for an OR gate from earlier, we can see that if both inputs to the OR gate are set to zero, then the output is set to zero as well. In other words, if there’s no current in either of the inputs, then there’s no current in the output. However, as soon as we pass a current through one of the inputs, let’s say input A, then immediately there’s a current flowing through the output of the OR gate. And so, the lamp switches on. And this would also be true if input B was set to one but input A was set to zero or of course if both inputs are set to one.

Now this is quite a useful thing to have because it could act like a double switch. Specifically, both input A and input B could be different switches in different parts of a room to this lamp over here. So if you wanted to switch on the lamp, you could turn on any one of the two switches. So that might seem quite useful. But the annoying thing is that if you want to turn off the lamp at any point, it will not do to simply turn off one of the switches. You will have to turn off the current into both inputs. So a slightly flawed double switch, but you can see how this might be useful in a circuit.

Now in real life, OR gates combine with other logic gates, form a very important part of the circuitry that we can find inside computers. But anyway, so now that we’ve had a fairly detailed look at OR gates, let’s have a look at an example question.

The diagram shows the circuit symbols for four logic gates. Which symbol represents an OR gate?

Okay, so we need to find the diagram for an OR gate. So let’s go through each one of the options one by one. Now the first option looks almost like the diagram for an OR gate. However, this little circle at the right-hand end of the gate just before the output means that this cannot be an OR gate because the circle means that the gate beforehand gets inverted. In other words, whatever the behaviour of this gate before the circle, the circle will take the output value in each case and then flip it. So if we were going to have an output of one, the circle will take it and turn it into zero and vice versa. And so, in reality, option a) is actually the diagram of a NOR gate, where it’s almost like an OR gate, but with a NOT gate after it. So this cannot be the answer to our question.

Option b) then, we see first of all that it’s got a very nice D shape to it. And secondly, it’s got that little circle at the right-hand end as well. Now, D-shaped gates are actually AND gates. And the way to remember that is the word AND has a D at the end. And hence, the AND gate is a D-shaped gate. However, remember what we said about the little circle earlier. It flips the output of the AND gate. And so, the whole gate including the circle is now a NAND gate, in other words a NOT AND gate or an inverted AND gate. And hence, this cannot be our answer either.

Moving on to option c) then, we can see that it’s a D-shaped gate without anything on the right-hand end. And so, this is a traditional AND gate. Hence, this is not the option we’re looking for. And then finally for option d), we can see that this is the shape of an OR gate. It’s almost a D-shaped gate but with a curved left-hand edge. And so at this point, we found the answer to our question. The symbol that represents an OR gate is option d) in this case. Okay, so now that we’ve had a look at this question, let’s take a quick look at another one.

The truth table shows the output of an OR gate for various combinations of inputs. What is the value of 𝑝 in the table? What is the value of 𝑞 in the table?

Okay, so in this question, we’ve been given a truth table, specifically for an OR gate. But instead of it being completely filled with zeros and ones, we can see that in this position we’ve got the letter 𝑝 and in this position we’ve got the letter 𝑞. And in this question, we need to try and work out the values of 𝑝 and 𝑞. So to do this, we need to remember what the behaviour of an OR gate is. We can recall that for an OR gate, the output is one if either input A or input B is set to one.

So we can see that on the first row of the table, both input A and input B are set to zero and therefore the output is zero. However, in the second row of the table, input A is set to zero, but input B is set to one. And so, this condition is fulfilled: either input A or input B is one. In this case, input B is one. Therefore, the value of 𝑝, the value of the output in this case, is going to be one. And hence, that’s our answer to the first part of the question.

Now moving on to the third row, we can see that the value of input A is one, but input B is zero. However, because at least one of the inputs is one, the condition is fulfilled yet again. And so, we see that the output is one. And then, finally, moving on to the final row, both inputs are set to one. And so this condition is actually fulfilled. Now, note when we say that either input A or input B is one, that does not mean that only one of them can be one. In fact, if either of these inputs is one or both of them is one, then the output is still going to be one. And that is the behaviour of an OR gate. If we instead said that the output can only be one, if either input A or input B exclusively were one, in other words only one of the inputs could be one, then that is the behaviour of an XOR gate or an Exclusive OR gate, which is a different logic gate entirely.

And so, as an answer to this question, we can see the value of 𝑞 in this case for a normal OR gate is going to be one. And that is our answer to the second part of the question. Okay, so now that we’ve had a look at a couple of example questions, let’s summarize what we’ve talked about in this lesson.

Firstly, we saw that an OR gate is a logic gate with two binary inputs and one binary output, where the word binary means that it can take on one of two values: zero or one or if we like false or true or off or on. We saw that specifically for an OR gate, the output is one if either input A or input B or both is set to one. And finally, we saw that OR gates along with other logic gates are very useful in electrical circuits and they’re commonly used in the circuitry found in computers.