# What are logic gates?

From the school days were taught about major 4 arithmetic functions Addition, Subtraction, Multiplication and division. But we are also using other than these arithmetic function few logic functions day to day life. If some one is there in the room switch on the light other wise switch of the light. If 1 OR more people are there, switch on the light. Here we use OR function. This is a logical function. Not arithmetic.  Same way we say if person A  AND person B comes then start the bus. Here we use AND function.  Finally NOT function. If the climate is chill do NOT switch on the AC. Here we use NOT function. If you notice all the logical operations we do are based on the above three function AND, OR and NOT.

The Mathematicians derived Arithmetic functions by using the AND, OR and NOT functions and Engineers could able implement the logical functions physically. This the start of Computer.

Let us try to understand logic functions from basics These logical functions were implemented using mechanical components, Magnetic Components, Optical Components and Electronics components. So these logic functions are not only for Electronics. Because of miniaturization, today we mostly implement logic functions using Transistors (an Electronic Component).  Electronics is the control part of Electrical. So let us start discussing about logic gates from simple electrical Circuit, which involves V, I and R.

V = I x R  (Ohm's Law)

Now let us split the resistance into TWO, R1 and R2.

V = I * R
R = R1 + R2

Now let us calculate the Voltage across each resistance
V1 = I * R1
V2 = I * R2
V = V1 + V2

So V2 = V – V1
V1 = I * R1

Now let us introduce a Common point. In this case the negative terminal of the Battery is assumed to be a common point

Since ground is common point we can split the circuit. Need not
required to show the ground connections

Now Voltage connection is also split . Since we use the label V, we
need not required to show the Voltage connections

Generally voltage source is not shown in circuits.

For V1 and V2 there are 2 points. But Vo has only one point, then how to measure Vo. In electric circuit if only one point is mentioned the other points is assumed  to be Ground

In this case Vo is equal to V2.

If V and V1 are known then    Vo = V – V1

If V, I, R1 are known then    Vo = V – I * R1

Now Let us replace the bottom resistor (R2) with Switch

If switch in OFF condition, there will not be any current,

so I = 0.

Vo = V – I * R1
Vo = V – 0 * R1
Vo = V – 0
Vo = V = 5V

If switch in ON condition, Vo will  equal to Ground potential.
So the difference between Vo and Ground is Zero.

Vo = 0V

The switch are simple Electrical switchs. We manually control them.

Now let us replace these manual switches with automatic switches. i.e. the switches controlled by voltage. If Control voltage is 5V then the Switch is ON

If Control voltage is 0V then the Switch is ON

This automatic switch is nothing but  Transistor. So when we operate the transistor in CUT-OFF mode then the transistor acts as Switch in OFF condition.

When we operate the transistor in Saturation mode then the transistor acts as Switch in ON condition.  Since we are using the Transistor as a switch, in our further discussions we show them only as switch in diagram.

Now let use these transistor switches in combinations to derive some logical functions. In this case we have two input and one output.

When both the inputs are 0V the output is 0V

When the inputs are 0V and 5V the output is 0V

When the inputs are 5V and 0V the output is 0V

When the inputs are 5V and 5V the output is 5V

Now let us summarize all the 4 condition in a table.

Since we have only two voltage level, we also mention them as o and 1. o represents 0V and 1 represents 5V.

Instead of showing the entire circuit we draw them as a symbol. Here we have shown what is inside the symbol.

Only when both the input A  AND  B are 1 the output is 1. So this logic function is called AND functions. The symbol is show below.

Now let us see the other type of switch combinations

When both the inputs are 0V the output is 0V

When the inputs are 0V and 5V the output is 5V

When the inputs are 5V and 0V the output is 0V

When the inputs are 5V and 5V the output is 0V

Now let us summarize all the 4 condition in a table.

Since we have only two voltage level, we also mention them as o and 1. o represents 0V and 1 represents 5V.

Instead of showing the entire circuit we draw them as a symbol. Here we have shown what is inside the symbol.

when any one of  the input A  OR  B is 1 the output is 1. So this logic function is called OR functions. The symbol is show below.

Now let us see the other type of switch usage.

When the inputs is 0V the output is 5V

When the input is 5V  output is 0V

Now let us summarize both conditions in a table.

Since we have only two voltage level, we also mention them as o and 1. o represents 0V and 1 represents 5V.

Instead of showing the entire circuit we draw them as a symbol. Here we have shown what is inside the symbol.

The output is inversion of input. So this function is called INVERTER. The symbol is show below.

These three logic functions AND , OR , Inverter are also called logic gates when we use transistor. When a transistor operates in Cut-off or Saturation mode, it is called GATE. So we also call the these logic functions as logic gates.

AND logic function –  AND Gate
OR    logic function –   OR Gate
Inverter    logic function  – NOT Gate.

The AND and OR GATE can have any number of Inputs and only one output. The NOT Gate will have only one input and one output.

The three Logic GATEs are the Basics of Computer. Even though they look very simple, they do miracle functions in computers. Let us see the use of these gates in some other answer

What are logic gates?