What Is Boolean Algebra And Why Is It Used in Computer Science?
George Boole, an English mathematician tried to find a way to express and simplify difficult algebraic algorithms and built a system called Boolean algebra.
What Is Boolean Algebra?
Boolean algebra is a mathematical system that consists of symbols that are used to understand the relativity between two contents.
The two logical variables are-
- TRUE
- FALSE
True is represented by 1 and false by 0.
Logic circuits are being designed by the use of Boolean Algebra. It is simple yet powerful part of Algebra that can be used for performing simple to complex analysis.
The following five types of operations can be performed with Boolean algebra-
- NOT
- AND
- OR
- NAND
- NOR
NOT-
NOT gives the reverse outcome of the input that’s being made. For example, if you have given 1 as an input, NOT will generate the opposite as an output which is 0 and vice-versa. So, in total you can have two possible outcomes.
Input | Output |
0 | 1 |
1 | 0 |
NOT Table
AND-
With AND, you have to make two digits input and the output depends on them.
If you have given both 1 as input in AND operation, you will get 1 as an output otherwise the output will be zero.
Input 1 | Input 2 | Output |
0 | 0 | 0 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 1 |
AND Table
OR-
With OR, you have to make two digits input and the output depends on them.
If one of the values given to OR operation is 1, then the output would be 1 otherwise 0.
Input-1 | Input-2 | Output |
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 1 |
OR Table
NAND-
When you combine AND and NOT, the output is NAND. Together they form a cascade. If both the inputs are 1, then the output will be 0 otherwise all combinations will result in 1.
Input-1 | Input-2 | Output |
0 | 0 | 1 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
NAND Table
NOR-
The combination of NOT and OR will result in NOR. It reverses the output of OR. When both the inputs are 0, that’s only way the output comes is 1. Rest of the inputs gets 0 as output.
Input-1 | Input-2 | Output |
0 | 0 | 1 |
0 | 1 | 0 |
1 | 0 | 0 |
1 | 1 | 0 |
NOR Table
Basic Boolean Laws-
Boolean algebra comes with the set number of laws in order to simplify boolean expressions properly.
Basic Boolean Laws are as follows:
1. Idempotent Law-
A * A = A (A variable AND with itself is always equal to the variable)
A + A = A (A variable OR with itself is always equal to the variable)
2. Associative Law-
You can re-group the variables by removing the brackets-
(A * B) * C = A * (B * C)
(A + B) + C = A + (B + C)
3. Commutative Law-
Application order change doesn’t matter. It’s same one way or the other-
A * B = B * A
A + B = B + A
4. Distributive Law-
This law allows you to multiply or factor out the variables-
A * (B + C) = A * B + A * C
A + (B * C) = (A + B) * (A + C)
5. Identity Law-
A * 0 = 0 A * 1 = A (A variable AND with 1 is always equal to the variable)
A + 1 = 1 A + 0 = A (A variable OR with 0 is always equal to the variable)
6. Complement Law-
A * ~A = 0 (A variable AND with its complement is always equal to 0)
A + ~A = 1 (A variable OR with its complement is always equal to 1)
7. Involution Law-
~(~A) = A
8. DeMorgan’s Law-
~(A * B) = ~A + ~B
Two separate terms NAND together is the same as the two terms Complemented and OR
~(A + B) = ~A * ~B
Two separate terms NOR together is the same as the two terms Complemented and AND
9. Absorption-
In this law, like terms gets absorbed in order to simplify a complicated expression-
A + (A * B) = A
A * (A + B) = A
Each law is described by two parts that are duals of each other.
The duality Principle is Interchanging the + (OR) and * (AND) operations of the expression or interchanging the 0 and 1 variables of the expression and not changing the form of the variables.
Not everyone has the mathematical mind and simplifying such complex expressions can be very difficult for them. One needs help in such matters from time to time.
Boolean Algebra Calculator-
In order to make your life easy, Boolean Calculator is available online that can help you simply any boolean expression. You can easily find the truth table with its help.
Boolean Algebra Calculator is very ease to use. It can simplify any expression in no time. All you have to do is add an expression and press PARSE and that’s it.
The complicated Algebraic expression gets simple with a click and you get the result that you can use with what ever task you are performing.
Uses Of Boolean Algebra In Computer Science-
Boolean Algebra has wide range of usage in computer science world. A lot of programming is done with the help of Boolean Algebra. It consist of two expressions and their comparison.
For Example-
You will always get a true result 5 < 8 as 5 is always less than 8.
In x<6, you will only get the true result when x is a number that is less than 6 but a false result if x is a number that is equal to or greater than 6.
A<B is only true when A is a variable that is less than variable B. For programming purposes, other data types can also be used.
Overall, Boolean algebra has been very helpful in our lives.
![Gate Vidyalay](https://www.gatevidyalay.com/wp-content/uploads/2018/05/Gate-Vidyalay-Logo.png)