Java Circuit Simulation Workaround ▾

Due to recent changes by Oracle, java applets have become difficult to run in the browser. To mitigate the troubles, Oracle has provided the following websites to help users troubleshoot: and

Even after following the above instructions, loading applets may still show warning concerning “unsigned application” and “unknown publisher”. For Teahlab in particular, these warnings are due to the fact that we have opted not to pay a third party such as Verisign to sign our applets. Any warning that comes up when you try to run our applets should emphasize that our applets will always run with “limited access”, which is Oracle’s way of letting you know that teahlab doesn’t do anything on your computer except running the circuits you see: in other words, our applets are safe to run.


The Teahlab Team

by Isai Damier (Let's connect on twitter @isaidamier )

Interactive AND digital logic circuit with boolean algebra equation and truth table

The AND gate is an electronic circuit that performs logical conjunction. The output of the AND Boolean operator is true only when all the inputs are true. Otherwise, the output is false.

Input Output Comment
A B Out
0 0 0 Low
0 1 0 Low
1 0 0 Low
1 1 1 High
Through a short and simple analysis you can determine what a statement that uses the word AND is truly saying. We illustrate with the following statement: Water is the product of Hydrogen AND Oxygen.

The statement tells us that the existence of Water depends on the existence of two objects: Hydrogen and Oxygen. Now each of these two objects can be in two possible definitive states: either an object exists or it does not exist. Consequently we have four possible conditions, which we list in Table 1 below by row.

ConditionHydrogen existsOxygen existsCOMMENT
Case 1 False False neither exists
Case 2 False True only oxygen exists
Case 3 True False only hydrogen exists
Case 4 True True both exist

Table 1: possible input conditions

You can list the possibilities however you want; you will still end up with four different cases. Try it if you want.

Once we list the possible input conditions, we can proceed by adding a column for water as in Table 2.

Hydrogen existsOxygen existsWater exists
False False
False True
True False
True True

Table 2: Empty water column

To fill the column for Water, we simply do exactly as the original statement says: Water is the product of Hydrogen AND Oxygen. So for example, the first row for water must be false since the statement did not say we can produce water out of nothing. We fill all the rows in Table 3 below. Notice that water is shown to exist only when both Hydrogen and Oxygen exist.

Hydrogen existsOxygen existsWater existsComments
False False False can't make water out of nothing
False True False oxygen alone is not water
True False False hydrogen alone is not water
True True True now we have water

Table 3: Truth Table of Water = Hydrogen AND Oxygen

It is typical in engineering to use 1 instead of TRUE and 0 instead of FALSE. Hence, we rewrite Table 3 as Table 4 below.

Hydrogen existsOxygen existsWater existsComments
0 0 0 can't make water out of nothing
0 1 0 oxygen alone is not water
1 0 0 hydrogen alone is not water
1 1 1 now we have water

Table 4: TRUE = 1; FALSE = 0

For greater detail on the logic of the AND gate, read the Boolean Algebra article.

Physical Implementation

In order to apply the principles of Boolean algebra to create real machines that can think and make decisions, we have had to find ways to physically implement the logic operators AND, OR, NOT, etc. To that end, modern day engineering uses transistor networks called logic gates. Hence, a logic gate is actually a group of transistors so arranged as to behave as a Boolean operator.

From a circuit complexity perspective, the most basic logic gate is the NOT gate (aka the Inverter). The NOT gate is made of two transistors, as shown in Figure 1. The next most basic logic gate is the NAND gate, which is effectively two Inverters as shown in Figure 2. We only need four transistors to build a NAND gate. Finally, to create the AND gate, microchip manufacturers connect a NOT gate at the end of a NAND gate, as in Figure 3. Hence, the AND gate is made of six transistors.

Figure 1: Interactive transistor circuit of the NOT logic operator

Figure 2: Interactive transistor circuit of the NAND logic operator

Figure 3: Interactive transistor circuit of the AND logic operator


The use of transistors to build logic gates is quite modern. Before transistors we used other devices, such as vacuum tubes (aka thermionic valves). And very soon we may use DNA, or some other abundant material. There are many types of transistors. Our circuits in figures 1, 2 and 3, for example, use complementary metal-oxide semiconductor (CMOS) technology. Our choice of CMOS is arbitrarily based on the fact that CMOS is by far the dominant technology in use today. The dominance is due to how well CMOS performs in all the important categories: fabrication cost, packing density, loading capacity (i.e. fan-out), operational speed (i.e. propagation delay), noise margin, and power dissipation (i.e. green technology).

There is of course more to transistors than can be presented here; especially since transistors are used for more than just digital systems. And so we refer you to any good micro-electronics textbook.

Alternate Design

Below we show three additional typical constructions of the AND gate. Each of the constructions presents specific conveniences to designers. If you are very new to digital systems design, you may not understand the importance of the figures below. Still, we include them in this article for the people who may need them.

Interactive NANDs digital logic circuit with boolean algebra equation and truth table
Figure 4: AND gate implemented with two NAND gates

Interactive Nor AND digital logic circuit with boolean algebra equation and truth table
Figure 5: AND gate implemented with three NOR gates

Interactive 2 to 1 Mux digital logic circuit with boolean algebra equation and truth table
Figure 6: AND gate implemented with a 2X1 Mux