AND GATE

A:
C:
B:
Truth Table:
ABC
000
010
100
111
Click on the A or B labels to change the input values.
Some words on AND gates
A logic gate's output value is dependent on an exact combination of input values.
Remember that an AND gate's output (labeled C) is set to 1 only if BOTH inputs (labeled A and B) are set to 1. That's why we call it an AND gate.
To know what any gate will set its output value to for a given combination of input values, we consult the truth table. The truth table above tell us which values we expect on the output of the AND gate for which values of the inputs A and B. For example, if A=1 and B=0, C will be 0. If A=1 and B=1, which value of C do you find?

Exercise 1
Clicking on the gate labels A and B (in the diagram above) switches their values.
Take a piece of paper and make a three column table. The first column represents input A. The second input B. The third column represents input C.
Try all possible values of input A and B by switching their values on the logic gate above. Write the values of A and B down in the table, in the same row. Record the resulting value of the AND gate's output C in the third column. Your table should match the one listed above. Which input values produce a 1?

Excercise 2
Logic gates implement what we call "Boolean logic". The AND operation is part of that logic. In Boolean logic, an AND operation combines two statements into one. The resulting statement is true when both statement are true, and false when either or both statements are false. Generally, we take a 0 to represent false and 1 to represent true.

For example, let's assume we can say that it is a nice day when "it is dry" AND "the sun shines". Under that assumption it can only be a nice day if both statements ("dry") AND "sun shines" are true. In all other cases, it is not true that it is a nice day. For example, it could be dry but the sun does not shine. In that case, according to the AND operator, the statement that it is a nice day is not true.

Try the following exercise. Look at the logic gate above. Pretend input A's values indicate whether it is dry or not. When A is 1 it is dry. When input A's value is 0 it is not dry.
Input B's value indicates whether the sun shines or not. When input B is 1, the sun shines. When it is 0 the sun does not shine.
Output C than tell us whether it is a nice day. When it's value is 1, it is a nice day. When it is 0 it is not a nice day. List all possible combination of values of A (0,1) and B (0,1) and write down for which combination you can conclude it is a nice day.

Exercise 3
An AND statement can combine any two statements into one. The combined statement is true when both statements are true. If either one of the statements is not true, the combined statement will not be true.

Here's an exercise:
Let's say, t represents today's temperature, and h represents today's humidity.
The weather persons on the local news decide they can tell their viewers it is a nice day when the temperature is within a certain range (not too hot, not too cold) and the humidity is within a given range (not too humid, not too dry).
They agree on ranges for temperature and humidity. They decide that when t (temperature) > 90F, it is too hot for it to be called a nice day. When t < 60F, it is too cold for it to be a nice day. Also, when h (humidity) > 90% it is too humid, and when h < 50% it is too dry, for it to be a nice day.

When the meteorologist's report comes in, it usually has the results of 4 tests on the present temperature and humidity. Test A measures whether t < 90F (it is not too hot). Test A can come out true (e.g t = 80F) or false (e.g. t=105F). Test B measures whether t > 60F (not too cold). Test B can come out true (e.g. t= 73F) or false (e.g. t= 45F). Test C measures whether h < 90% (not too humid). Again C can come out true or false (think of a number of values for which either would be these case). Test D measures whether h > 50% (not too dry). D can come out true or false (e.g. h = 25%, so test D=false).

Now the weather persons must make a decision on the basis of these results. They want to decide whether they can tell their viewers it is a nice day. For it to be a nice day, all statements must be true. So, in terms of Boolean logic, an AND operator must be applied to them.

Try the following.
Statement E states it is a nice day. Define statement E such that it is equal to a boolean expression combining the results of test A, B, C and D, and its value tells our weather persons whether or not it is a nice day.


Back to the list of logic gates...