Skip to content

Commit 6e1a80e

Browse files
Added Derived Gates and Modified basic gates along with explanation, symbols, examples and Truth Tables.
1 parent e2a78d4 commit 6e1a80e

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed

boolean_algebra/README.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,128 @@
22

33
Boolean algebra is used to do arithmetic with bits of values True (1) or False (0).
44
There are three basic operations: 'and', 'or' and 'not'.
5+
Special or derived operations are : 'NAND', 'NOR', 'XOR' and 'XNOR'
6+
7+
AND :
8+
The AND operation in Boolean algebra gives a result of 1 (True) only when all the input variables are 1 (True).
9+
If any input is 0 (False), the output will be 0 (False).
10+
11+
Symbol: · or ∧
12+
Example: If A = “I study” and B = “I sleep early”,
13+
then A AND B means “I study and I sleep early”.
14+
------------------------------
15+
|INPUT A | INPUT B | Output |
16+
------------------------------
17+
| 0 | 0 | 0 |
18+
| 0 | 1 | 0 |
19+
| 1 | 0 | 0 |
20+
| 1 | 1 | 1 |
21+
------------------------------
22+
23+
OR :
24+
The OR operation gives a result of 1 (True) when at least one of the input variables is 1 (True).
25+
It gives 0 (False) only when all inputs are 0 (False).
26+
27+
Symbol: + or ∨
28+
Example : If A = “I study” and B = “I sleep early”,
29+
then A OR B means “I study or I sleep early”.
30+
31+
------------------------------
32+
| INPUT A | INPUT B | Output |
33+
------------------------------
34+
| 0 | 0 | 0 |
35+
| 0 | 1 | 1 |
36+
| 1 | 0 | 1 |
37+
| 1 | 1 | 1 |
38+
------------------------------
39+
40+
NOT:
41+
The NOT operation is a unary operation (works on one variable).
42+
It inverts the value of the variable —
43+
if the input is 1 (True), the output becomes 0 (False), and vice versa.
44+
45+
Symbol: Overline ( ̅ ), ¬, or !
46+
Example : If A = “It’s raining”, then NOT A means “It’s not raining”.
47+
48+
------------------------------
49+
| A | A̅ |
50+
------------------------------
51+
| 0 | 1 |
52+
| 1 | 0 |
53+
------------------------------
54+
55+
NAND:
56+
The NAND operation is the inverse of the AND operation.
57+
It gives an output of 0 (False) only when all inputs are 1 (True).
58+
For all other combinations, the output is 1 (True).
59+
60+
Symbol: (A · B)̅ or ¬(A ∧ B)
61+
Example:
62+
If A = “I study” and B = “I sleep early”,
63+
then A NAND B means “It’s not true that I study and sleep early both.”
64+
65+
66+
------------------------------
67+
| INPUT A | INPUT B | Output |
68+
------------------------------
69+
| 0 | 0 | 1 |
70+
| 0 | 1 | 1 |
71+
| 1 | 0 | 1 |
72+
| 1 | 1 | 0 |
73+
------------------------------
74+
75+
NOR:
76+
The NOR operation is the inverse of the OR operation.
77+
It gives an output of 1 (True) only when all inputs are 0 (False).
78+
If any input is 1 (True), the output becomes 0.
79+
80+
Symbol: (A + B)̅ or ¬(A ∨ B)
81+
Example : If A = “I study” and B = “I sleep early”,
82+
then A NOR B means “Neither I study nor I sleep early.”
83+
84+
------------------------------
85+
| INPUT A | INPUT B | Output |
86+
------------------------------
87+
| 0 | 0 | 1 |
88+
| 0 | 1 | 0 |
89+
| 1 | 0 | 0 |
90+
| 1 | 1 | 0 |
91+
------------------------------
92+
93+
XOR:
94+
The XOR (Exclusive OR) operation gives an output of 1 (True) only when exactly one of the inputs is 1 (True).
95+
If both inputs are the same (both 0 or both 1), the output is 0 (False).
96+
97+
Symbol: ⊕ or A XOR B
98+
Example:
99+
If A = “I study” and B = “I sleep early”,
100+
then A XOR B means “I study or I sleep early, but not both.”
101+
102+
------------------------------
103+
| INPUT A | INPUT B | Output |
104+
------------------------------
105+
| 0 | 0 | 0 |
106+
| 0 | 1 | 1 |
107+
| 1 | 0 | 1 |
108+
| 1 | 1 | 0 |
109+
------------------------------
110+
111+
XNOR:
112+
The XNOR (Exclusive NOR) operation is the inverse of the XOR operation.
113+
It gives an output of 1 (True) when both inputs are the same — either both 0 or both 1.
114+
If the inputs are different, the output is 0 (False).
115+
116+
Symbol: ⊙ or (A ⊕ B)̅ or A XNOR B
117+
Example: If A = “I study” and B = “I sleep early”,
118+
then A XNOR B means “Either I study and sleep early both, or neither I study nor sleep early.”
119+
------------------------------
120+
| INPUT A | INPUT B | Output |
121+
------------------------------
122+
| 0 | 0 | 1 |
123+
| 0 | 1 | 0 |
124+
| 1 | 0 | 0 |
125+
| 1 | 1 | 1 |
126+
------------------------------
5127

6128
* <https://en.wikipedia.org/wiki/Boolean_algebra>
7129
* <https://plato.stanford.edu/entries/boolalg-math/>

0 commit comments

Comments
 (0)