Computer Mathematics Sample
Computer Mathematics Sample
DICT
Computer Mathematics
LEVEL I
PAPER NO. 2
Contents
TOPIC 1 ........................................................................................................................................................ 2
DATA REPRESENTATION AND NUMBER SYSTEM ............................................................................... 2
Introduction to Number System ......................................................................................................... 2
Bits & Bytes: ........................................................................................................................................... 3
Binary Number System: ....................................................................................................................... 3
TOPIC 3 ........................................................................................................................................................ 4
SET THEORY ............................................................................................................................................... 4
Types of Sets ........................................................................................................................................... 4
TOPIC 4 ........................................................................................................................................................ 7
LOGIC AND TRUTH TABLES ..................................................................................................................... 7
Introduction ........................................................................................................................................... 7
Understanding Truth Tables............................................................................................................... 7
Logic gates ............................................................................................................................................ 10
TOPIC 6 ...................................................................................................................................................... 11
LINEAR EQUATIONS ................................................................................................................................ 11
TOPIC 1
1. Binary Number System: It is the number system with base value 2 means it has only two
digits to represent the data. The digits are (0, 1). E.g. 00,01,10,11,100….
2. Decimal Number System: It is the number system with base value 10 means it has 10-
digits to represent the data. The digits are(0-9). Eg. 0,1,2,3,4,5,6 ………
3. Octal Number System: It is the number system with base value 8 means it has 8 digits to
represent the data. The digits are ( 0-7).
1 byte = 8-bits
0 Start at 0
1 Then 1
??? Then no other symbol
So we count in the same way as using decimal number system. For example:
Decimal number system start at 0 and then 1,2,3,4,5,6,7,8,9… now what after nine repeat the
no in combination such as start at 0 again the add 1 to the left of 0 resultant 10 , 11 ,12… so on.
100, 1000 etc.
SET THEORY
These 'things' may be anything you like: numbers, people, shapes, cities, bits of text ..., literally
anything.
The key fact about the 'rule' they all obey is that it must be well-defined. In other words, it
enables us to say for sure whether or not a given 'thing' belongs to the collection. If the 'things'
we're talking about are English words, for example, a well-defined rule might be:
Requirement of a set
1. A set must be well defined i.e. it must not leave any room for ambiguities e.g sets of all
students- which? Where? When?
2. The objective (elements or members) from a given set must be distinct i.e each object
must appear once and only once, Must appear but not more than once
Types of Sets
In set theory, there are different types of sets. All the operations in set theory could be based on
sets. Set should be a group of individual terms in domain. The universal set has each and every
Universal Set
The set of all the 'things' currently under discussion is called the universal set (or sometimes,
simply the universe). It is denoted by U.
The universal set doesn’t contain everything in the whole universe. On the contrary, it restricts us
to just those things that are relevant at a particular time. For example, if in a given situation
we’re talking about numeric values – quantities, sizes, times, weights, or whatever – the
universal set will be a suitable set of numbers (see below). In another context, the universal set
may be {alphabetic characters} or {all living people}, etc.
Singleton Set:
A set which contains only one element is called a singleton set.
For example:
• A = {x : x is neither prime nor composite}
Here A is a singleton set because there is only one element 2 whose square is 4.
• Let B = {x : x is a even prime number}
Here B is a singleton set because there is only one prime number which is even, i.e., 2.
For example:
• Set of all points in a plane
• A = {x : x ∈ N, x > 1}
• Set of all prime numbers
• B = {x : x ∈ W, x = 2n}
Note:
All infinite sets cannot be expressed in roster form.
For example:
The set of real numbers since the elements of this set do not follow any particular pattern.
For example:
• A {x : x ∈ N, x <
5} A = {1, 2, 3, 4}
Therefore, n(A) = 4
B = {A, L, G, E, B, R}
Logic is more than a science, it‘s a language, and if you‘re going to use the language of
logic, you need to know the grammar, which includes operators, identities, equivalences,
and quantifiers for both sentential and quantifier logic.
Introduction
Boolean functions may be practically implemented by using electronic
gates. The following points are important to understand.
Electronic gates require a power
Gate INPUTS are driven by voltages having two nominal values, e.g. 0V
and 5V representing logic 0 and logic 1
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
There is always a time delay between an input being applied and the output
Truth tables can also help understand the behaviour of combinations of logic gates
linked together.
They are drawn in the same way as before but this time adding more columns in
between the input and output
The following example shows the steps for drawing up a truth table for a
combined gate configuration.
Interactive Example
Here is a logic circuit of many gates. How will the truth table be drawn to find
the output expression?
The first set of gates that the inputs A and B go to need to be identified. There are two
OR gates both doing the A+B function, a NOT gate doing the NOT A function and two
AND gates doing the A.B function. These functions can fill in the next set of columns
on the truth table.
function (A+B).(A+B) and there is an OR gate that takes the outputs of the two AND gates
doing the function (A.B)+(A.B). These functions can fill in the next set of columns on the truth
table.
The final gate takes the inputs of the AND gate, NOT gate and the OR gate doing the
complete function of the whole logic circuit (A+B).(A+B)+(NOT A)+(A.B)+(A.B). The
final column can be filled in to give the output of the logic circuit.
Logic gates
Digital systems are said to be constructed by using logic gates. These gates are the AND,
OR, NOT, NAND, NOR, EXOR and EXNOR gates. The basic operations are described
below with the aid of truth tables.
LINEAR EQUATIONS
LINEAR EQUATIONS
It takes the form y = a + bx
e.g y = 20 + 2x
y = 5x
y = 15-0.3x
In graphical presentation of a linear equation, the constant ‘a’ represents y-intercept and ‘b’
represents the gradient of the slope.
Solution to equations
Solving and graphs
Solve for x in the following equation.
Example 1:
5x-6=3x-8
Subtract 3x from both sides of the equation:
2x-6= -8
Add 6 to both sides of the equation:
2x=-2
Divide both sides by 2:
x= -1
The answer is x = - 1
Check the solution by substituting -1 in the original equation for x. If the left side of the equation
equals the right side of the equation after the substitution, you have found the correct answer.
Exercise
Solve each of the following equations.
To solve a system of equations graphically, graph both equations and see where
they intersect. The intersection point is the solution.
First, solve each equation for "y =".
4x - 6y = 12 2x + 2y = 6
slope =
y-intercept = -2
Check: Since the two lines cross at (3,0), the solution is x = 3 and y = 0. Checking these value
shows that this answer is correct. Plug these values into the ORIGINAL equations and get a true
result.
4x - 6y = 12 2x + 2y = 6
4(3) - 6(0) = 12 2(3) + 2(0) = 6
12 - 0 = 12 6+ 0 = 6
QUADRATIC EQUATIONS
2
The general formula is ax + bx + c = 0
When the equation is ploted, it yields either a valley or a mountain depending on constant a. if <
0 a mountain, if> 0 a valley.
INTRODUCTION TO PROBABILITY
Introduction
Probability is a measure of likelihood, the possibility or chance that an event will happen
in future.
Trial- Each repetition of an experiment can be thought of as a trial which has an observable
outcome e.g. in tossing a coin, a single toss is a trial which has an outcome as either head or tail
Sample space is the set of all possible outcomes in an experiment e.g. a single toss of a coin,
S=(H,T). The sample space can be finite or infinite. A finite sample space has a finite number of
possible outcomes e.g. in tossing a coin only 2 outcomes are possible.
Collectively exclusive event - A set of events is said to be collectively exclusive if their union
accounts for all possible outcomes i.e. one of their events must occur when an experiment is
conducted.
Independent events –Events are independent if the happening or non-happening of one has no
effect on the future happening of another event. E.g. in tossing two times of a coin, the outcome
of 1st toss does not affect 2nd toss.
Equally likely events –Events are equally likely if the happening of one is not favored over
the happening of others. In tossing a coin the tail and head are equally likely.
Other Concepts
Unconditional and conditional probabilities –with unconditional probability we express
probability of an event as a ratio of favourable outcomes to the number of all possible outcomes.
A conditional probability is the probability that a second event occurs if the first event has
already occurred.
Joint probability –joint probability gives the probability of the joint or simultaneous
occurrence of two or more characteristics.
known as the normal distribution, which is the most commonly observed probability
distribution.
P (A or B) = P (A) + P (B)
P (A or B or C) = P (A) + P (B) + P(C)
Illustration
An automatic plastic bag - a mixture of beans, broccoli and other vegetables, most of the bags
contain the correct weight but because of slight variations in the size of beans and other
vegetables. A package may be slightly under or overweight. A check of 4,000 packages of past
reveals the following:
P (A or C) = P (A) + P (C)
P(A) =100/4000
P(C) =300/4000
P(A or C) =400/4000 = 1/10 =0.1
Example
a) What is the probability that a card chosen at random from a pack of well shuffled deck will
either be a king or a heart?
What’s the probability that an employee selected at random will either need correcting shoes or
major dental work?
2. Rule of Multiplication
Special Rule of multiplication
For two events A and B the probability that A and B will both occur is found by multiplying the
probability
Example
i) Two coins are tossed. What is the probability that both will land tails
up The two events are independent
P (T and T) = P (T) × P
(T) =1/2 × 1/2 = ¼ = 0.25
From long experience firestone tyres have a 0.8 probability that their xB.70 will last 40,000
miles before it becomes bald and adjustments made. If you purchase four xB.70
What’s the probability that all tyres will last 40,000 miles?
What’s the probability that at least two will last 40,000 miles?
Solution
P(L and L and L and L) =P(L) × P(L) × P(L) × P(L)
= 0.8 × 0.8 × 0.8 × 0.8
= 0.4096
Example
1. Assume that there are 10 rolls of film in a box 3 of which are defective. Two rolls are to
be selected one after another. What’s the probability of selecting a defective roll followed
by another defective roll?
EMAIL [email protected]
Follow us on: