Lesson video

In progress...

Loading...

Welcome to this Oak National Academy lesson which is called Boolean Logic and it's taken from the unit computer systems and data science.

Thank you for joining me for this lesson today, and I hope you enjoy learning along with me.

The outcome of today's lesson is I can describe how computers use Boolean logic and logic gates to make decisions.

Let's get started.

We have three keywords in this lesson.

So the first keyword is Boolean, and Boolean means an expression that evaluates to either true or false.

Then we have logic gate.

So a logic gate is an electronic component that carries out logical operation.

And finally, we have truth table.

And a truth table is a chart that shows all the possible ways a statement can be true or false.

So there's our three keywords, Boolean, logic gate and truth table.

There are two learning cycles in this lesson.

So the first learning cycle is to describe Boolean logic and the second learning cycle is explain logic gates.

So we can now start with that first learning cycle, describe Boolean logic.

The origin of the term comes from George Boole who was an English mathematician and logician, and he was born in 1815.

His work became one of the building blocks of modern computing, even though he himself never got to use a computer.

Boole was particularly interested in how humans think and how they reason.

And he believed that you could use maths to describe logic.

In 1847, he introduced Boolean logic in which all expressions evaluate to either true or false.

So let's find out a little bit more about that.

Boolean logic is about making decisions using true or false values.

And it's this Boolean logic that provides the basic mathematical framework that's made modern computers possible.

Engineers would later go on to combine Boolean logic with electrical circuits to develop modern computers.

So the whole foundation of modern computing is built around Boolean logic, so the impact of his work can't be understated.

Without Boolean logic, we wouldn't have computers as we know them today.

Time for a true or false question, George Boole used modern computers to develop Boolean logic.

Is that true or false? Correct, the answer is false.

Now can you explain why? And it's because modern computers were not invented during Boole's life, yet his work became one of the building blocks of modern computing even though he never got to use a computer.

So let's dive into Boolean logic a bit further.

In Boolean logic, there are only ever two possible values, so true, which is often represented as one and false, which is often represented as zero.

So in Boolean logic, these are the only two possible values, true represented as one and false represented as zero.

These are the same two values used in binary numbers, which is the language that computers understand.

So we've got a logic framework using one and zero, and then binary numbers which computers understand which combine to make computers work.

Arithmetic operations, such as addition, operate using numbers.

So here we have seven add x.

So the whole thing together is an arithmetic expression.

In this example, seven is a constant, so that's a number.

The plus sign is the operator, and then x is a variable and that can be a number as well.

The result, the value of an arithmetic expression is also a number.

Logical operations operate on statements that are true or false.

So this time, instead of an arithmetic expression, we have a logical expression, so the whole thing together is the logical expression.

Then we have a statement which is true or false.

An operator, which in this case is AND.

And then another statement which is also true or false.

And together the result is the value of a logical expression, which is either true or false.

There are three basic Boolean operators.

So AND, which you've seen on the previous example.

So, AND is true if all conditions are true.

OR is true if at least one condition is true.

And NOT reverses the truth value.

I'm just gonna go through this again, these are really important for the rest of the lesson.

So, AND is true if all conditions are true.

OR is true if at least one condition is true.

And NOT reverses the truth value.

So NOT reverses the value.

So here we have an expression, go out equals NOT raining.

The whole thing together is the logical expression, go out equals NOT raining.

We have a statement which is go out, which is true or false.

Then an operator, which this case is NOT.

And then another statement which is true or false.

So here we can see that if it's raining is false, then not raining will be true.

And if it's raining is true, then not raining is false.

And what this is saying in the form of an expression is that I will go out if it's not raining, I won't go out if it is raining.

The statement NOT A is true when A is false and vice versa.

So here we have an example of some electronic doors.

So we've got a statement here which is open equals motion AND activated.

So the first statement is a true or false statement which is open.

Then we have another statement which is true or false, so that's motion.

We have the operator which is AND.

And finally, a third statement, which is true or false.

And here's the table for this one.

So if motion is false and activated is false, then the doors won't be open, so that's false.

There's no motion, there's no activation, the doors are not open.

If motion is false, so no motion, but activated is true, then open will still be false because one or the other is false, motion and activated.

Similarly, if motion is true and activated is false, then open will be false.

The only scenario in which open is true in this example is if motion is true, activated is true and open is true.

All three need to be true.

So to sum this one up, the statement A AND B is true when both A and B are true.

So Laura has a question, "What about if the left or right electric door was open?" So there's the left door, there's the right door.

So a door would be open if either the left or right door was open.

So the statement here would be open equals left OR right.

So our first statement is open, that's true or false.

Then we have another statement which is left, true or false.

Our operator, which is OR.

And our statement which is right there, which is true or false.

So the table for this one is if both left or right were false, then open would be false.

Both doors would be closed, so open would be false.

If the left was false but the right was true, then the door is open, so that's true.

Similarly, if the left was true but the right was false, the door is still open and that's true.

And if both left and right are open, then the value of open is also true.

So let's sum that up as a statement.

The statement A OR B is true when at least one of A or B is true.

And it's also true if they're both true.

Time for a question, which Boolean operator reverses the truth value? Is it A, AND, B, OR, or C, NOT? Well done, the answer is NOT.

The Boolean operator NOT reverses the truth value.

Another question: The Boolean value true is often represented by the value? Is it A, one, B, zero, or C, 0.

5? Well done.

The value true is often represented by the value one.

Now match the statements to the description.

So match the Boolean operators with the correct meaning.

The three Boolean operators we have are the three we've introduced, AND, NOT and OR.

And the three descriptions are only true if both conditions are true.

True if at least one condition is true.

And reverses the value, so that means true becomes false.

So let's go through the answers.

So AND is only true if both conditions are true.

NOT reverses the value, so true becomes false or false becomes true.

And OR is true if at least one condition is true.

Now time for the second part of your task.

In your own words describe Boolean logic.

Okay, you could have written something like this.

So Boolean logic is a way of making decisions using only true or false values.

It uses simple rules like AND, OR and NOT to check if conditions are met.

Computers use Boolean logic to help them decide what to do by following instructions or solving problems. Let's now move on to the second learning cycle, which is to explain logic gates.

In 1940, Claude Shannon proved that Boolean logic expressions and electrical circuits with switches are equivalent.

Shannon showed that ON and OFF switches in an electrical circuit could represent true and false values just like in Boolean logic.

Here we have a picture of one switch, which is off and one switch which is set to on.

So there's our off switch, so false equals zero and our on switch, which is true equals one.

So off is equivalent to false and zero.

On is equivalent to true and one.

the Boolean AND operator can be represented by two switches in a line.

So here we have two switches and the AND value with those two switches.

So in this example, one switch is off and one switch is on.

So the switch on the left is open, which means off, and the switch on the right is closed, which means on.

Because one of them is off, then the whole circuit will be off.

So here you see the value of the first switch is off, which is zero.

And the value of the second switch is on, which is true or one.

But because one of the circuits is off and we are using the AND operator, then the circuit will be off.

For it to be on, we'd need both switches to be on.

Here's another example: So here we have two switches, but this time there in parallel rather than in a line.

So this time we're going to look at the OR operator.

In this situation, the first switch at the top is off or false, the value is zero.

And the switch at the bottom is on or true with the value of one.

In this example, the circuit will be on because one or other of the switches is on.

The circuit would also be on if both switches were on, or true or value one.

If both switches were off or false or value zero, the circuit would be off.

Using electrical switches to implement Boolean logic is what led to the creation of logic gates.

A logic gate is the fundamental building block of digital circuits.

It's an electronic device that performs Boolean logic by taking one or more binary inputs and producing a single binary output.

There are three fundamental logic gates and each logic gate can be represented as a symbol.

So first of all we have this one here, which is an AND logic gate.

The next one we have is an OR logic gate and finally we have a NOT logic gate.

I'm just gonna describe these to you in a little bit more detail as this is a really important concept for the rest of the this lesson.

So the first one, the AND logic gate has two inputs going into it and it's kind of like a half square, half semicircle shape with one output.

The second one looks a little bit like an arrowhead with two inputs going in and one input going out.

And then finally we have the NOT logic gate, which has one input, a triangle shape, then a small circle and one output.

So time for a true or false question.

Logic gates can be represented by symbols.

Is that true or false? Well done, as we've just seen, that's true.

We can represent logic gates by using symbols.

So this builds on what I explained before.

So the logic gates only have a single output each.

The AND and the OR and the NOT logic gate, they have one single output.

So there's our single outputs for each logic gate.

A NOT logic gate has one input.

So there we see the one input into a NOT logic gate.

And the other logic gate such as AND or OR have two inputs.

So this one has two on the left for the AND logic gate and two on the right for the OR logic gate.

Laura has a question for Andeep.

"Did you know each logic gate has a truth table?" And Andeep says, "What's a truth table?" So let's find out.

A truth table is a simple way to show all the possible outcomes of a logic gate.

Truth tables are a clear and simple way to show exactly what a logic gate will output for every possible input.

So here we have an example of a basic truth table.

So we have the input being zero, the output being one or the input being one, the output being zero.

A truth table lists all the combinations of inputs like true/false and shows what the output result will be for each one.

The truth table below shows all the possible outcomes for a NOT gate.

So this is for a NOT gate.

So if the input is zero, then the output will be one.

If the input is one, then the output will be zero.

And put simply, it means the input is not the same as the output 'cause we've only got two conditions, one or zero.

That means if the input is zero, the output will be one.

Or if the input is one, the output is zero.

So that's the simplest example of a truth table.

The truth table below shows all the possible outcomes for an OR gate.

So this time if input A or input B is zero, then the output will be zero.

If input A is zero, but input B is one, then the output will be one.

If input A is one, but input B is zero, then the output will be one.

And finally, if input A is one and input B is one, the output will be one.

So put simply, if either outputs or both outputs are one, then the output will be one.

If neither of the inputs is one, they're both zero, then the output will be zero.

So that's an OR gate.

Now let's have a look at the outcomes for an AND gate.

So this time if input A is zero and input B is zero, the output will be zero.

If input A is one and input B is zero, the output will be zero.

And if input A is one and input B is one, the output will be one.

So for the output to be one, both inputs need to be one.

So both inputs need to be true for the output to be true.

Logic gates can be combined to create more complex circuits and logic.

Now we can have a look at a logic diagram for the rock, paper scissors game.

So we'll have a look at a couple of examples of how the game is represented in this diagram.

So I'll just take you through what you can see here first of all, on the screen.

So initially you've got the choice for player one, so rock, paper or scissors, and the choice for player two, rock, paper or scissors.

These are all zero at the moment, so they haven't made a choice yet.

So they're all false.

If we were to change them to true, they would change the number one.

We'll do that in a second.

Then we've got, in the middle, we've got the process and that begins with six and gates, which gives you every combination you can have of rock, paper, scissors for two players.

There's six different combinations.

And then each of the three combinations at the top and the bottom lead into an OR gate.

So there's three inputs into that OR gate and one output.

And then in the middle we have the NOT gates here, so two NOT gates, one there, and one there, and then another AND gate there.

And then we have finally, on the right hand side, the three outcomes.

So player one wins, tie, or player two wins.

So let's start the simulation.

So first of all, I'm gonna run it all the way through so that you can see what the outcome is.

So we're gonna have player one choosing rock and player two choosing paper.

Now we know in the game that paper beats rock, so you can see that player two wins.

Let's have a look at how the simulation gets there.

So first of all, I'm just gonna turn paper to false.

So we can just follow the lines through for rock.

So rock takes us into two of the AND gates, so the AND gate at the very top and then the AND gate here in the middle.

So that one there and that one there.

So that's what rock will lead us to two different AND gates.

And if I now turn on paper, you'll see the paper leads us to two AND gates as well.

So this AND gate and this AND gate.

Now there's only one AND gate that's got two inputs and it's this one here.

So this input is true so it carries on into this OR gate here.

So because we've got one true input into this OR gate, and it's an OR gate, it goes all the way through to player two wins because it's true here.

It goes into a NOT gate, so it becomes false and stops there, okay? Similarly, this false line into this NOT gate becomes true.

But because this is an AND gate, we've got one true, one false, so it stops there.

So we can just prove that the model works by simulating a tie as well.

So we're gonna have rock and rock and you can see that this time everything ends at the AND gate in terms of truths.

So everything from there on is false until they get to these two NOT gates where because they're both false, they turn true, and we have the tie simulated.

So that's how the game rock, paper scissors can be simulated using AND, OR, and NOT gates.

If you'd like to try that logic diagram for yourself, go to oak.

link/rock-paper-scissors-logic.

So combining logic gates means computers can perform more advanced tasks like making decisions and running programs. Modern computer processes contain billions of tiny logic gates that all work together at incredible speed.

So any computing device you use like a mobile phone, a laptop or an iPad will have a processor like this.

It will be much smaller than the image you see there, probably about one centimeter squared, and will contain billions of tiny logic gates.

Logic gates are the building blocks of every digital device.

All computer hardware is built from logic circuits that understand only binary zeros and ones.

Time for a question.

Which logic gate only ever has one input? Is it A, NOT, B, AND, or C, OR? Well done, it's NOT.

A NOT logic gate only ever has one input.

Time for a question.

The truth table below belongs to which logic gate? And in the truth table we have input A is zero, input, B is zero, and output is zero on the first line.

On the second line we have input A is zero, input B is one, and the output is one.

Third line input A is one, input B is zero and the output is one.

And on the fourth line input A is one, input, B is one, and the output is one.

Does that truth table represent a NOT logic gate, an OR logic gate or an AND logic gate? Well done, it's an OR logic gate.

So if either A or input B or both are true, the output will be true.

Now, a true or false question.

It's not possible to combine logic gates to create more complex circuits and logic.

Is that true or false? Okay, well done.

That's false.

Can you explain your answer? And this is why.

Logic gates can be connected to create more complex circuits and logic.

Combining them means computers can perform more advanced tasks like making decisions and running programs. Now time for your task.

So match the logic gate names to the correct symbols, and the three logic gate names we have are AND, NOT and OR, so match those to the correct symbols on the right hand side.

Okay, so the AND matches up to the symbol on the bottom, which is like the half rectangle, half semicircle with two inputs, one output.

The OR logic gate is a bit like a arrowhead with two inputs and one output.

And the NOT logic gate is one input going into a triangle, then a small circle and one output.

And the second part of your task, in your own words, explain how each of the three fundamental logic gates, AND, OR and NOT all work in their own way.

And you could have written something like this: An AND gate only gives a true result if both inputs are true.

If even one input is false, then the answer is also false.

An OR gate gives a true result if at least one of its inputs is true.

It only gives a false result when both inputs are false.

And finally, a NOT gate only has one input and it flips it.

If the input is true, the output is false.

And if the input is false, the output is true.

Let's have a look at a summary of this lesson about Boolean logic.

In Boolean logic, there are only ever two possible truth values, true and false.

Logic gates are the fundamental building blocks of digital circuits and perform Boolean logic by taking one or more binary inputs and producing a single binary output.

Logic gates can be combined to create more complex circuits and logic.

Modern computer processes contain billions of tiny logic gates that all work together at incredible speed.

Thank you for joining me for this Oak National Academy lesson.

I hope you've enjoyed learning about Boolean logic with me today, and I look forward to seeing you for more lessons in the future.