Module 3
Module 3
Algebra has computations similar to arithmetic but with letters standing for numbers which
allows proofs of properties that are true regardless of the numbers involved. For example,
quadratic equation: ax2 + bx + c = 0 where a, b, c can be any number (a≠0). Algebra is used in
many studies, for example, elementary algebra, linear algebra, Boolean algebra, and so on.
1.1 Polynomials
A polynomial involves operations of addition, subtraction, multiplication, and non-negative
integer exponents of terms consisting of variables and coefficients. For example, x2 + 2x − 3 is a
polynomial in the single variable x. Polynomial can be rewritten using commutative, associative
and distributive laws.
An important part of algebra is the factorization of polynomials by expressing a given
polynomial as a product of other polynomials that cannot be factored any further. Another
important part of algebra is computation of polynomial greatest common divisors. x2 + 2x − 3 can
be factored as (x − 1)(x + 3).
Boolean algebra can be used to describe logic circuit; it is also use to reduce complexity of
digital circuits by simplifying the logic circuits. Boolean algebra is also referred to as Boolean
logic. It was developed by George Boole sometime on the 1840s and is greatly used in
computations and in computer operations. The name Boolean comes from the name of the
author.
Boolean algebra is a logical calculus of truth values. It somewhat resembles the arithmetic
algebra of real numbers but with a difference in its operators and operations. Boolean operations
involve the set {0, 1}, that is, the numbers 0 and 1. Zero [0] represents “false” or “off” and One
[1] represents “true” or “on”.
1 – True, on
0 – False, off
This has proved useful in programming computer devices, in the selection of actions based on
conditions set.
1. AND
The AND operator is represented by a period or dot in-between the two operands e.g
- X .Y
The Boolean multiplication operator is known as the AND function in the logic domain;
the function evaluates to 1 only if both the independent variables have the value 1.
2. OR
The OR operator is represented by an addition sign. Here the operation + is different from
that defined in normal arithmetic algebra of numbers. E.g. X+Y
The + operator is known as the OR function in the logic domain; the function has a value
of 1 if either or both of the independent variables has the value of 1.
3. NOT
The NOT operator is represented by X' or X̅ .
This operator negates whatever value is contained in or assigned to X. It changes its value
to the opposite value. For instance, if the value contained in X is 1, X' gives 0 as the
result and if the value stored in X is 0, X' gives 1 as the result. In some texts, NOT may
be represented as X̅
To better understand these operations, truth table is presented for the result of any of the
operations on any two variables.
Truth Tables
A truth table is a mathematical table used in logic to compute the functional values of
logical expressions on each of their functional arguments. It is specifically in connection with
Boolean algebra and Boolean functions. Truth tables can be used to tell if a proposition
expression is logically valid. In a truth table, the output is completely dependent on the input. It
is composed of a column for each input entry and another column the corresponding output.
Each row of the truth table therefore contains one possible configuration of the input variables
(for instance, X=true Y=false), and the result of the operation for those values.
Truth tables are a means of representing the results of a logic function using a table. They are
constructed by defining all possible combinations of the inputs to a function in the Boolean
algebra, and then calculating the output for each combination in turn. The basic truth table shows
the various operators and the result of their operations involving two variables only. More
complex truth tables can be built from the knowledge of the foundational truth table. The number
of input combinations in a Boolean function is determined by the number of variables in the
function and this is computed using the formula .
For example, a function with two variables has an input combination of =4. Another with
three variables has =8 input combinations, and so on.
AND
X Y X.Y
0 0 0
0 1 0
1 0 0
1 1 0
OR
X Y X+Y
0 0 0
0 1 1
1 0 1
1 1 1
NOT
X X'
0 1
1 0
The NOT operation is a unary operator; it accepts only one input.
Example:
• Draw a truth table for A+BC. • Draw a truth table for AB+BC.
A B C BC A+BC A B C AB BC AB+BC
0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 1 0 0 0
0 1 0 0 0 0 1 0 0 0 0
0 1 1 1 1 0 1 1 0 1 1
1 0 0 0 1 1 0 0 0 0 1
1 0 1 0 1 1 0 1 0 0 0
1 1 0 0 1 1 1 0 1 0 1
1 1 1 1 1 1 1 1 1 1 1
J= f(A,B,C) = A +
A B C A A +
0 0 0 1 1 1 0 1 1
0 0 1 1 1 0 0 0 0
0 1 0 1 0 1 0 0 0
0 1 1 1 0 0 0 0 0
1 0 0 0 1 1 1 0 1
1 0 1 0 1 0 0 0 0
1 1 0 0 0 1 0 0 0
1 1 1 0 0 0 0 0 0
Basic Logic Gates
Logic can be viewed as black boxes with binary input (independent variable) and binary output
(dependent variable). It also refers to both the study of modes of reasoning and the use of valid
reasoning. In the latter sense, logic is used in most intellectual activities. Logic in computer
science has emerged as a discipline and it has been extensively applied in the fields of Artificial
Intelligence, and Computer Science, and these fields provide a rich source of problems in formal
and informal logic.
Boolean logic, which has been considered as a fundamental part to computer hardware,
particularly, the system's arithmetic and logic structures, relating to operators AND, NOT, and
OR.
Logic gates
A logic gate is an elementary building block of a digital circuit. Complex electronic circuits are
built using the basic logic gates. At any given moment, every terminal of the logic gate is in one
of the two binary conditions low (0) or high (1), represented by different voltage levels.
Other gates- NAND, NOR, XOR and XNOR are based on the 3 basic gates.
The output is "true" when both inputs are "true." Otherwise, the output is "false."
The OR gate
The OR gate gets its name from the fact that it behaves after the way of the logical "or." The
output is "true" if either or both of the inputs are "true." If both inputs are "false," then the output
is "false."
A logical inverter, sometimes called a NOT gate to differentiate it from other types of electronic
inverter devices, has only one input. It reverses the logic state (i.e. its input).
As previously considered, the AND, OR and NOT gates’ actions correspond with the AND, OR
and NOT operators.
More complex functions can be constructed from the three basic gates by using DeMorgan’s
Law.
The NAND gate operates as an AND gate followed by a NOT gate. It acts in the manner of the
logical operation "and" followed by negation. The output is "false" if both inputs are "true."
Otherwise, the output is "true". It finds the AND of two values and then finds the opposite of the
resulting value.
The NOR gate is a combination of an OR gate followed by an inverter. Its output is "true" if both
inputs are "false." Otherwise, the output is "false". It finds the OR of two values and then finds
the complement of the resulting value.
The XOR gate
The XOR (exclusive-OR) gate acts in the same way as the logical "either/or." The output is
"true" if either, but not both, of the inputs are "true." The output is "false" if both inputs are
"false" or if both inputs are "true." Another way of looking at this circuit is to observe that the
output is 1 if the inputs are different, but 0 if the inputs are the same.
( A ⊕ B)
Z=
XOR gate
A B Z
0 0 0
0 1 1
1 0 1
1 1 0
The XNOR (exclusive-NOR) gate is a combination of an XOR gate followed by an inverter. Its
output is "true" if the inputs are the same, and"false" if the inputs are different. It performs the
operation of an XOR gate and then inverts the resulting value.
( A ⊕ B)
Z=
XNOR gate
A B Z
0 0 1
0 1 0
1 0 0
1 1 1