0% found this document useful (0 votes)
1 views

boolean algebra - Coding Ninjas

The document provides an overview of Boolean algebra, which focuses on logical operations involving binary variables represented as 0 (false) and 1 (true). It covers the basic operations (negation, conjunction, disjunction), laws, theorems like De Morgan's Law, and the use of truth tables and logic diagrams to represent Boolean functions. The blog emphasizes the importance of Boolean algebra in simplifying complex expressions in computer programming and related fields.

Uploaded by

Adesh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

boolean algebra - Coding Ninjas

The document provides an overview of Boolean algebra, which focuses on logical operations involving binary variables represented as 0 (false) and 1 (true). It covers the basic operations (negation, conjunction, disjunction), laws, theorems like De Morgan's Law, and the use of truth tables and logic diagrams to represent Boolean functions. The blog emphasizes the importance of Boolean algebra in simplifying complex expressions in computer programming and related fields.

Uploaded by

Adesh
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

Boolean Algebra

Saloni Singhal

Introduction

Boolean algebra is a division in mathematics that deals with logical operations and incorporates
binary variables. The distinguishing factor of Boolean algebra is that it deals with the study of
binary variables. Boolean variables are represented with the possible values of 0 (false) or 1 (true).
The variables can also have more complex interpretations, such as set theory. The modern use of
Boolean algebra is in computer programming languages.

This blog will discuss Boolean Algebra, its function, laws, and its complement, along with the truth
table and logical diagram.

Boolean Algebra

Boolean algebra is a category of algebra that deals with the truth values of the variables. i.e., Truth
or false, ideally represented in the form of 1 and 0, respectively. Elementary algebra deals with
numeric operations, whereas Boolean algebra deals with logistic operations. Boolean algebra is
also known as Binary Algebra. It uses conjunction, disjunction, and negation, instead of addition,
subtraction, multiplication, and division.

Boolean Algebra Operations

The three basic algebraic operations in the order of their precedence are as follows:

Negation (NOT operation): The negation of two variables is represented by the given Venn
diagram. Here, the region except for the negated variable is included in the result. It is also
represented by the ‘ or ¬ symbol.

Source: Link

Conjunction (AND operation): A conjunction of two variables is represented by the given


Venn diagram. Here, the common region between both the variables represents the conjunction
between A and B. (A ∧ B) It is also represented by dot(.) or ∧ symbol.
Source: Link

Disjunction (OR operation): The given Venn diagram represents a disjunction of two
variables. Here, the entire region covered by A and B represents the disjunction. (A ∨ B) It is also
represented by + or ∨ symbol.

Source: Link

Boolean Algebra Truth Table

The table used to represent the Boolean expression is commonly known as Truth Table. A logic
gate truth table represents every possible input combination to the gate with the resultant output
depending upon the combination of these inputs. The number of rows in a Truth Table is equal to
2n, where n equals the number of literals in the given function.

Consider the Truth Table given below:


Boolean Functions

A Boolean function is formed with binary variables, operators (AND, OR, and NOT), and
parenthesis. The value of a Boolean function can either be 0 or 1. A Boolean function can be
represented in a truth table or an algebraic expression.

Representation as an Algebraic Expression

Consider the given expression:

Y = X + (W)’ ^ Z

Here, variable Y is a function of X, W, and Z that can also be written as Y= f(X, W, Z).

The RHS of the equation is known as expression, and the variables X, W, and Z are known as the
literals of the expression. A Boolean function can have more than one algebraic expression.

Representation as a Truth Table

Consider the given expression:

Y = X + (W)’ ^ Z

Truth Table for the given expression will look like this:
Laws in Boolean Algebra

The basic laws of Boolean algebra are as follows:

Commutative Law: This law states that changing the order of operands in a Boolean equation
doesn’t affect the output of the equation.
Example: A + B = B + A

Associative Law: This law states that the output of the Boolean equation does not depend on the
order of the logical operands.
Example: (A*B)*C = A*(B*C)

Distributive Law: Every Boolean expression satisfies the following condition:


(A + B) *C = A*C + B*C

AND Law: This law uses the AND operation.


A .0 = 0 (Annulment)
A . 1 = A (Identity)
A. A = A (Idempotent)
A. A’ = 0 (Complement)

OR Law: This law uses the OR operation.


A + 0 = A (Identity)
A + 1 = 1 (Annulment)
A + A = A (Idempotent)
A + A’ = 1 (Complement)

Inversion Law: This law states that the double inversion of the variable results in the original
variable. i.e., A = (A’)’.

Absorption Law: Every Boolean expression satisfies the following condition:


A . (A + B) = A
A + AB = A
Theorems in Boolean Algebra

The most important theorem used in Boolean Algebra is known as De Morgan’s Law/ Theorem
depending on the concept of duality. Duality states the interchanging of operators such as AND to
OR and vice-versa, or the variables 0 to 1 and 1 to 0.

The two theorems given by De Morgan's are as follows:

De Morgan's First Law: This law states that the negation of a conjunction is the disjunction of
the negation, which implies that the complement of the variable’s product is equal to the sum of
their complements.
( A . B)’ = A’ + B’
We can verify the above expression by the given truth table:

De Morgan’s Second Law: This law states that the negation of a disjunction is the conjunction
of the negation, which implies that the complement of the variable’s sum is equal to the product of
their complements.
( A + B )’ = A’. B’
We can verify the above expression by the given truth table:

Boolean Logic Diagram

Let’s try to understand the concept of a logic diagram through some examples. Consider the
following examples:

Example: Given a Boolean expression Y = A + B’C

The logic diagram for the Boolean expression can be represented as:
The given Boolean expression is converted into a logic diagram consisting of AND, OR, inverter
gates with the help of the truth table. The inverter at B generated B’. Similarly, there is an AND
gate attached for the expression B’C, and at last, the OR gate is used to combine the complete
expression A + B’C.

The truth table for the given expression will look like this:

Frequently Asked Questions

What is a snooping protocol?


A snooping protocol is also known as the bus-snooping protocol. It is used to maintain the cache
coherency in symmetric multiprocessing environments. All caches on the bus snoop are monitored
to determine if they have a copy of the requested data on the bus. In a multiprocessing
environment, several copies of a file can be read without facing the problem of coherence.
However, a processor should have access to the bus to write.

What is the easiest way to determine the cache location to store the memory blocks?
Direct mapping is one of the easiest ways to define the cache locations to store memory blocks. It
maps each block of the main memory into one possible cache line. The cache in a direct-mapped
structure is organized into several sets, a single line per set. Based on the memory block's address,
it can only use a single cache line. The cache can also be framed as a column matrix.
What do you understand by the term wait-state?
A wait-state is when a computer processor experiences a delay while accessing a device or an
external memory. We try to minimize or eliminate wait-states as they are considered wasteful in a
processor's performance. These include pipelines, caches, instruction prefetch, branch prediction,
and simultaneous multithreading. These techniques can't eliminate wait-states, but they can
significantly minimize the problem when implemented simultaneously.

Key Takeaways

This blog discussed Boolean Algebra, its complement, functions, laws, along with the truth table
and logic expressions. Boolean Algebra is very useful when dealing with complex expressions. Such
expressions can be simplified using Boolean logic diagrams and truth tables.

If you are a beginner and are interested in learning other fields related to computer subjects such
as web development, or competitive programming, you can follow our guided path to get a good
grip on such concepts.

You might also like