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 )

The NAND gate is an electronic circuit that performs alternative denial (i.e. “not both”). The output of the NAND Boolean operator is false only when both of the inputs are true. Otherwise, the output is true.

Input Output Comment
A B Out
0 0 1 High
0 1 1 High
1 0 1 High
1 1 0 Low
Although the word NAND is not used in everyday communication, it is not difficult to see that it is the complement of the word AND.
It is often helpful to think of NAND as not both, as in the sentence not both Natalie and Katy are engineers.

The following analysis clarifies the meaning of the NAND operator. Consider the statement not both math and biology are tested on the final board. We could say neither math nand biology are tested on the final board, but such is not a currently acceptable English usage of the word NAND; so bear with not both.

For each of the two subjects, math and biology, there are two possibilities: either a subject is tested or it is not tested. As such there are four possible conditions, as in Table 1.

PossibilitiesMath testedBiology testedCOMMENT
Case 1 FALSE FALSE Neither is tested
Case 2 FALSE TRUE Biology is tested
Case 3 TRUE FALSE Math is tested
Case 4 TRUE TRUE Both are tested

Table 1: possible input conditions

Having listed the possibilities, we proceed to evaluate the original statement using the four cases. The truth we are analyzing for is not both, so as long as we can answer not both the case is true. We show the complete evaluation in Table 2 below. Observe that the final board can be structured as any of the first three cases. Only the last case cannot be the final board, since we are guaranteed that not both will be tested.

Math testedBiology testedFinal board structureCOMMENT
FALSE FALSE TRUE Neither is tested
FALSE TRUE TRUE Only biology is tested
TRUE FALSE TRUE Only math is tested
TRUE TRUE FALSE Both are tested

Table 2: Truth Table of complete evaluation

Observe further that not both does not necessarily mean one of them. If I tell you not both slices of pizza are for you, that does not necessarily mean one of them is yours. Maybe you get none.

An important discovery about the word NAND is that it can express all logical operations. In other words, if you become good at using the word NAND, then you will never need to use any of the operators AND, OR, NOT to adequately express yourself. To see how the NAND gate is used to construct all the other logic gates, see the Universal Gates pages. Also, the Boolean algebra article offers greater detail on the logic significance of the word NAND.

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

Math testedBiology testedFinal board structureCOMMENT
0 0 1 Neither is tested
0 1 1 Only biology is tested
1 0 1 Only math is tested
1 1 0 Both are tested

Table 3: Truth Table of complete evaluation

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. Hence, we only need four transistors to build a NAND gate.

Figure 1: Interactive transistor circuit of the NOT logic operator

Figure 2: Interactive transistor circuit of the NAND 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 and 2, 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 two additional typical constructions of the NAND 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 NAND gate implemented with four NOR gates digital logic circuit with boolean algebra equation and truth table.
Figure 3: NAND gate implemented with four NOR gates

Interactive NAND gate implemented with a 2X1 Multiplexers digital logic circuit with boolean algebra equation and truth table.
Figure 4:NAND gate implemented with a 2X1 Mux