The AND logic gate takes two bits as an input. Its output follows the rule: "only if both bits are $1$, output $1$; otherwise, output $0$." This gate acts exactly as the "and" operator in programming does: given the Boolean variables x and y, then x && y means "x and y". You may also use the bitwise & operator: x & y.
Below is the black-box representation of the AND gate, one way in which we can build it with transistors, and its truth table.
AND Gate: black-box representation. Miriam Briskman, CC BY-NC 4.0.
One way to build an AND Gate from transistors. Taken from this article by Muhammad Shahid.
Input | Output | |
---|---|---|
x | y | xy |
$0$ | $0$ | $0$ |
$0$ | $1$ | $0$ |
$1$ | $0$ | $0$ |
$1$ | $1$ | $1$ |