You are on page 1of 66

Mathematics I – MAT 1001

Maths I-Lab Manual

COURSE CODE MAT 1001


COURSE NAME MATHEMATICS I
STUDENT NAME
STUDENT ID

Learning Outcomes:

Page 1 of 66
Upon the successful completion of the course, the student will be able to:
LO1. Demonstrate an Understanding of basic concepts in set theory, and counting principles
LO2. Demonstrate an understanding logic and Boolean algebra
LO3. Analyze the properties of trees and graphs
LO4. Demonstrate applications of derivatives and integral calculus to solve problems.

Lab Exercises
S.no Experiment Date of Exercise Faculty
Signature

1
Set Theory (LO 1)

Relations and Functions (LO1,LO2)


2
Connectivity, Paths, Trees ( LO3)
3

4 Logic Theory and Boolean Algebra(LO2)

Combinations, Permutations and Binomial


5 Theorem (LO 1)
Limits and Continuity.(LO2,LO3)
6
Derivatives and Integrals and their
7 Applications (LO3)

CHAPTER 1 – SET THEORY


Probability theory enables us to deal with uncertainty. Sets and set operations are the basic tools for
the study of probability.

Page 2 of 66
1. Use the following sets for the below cases.

P = { x : x is a prime number }
Z = { … -3, -2, -1, 0, 1, 2, 3, … }
C = { y : y is an integer, 4 <= y < 9}
B = { 2, 4, 6, 8, 10 }

a. List the 10 smallest elements of P.

b. What are the next four elements in the listing for Z?

c. Describe Z using the property format.

d. Describe B using the property format.

e. Describe C with a list format.

f. Which of the sets are finite and which are infinite?

2. Which of the following are subsets of other sets described?

a. A = { 2, 4, 6, 8, 10 ….. }
b. X = { x : x is a prime number }
c. E = { y : y is a positive multiple of 8 }
d. S = { x : x = n2, n is an integer }
e. T = { 16, 64, 196 }

3. Let B = { a, b, c, d, e, f }

a. How many elements are in P(B)?

b. To which set in P (B) does the number 1011 2, correspond?

c. Write the binary that corresponds to { b, c, e, f }

Page 3 of 66
d. Which binary corresponds to Ø?

4. Suppose E = { 1, 2, 3, ……., 10 }, A = { 1, 3, 7, 9 }, B = { 2, 3, 6, 7, 10 }, and C = { 1, 5, 6, 8 }. List


the elements in each of the following sets:

a. AUB
b. A∩C
c. B’
d. AUC’

5. Suppose X = { x : x = y2, y ɛ N }, P = { p : p is a prime number } and E = { s : s = 2t, t ɛ N).


Determine:

a. PE
b. XE
c. XP
d. E’
VENN DIAGRAM

1. Suppose that E = { 1, 2, 3, …., 15 }, A = { 2, 4, 6, 8, 10 }, B = { 5, 10, 15 }, and C = { 3, 5, 7, 11 }.


Draw a Venn diagram for these sets. Be careful how they overlap.

2. Construct Venn diagram to represent the following sets.

a. A ‘  B

b. A ‘ – B

Page 4 of 66
c. (A  B)’

d. A  B  C’

e. A’  (B  C)’

3. Using Venn Diagram, verify that (A  B)  C = A  (B  C)

Page 5 of 66
Additional Questions:

1. Which of the following are subjects of the other sets? Are any of the sets equal to one
another?

a. Y = { y : y is prime, y2 }
b. X = { x : x ɛ N, 1  x  6 }
c. W = { 1, 3, 5, 7, 9, …. }
d. G = { g : g = 2n – 1, n ɛ N }
e. F = { f : f2 = 25, f < 7, f ɛ N }

2. For the set B = { a, b, c, d, e } , list all of the subsets having exactly two elements.

3. Let A = { x : x is an odd number, 2  x  8 }


a. How many elements are in P ( A )?
The definition of a power set is, “The power set of a given set S is the set of all
subsets of S”. The power set of S is shown as P ( S ), or 2S.

b. List all the elements of P ( A ).

4. Let E = { 2, 4, 6, 8, 10, 12, 15 }, A = { 2, 6, 12 }, B = { 6, 8, 12, 15 }, C = { 4, 8 }

a. B  C’

Page 6 of 66
b. (( A  B )  C )

5. Construct Venn Diagram to represent the following sets.

a. ( A  B )’  C

b. A’  ( B – C )

6. Using Venn Diagram, verify that ( A  B )’ = A’  B’

CARTESIAN PRODUCT

Page 7 of 66
What is a Cartesian product in SQL?
The Cartesian Product, also referred to as a cross-join, returns all the rows in all the tables listed in
the query. Each row in the first table is paired with the rows in the second table. This happens when
there is no relationship defined between the two tables.

What is a Cartesian product in Oracle?


A Cartesian join, or Cartesian product is a join of every row of one table to every row of another
table. This normally happens when a matching join columns are specified. For example, if table A
with 100 rows is joined with table B with 1000 rows, a Cartesian join will return 100,000 rows.

7. Suppose A = { 1, 2 } and B = { a, b }. Find A x B.

8. Suppose A = { 1, 2 } and B = { a, b }. Find B x A.

9. If A is a set and |A| = 5, then what is |P ( A )|?


Note: The definition of a power set is, “The power set of a given set S is the set of all subsets
of S”. The power set of S is shown P ( S ), or 2S.

10. If A = { 12, 14, 5, 1 }, what is |( A x A )  A|?

CARDINALITY OF SETS

In mathematics, the cardinality of set is a measure of the “number of elements of the set.”

What is cardinality in statistics?


The number of rows in the tables. The number of unique values for a set of columns for leading
columns in an index key, also known as cardinality. Leading columns refers to the first column, or
the first and second column, or the first, second, and third column of an index (and so on).

Page 8 of 66
In the context of databases, cardinality refers to the uniqueness of data values contained in a
column. High cardinality means that the column contains a large percentage of totally unique
values.

Low cardinality means that the column contains a lot of “repeats” in its data range.

11. If A = { 2, 5, 6 } and B = { 6, 8, 10 }. Find the cardinality of A x B / A – B > 5.

12. Determine the cardinality of the following sets.


Set Cardinality (In corresponding notation)
1. A = { red, green, yellow, blue }
2. B = { x | x is a digit }
3. C = { x | x is whole number less than five }
4. D = { x | x is a vowel of the word “apple” }
5. E = { x ɛ N | x – 4 = -1
6. F = { x ɛ N | x > 3 }

13. From a set of 15 players, 4 are to be selected to present a list of grievances to the coach.
a. How many ways can this be done?

Page 9 of 66
b. One of the players is Michael Branson. Find the probability that Michael Branson will
be selected?

c. Find the probability that Michael Branson will not be selected?

14. The set G = { b : b is a multiple of 4, b < 50 }. Find the cardinality of G.

Learning Outcome Covered:


LO1 :Demonstrate an Understanding of basic concepts in set theory, and counting principles.

CHAPTER 2 – RELATIONS AND FUNCTIONS


The modern world is overwhelmed with data –from the cost of college, cost of devices, health care
expenditures and travel expenses to spending trends and other pieces of information. Functions
enable us to construct mathematical models that can sometimes be used to estimate outcomes.
Graphs of functions allow us to visualize a situation and to detect trends more easily.

EXERCISE

1. Given the set A = { 6, 8, 19, 15 } and B = { 7, 9, 12, 13 }


a. Write the Range for set A x B.

Page 10 of 66
b. Write the Domain for set A x B.

2. Let A = { 10, 20 }, B = { 30, 40, 50 }. List the elements of each of the following product sets
and draw their coordinate diagram.

a. A x B

b. B x A

3. Function f is defined by f (x) = -2 x 2 + 6x. Find f (-2).

4. Function h is defined by h (x) = 3 x 2 – 7x – 5. Find h (x-2).

5. Sketch the graph of y = 5x – 4. Find the x and y intercept.

6. Sketch the graph of y = 9x + 3 and find the zeros and y intercept.

Page 11 of 66
7. Find the y-intercept and zeros of h (x) = x2 – 3x + 2.

8. Show that the function (x) = 5x - 9 is increasing.

9. Show that the function (x) = -3x + 9 is decreasing.

10. Show that the function (x) = x2 + 1 is an even function.

Page 12 of 66
11. Show that the function (x) = x3 - x is an odd function.

12. Is the graph shown below that of a function?

OPERATIONS ON FUNCTIONS

1. Find the sum, difference, product, and quotient of each pair of the following function and
state the domain of each:
a. (x) = 3x + 5, g (x) = 2 – x

Page 13 of 66
Sum:

Difference:

Product:

Quotient:

2. Find the sum, difference, product and quotient of each of the pairs of the following function
and state the domain of each.
a. (x) = 2x, g(x) = 3 - 2x

Sum:

Difference:

Page 14 of 66
Product:

Quotient:

3. Let (x) = 2x - 5 and g(x) = 5 x 2. Find:


a. (f ◦ g)(x)

b. (g ◦ f )(x)

c. (f ◦ f )(x)

Page 15 of 66
ONE-TO-ONE AND ONTO FUNCTIONS

1. Prove that (x) = 3x + 4 is 1-1 function without using graph.

2. Determine graphically whether the following functions are 1-1 or onto.


a. (x) = x2

b. g(x) = 2x + 1

Page 16 of 66
INVERSE

1. Find the inverse relation of R = {(3,b),(2,a),(5,b),(1,a),(4,c)}

3
2. Show that (x) = x3 and g(x) = √x are inverse functions.

3. Find the inverse of the following function assuming it is one-to-one and onto and verify that
this is actually the inverse function.

a. (x) = 4x – 1

x+1
b. (x) = 2x-1

Page 17 of 66
4. Which of the following functions are 1-1? Which are onto? Assume the domain and the co
domain of each is the set of real numbers:

a. (x) = 5x + 3

b. (x) = x3 + 2x

5. Find the inverse of the function: (x) = -3x + 2

6. Draw the graph of the function Y = x2 + 6x + 5

7. Y = x2 - 5x + 9

RELATIONS

1. Let S = { 1, 2, 3, 4} and T = { 1, 2, 3, 4 }. In each of the following find all of the pairs of S XT


that belongs to R:

a. R = {(x,y) | x = y2 }

Page 18 of 66
b. R = {(x,y) | x  y }

2. List explicitly the following relations from A = { 1, 2, 3 } to B = { 1, 2 } (i.e. write down R as a


set of ordered pairs).

a. xRy if and only if x = y

b. xRy if and only if x = y + 3

c. xRy if and only if y  2

3. In each case, a relation on the set {1,2,3} is given. Of the three properties, reflexivity,
symmetry, and transitivity, determine which ones the relation has. Give reasons for each of
them.

a. R = { (1,3), (3,1), (2,2) }


b. R = { (1,1), (2,2), (3,3), (1,2) }

Solution:

a.

Page 19 of 66
b.

4. Set A = {1,2,3,4} and the relation R over AXA is explicitly defa R = { (1,1), (1,4), (4,1), (4,4),
(2,2), (2,3), (3,2), (3,3) } Verify whether the given relation is equivalence relation or not.

5. Let Z be the set of integers and let R be the relation called “congruence modulo 3” defined
by
R= {<x, y> | x ɛ Z ɛ y ɛ Z ɛ (x-y) is divisible by 3}. Determine the equivalence classes generated
by the elements of Z.

6. Let Z be the set of integers and let the relation R be defined by R= {<x, y> | x ɛ Z ɛ y ɛ Z ɛ (x-y)
is divisible by 5}. Determine the equivalence classes generated by the elements of Z.

Page 20 of 66
Additional Questions:

1. Functions g and h are given by g(x) = √(x – 1) and h(x) = x2 + 1.


Find the composite function g o h(x)

2. How is the graph of (x – 2) compared to the graph of (x)?

3. Express the perimeter P of a square as a function of its area.

4. Evaluate (3) given that (x) = |x-6| + x2 – 1.

5. Find (x + h) - f(x) given that f(x) = a x + b

Page 21 of 66
6. Find f(x + h) - f(x) given that f(x) = a x + b

7. Find the domain of f(x) = √(-x2 - x + 2)

8. Find the range of g(x) = - √(- x + 2) – 6

9. Find (f o g)(x) given that f(x) = √(x) and g(x) = x2 - 2x + 1

10. How do you obtain the graph of - f(x - 2) + 5 from the graph of f(x)?

Practical Applications: Page 163 (Textbook)

Page 22 of 66
11. A company manufactures a 42-inch plasma HDTV that it sells to retailers for 550 Dhs. The
cost of making x of these TVs for a month is given by the cost function C(x) = 250x + 213,000

a. Find the function R that gives the revenue from selling x TVs

b. What is the revenue from selling 600 TVs?

c. Find the profit function P.

d. What is the profit from selling 500 TVs.

e. What is the Break –Even point for the company

Page 23 of 66
CHAPTER 3 – CONNECTIVITY, PATHS, TREES
Shortest paths in a weighted digraph

Shortest-paths is a broadly useful problem-solving model

Page 24 of 66
Maps
• Robot navigation.
• Texture mapping.
• Typesetting in TeX.
• Urban traffic planning.
• Optimal pipelining of VLSI chip.
• Subroutine in advanced algorithms.
• Telemarketer operator scheduling.
• Routing of telecommunications messages.
• Approximating piecewise linear functions.
• Network routing protocols (OSPF, BGP, RIP).
• Exploiting arbitrage opportunities in currency exchange.
• Optimal truck routing through given traffic congestion pattern.

CONNECTIVITY IN GRAPHS

A graph is said to be connected if there is a path between every pair of vertex. From every vertex to
any other vertex, there should be some path to traverse. That is called the connectivity of a graph. A
graph with multiple disconnected vertices and edges is said to be disconnected.

Example 1
In the following graph, it is possible to travel from one vertex to any other vertex. For example, one
can traverse from vertex ‘a’ to vertex ‘e’ using the path ‘a-b-e’.

Page 25 of 66
Example 2
In the following example, traversing from vertex ‘a’ to vertex ‘f’ is not possible because there is no
path between them directly or indirectly. Hence it is a disconnected graph.

CUT VERTEX

Let ‘G’ be a connected graph. A vertex V ∈ G is called a cut vertex of ‘G’, if ‘G-V’ (Delete ‘V’ from ‘G’)
results in a disconnected graph. Removing a cut vertex from a graph breaks it in to two or more
graphs.
Note − Removing a cut vertex may render a graph disconnected.
A connected graph ‘G’ may have at most (n–2) cut vertices.

Example
In the following graph, vertices ‘e’ and ‘c’ are the cut vertices.

By removing ‘e’ or ‘c’, the graph will become a disconnected graph.

Page 26 of 66
Without ‘g’, there is no path between vertex ‘c’ and vertex ‘h’ and many other. Hence it is a
disconnected graph with cut vertex as ‘e’. Similarly, ‘c’ is also a cut vertex for the above graph.

Cut Edge (Bridge)

Let ‘G’ be a connected graph. An edge ‘e’ ∈ G is called a cut edge if ‘G-e’ results in a disconnected
graph.
If removing an edge in a graph results in to two or more graphs, then that edge is called a Cut Edge.

Example:
In the following graph, the cut edge is [(c, e)]

By removing the edge (c, e) from the graph, it becomes a disconnected graph.

In the above graph, removing the edge (c, e) breaks the graph into two which is nothing but a
disconnected graph. Hence, the edge (c, e) is a cut edge of the graph.

Note − Let ‘G’ be a connected graph with ‘n’ vertices, then

 a cut edge e ∈ G if and only if the edge ‘e’ is not a part of any cycle in G.
 the maximum number of cut edges possible is ‘n-1’.
 whenever cut edges exist, cut vertices also exist because at least one vertex of a cut edge is
a cut vertex.
 if a cut vertex exists, then a cut edge may or may not exist.

Page 27 of 66
Cut Set of a Graph

Let ‘G’= (V, E) be a connected graph. A subset E’ of E is called a cut set of G if deletion of all the edges
of E’ from G makes G disconnect.

If deleting a certain number of edges from a graph makes it disconnected, then those deleted edges
are called the cut set of the graph.

Example
Take a look at the following graph. Its cut set is E1 = {e1, e3, e5, e8}.

After removing the cut set E1 from the graph, it would appear as follows −

Similarly, there are other cut sets that can disconnect the graph −
• E3 = {e9} – Smallest cut set of the graph.
• E4 = {e3, e4, e5}
Edge Connectivity

Let ‘G’ be a connected graph. The minimum number of edges whose removal makes ‘G’
disconnected is called edge connectivity of G.

Notation − λ(G)

In other words, the number of edges in a smallest cut set of G is called the edge connectivity of G.
If ‘G’ has a cut edge, then λ(G) is 1. (edge connectivity of G.)

Example

Take a look at the following graph. By removing two minimum edges, the connected graph becomes
disconnected. Hence, its edge connectivity (λ(G)) is 2.

Page 28 of 66
Here are the four ways to disconnect the graph by removing two edges –

Vertex Connectivity

Let ‘G’ be a connected graph. The minimum number of vertices whose removal makes ‘G’ either
disconnected or reduces ‘G’ in to a trivial graph is called its vertex connectivity.
Notation − K(G)
Example
In the above graph, removing the vertices ‘e’ and ‘i’ makes the graph disconnected.

If G has a cut vertex, then K(G) = 1.


Notation − For any connected graph G,
K(G) ≤ λ(G) ≤ δ(G)
Vertex connectivity (K(G)), edge connectivity (λ(G)), minimum number of degrees of G(δ(G)).

Example
Calculate λ(G) and K(G) for the following graph –

Page 29 of 66
Solution
From the graph,
δ(G) = 3
K(G) ≤ λ(G) ≤ δ(G) = 3 (1)
K(G) ≥ 2 (2)
Deleting the edges {d, e} and {b, h}, we can disconnect G.
Therefore,
λ(G) = 2
2 ≤ λ(G) ≤ δ(G) = 2 (3)
From (2) and (3), vertex connectivity K(G) = 2

Graph Theory
(http://www.cs.uu.nl/docs/vakken/emgmt/exercises/solutions_graphtheory.pdf)
1. Model the following situations as (possibly weighted, possibly directed) graphs. Draw each
graph, and give the corresponding adjacency matrices.

a. Ada and Bertrand are friends. Ada is also friends with Cecilia and David. Bertrand,
Cecilia and Évariste are all friends of each other.

b. It is found that the Animal article links to none of the others, the Burrow article links
to Animal and Chile, the Chile article links to Desert, the Desert article links to Chile,
and the Elephant article links to Animal and Desert. Strangely, no relation between
Burrow and Elephant seems to be present. We encode this information with a
directed graph

Page 30 of 66
c. It is well-known that in the Netherlands, there is a 2-lane highway from Amsterdam
to Breda, another 2-lane highway from Amsterdam to Cappele aan den IJssel, a 3-
lane highway from Breda to Dordrecht, a 1-lane road from Breda to Ede and another
one from Dordrecht to Ede, and a 5-lane superhighway from Cappele aan den IJssel
to Ede.

Euler’s formula: V + F = E + 2

Draw an example graph for each of these.


a. A planar graph has 5 vertices and 3 faces. How many edges does it have?

b. A planar graph has 7 edges and 5 faces. How many vertices does it have?

Page 31 of 66
TREES

Probability Tree is a diagram having branches represent the probabilities of associated events.

Example:
There are three machines designated as A, B, and C producing the same item. The output of A, B,
and C are 40%, 35% and 25% respectively. A produces 5% defectives, B produces 10% defectives and
C produces 12% defectives, draw the probability tree and then answer the following;
a. If an item is selected from the total output at random, what is the probability that it is
defective?
b. If an item is selected from the total output at random, what is the probability that it is
non-defective (good Piece)
c. An item is selected and found to be defective. What is the chance that it is produced from
A? produced from B? produced from C?

P(A).P(D) =0.02

P(A).P(G) =0.38

P(B).P(D) =0.035
Page 32 of 66

P(B).P(G) =0.315
P(C).P(D) =0.03

P(C).P(G) =0.22

Solution Details:
a. If an item is selected from the total output at random, what is the probability that it is
defective?

Look at the tree. Defective occurs in three places. A and Defective, B and Defective, C and Defective.
Adding these three joint probabilities, namely 0.02 + 0.035 + 0.03 you get the answer 0.085 or 8.5%.
That is P(D) = 0.085

Binary tree

The diagram represents a binary tree(T) as follows:


1. T consists of 11 nodes, represented by letters A through L excluding I.
2. The root T is the node A at the top of the diagram.
3. A left downward slanted line at node N indicates a left successor of N; and a right downward
slanted line at N indicates a right successor of N.
4. [B is left successor and C is a right successor of root A.]
5. The left subtree of the root A consists of nodes B, D, E, F and the right subtree of A consists
of nodes C, G, H, J, K and L.
6. The nodes A, B, C and H have two successors and the nodes E and J have only one successor,
and the nodes D, F, G, L and K have no successors, i.e. they are terminal nodes.

Binary tree for algebraic expressions

Page 33 of 66
Example: Construct a binary tree for the following algebraic expression.
E = (a-b) / ( ( c * d) + e)
Note:
The variables in E appear as internal node
The left and right sub trees correspond to the operands of the operation

In the expression E, the operands of + are c*d and e.


In the tree T, the subtrees of the node + correspond to the expression c*d and e.
A tree which uses only binary operations is called an Extended tree or 2-tree

1. Construct a binary tree for the following algebraic expression.


E = (X + Y) (W - Z) / (W - G)

2. Construct a binary tree for the following algebraic expression.


E = (A + 2B) ( Z2) / (C + D) (W - G)

3. Construct a complete tree T₂₆

Page 34 of 66
4. Construct a sequential representation of the binary tree

Solution:
45 22 77 11 30 90 15 25 88

END

5. Construct a sequential representation of the binary tree.

Solution :

Types of Graphs

In figure b the edges e₄ and e₅ are called multiple edges since they connect the same end points, the
edge e₆ is called a loop such a diagram is called a multi graph.
A graph (fig a) is without multiple edges or loops.

Page 35 of 66
Handshaking lemma: The sum of degree of the vertices of the graph G is equal to twice the number
of edges in G

For example, consider fig a:


Deg (A) = 2, deg (B) = 3, deg (C) = 3, deg (D) = 2
The sum of the degrees equals 10 which is twice the edges.

A vertex is even or odd according as its degree is even or odd number


Thus A and D are even vertices and B and C are odd vertices.
For fig b the deg (D)= 4 since the edge e 6 is counted twice. Hence D is even vertex.

A vertex with degree 0 is called isolated vertex. A graph with one vertex and no edges (single point)
is called trivial graph.

Example:
Consider the figure. Find the set V(G) of vertices of G and the E(G) of edges of G. Also find the degree
of each vertex and verify handshaking theorem for this graph.

Solution: V(G) = { A, B, C, D, E }
E(G) = { ( A,B ), ( A,C ) ( A,D ) ( B,C ) ( B,E ) ( C,D ) ( C,E ) }
d(A) = 3, d(C) = 4, d(D) = 2, d(E) = 2.
Handshaking theorem: the sum of the degree of vertices = 3+3+4+2+2=14, which equals twice the
number of edges.

1. Write the statement of Hand Shaking Lemma and prove the same for the figure given below:

Page 36 of 66
Consider the Graph

Find:
a. All simple paths from A to F.
b. All trails from A to F.
c. Distance (A, F).
d. Diameter of G
e. All cycles which include vertex A.
f. All cycles in the graph G

Simple path has no edge and no vertex repeated.


a. All simple paths from A to F: ( A, B, C, F ), ( A, B, C, E, F ), ( A, B, E, F ) ( A, B, E, C, F )
( A, D, E, F ) ( A, D, E, B, C, F ) ( A, D, E, C, F )
A trail from A to F is a path such that no edge is repeated.

b. All the above paths + ( A, D, E, B, C, E, F ) + ( A, D, E, C, B, E, F ).


c. Distance( A, F ) = 3
d. Diameter (G) = 3
e. All cycles which include vertex A = ( A, B, E, D ), ( A, B, C, E, D, A ), ( A, B, C, F, E, D, A )
f. all cycles in the graph G. = Above cycles + ( B, C, E, B ), ( C, F, E, C ), ( B, C, F, E, B )

Page 37 of 66
EULER’S FORMULA

Statement: A finite graph G is Eulerian if and only if each vertex has even degree.

Example: Count the number v of vertices, the number E of edges, the number R of regions, degree d
of the outside region and verify Euler’s formula.

a. V = 4, E = 6, R = 4, D = 3 Hence: V – E + R = 4 – 6 + 4 = 2
b. V = 6, E = 9, R = 5, D = 6 Hence: V – E + R = 6 – 9 + 5 = 2
c. V = 5, E = 10, R = 7, D = 5 Hence: V – E + R = 5 – 10 + 7 = 2

DIRECTED GRAPHS

Consider the directed graph with vertices X, Y, Z, W. Suppose the vertices are ordered as follows: x-y-
z-w
Find the adjacency matrix

2. Consider the directed graph with vertices A, B, C, D, E. Suppose the vertices are ordered as
follows: A, B, C, D, E.
Find the weighted adjacency matrix

Page 38 of 66
CHAPTER 4 – LOGIC THEORY AND BOOLEAN ALGEBRA
There has always been a strong influence from mathematical logic on the field of Artificial
Intelligence (AI). It was realized that technology to automate logical inferences could have great
potential to solve problems and draw conclusions from facts. For example, IF THEN rules used in
Expert Systems are a very limited subset of FOL.

Another major area of research for logical theory was software engineering. Research projects such
as the Knowledge-Based Software Assistant and Programmer's Apprentice programs applied logical
theory to validate the correctness of software specifications. They also used them to transform the
specifications into efficient code on diverse platforms and to prove the equivalence between the
implementation and the specification. The appropriate domains are usually those such as weapons
systems, security systems, and real time financial systems.

Another important application of logic to computer technology has been in the area of frame
languages and automatic classifiers. Frame languages such as KL-ONE have a rigid semantics.
Definitions in KL-ONE can be directly mapped to set theory and the predicate calculus. This allows
specialized theorem provers called classifiers to analyze the various declarations between sets,
subsets, and relations in a given model. In this way the model can be validated and any inconsistent
definitions flagged. The classifier can also infer new information, for example define new sets based
on existing information and change the definition of existing sets based on new data. The level of
flexibility is ideal for handling the ever changing world of the Internet.

LOGIC THEORY – EXERCISES

Statements / Propositions

1. Using the statements


R: Aisha is rich.

H: Aisha is happy.
Write the following statements in the symbolic form using proposition logic:

[ Note: Statements are otherwise known as Propositions. ]

a. Aisha is poor and Aisha is happy.

b. Aisha is rich or Aisha is unhappy.

Page 39 of 66
c. Aisha is neither rich nor happy.

d. Aisha is poor or she is rich and unhappy.

e. Aisha is poor and unhappy or Aisha is rich.

Conjunction, Disjunction and Negation

1. Write the truth table of:


a. P  ( QS )

b. ~P  ~Q.

Writing Statements using Logic symbols:

1. Write the following statements in symbolic form:


a. If Ahmed takes English and Zuhair takes Accountancy, then Reem takes Computers.

b. The crop will be destroyed if there is a flood.

c. I sleep if and only if I am tired.

d. I will go to the hospital if and only if I am not well.

Page 40 of 66
Conditional and Biconditional Statement

1. Construct the truth table for P  ~(P  Q).

2. Construct the truth table for (P  Q)  (P  Q)

Tautology and Contradiction

1. Verify whether the following is a Tautology / Contradiction on neither.


a. ( P  Q )  ~( P  Q )

b. ( P  Q )  ( ~Q  ~P )

c. P  ~ (P VQ)

Page 41 of 66
Logical Equivalence

1. Show that ( a  b )  ( a  b )  a  ( b  c )

2. Verify whether the following is logically equivalent or not ~( p  q )  ~p  ~q

Logical Implications:

1. Construct a truth table and check if the given argument is VALID argument or not
( p  q ), p ⊢ q.

2. Analyze the following argument: Tom is either a carpenter or a plumber. If he carries a


wrench, he is a plumber. Tom is a carpenter. Therefore, he does not carry a wrench.

Page 42 of 66
3. Analyze the following argument: If Ahmed wins then Tariq will be happy. If Hussam wins
then Bader is happy. Either Ahmed win or Hussam win. However, if Ahmed wins, Bader will
not be happy and if Hussam wins then Tariq will not be happy. So Tariq will be happy if and
only if, Bader is not happy.

4. Analyze the validity of the following argument: If the subject is interesting then I am awake. I
am awake if the subject is Abstraction & Modeling. Therefore, the subject

BOOLEAN ALGEBRA

Page 43 of 66
Multiplication Truth Table:

0 x 0 = 0
0 x 1 = 0
1 x 0 = 0
1 x 1 = 1 

Addition Truth Table:

0 + 0 = 0 
0+1=1
1 + 0 = 1 
1+1=1

The important relations in the above exercise are widely used in simplifying circuits. These
correspond to rules (8a) and (8b) in the table of Boolean identities are De Morgan’s laws.

1. show that x · (x + y) =x using Boolean laws

x · (x + y) = x · x + x · y using (3a)

= x + x · y using (4a)

= x · (1 + y) using (3a)

= x · 1 using Exercise 1

=x

2. Simplify the Boolean expression using Boolean algebra.


a. (A + B) + B ̅ .

b. AA + BC + BC ̅

c. A ̅ + C + AB

Page 44 of 66
d. A ̅(B + AC ).

3. Create the Boolean Table for AB + C ̅

4. Simplify the Boolean expression.


a. Á (B + A).

b. ABC + A B́C + AB Ć

c. ABC + A B́C + AB Ć

d. (B+ AC) (B+ Á )

5. Using Boolean algebra techniques, simplify the expression X Y + X (Y + Z) + Y (Y + Z).

Page 45 of 66
6. Prove that (x + y) * (x + z) = x + yz

7. Simplify x * (Y + z) * 

8. Simplify x * y * z + x * z

9.

CHAPTER 5 – COMBINATIONS, PERMUTATIONS AND BINOMIAL THEOREM

1. Solve for the factorials below:

Page 46 of 66
a. 4!
b. 0!
c. (3!) (2!)
d. 10! / 8!

2. How many ways can you turn in a batting order for a baseball team if you only have 9
players?

3. Suppose a lawyer must select 4 juniors from a set of six candidates. How many groups are
possible?

4. How many ways can 3 runners be selected for the Olympics from a field of 5 contestants?

5. Suppose we have to select manager, assistant manager, and night manager from a list of 10
people. How many ways can this be done? Give the correct expression that gives the
answer.

6. A shipment of 20 disk drives was received by a computer store. Four of the drives are
defective. A sample of 2 are selected randomly.

a. How many different samples can be selected?


Combination Problem: 20C2 =

b. How many of the samples contain 2 defective drives?


Combination Problem: 4C2 =

7. Suppose we have an office of 5 women and 6 men and need to select 4-person committee.
How many ways can we select?

Page 47 of 66
a. 2 men and 2 women? (5C2)(6C2) =

b. 3 men and 1 women? (5C3)(6C1) =

c. All women? (5C0)(6C4) = or just 6C4 =

8. A lottery consists of 54 numbers. To purchase a ticket, you select 6 numbers from 54 without
repetition. How many selections are possible?

9. In how many different ways can the letters of the word “MATHEMATICS” be arranged such
that the vowels must always come together?

a. 98,000
b. 100,020
c. 120,960
d. 140,020

10. Professor Bill Jones owns 4 pairs of pants, 7 shirts, and 3 sweaters. He’s going on a trip, and
he will pack 2 pairs of pants, 3 shirts, and 1 sweater. How many ways could he choose which
clothes he will bring?
There are C(4,2) = 6 ways to choose 2 pairs of pants.
There are C(7,3) = 35 ways to choose 3 shirts.
There are C(3,1) = 3 ways to choose a sweater.
So in total, there are: 6*35*3 = __________________ ways to pack.

11. A computer shop has 15 PCs, 10 laptops and 20 iPads. A customer wants to purchase 5 PCs,
8 Laptops and 23 iPads. In how many ways can the salesman chose the devices?

Page 48 of 66
12. A secret code is created by combining 2 letters from the English alphabet and any 2 one-digit
numbers between and including 0 and 9. How many different code combinations are
possible if numeric digits can be repeated but letters cannot?

a. 71
b. 72
c. 60,840
d. 65,000
e. 67,600

Note: Permutation: Picking a President, Vice-President and water boy from a group of 10.
P(10,3) =
Combination: Choosing 3 desserts from a menu of 10.
C(10,3)

BINOMIAL DISTRIBUTION

Binomial probability distribution can be applied on such events where only two outcomes are
possible. If n repeated trials are done on a binomial experiment then for a certain even p to occur r
times, binomial distribution is used.

The binomial distribution formula is: b(x; n, P) = nCx * Px * (1 – P)n – x

WHERE:
b = binomial probability
x = total number of “success” (pass or fail, heads or tials, ect.)
P = probability of a success on an individual trial
n = number of trials

Example: A coin is tossed 10 times. What is the probability of getting exactly 6 heads?

I am going to use this formula: b(x; n, P) = nCx * Px * (1 – P)n – x


The number of trials (n) is 10
The odds of success (“tossing a heads”) is 0.5 (so 1-p = 0.5)
x=6

P(x=6) = 1 10C6 * 0.56 * 0.54 = 210 * 0.015625 * 0.0625 = 0.205078125

1. The probability of winning a match for team A is 0.6. Find the probability of winning 3
matches out of 5.

Page 49 of 66
2. If a committed has 7 members, find the probability of having more female members than
male members given that the probability of having a male or a female member is equal.

To have more female members, the number of females should be greater than or equal to 4.

P(X  4) = P (4) + P(5) + P(6) + P(7)

3. Aren is taking part in four competitions. If the probability of him winning any competition is
0.3, find the probability of him winning at least one competition.

Probability of winning at least one competition will be the complement of the probability of
winning not a single competition.

Chances of winning at least one competition = 1-P(X-0)

4. If a coin is tossed thrice, find the probability of getting head at least two times.
P(X  2) = P(X = 2) + P(X = 3)

5. If only 5 percent kids can secure A grade in paper, find the probability of at most 2 out of 10
kids will get A grade in that paper.

6. In a store, out of all the people who came there thirty percent bought a shirt. If four people
came in the store together then find the probability of one of them buying a shirt.

Page 50 of 66
7. In a hospital sixty percent of patients are dying of a disease. If on a certain day, eight
patients got admitted in the hospital for that disease what are the chances of three to
survive?

8. In a restaurant seventy percent of people order for Chinese food and thirty percent for
Italian food. A group of three persons enter the restaurant. Find the probability of at least
two of them ordering for Italian food.

9. In an exam only 10 percent students can qualify. If a group of 4 students have appeared, find
the probability that at most one student will qualify?

For at most one student to qualify, either 1 student will qualify or none of the 4 will qualify.

Probability for a student to qualify = 0.10.1

Probability for a student to disqualify = 0.90.9

The probability of qualification of zero students =

The probability of qualification of zero students =

Hence, the probability of at the most one student to qualify out of four will be P(X=0)+P(X=1)

10. Emily hits 60% of her free throws in basketball games. She had 7 free throws in last week’s
game. Denote Y the hits in Emily’s 7 free throws. The event that she made at least 5 hit is
then.

CHAPTER 6 – LIMITS AND CONTINUITY


Applications of Limits and Continuity:
We find many applications of limits and continuity in our daily life. If you drop an ice cube in a glass of
warm water and measure the temperature with time, the temperature eventually approaches the

Page 51 of 66
room temperature where the glass is stored. Measuring the temperature is a limit again as time
approaches infinity.

It is very difficult to calculate a derivative of complicated motions in real-life situations. So for designing
machines, engineers approximate using small differences in the function and then try and estimate
the value of the function by having smaller and smaller spacing in the domain intervals. The reading
of a speedometer is basically a limit because the speed of your car keeps changing. The value is
continually put to limit to find an absolute value!

Limits and Continuity form the basis of calculus and thus form an important strand to your preparation
The best part of Mathematics is its capability to estimate calculations which are completely exhaustive for
humans and extremely lengthy for computers as well. Limits and Continuity is one such chapter in
the curriculum which practically forms the basis of the entire differential calculus.

Limit is estimating the value of a given function at a particular point. Theoretically, this means finding the
value of function f(x) as it approaches a particular point (say x=a) from either sides (left or right on
the coordinate axis). Mathematically,

Where g(x) is the function obtained after estimation. This is basically assuming the value of function f(x) at
x=a, but in most cases, the function does not exist at x=a (like the log(x) function which does not
exist at x=0) and hence an estimation is required. But for continuous functions (such as polynomials),
the limit is simply the value of function at the point, that is,

Because the function exists at x=a. But, for example, if our function is defined as:

If we carefully look into this, for x approaching x=0, f(0)=1, but

Here, the limit gives 0 as the result. Why is that?

We are supposed to approach the value of function at x→0, so we find the value of function at points
very slightly before and after x=0 (say x= —0.001 and x=0.001). At these points, f(x) = x2 gives
0.000001 in both cases. This value can be safely estimated to 0. When such a conclusive answer is
not found, the limit is said to not exist. Here, it is not of our concern that the function has a value of
1 at x=0 because the function approaches a value of 0 as x→0 which is the desired result.

The limit obtained while approaching from the left side (of coordinate axis) is called left hand limit while
from the right side is called right hand limit. There can be cases where these may not be equal (or
one/both of them may not exist), and the limit is then understood to not exist. Limits are also
effective in finding values of the function at the points where the function attains a 5 or 6 or any
such indeterminable form.

For example: 7. At x=0, this function attains the 5 form which is inconclusive but the limit of this function
is 2. Limits provide us with several tools to deal with problems such as these.

Example :

Solution :

Page 52 of 66
Reference : http://www.tkiryl.com/Calculus/Problems/Section%201.4/Calculating%20Limits/Calculating
%20Limits.html
Questions : Find the limit of the following :

1.

2.

3.

4.

CHAPTER 7 – DERIVATIVES AND INTEGRALS AND THEIR APPLICATIONS


Calculus (along with differentiation) is very important in Computer Science.

In Isaac Newton’s day, one of the biggest problems was poor navigation at sea.

Page 53 of 66
Before calculus was developed, the stars were vital for
navigation.

Shipwrecks occurred because the ship was not where the


captain thought it should be. There was not a good enough
understanding of how the Earth, stars and planets moved
with respect to each other.

Calculus (differentiation and integration) was developed to


improve this understanding.

Differentiation and integration can help us solve many


types of real-world problems.

We use the derivative to determine the maximum and minimum values of particular functions (e.g.
cost, strength, amount of material used in a building, profit, loss, etc.).

Derivatives are met in many engineering and science problems, especially when modelling the
behavior of moving objects.

Ten major application of calculus in computer science is in the comparison of the performance of
various algorithms and the complexity of various problems. These are often expressed using big O
notation (used to classify algorithms), which relies on the idea of the limits of ratios of functions as a
variable tends to infinity.

Differentiation is used in:


 Numerical analysis for scientific software will use a lot.
 Physics engines for video games.
 Data analysis and prediction for business applications.
 Modeling software for things like biological systems, meteorology and climatology,
engineering applications, etc.
 Machine learning and artificial intelligence, including such things as natural language
processing, pattern recognition, etc.
 Image, video and audio processing.

Page 54 of 66
Find the derivatives of the following:

Power Rule:

1. f(x) = 2x2 + 4
Solution: f ‘ (x) = 2(2) x2-1 + 0
F ‘ (x) = 4 x

2. f(x) = 2x5 + 8x2 + x - 78


f ‘ (x) =

3. f(x) = 7x7 + 8x5 + x3 + x2 – x


f ‘ (x) =

1
4. f(x) = 3
√ x2
f ‘ (x) =

1
1
5. f(x)= 2 +3 x 3
x
Page 55 of 66
f ‘ (x) =

6.

Product rule:

7. f(x) = (x4 + 4x + 2) (2x + 3)

8. f(x) = (x3 - 12x) (3x2 + 2x)

9. f(x) = 5x2 (x3 - x + 1)3

Quotient rule:

Page 56 of 66
2 x +1
10. f(x) =
x +5

u3+ 2
11. f(x) =
u3

4 x−3
12. f(x) =
2 x +2

Chain rule:

13.

14.

15.

16. f(X) = (2x+1) √ 2 x +2

Exponentials

17. f(x) = (3x2 + e) e2x

18. f(x) = e 2 x +3x

Page 57 of 66
19.

Logic Functions:

20.

21.

22.

23.

Second Derivative Test and Optimization

Find the second derivative of the given functions (text book – page 821)

1. f(x) = 8x3 – 9x2 + 6x + 4

Page 58 of 66
f ‘ (X) =

F‘=

4 x +2
2. y =
3 x −1

3. y = x ex

4. Suppose that an object is moving along a straight line, with its position, in feet, at time t, in
seconds, given by

S(t) = t3 – 2t2 – 7t + 9

a. Find the velocity at any time (t).


v(t) = s’(t) =

b. The acceleration at any time (t).


a(t) = v’(t) = S’(t) =

c. When the object stops, its velocity is zero. For t  0, when does that occur?
(factorize and find the optimal value for velocity)

Page 59 of 66
5. The revenue R(x) generated from airplane passengers is related to the number of available
seat miles x by :

R(x) = -0.928 x3 + 31.492 x2 - 326.80x + 1143.88 ( 8 ≤ x ≤ 12)

Where x is measured in hundreds of billions of miles and R(x) is in billions of Dirhams. Is


there a point of diminishing returns for this function? If so what is it?

Hint: Solve for R”(x) = 0 and find x.

Page 60 of 66
INTEGRATION

Page 61 of 66
APPLICATIONS OF INTEGRALS

Find the antiderivative of the following:

1.  5 dx
x6
= +c
6

1
2. ∫ t 2 dt
Page 62 of 66
−2
= ∫t dt

t −2+1
= +c
−2+1

t −1
= +c
−1

3. ∫ √u du
1
1 +1
1/ 2 u2
= ∫u du = 1 +c
+1
2
=
2 3/2
= u +c
3

4. ∫ dx
=x+c

2
1
5. ∫ x√+1
x
dx = ∫ ¿ ¿ +
√x
)dx

=∫ ¿ ¿+ x−1 /2 )dx

2 5/ 2
= x +2x1/2 +c
5

6. ∫ (x 2−1) dx 2

Page 63 of 66
DEFINITE INTEGRAL AND APPLICATION OF INTEGRALS

1. A company that provides warranties on used electronic items uses currently data and part
experience to determine that the annual rate of repair costs for a particular model is given a
year x by
r(x) = 120 e4x
What will the total repair costs be for one year and for 3 years?

The total repair costs are represented by the area under the rate curve over the
approximate integral.

Page 64 of 66
1
0.4 x
For 1 year the total repair costs = ∫ 120 e dx
0

120 0.4 x
= e
0.4

= 300 e0.4 - 300 ≈ 147.55

For 3 years the total repair costs = 3

∫ 120 e 0.4 x dx
0

120 0.4 x
e
0.4

=300 e0.4(3) -300 e0.4(0)


=300 e1.2 -300≈696.04

2. According to data from Apple Computer Inc. Apple’s rate of net sales (in billions of
dirhams per year) can be approximated by

F(x) = 5.3 x-14.5 (x≥4)

Where x corresponds to year 2004

a. what were the total sales from the beginning of 2004 to the end of 2008 ?
Solution: The total sales are the area under the graph of f(x) above the x axis
from x=4 to x=9 (99.75 billion dirhams)
9
= ∫ (5.3 x−14.5)dx
4

Page 65 of 66
b. In what year (starting in 2004) did total sales reach 30 billion?
(Hint: solve the quadratic equation -2.65t2 – 14.5t – 14.4 = 0 and t  6.33)
t
Solution: the total sales from x = 4 to x = t are given by ∫ (5.3 x−14.5)dx
4
t

So we must find t such that ∫ (5.3 x−14.5)dx = 30


4

Page 66 of 66

You might also like