Lesson Plan Industry Sector
Engineering & Design

## B7- When Does 3 and 6 = 7- How Computers Calculate

### Lesson Plan Overview / Details

When computers calculate, they have to use a simpler type of mathematics since they only can work with ones and zeros. The math they use is called “Boolean Algebra” after George Boole, who invented it in the mid 1800’s. Boolean Algebra is used for all computer processes, but it probably is most apparent in internet searches.

Total Time 2.5 hours

### Student Objectives / Goals

• Students will be able to conduct advanced Boolean searches on the internet.
• Students will understand the basic concepts of Boolean logic and how it is used in the computer field.
• Students will be able to perform AND and OR Boolean operations on binary numbers.
• Students will appreciate the contributions of George Boole to computer technology.

### Activities in this Lesson

• Hook Activity 30min - Hooks / Set

Play the video “Cat Videos on the Internet”.

Ask the question, “How many web pages do you think there are on the internet that mention cats?” Have the students do a Google search on the word “cats” and write the number of web sites found on the board.

Now ask, “How many web pages mention dogs?” Have them search on “dogs” and write the number of web sites on the board.

Now ask, “How many web pages do you think have BOTH cats and dogs mentioned on them?” Have them type “cats and dogs” into the search and see how many web sites they get. Write this number on the board.

You should find that the search for “cats and dogs” produces quite a few LESS results than either “cats” or “dogs”. Why??

Now have them go to the advanced search and type “cats and dogs” into the “exact wording or phrase” text box. When they search, they should get even fewer web pages! Point out to them that the search came up with quotation marks.

Now have them go back to the advanced search option (beside the search toolbar) search for “cats OR dogs” and see how many results they get. They should get quite a few more than either cats or dogs separately. Be sure to write the results of these searches on the board.

What’s going on here? Explain the concept of AND and OR to the students. When they searched for “cats”, it gave them every web page that had the word “cats” on it and the same for “dogs”. But when they searched for “cats” AND “dogs” it gave them only pages that had both of the words on it. The words “cats” or “dogs” could be anywhere on the page, but both words had to be present. If the page had only one of the words on it, the page would not show up in the search.

But when they searched on “cats” OR “dogs”, it gave them all of the pages that have “cats”, “dogs” or either of them individually.

When they searched for the phrase “cats and dogs”, it only returned pages that had the entire phrase exactly like that and with the words in that order on them.

Show the video “Search smarter, Search faster”.

There is one more type of search they could try. Have them search for “dogs NOT cats”. This will give them all the pages that only have the word “dogs” without the word “cats”. In other words, even if the page has the word “dogs”, if it also has the word “cats”, it won’t show up on the search.

These searches are all based on a special type of mathematics called Logic. What in the world is Boolean Logic??

Show the video “Red Green - Boolean Logic”.

• What is Boolean Logic? Don’t let the funny name throw you, it’s just named after a guy named George Boole.

I have attached a video of the life of George Boolebelow if you want to show it.

George Boole was a mathematician who studied logic. He studied the concept of “syllogisms” which were first defined by the ancient Greek philosopher Socrates. Syllogisms were ways to see how different thoughts or sentences related to each other. For example, Socrates best known syllogism looked like this:

All men are mortal.
Socrates is a man.
Therefore, Socrates is mortal
.

Ask your students if they have heard any other syllogisms. Most students have at some point of their education. If you have time, have the students make up their own syllogism.

Syllogisms try to understand the relationship between several logical statements. In Socrates’ example, the question is, if the first statement is true and the second statement is true, does that mean the last statement is true? George Boole tried to take these philosophical concepts and turn them into mathematical formulas. He succeeded extremely well and a hundred years later, his works became the backbone of all current computer theory. Unfortunately, George Boole lived and died in a time long before computers, so in his lifetime he was seen more as a geeky nerd than anything else. Decades later people would rediscover his work and use it to design computer systems.

The basic parts of Boole’s work are called Boolean Logic or Boolean Algebra and focus mostly on three words, AND, OR and NOT. These words would be used to combine true and false statements together and then see if the resulting statement is overall true or false. For example, take the statement:

England is a country AND London is a city.

The first statement, “England is a country” is true and the second statement “London is a city” is true. When I combine these two statements together with the Boolean AND, they must both be true for the entire sentence to be true. In this case, we would say the sentence is true. But if we made the statement:

Elvis Presley was a singer AND Bill Gates is poor.

The first statement is true, but the second statement is false. Therefore, the entire sentence as a whole is false, even though the first part was true.

The Boolean word OR (or operators, as they are called) works similarly to AND except for OR, if either statement is true, the overall sentence is true. So in the case of the previous sentence about Elvis Presley and Bill Gates, the overall statement is true, even though the part about Bill Gates is false. The Elvis Presley statement makes it true, since only one OR the other statement has to be true to make the entire sentence true.

NOT is the simplest Boolean operator of all. All NOT does is reverse the value of a statement. A true statement becomes false and a false statement becomes true. So, for example, the statement “Bill Gates is poor” becomes “Bill Gates is NOT poor.” NOT does not need two statements to compare.

So how does this work with electronics? It turns out that if you use these concepts with electricity and consider “on” as “true” and “off” as “false”, Boolean logic works very well with circuits. Show these three videos:

Logic Gates- The AND Gate
Logic Gates- The OR Gate
Logic Gates- The NOT Gate

For a “quick and  dirty” presentation of the subject, you can use these short clips:

AND gate
OR gate
NOT gate

Boolean logic worked well with electronics, but when the computer was invented, it really found its place. It turns out that the transistor, which is the basis of computer technology, uses Boolean logic entirely. If you think of bits as little statements where a “one” bit is like a “true” statement and a “zero” bit is a “false” statement, transistors use Boolean logic to work with them. Here’s how it works:

AND:
1 + 1 = 1
1 + 0 = 0
0 + 1 = 0
0 + 0 = 0

OR:
1 + 1 = 1
1 + 0 = 1
0 + 1 = 1
0 + 0 = 0

You can see more of this process here:
http://computer.howstuffworks.com/boolean.htm

• At the root of their logic, computers add without the ability to carry numbers to the next place. So if I were to ADD the numbers three and six, for example, it would look like this in binary:

0 1 1  (three in binary)
AND   1 1 0  (six in binary)
1 1 1  (seven in binary)

So we can see that using Boolean Algebra, 3 AND 6 equal 7 Try telling your algebra teacher that!

• Guided Practice 20min - Guided Practice

Tell the students “Take out a sheet of paper and write your name in the upper right corner. Title the paper “Boolean Algebra Lab”. Now let’s do a problem together.”

Write these bytes on the board:

0 1 1 0 1 1 0 1   (109) AND
1 0 1 1 0 0 0 1   (177)

Walk the students through the process, adding each bit with the bit beneath it. If you added the decimal numbers, you would get 109 + 177 = 286.

0 1 1 0 1 1 0 1   (109) AND
1 0 1 1 0 0 0 1   (177)
1 1 1 1 1 1 0 1   (253)

But when you AND them you get 253!

Now let’s OR the same numbers.

0 1 1 0 1 1 0 1   (109) OR
1 0 1 1 0 0 0 1   (177)
0 0 1 0 0 0 0 1     (33)

When we OR these numbers, we get 33! But subtracting them would have given  us -68.

Now have the students make up two decimal numbers of their own and have them add them together using normal addition and then convert them to binary and AND them together using Boolean logic. Have them compare the two answers. Now have them do the same thing subtracting the numbers and then ORing them. Now have them give their two decimal numbers to a partner and have the partner independently add and AND and subtract and OR them. Have the students compare their results.

• Lab Activity 30min - Independent Practice

Write these five number pairs on the board. Have the students copy them to their own papers and add and AND them together, then subtract and OR them. Have them compare the numbers. When they are done, collect the papers.

170      50
220    151
6            5
177     212
16           8

• If you have time, show the video “Boolean Sandwich”. It is a humorous video of a teacher demonstrating Boolean logic by making sandwiches. After watching the video, ask the students to come up with other examples from their own lives of where they might see Boolean-type logic.

• Assessment - Assessment

Assessment should be based on the teacher grading the Lab write-up and assigning points for participation during lecture and demonstration.

Total TIme
0 Hours