# Logic gates

A logic gate is a device that implement a boolean function, that is, performs logical operations on one or more logical inputs to produce a single logical output.

## 1-input logic gates

x out
1 1
0 0

### Inverter (NOT gate)

Logical negation (“not”).

x out
1 0
0 1

## 2-input logic gates

### AND gates

Logical conjunction (“and”).

A HIGH output (1) results only if all the inputs to the gate are HIGH (1). Otherwise, a LOW output (0) results.

x y out
1 1 1
1 0 0
0 1 0
0 0 0

### NAND gates

Logical alternative denial (“not both”).

A LOW output (0) results only if all inputs to the gate are HIGH (1). Otherwise, a HIGH output (1) results.

x y out
1 1 0
1 0 1
0 1 1
0 0 1

### OR gates

Logical disjunction (“or”).

A HIGH output (1) results if one or both inputs to the gate are HIGH (1). Otherwise, a LOW output (0) results.

x y out
1 1 1
1 0 1
0 1 1
0 0 0

### XOR gates

Logical exclusive disjunction (“one or the other but not both nor none”).

A LOW (0) output results If both inputs to the gate are the same. Otherwise, a HIGH output (1) results.

x y out
1 1 0
1 0 1
0 1 1
0 0 0

### NOR gates

Logical joint denial (“neither…nor”).

A HIGH output (1) results if both inputs to the gate are LOW (0). Otherwise, a LOW output (0) results.

x y out
1 1 0
1 0 0
0 1 0
0 0 1

### XNOR gates

Logical biconditional (“if and only if”).

A HIGH output (1) results if both inputs to the gate are the same. Otherwise, a LOW output (0) results.

x y out
1 1 1
1 0 0
0 1 0
0 0 1

### IMPLY

Logical material implication (“if…then”).

If input x is HIGH (1), the output follows input y. Otherwise, the output is always HIGH (1).

x y out
1 1 1
1 0 0
0 1 1
0 0 1

### NIMPLY

Logical material nonimplication (“but not”).

A HIGH output (1) results if input x is HIGH (1) but input y is LOW (0). Otherwise, a LOW output (0) results.

x y out
1 1 0
1 0 1
0 1 0
0 0 0