




























































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





























































































When we type some letters or words, the computer translates them in numbers as
computers can understand only numbers. A computer can understand the positional
number system where there are only a few symbols called digits and these symbols
represent different values depending on the position they occupy in the number.
The value of each digit in a number can be determined using ā
ļ· The digit
ļ· The position of the digit in the number
ļ· The base of the number system (where the base is defined as the total number
of digits available in the number system)
Decimal Number System
The number system that we use in our day-to-day life is the decimal number system.
Decimal number system has base 10 as it uses 10 digits from 0 to 9. In decimal
number system, the successive positions to the left of the decimal point represent
units, tens, hundreds, thousands, and so on.
Each position represents a specific power of the base (10). For example, the decimal
number 1234 consists of the digit 4 in the units position, 3 in the tens position, 2 in
the hundreds position, and 1 in the thousands position. Its value can be written as
(1 x 1000)+ (2 x 100)+ (3 x 10)+ (4 x l)
(1 x 10
3
)+ (2 x 10
2
)+ (3 x 10
1
)+ (4 x l
0
)
1000 + 200 + 30 + 4
1234
As a computer programmer or an IT professional, you should understand the
following number systems which are frequently used in computers.
S.No. Number System and Description
Binary Number System
Base 2. Digits used : 0, 1
Octal Number System
Base 8. Digits used : 0 to 7
Hexa Decimal Number System
Base 16. Digits used: 0 to 9, Letters used : A- F
Binary Number System
Characteristics of the binary number system are as follows ā
ļ· Uses two digits, 0 and 1
ļ· Also called as base 2 number system
ļ· Each position in a binary number represents a 0 power of the base (2).
Example 2
0
ļ· Last position in a binary number represents a x power of the base (2).
Example 2
x
where x represents the last position - 1.
Example
Binary Number: 10101 2
Calculating Decimal Equivalent ā
Step Binary Number Decimal Number
Step 1 10101
2
((1 x 2
4
) + (0 x 2
3
) + (1 x 2
2
) + (0 x 2
1
) + (1 x 2
0
10
Step 2 10101 2
10
Step 3 10101 2
10
Note ā 10101 2
is normally written as 10101.
Octal Number System
Characteristics of the octal number system are as follows ā
ļ· Uses eight digits, 0,1,2,3,4,5,6,
ļ· Also called as base 8 number system
ļ· Each position in an octal number represents a 0 power of the base (8).
Example 8
0
ļ· Last position in an octal number represents a x power of the base (8).
Example 8
x
where x represents the last position - 1
There are many methods or techniques which can be used to convert numbers from
one base to another. In this chapter, we'll demonstrate the following ā
ļ· Decimal to Other Base System
ļ· Other Base System to Decimal
ļ· Other Base System to Non-Decimal
ļ· Shortcut method - Binary to Octal
ļ· Shortcut method - Octal to Binary
ļ· Shortcut method - Binary to Hexadecimal
ļ· Shortcut method - Hexadecimal to Binary
Decimal to Other Base System
Step 1 ā Divide the decimal number to be converted by the value of the new base.
Step 2 ā Get the remainder from Step 1 as the rightmost digit (least significant digit)
of the new base number.
Step 3 ā Divide the quotient of the previous divide by the new base.
Step 4 ā Record the remainder from Step 3 as the next digit (to the left) of the new
base number.
Repeat Steps 3 and 4, getting remainders from right to left, until the quotient becomes
zero in Step 3.
The last remainder thus obtained will be the Most Significant Digit (MSD) of the
new base number.
Example
Decimal Number: 29 10
Calculating Binary Equivalent ā
Step Operation Result Remainder
Step 1 29 / 2 14 1
Step 2 14 / 2 7 0
Step 3 7 / 2 3 1
Step 4 3 / 2 1 1
Step 5 1 / 2 0 1
As mentioned in Steps 2 and 4, the remainders have to be arranged in the reverse
order so that the first remainder becomes the Least Significant Digit (LSD) and the
last remainder becomes the Most Significant Digit (MSD).
Decimal Number : 29 10
= Binary Number : 11101
Other Base System to Decimal System
Step 1 ā Determine the column (positional) value of each digit (this depends on the
position of the digit and the base of the number system).
Step 2 ā Multiply the obtained column values (in Step 1) by the digits in the
corresponding columns.
Step 3 ā Sum the products calculated in Step 2. The total is the equivalent value in
decimal.
Example
Binary Number: 11101 2
Calculating Decimal Equivalent ā
Step Binary Number Decimal Number
Step 1 11101 2
((1 x 2
4
) + (1 x 2
3
) + (1 x 2
2
) + (0 x 2
1
) + (1 x 2
0
10
Step 2 11101 2
10
Step 3 11101 2
10
Binary Number : 11101 2
= Decimal Number : 29 10
Other Base System to Non-Decimal System
Step 1 ā Convert the original number to a decimal number (base 10).
Step 2 ā Convert the decimal number so obtained to the new base number.
Example
Octal Number : 25 8
Calculating Binary Equivalent ā
Step 1 - Convert to Decimal
Step Octal Number Decimal Number
Step 1 25 8
((2 x 8
1
) + (5 x 8
0
10
Step 2 25 8
10
Calculating Binary Equivalent ā
Step Octal Number Binary Number
Step 1 25 8
10
10
Step 2 25 8
2
2
Step 3 25 8
2
Octal Number : 25 8
= Binary Number : 10101 2
Shortcut Method ā Binary to Hexadecimal
Step 1 ā Divide the binary digits into groups of four (starting from the right).
Step 2 ā Convert each group of four binary digits to one hexadecimal symbol.
Example
Binary Number : 10101 2
Calculating hexadecimal Equivalent ā
Step Binary Number Hexadecimal Number
Step 1 10101 2
Step 2 10101
2
10
10
Step 3 10101 2
16
Binary Number : 10101 2
= Hexadecimal Number : 15 16
Shortcut Method - Hexadecimal to Binary
Step 1 ā Convert each hexadecimal digit to a 4-digit binary number (the hexadecimal
digits may be treated as decimal for this conversion).
Step 2 ā Combine all the resulting binary groups (of 4 digits each) into a single
binary number.
Example
Hexadecimal Number : 15 16
Calculating Binary Equivalent ā
Step Hexadecimal Number Binary Number
Step 1 15 16
10
10
Step 2 15
16
2
2
Step 3 15 16
2
Hexadecimal Number : 15 16
= Binary Number : 10101 2
Introduction
Boolean functions may be practically implemented by using electronic gates. The
following points are important to understand.
ļ· Electronic gates require a power supply.
ļ· Gate INPUTS are driven by voltages having two nominal values, e.g. 0V and
5V representing logic 0 and logic 1 respectively.
ļ· The OUTPUT of a gate provides two nominal values of voltage only, e.g. 0V
and 5V representing logic 0 and logic 1 respectively. In general, there is only
one output to a logic gate except in some special cases.
ļ· There is always a time delay between an input being applied and the output
responding.
Truth Tables
Truth tables are used to help show the function of a logic gate. If you are unsure
about truth tables and need guidence on how go about drawning them for individual
gates or logic circuits then use the truth table section link.
This is a NOT-AND gate which is equal to an AND gate followed by a NOT
gate. The outputs of all NAND gates are high if any of the inputs are low.
The symbol is an AND gate with a small circle on the output. The small circle
represents inversion.
NOR gate
This is a NOT-OR gate which is equal to an OR gate followed by a NOT gate.
The outputs of all NOR gates are low if any of the inputs are high.
The symbol is an OR gate with a small circle on the output. The small circle
represents inversion.
EXOR gate
The ' Exclusive-OR ' gate is a circuit which will give a high output if either,
but not both , of its two inputs are high. An encircled plus sign ( ) is used to
show the EOR operation.
EXNOR gate
The ' Exclusive-NOR' gate circuit does the opposite to the EOR gate. It will give a
low output if either, but not both , of its two inputs are high. The symbol is an
EXOR gate with a small circle on the output. The small circle represents inversion.
The NAND and NOR gates are called universal functions since with either one the
AND and OR functions and NOT can be generated.
Note:
A function in sum of products form can be implemented using NAND gates by
replacing all AND and OR gates by NAND gates.
A function in product of sums form can be implemented using NOR gates by
replacing all AND and OR gates by NOR gates.
Table 1: Logic gate symbols
Table 2 is a summary truth table of the input/output combinations for the NOT gate
together with all possible input/output combinations for the other gate functions. Also
note that a truth table with 'n' inputs has 2
n
rows. You can compare the outputs of
different gates.
Table 2: Logic gates representation using the Truth table
Commutative law
Any binary operation which satisfies the following expression is referred to as
commutative operation.
Commutative law states that changing the sequence of the variables does not have
any effect on the output of a logic circuit.
Associative law
This law states that the order in which the logic operations are performed is irrelevant
as their effect is the same.
Distributive law
Distributive law states the following condition.
AND law
These laws use the AND operation. Therefore they are called as AND laws.
OR law
These laws use the OR operation. Therefore they are called as OR laws.
INVERSION law
This law uses the NOT operation. The inversion law states that double inversion of a
variable results in the original variable itself.
Important Boolean Theorems
Following are few important boolean Theorems.
Boolean function/theorems Description
Boolean Functions
Boolean Functions and Expressions, K-Map and
NAND Gates realization
De Morgan's Theorems De Morgan's Theorem 1 and Theorem 2
Linear Algebra and Matrices
Contents
simultaneous equations
elementary Markovian process.
1.1 Functions and graphs
A function is a mathematical relationship in which the value of a single
dependent variable are determined from the values of one or more
independent variables. The following is an example of a function in which
y is said to be a function of x.
y = a + bx
In the above example, both x and y are variables this is because they may
assume different values throughout the analysis of the function. On the
other hand, a and b are referred to as constants because they assume
fixed values.
5x
2
2x
3
2
The solution of equations or the values of the variables for which the
equations hold is called the roots of the equation or the solution set.
Solution of Linear Equation
Supposing M, N, and P are expressions that may or may not involve
variables, then the following constitute some rules which will be useful in
the solution of linear equations
Rule 1: Additional rule
If M = N then M + P = N + P
Rule 2: Subtraction rule
If M = N, Then M ā P = N ā P
Rule 3: multiplication rule
If M = N and P ā O then M x P = N x P
Rule 4: Division rule
If P x M = N and P ā O
And N/P = Q Q being a raterial number then
M = N/P
Example
i. Solve 3x + 4 = -
ii. Solve
y
= -
Solutions
i. 3x + 4 = ā
3x + 4 ā 4 = ā 8 ā 4 (by subtraction rule)
3x = ā 12 (simplifying)
x
(by division rule)
x = ā4 (simplifying)
ii.
4 3
3
y
3 ļ“ ļ½ļ ļ“
y = ā12 (simplifying)
Solution of quadratic equations
Suppose that we have an equation given as follows
ax
2
Where a, b and c are constants, and aā 0. such an equation is referred to
as the general quadratic equation in x. if b = 0, then we have
ax
2
Which is a pure quadratic equation
There are 3 general methods for solving quadratic equations; solution by
factorization , solution by completing the square and solution by the
quadratic formula.
Solution by Factorization
The following are the general steps commonly used in solving quadratic
equations by factorization
(i) Set the given quadratic equation to zero
(ii) Transform it into the product of two linear
factors
(iii) Set each of the two linear factors equal to
zero
(iv) Find the roots of the resulting two linear
equations
Example
Solve the following equation by factorization
i. 6x
2
= 18x
ii. 15x
2
Solutions
i. 6x
2
= 18x
6x
2
6x(x ā 3) = 0....................................(step 2)
6x = 0..............................................(step 3)
and x ā 3 = 0
ā“ x = 0 or x = 3 ..............................(by step 4)
ii. 15x
2
15x
2
(5x ā 3) (3x +5) = 0.........................(step 2)
(5x ā 3) = 0} Step 3
{3x + 5 = 0}
or
(= 3 or 0)
ii. 2x
2
2
2
3x 1
x + = -
ā¦ā¦ā¦ā¦ā¦ā¦ā¦...ā¦..(Step 1)
2 2
2
x
X
ā¦ā¦ā¦ (Step 2)
2
x + =
ā¦ā¦ā¦ā¦ā¦ā¦ā¦ā¦.. (Step 3)
3 1
4 16
x + = ±
3 1
4 4
x = ļ = ±
3 1 3 1
4 4 4 4
ļ + or - -
1
2
x ļ½ļ or x ļ½ļ 1
Solution by Quadratic Formula
Consider the general quadratic equation
2
ax + bx + c = 0 where a ļ¹ 0
The roots of the equation are obtained by the following formula:
2
Example
Solve for x by formula
5x
2
Solution
a = 5, b = 2, c = - 3
2
2
Inequalities
An inequality or inequation is an expression involving an inequality sign
(i.e. >,<, ā¤, ā„, i.e. greater than, less than, less or equal to, greater or
equal to) The following are some examples of inequations in variable x.
3x + 3 > 5
x
2
The first is an example of linear inequation and the second is an example
of a quadratic in equation.
Solutions of inequations
The solutions sets of inequations frequently contain many elements. In a
number of cases they contain infinite elements.
Example
Solve and graph the following inequation
x ā 2 > 2 ;
x ļ w
(where x is a subset of w)
Solution
x ā 2 > 2 so x ā 2 + 2 > 2 + 2
Thus, x>
The solution set is infinite, being all the elements in w greater than 4
0 1 2 3 4 5 6 7 8 9 10 11
Example
Solve and graph
3x ā 7 < - 13;
Solution