From 6e1a80e03f79e28701dc461a531ba7e32305b51d Mon Sep 17 00:00:00 2001 From: Siri Vennela Date: Thu, 30 Oct 2025 12:10:41 +0530 Subject: [PATCH 1/2] Added Derived Gates and Modified basic gates along with explanation, symbols, examples and Truth Tables. --- boolean_algebra/README.md | 122 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 122 insertions(+) diff --git a/boolean_algebra/README.md b/boolean_algebra/README.md index 45969c855f9c..aa0a6df08df1 100644 --- a/boolean_algebra/README.md +++ b/boolean_algebra/README.md @@ -2,6 +2,128 @@ Boolean algebra is used to do arithmetic with bits of values True (1) or False (0). There are three basic operations: 'and', 'or' and 'not'. +Special or derived operations are : 'NAND', 'NOR', 'XOR' and 'XNOR' + +AND : +The AND operation in Boolean algebra gives a result of 1 (True) only when all the input variables are 1 (True). +If any input is 0 (False), the output will be 0 (False). + +Symbol: · or ∧ +Example: If A = “I study” and B = “I sleep early”, +then A AND B means “I study and I sleep early”. +------------------------------ + |INPUT A | INPUT B | Output | + ------------------------------ + | 0 | 0 | 0 | + | 0 | 1 | 0 | + | 1 | 0 | 0 | + | 1 | 1 | 1 | + ------------------------------ + +OR : +The OR operation gives a result of 1 (True) when at least one of the input variables is 1 (True). +It gives 0 (False) only when all inputs are 0 (False). + +Symbol: + or ∨ +Example : If A = “I study” and B = “I sleep early”, +then A OR B means “I study or I sleep early”. + + ------------------------------ + | INPUT A | INPUT B | Output | + ------------------------------ + | 0 | 0 | 0 | + | 0 | 1 | 1 | + | 1 | 0 | 1 | + | 1 | 1 | 1 | + ------------------------------ + +NOT: +The NOT operation is a unary operation (works on one variable). +It inverts the value of the variable — +if the input is 1 (True), the output becomes 0 (False), and vice versa. + +Symbol: Overline ( ̅ ), ¬, or ! +Example : If A = “It’s raining”, then NOT A means “It’s not raining”. + + ------------------------------ + | A | A̅ | + ------------------------------ + | 0 | 1 | + | 1 | 0 | + ------------------------------ + +NAND: +The NAND operation is the inverse of the AND operation. +It gives an output of 0 (False) only when all inputs are 1 (True). +For all other combinations, the output is 1 (True). + +Symbol: (A · B)̅ or ¬(A ∧ B) +Example: +If A = “I study” and B = “I sleep early”, +then A NAND B means “It’s not true that I study and sleep early both.” + + +------------------------------ + | INPUT A | INPUT B | Output | + ------------------------------ + | 0 | 0 | 1 | + | 0 | 1 | 1 | + | 1 | 0 | 1 | + | 1 | 1 | 0 | + ------------------------------ + +NOR: +The NOR operation is the inverse of the OR operation. +It gives an output of 1 (True) only when all inputs are 0 (False). +If any input is 1 (True), the output becomes 0. + +Symbol: (A + B)̅ or ¬(A ∨ B) +Example : If A = “I study” and B = “I sleep early”, +then A NOR B means “Neither I study nor I sleep early.” + +------------------------------ + | INPUT A | INPUT B | Output | + ------------------------------ + | 0 | 0 | 1 | + | 0 | 1 | 0 | + | 1 | 0 | 0 | + | 1 | 1 | 0 | + ------------------------------ + +XOR: +The XOR (Exclusive OR) operation gives an output of 1 (True) only when exactly one of the inputs is 1 (True). +If both inputs are the same (both 0 or both 1), the output is 0 (False). + +Symbol: ⊕ or A XOR B +Example: +If A = “I study” and B = “I sleep early”, +then A XOR B means “I study or I sleep early, but not both.” + +------------------------------ + | INPUT A | INPUT B | Output | + ------------------------------ + | 0 | 0 | 0 | + | 0 | 1 | 1 | + | 1 | 0 | 1 | + | 1 | 1 | 0 | + ------------------------------ + +XNOR: +The XNOR (Exclusive NOR) operation is the inverse of the XOR operation. +It gives an output of 1 (True) when both inputs are the same — either both 0 or both 1. +If the inputs are different, the output is 0 (False). + +Symbol: ⊙ or (A ⊕ B)̅ or A XNOR B +Example: If A = “I study” and B = “I sleep early”, +then A XNOR B means “Either I study and sleep early both, or neither I study nor sleep early.” +------------------------------ + | INPUT A | INPUT B | Output | + ------------------------------ + | 0 | 0 | 1 | + | 0 | 1 | 0 | + | 1 | 0 | 0 | + | 1 | 1 | 1 | + ------------------------------ * * From 9fc6bf7fb19872cacd79cfb3375735a5382f12e9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 30 Oct 2025 06:50:30 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- boolean_algebra/README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/boolean_algebra/README.md b/boolean_algebra/README.md index aa0a6df08df1..a4416d70b7c2 100644 --- a/boolean_algebra/README.md +++ b/boolean_algebra/README.md @@ -4,7 +4,7 @@ Boolean algebra is used to do arithmetic with bits of values True (1) or False ( There are three basic operations: 'and', 'or' and 'not'. Special or derived operations are : 'NAND', 'NOR', 'XOR' and 'XNOR' -AND : +AND : The AND operation in Boolean algebra gives a result of 1 (True) only when all the input variables are 1 (True). If any input is 0 (False), the output will be 0 (False). @@ -20,7 +20,7 @@ then A AND B means “I study and I sleep early”. | 1 | 1 | 1 | ------------------------------ -OR : +OR : The OR operation gives a result of 1 (True) when at least one of the input variables is 1 (True). It gives 0 (False) only when all inputs are 0 (False). @@ -43,7 +43,7 @@ It inverts the value of the variable — if the input is 1 (True), the output becomes 0 (False), and vice versa. Symbol: Overline ( ̅ ), ¬, or ! -Example : If A = “It’s raining”, then NOT A means “It’s not raining”. +Example : If A = “It’s raining”, then NOT A means “It’s not raining”. ------------------------------ | A | A̅ | @@ -52,7 +52,7 @@ Example : If A = “It’s raining”, then NOT A means “It’s not raining” | 1 | 0 | ------------------------------ -NAND: +NAND: The NAND operation is the inverse of the AND operation. It gives an output of 0 (False) only when all inputs are 1 (True). For all other combinations, the output is 1 (True). @@ -72,7 +72,7 @@ then A NAND B means “It’s not true that I study and sleep early both.” | 1 | 1 | 0 | ------------------------------ -NOR: +NOR: The NOR operation is the inverse of the OR operation. It gives an output of 1 (True) only when all inputs are 0 (False). If any input is 1 (True), the output becomes 0. @@ -108,7 +108,7 @@ then A XOR B means “I study or I sleep early, but not both.” | 1 | 1 | 0 | ------------------------------ -XNOR: +XNOR: The XNOR (Exclusive NOR) operation is the inverse of the XOR operation. It gives an output of 1 (True) when both inputs are the same — either both 0 or both 1. If the inputs are different, the output is 0 (False).