# How to be a Programmer | Part 7 : Logic Gates and Boolean Algebra

Logic Gates and Boolean Algebra

## Logic Gates

The Computer (Electronic Devices) is made of a large amount of complex digital circuits. Logic gates are the basic items of any digital circuits. There are seven basic logic gates:

AND, OR, NOT, XOR, NAND, NOR, XNOR

How to be a Programmer

### Logic Gates and Boolean Algebra – AND Gate (.)

If at least one input is in False (0) state, the output of AND gate is False (0).

### Logic Gates and Boolean Algebra – OR Gate (+)

At least one input should be 1 for the output of OR gate to be 1.

### Logic Gates and Boolean Algebra – NOT Gate (–)

Not gate consists of only one input. Output will be FALSE if input is TRUE and Output will be TRUE if input is FALSE.

### Logic Gates and Boolean Algebra – XOR Gate

In this gate, the output will be FALSE if both inputs are at the same state (TRUE or FALSE) and output will be TRUE if both the inputs are at the different state.

### Logic Gates and Boolean Algebra – NAND Gate

NAND gate is a combination of AND gate and NOT gate. It works opposite to the AND gate

### Logic Gates and Boolean Algebra – NOR Gate

NOR gate is a combination of OR gate and NOT gate. It works opposite to the OR gate

### Logic Gates and Boolean Algebra – XNOR Gate

It is exclusive NOR gate. It is a combination of XOR gate and NOT gate. It works opposite to the XOR gate. In this gate, the output will be TRUE when both the inputs are at the same state. and output will be FALSE if both the input are a different state,

## Boolean Algebra

Boolean Algebra is used to analyze and simplify the logic circuits. It introduced by George Boole in 1847

X.0 = 0
X+1 = 1

X.1 = X
X+0 = X

X.X = X
X+X = X

X.X = 0
X+X = 1

X = X

X.Y = Y.X
X+Y = Y+X

### Associative law

X.(Y.Z) = (X.Y).Z = (X.Z).Y = X.Y.Z
X+(Y+Z) = (X+Y)+Z = (X+Z)+Y = X+Y+Z

### Distributive law

X.(Y+Z) = X.Y + X.Z
X+Y.Z = (X+Y).(X+Z)

X.Y = X+Y
X+Y = X.Y

X.(X+Y) = X
X+(X.Y) = X

### Consensus law

(X+Y).(X+Z).(Y+Z) = (X+Y).(X+Z)
(X.Y)+(X.Z)+(Y.Z) = X.Y+X.Z

(X+Y).(X+Y) = X
X.Y+X.Y = X
(X+Y).Y = XY
X.Y+Y = X+Y

### Hi Friends,

Hope this post (How to be a Programmer Part 7 – Logic Gates and Boolean Algebra) will help you to learn something. If you enjoy my work, please Share my posts with your friends and anyone who might be interested in programming. Don’t forget to Comment and, Subscribe.

See you in the comment section.