# Electronics/Boolean Algebra
## Boolean Algebra

Boolean Algebra was created by George Boole (1815 - 1864) in his paper An Investigation of the Laws of Thought, on Which Are Founded the Mathematical Theories of Logic and Probabilities, published in 1854. It had few applications at the time, but eventually scientists and engineers realized that his system could be used to create efficient computer logic. The Boolean system has two states: True (T) or False (F). This can be represented in several different ways as on or off, one or zero, yes or no, etc. These states are manipulated by three fundamental operations called logical operators: AND, OR and NOT. These operators take certain inputs and produce an output based on a predetermined table of results. For example, the AND operator takes two (or more) inputs and returns an 'on' result only when both (or all) inputs are 'on'.
* In these tables T means "True", or "Yes", or 1 (in electronics), and
* F means "False", or "No" or 0 (in electronics).
* For example, the 1st line of the AND table says that if A is F and B is F then the result also is F. This is also said often as If A is 0 and B is also 0, then A AND B = 0 times 0 = 0
* Also at the bottom of the AND table 1 times 1 is 1.
* Looking at the OR table, use plus instead of times: 0 plus 0 is 0, where again 0 is F and 1 is T. Only 0 and 1 exist, therefore if the result of the addition is more than 1, then change it to 1.
* The 3rd table shows NEGATION: whatever it is, change it to the other; 0 is changed into 1, and 1 is changed into 0.
AND :
| A | B | $A\wedge B$ |
| F | F | F |
| F | T | F |
| T | F | F |
| T | T | T |
OR :
| A | B | $A\vee B$ |
| F | F | F |
| F | T | T |
| T | F | T |
| T | T | T |
NOT :
| A | ${\bar {A}}$ |
| F | T |
| T | F |
These simple operators are good because they allow us to create very simple logic circuits: if user put in a quarter AND the Coke button is pressed, drop a Coke
There are ways, however, to combine these expressions to make much more complex but useful digital circuits. By using multiple operators on the same inputs, it is possible to create much more complex outputs. An expression like: A and B or C would have a truth table of the following:
A and B or C :
| A | B | C | X |
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 |
This truth table follows the rules If A and B are true, or C is true, then X is true
Exercise: Go through each case in the table and check it using the above statement.

### Formal Mathematical Operators

AND is represented by $\wedge$ or $\cdot \,$ that is A AND B would be $A\wedge B\,$ or $A\cdot B\,$.
OR is represented by $\vee$ or $+\,$ that is A OR B would be $A\vee B$ and $A+B\,$.
NOT is represented by $\lnot$ or ${\bar}$ that is NOT A is $\neg A$ or ${\bar {A}}$.
If these three operators are combined then the NOR and NAND can be created. So A NOR B is $\neg (A\vee B)$ or ${\overline {A+B}}$. NAND is $\neg (A\wedge B)\,$ or ${\overline {A\cdot B}}$. Other notations are valid as well, and many different combinations of them arise in mathematics and engineering. No universal standard has been agreed upon. However, most sources will make explicit the particular notation used.

### Boolean Algebra Laws

Boolean Algebra, like regular algebra, has certain rules. These rules are Associativity, Distributivity, Commutativity and De Morgan's Laws. Associativity, Commutativity and Distributivity only apply to the AND and OR operators. Some of these laws may seem trivial in normal Algebra but in other algebras they are not.

#### Associativity

Associativity is the property of algebra that the order of evaluation of the terms is immaterial.
    $A\vee (B\vee C)=(A\vee B)\vee C$
    $A\wedge (B\wedge C)=(A\wedge B)\wedge C$
Or
    $A+(B+C)=(A+B)+C\,$
    $A\cdot (B\cdot C)=(A\cdot B)\cdot C\,$
    Wikipedia:Associativity

#### Distributivity

Distibutivity is the property that an operator can be applied to the terms within the brackets.
    $A\wedge (B\vee C)=(A\wedge B)\vee (A\wedge C)$
Or
    $A\cdot (B+C)=(A\cdot B)+(A\cdot C)\,$
    Wikipedia:Distributivity

#### Commutativity

Commutativity is the property that order of application of an operator is immaterial.
    $A\wedge B=B\wedge A$
    $A\vee B=B\vee A$
Or
    $A\cdot B=B\cdot A\,$
    $A+B=B+A\,$
    Wikipedia:Commutativity

#### De Morgan's Law

De Morgan's Law is a consequence of the fact that the not or negation operator is not distributive.
    $\neg (P\wedge Q)=(\neg P)\vee (\neg Q)$
    $\neg (P\vee Q)=(\neg P)\wedge (\neg Q)$
Or
    ${\overline {P\cdot Q}}={\bar {P}}+{\bar {Q}}$
    ${\overline {P+Q}}={\bar {P}}\cdot {\bar {Q}}$

#### Notes

It is important to note that
    $A\wedge B\vee C\neq A\wedge (B\vee C)$
Or
    $A\cdot B+C\neq A\cdot (B+C)$
This can be seen as either AND having a higher precedence or the fact that Associativity does not hold between AND and OR or that it is an invalid application of distributivity.
Another way of looking at this is the possible application of our understanding of normal algebra rules using the second notation. Where clearly the analogy between OR being addition and AND being multiplication is made. We would never make this error if this were high school algebra.

#### Rules

All of these Laws Result in a number of rules used for the reduction of Boolean Algebra.
* $A\wedge A=A\,$
* $A\vee A=A\,$
* $A\wedge 1=A\,$
* $A\vee 1=1\,$
* $A\wedge 0=0\,$
* $A\vee 0=A\,$
* $A\wedge \neg {A}=0\,$
* $A\vee \neg {A}=1\,$
* $\neg (\neg {A})=A\,$
* $A\vee \neg {A}\wedge B=A\vee B$
* $\neg {A}\vee A\wedge B=\neg {A}\vee B$
Or
* $A\cdot A=A\,$
* $A+A=A\,$
* $A\cdot 1=A\,$
* $A+1=1\,$
* $A\cdot 0=0\,$
* $A+0=A\,$
* $A\cdot {\bar {A}}=0\,$
* $A+{\bar {A}}=1\,$
* ${\overline {\bar {A}}}=A\,$
* $A+{\bar {A}}\cdot B=A+B$
* ${\bar {A}}+A\cdot B={\bar {A}}+B$

### Examples

Simplify the following Expressions.
* $B\wedge A\wedge \neg {A}$
* $A\wedge \neg {B}\vee A\wedge B$
Or
* $B\cdot A\cdot {\bar {A}}$
* $A\cdot {\bar {B}}+A\cdot B$
For number 1 using rule 7. We get.
    $B\wedge 0=0\,$
Or
    $B\cdot 0=0\,$
Which happens to be rule 5 so the answer is zero. In number 2 we can take out A. Given
    $A\wedge (\neg {B}\vee B)$
Or
    $A\cdot ({\bar {B}}+B)$
The Expression within brackets is rule 8. So the answer is A.

### See also

Wikipedia: Boolean logic