Basic Computational Mathematics
Basic Computational Mathematics
Contents
1 Numbers and Sets ..................................................................................................................................... 3
1.1 Brief theoretical background ................................................................................................................ 3
1.2 Compulsory problems ............................................................................................................................ 4
1.3 Supplementary problems ...................................................................................................................... 5
1.4 Answers for Tutorial 1 ............................................................................................................................ 6
2 Relations ..................................................................................................................................................... 9
2.1 Brief theoretical background ................................................................................................................ 9
2.2 Compulsory problems .......................................................................................................................... 10
2.3 Supplementary problems .................................................................................................................... 11
2.4 Answers for Tutorial 2 .......................................................................................................................... 13
3 Relation schemes and Functions .......................................................................................................... 16
3.1 Brief theoretical background .............................................................................................................. 16
3.2 Compulsory problems .......................................................................................................................... 18
3.3 Supplementary problems .................................................................................................................... 19
3.4 Answers for Tutorial 3 .......................................................................................................................... 20
4 Boolean types, logic and quantifiers ................................................................................................... 21
4.1 Brief theoretical background .............................................................................................................. 21
4.2 Compulsory problems .......................................................................................................................... 22
4.3 Supplementary problems .................................................................................................................... 23
4.4 Answers for Tutorial 4.......................................................................................................................... 24
5 C.n.f, negation of quantifiers, proof and argument .......................................................................... 27
5.1 Brief theoretical background .............................................................................................................. 27
5.2 Compulsory questions ......................................................................................................................... 29
5.3 Supplementary questions.................................................................................................................... 30
5.4 Answers for Tutorial 5 .......................................................................................................................... 31
6 Vectors and complex numbers ............................................................................................................. 32
6.1 Brief theoretical background .............................................................................................................. 32
6.2 Compulsory questions ......................................................................................................................... 36
1
6.3 Supplementary questions.................................................................................................................... 37
6.4 Answers for Tutorial 6 .......................................................................................................................... 38
7 Matrices .................................................................................................................................................... 39
7.1 Brief theoretical background .............................................................................................................. 39
7.2 Compulsory questions ......................................................................................................................... 42
7.3 Supplementary questions.................................................................................................................... 43
7.4 Answers for Tutorial 7 .......................................................................................................................... 44
8 Computer graphics in 2D: Matrix transformations ........................................................................... 45
8.1 Brief theoretical background .............................................................................................................. 45
8.2 Linear transformations in 2D .............................................................................................................. 45
8.3 Compulsory questions ......................................................................................................................... 47
8.4 Supplementary questions.................................................................................................................... 47
8.5 Answers for Tutorial 8 .......................................................................................................................... 49
9 Elements of graph theory ...................................................................................................................... 51
9.1 Brief theoretical background .............................................................................................................. 51
9.2 Compulsory problems .......................................................................................................................... 53
9.3 Supplementary problems .................................................................................................................... 54
9.4 Answers for Tutorial 9 .......................................................................................................................... 55
10 Elements of number theory and cryptography ............................................................................... 56
10.1 Brief theoretical background ............................................................................................................ 56
10.2 Compulsory problems........................................................................................................................ 58
10.3 Supplementary problems .................................................................................................................. 58
10.4 Answers for Tutorial 10 ..................................................................................................................... 59
11 Elements of Calculus............................................................................................................................. 62
11.1 Brief theoretical background ............................................................................................................ 62
11.2 Compulsory problems........................................................................................................................ 64
11.3 Supplementary problems .................................................................................................................. 64
11.4 Answers for Tutorial 11 ..................................................................................................................... 65
2
1 Numbers and Sets
1.1 Brief theoretical background
This section briefly presents the theoretical aspects covered in the tutorial. For
more details please check the lecture notes.
Number systems
N ={0, 1, 2, 3, . . . } natural numbers (including zero) (1.1)
N+ ={1, 2, 3, . . . } natural numbers excluding zero (1.2)
Z ={..., −2, −1, 0, 1, 2, . . . } integers (positive and negative) (1.3)
m
(1.4)
Q ={q = : m ∈ Z, n ∈ N+} rational numbers (fractions) n
R ={a.b : a, b ∈ Z} reals - infinite decimals (1.5)
R ={x ∈ R : x ≥ 0}
+ (1.6)
√ (1.7)
C ={a + bi : a, b ∈ R}, i = −1 complex numbers.
Motivation of number sets Number sets appeared from the need to solve
various equations, and to have well defined operations. Polynomials that
generate solutions in the various number sets are
1. P(x) = x − 1 ⇒x = 1 ∈ N
2. P(x) = x + 1 ⇒x = −1 6∈ N, x ∈ Z
3. P(x) = 4x − 1 ⇒x = 1/4 6∈ Z, x ∈ Q
√
4. P(x) = 2x − 1 ⇒x = 2 6∈ Q,
2 x∈R
√
5. P(x) = x + 1 ⇒x =
2 −1 = 1 6∈ R, x ∈ C.
• B ⊂ A ⇔x ∈ B ⇒x ∈ A
• A = B ⇔B ⊂ A and A ⊂ B
3
• P(A) - power set - set of all subsets of A
• finite or infinite
• A ∩ B = {x ∈ U : x ∈ A and x ∈ B} (intersection)
• A ∪ B = {x ∈ U : x ∈ A or x ∈ B} (reunion)
• A \ B = {x ∈ U : x ∈ A and x ∈ / B} (difference)
C 1.3. Let
4
C 1.4. Let the Universe U = {0, 1, 2, 3, 4, 5, 6, 7} and let
C 1.5. a) List the elements of the following sets (enumerate or give a formula).
i) {x ∈ N+ : x is a multiple of
4} ii) {x ∈ Z : −2 ≤ x ≤ 3}
A = {x ∈ N+ : x is prime}
B = {x ∈ N+ : x is even} C = {x ∈ N+
: x is odd}
D = {x ∈ N+ : x is a multiple of 6}
Are any of the above sets A, B, C or D subsets of one of the other sets? Write
down your answer using the notation ⊂.
c) Determine which of the following sets are equal
E = {0, 1, 2, 3}
F = {x ∈ N : x2 < 13}
G = {x ∈ N : (x2 + 3) < 2}
C 1.6. i) If A ⊆ C and C ⊆ B, does it follow that A ⊆ B
? ii) If A ⊆ C and B ⊆ C, what can you say about A
and B.
C 1.7. If A and B are subsets of the universe, show by constructing examples that
each of the following is true.
i) (A∆B)c = (A ∩ B) ∪ (A ∪
B)c ii) (A \ B)c = Ac ∪ B
C 1.8. Use Venn diagrams to show that the following pairs are logically
equivalent.
i) (A ∩ B) ∪ (A ∩ B)c = U(universal
set) ii) (Ac ∩ B) ∪ A = A ∪ B
i) A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) (distributivity of ∩)
ii) A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) (distributivity of ∪)
iii) (A ∩ B)c = Ac ∪ Bc (de Morgan law for ∩)
i) A ∪ B = {1, 2, 3, 4, 5, 6,
7, 8, 9, 10} ii) A ∩ B = {3,
4, 5} iii) A \ B = {2, 6}
C 1.1. P(A) = {∅, {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c}}.
C 1.2. A×B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c), (3, a), (3, b), (3, c), (6, a), (6, b), (6,
c)}.
C 1.3. A ∪ B = {‘r‘, ‘e‘, ‘s‘, ‘t‘, ‘l‘, ‘a‘, ‘x‘}; A ∪ C = {‘r‘, ‘e‘, ‘s‘, ‘t‘, ‘l‘, ‘u‘, ‘m‘, ‘b‘};
B ∪ C = {‘r‘, ‘e‘, ‘l‘, ‘a‘, ‘x‘, ‘s‘, ‘u‘, ‘m‘, ‘b‘}; A ∩ B = {‘r‘, ‘e‘}; A ∩ C = {‘r‘, ‘e‘, ‘s‘};
B ∩ C = {‘r‘, ‘e‘, ‘l‘}; A \ (A ∩ C) = {‘s‘, ‘t‘}; B \ (A ∪ C) = {‘a‘, ‘x‘}.
6
b) A = {2, 3, 5, 7, 11, . . . }(infinite set)
B = {2, 4, 6, 8, . . . } = {2n : n ∈ N+}
C = {1, 3, 5, 7, . . . } = {2n − 1 : n ∈ N+} = {2n + 1 : n ∈ N}
D = {6, 12, 18, . . . N+} = {6n : n ∈ N+} ⊂ B
c) E = F = {0, 1, 2, 3}.
C 1.8. Use Venn diagrams to show that the following pairs are logically
equivalent.
Supplementary problems
(a)A × B × C = {(1, a, a), (1, a, b), (1, a, c), (1, b, a), (1, b, b), (1, b, c), (1, c, a), (1, c, b), (1,
c, c),
(2, a, a), (2, a, b), (2, a, c), (2, b, a), (2, b, b), (2, b, c), (2, c, a), (2, c, b), (2, c, c),
(3, a, a), (3, a, b), (3, a, c), (3, b, a), (3, b, b), (3, b, c), (3, c, a), (3, c, b), (3, c, c)};
S 1.2. You may use the Venn diagrams where to show that both sides determine
the same region. Otherwise, we can use the following argument.
(i) Let x ∈ A ∩ (B ∪ C) then x ∈ A and x ∈ (B ∪ C). This means that x ∈ A and x ∈
B or x ∈ C. This means that x ∈ (A ∩ B) or x ∈ (A ∩ C).
For the proof to be complete one also need to start with a x from the right hand
side, and show that it belongs to the set at the left.
7
(iii) and (iv) - check with Venn diagrams.
A = {2, 3, 4, 5, 6}
B = {1, 3, 4, 5, 7, 8, 9, 10}
This is not a rational number. To prove this we assume there are two natural numbersp, q s.t they
have no common divisors and qp 2=
√ 3q2 and
= 3. This is equivalent to p
because p and q are natural numbers, p2 is a multiple of 3. This can only happen
when p itself is a multiple of 3, therefore p = 3p1. In this case, (3p1)2 = 3q2, which
gives 3p21 = q2. Using the same argument as before, q = 3q1. However, this
would mean that 3 is a common divisor of p and q, which is a contradiction. This
ends the proof.
8
2 Relations
2.1 Brief theoretical background
Notations and definitions
• X - domain, Y - co-domain
• G - graph (we usually identify the relation R with its graph G!!!)
9
N-arry relations Let n ≥ 2 and A1, . . . , An sets. A n-ary relation is a set R ⊂ A1 × ···
× An of n-tuples (a1, . . . , an) s.t. aj ∈ Aj, j = 1, . . . , n.
2.2 Compulsory problems
C 2.1. Let C be the set of characters and Y = {”apple”, ”pie”}. Find the define the
graph of the relation
APPEARS ⊂ C × Y
where (c, s) ∈ APPEARS if the character c appears in the string s.
Relation types
R ⊂ X × Y = {(1, A), (1, C), (2, A), (3, D), (4, D)}
S ⊂ Y × Y = {(E, A), (E, B), (B, D), (C, F), (A, F)}.
If A = {Bill, Dave, Frankie} ⊂ T and B = {hockey, tennis} ⊂ S then find A C LIKES, LIKES B B
and LIKES(A).
10
(A C R) B B = A C (R B B).
(2.1)
C 2.6. Let R ⊂ X × Y, S ⊂ Y × Z and T ⊂ Z × U be relations. Show that
S 2.3. Let STUDENTS be the set of students in a college, COURSES be the set of
courses the college runs, and SESSIONS be the set of sessions (such as: June 21,
a.m.) at which exam papers are taken. (Students may take more than one
course, and a course may have more than one exam paper.) Relations TAKING
and EXAM are defined as:
11
EXAM = {(c, d) ⊂ COURSES × SESSIONS : there is a paper for course c in session d}
Let F be the set of female students, and C the set of computing courses.
(i) Express in English each of the following:
i) HOBBIES B Arty
ii) Professional C HOBBIES
S 2.6. Prove whether the following binary relations are equivalences. If the
relation is not an equivalence relation, state why it fails to be one.
(i) X = Z : a ∼ b if ab > 0.
(ii) X = R : a ∼ b if a − b is rational .
(iii) X = R : a ∼ b if a ≥ b.
12
(iv) X = C : a ∼ b if |a| = |b|.
2.4 Answers for Tutorial 2
Compulsory problems
C 2.1. APPEARS =
C Y
‘a‘ ”apple”
‘p‘ ”apple”
‘l‘ ”apple”
‘e‘ ”apple”
‘p‘ ”pie”
‘i‘ ”pie”
‘e‘ ”pie”
C 2.2. (i)
1 ‘a‘
1 ‘b‘
2 ‘d‘
3 ‘b‘
4 ‘b‘
(ii) R−1 = {(‘a‘, 1), (‘b‘, 1), (‘b‘, 3), (‘b‘, 4), (‘d‘, 1)}.
C 2.3.
hockey)} LIKES(A) = {tennis, hockey}. C 2.5. Both sides represent the set
Supplementary problems
S 2.2. One just needs to use the definitions of ∩, ∪, C, B and of the image of a
subset, and the double inclusion to prove the pairs of sets are equal.
14
i)HOBBIES B Arty = {(Sarah, painting), (Tom, painting), (Sarah, sketching), (Craig,
sketching)}
ii)Professional C HOBBIES = {(Sarah, painting), (Joe, football), (Sarah, sketching)}
iii)Amateur C HOBBIES B Games = {(Janet, football), (Susie, hockey)}.
15
3 Relation schemes and Functions
3.1 Brief theoretical background
Notations and definitions
• Binary relation: subset R ⊂ X × Y.
• Relation scheme: table with its column headings (called attributes). The
entries in the table are called ”tuples”.
Examples of functions
• Card : P(X) →N, Card(A) = nr of elements in subset A
• Functions defined on N × N →N: well defined (+, ×) and ill defined (−, /).
16
• bijective (1-on-1): a function that is both injective and surjective
• Theory of cardinals:
1) Two sets have same cardinal X ∼ Y if there is a 1-1 function between
them
2) Finite sets: same cardinal means they have the same number of
elements
3) Infinite sets: N ∼ Z ∼ Q - countable sets
4) R - not countable
• Datatype string:
1) Sets: C set of all characters, S set of all (ordered) sequences of
characters
2) Notation: ‘a‘ - character, ”string” - string
3) Functions defining the datatype string (all but LEN):
17
– Example: =C is well defined when both inputs are in set C.
– >c: orders two characters by comparing their ASCII codes.
– +s concatenates two strings (”a” +s ”xe” = ”axe”)
3.2 Compulsory problems
When solving the problems one has to notice that the operations with index
(” +s ”, ” =c ”, ” =N ”, ” +R ”) refer to operations on the sets: S (strings), C
(characters), N (natural numbers) and R real numbers.
Make sure you understand the theory, before solving the problems!
C 3.2. Which of the following are true ? If false or invalid explain why.
(a) ‘a‘ <c ‘A‘; (b) ‘2‘ <c ‘Q‘; (c) 3 =c ‘3‘.
C 3.3. Which of the following are true, false (or invalid). Explain your decision.
(a) STR(‘c‘) =s ”c”; (b) ”d” =c ‘d‘; (c) ASC(‘c‘) ∈ C; (d) STR(ASC(‘b‘)) =s ”98”
C 3.4. Given s = ”Hal”, t = ”PRINCE” write down the following where
possible: (a) LEN(s); (b) LEN(t); (c) s +R t; (d) FIRST(s); (e) REST(t); (f)t +s s;
(g) t +s ‘s‘; (h) REST(s) +s ”ice”.
18
or that there are many possible elements and describe
them. a) c ∈ S such that c +s ”ed” =s ”pushed”;
b) t ∈ S such that LEN(t) = 6;
c) r ∈ S such that LEN(r) = 0;
d) v ∈ C such that ASC(v) = 109 ;
e) w ∈ N such that LEN(w) = 1.
3.3 Supplementary problems
S 3.1. Find the domain and codomain of the following functions f : X →Y:
S 3.2. Define the function CAPITAL CONVERT : S →S that replaces a string by the
same string, with the first letter replaced by the upper case symbol for that
letter. i.e. fish →Fish, ada →Ada. Hint: Check the notations booklet to find the
ASCII codes of
lower and upper letters, and for the functions of datatype string.
19
3.4 Answers for Tutorial 3
Compulsory problems
C 3.5. ‘1‘, 9.
C 3.6. (a) 68+100=168; (b) invalid; (c) ”H”; (d) STR(65) invalid;
(e) ”ouise”; (f) ”T”; (g) 7; (h) ”og” ; (i) ”o”; (j) FIRST(” ”) - invalid - the function is
only defined for non-empty strings; (k) ”f”+s” ”= ”f”.
Supplementary problems
Remark: five other functions ASC, CHR, FIRST, REST, ADDFIRST have all been
used to make the function CAPITAL CONVERT.
S 3.3. (a) bijective; (b) neither; (c) neither; (d) surjective; (e) bijective; (f)
bijective; (g) bijective; (h) bijective.
20
4 Boolean types, logic and quantifiers
4.1 Brief theoretical background
Boolean values: B = {true, false}
Boolean operations:
• NOT: ¬ : B →B (standard notation, some books may use ” ∼ ”)
• OR: ∨ : B × B →B
• AND: ∧ : B × B →B
• IMPLIES: ⇒: B × B →B
• EQUIVALENT: ⇔: B × B →B
p q ¬p p∨ q p∧ q p⇒q p⇔q
T T F T T T T
T F F T F F F
F T T T F T F
F F T F F T T
Equivalence between operations defined on boolean variables and set operations
Let A, B be two subsets of universe U and p and q be defined as
Definitions:
• Sentence: statement that takes a value true or false.
• Special predicates:
(i) ¬(p ∧ q) = ¬p ∨ ¬q
(ii) ¬(p ∨ q) = ¬p ∧ ¬q
21
Disjunctive normal form (d.n.f)
Definition: Equivalent way of writing the truth table, using the variables i.e. p, q, ¬p,
etc.... first using ∧ , then using ∨ .
The d.n.f of H is
Quantifiers
C 4.3. For x ∈ R, suppose that p, q, and r are the propositions given below:
22
p : x = −4 q :
x = +4 r : x2 =
16
Which of the following are true ?
a) p ⇒r; b) r ⇒p; c) q ⇒r; d) r ⇒q; e) p ⇔r;
f) q ⇔r; g) (p ∨ q) ⇒r; h) r ⇒(p ∨ q); i) (p ∨ q) ⇔r;
C 4.4. Decide which of the sentences below, are universally true, which are
universally false, and which are neither. Write the predicates in symbolic form.
i) (x + 3)2 > 8,
x ∈ N ii) 2x =
9, x ∈ N.
23
i) 27 ≥ 5; √
S 4.4 Decide which of the sentences below are universally true in R, which are
universally false and which are neither.
i) (x + 3)2 > 6; ii) x = x + 1; iii)2x = 7; iv) (x − 1)2 = x2 − 2x + 1.
S 4.5 Let R be the proposition ”Roses are red” and B be the proposition ”Violets
are blue”. Express each of the following propositions as logical expressions: a) If
roses are not red, then violets are not blue;
b) Roses are red or violets are not blue;
c) Either roses are red or violets are blue (but not both);
Use a truth table to show that (a) and (b) are equivalent.
S 4.6 Find the d.n.f. of the following formulas and the regions in the Venn
diagram: (i) ¬p ∧ (q ⇒p)
(ii) ¬p ∧ (¬q ∨ r);
(iii) ¬p ∧ (q ∨ r);
4.4 Answers for Tutorial 4
Compulsory problems
C 4.1. John is either not six feet tall, or he weighs less than 200 pounds.
C 4.2. In each case, one needs to build the table for 2 and 3 variables.
For simplicity, the final expressions are called H or G (to avoid too wide tables).
(i) Let H= ¬(¬p∧ q). The corresponding truth table is
p ¬p q ¬p ∧ q H
1 0 1 0 1
1 0 0 0 1
0 1 1 1 0
0 1 0 0 1
(ii) Let H=(p∨¬q)∧ r. The corresponding truth table is
p q r ¬q p∨¬q H
1 1 1 0 1 1
1 1 0 0 1 0
1 0 1 1 1 1
1 0 0 1 1 0
24
0 1 1 0 0 0
0 1 0 0 0 0
0 0 1 1 1 1
0 0 0 1 1 0
(iii) Let G=(p∧ q)∨ r and H=(p∨ r)∧ (q∨ r). The combined truth table for G and H is
p q r p∧ q p∨ r q∨ r G H
1 1 1 1 1 1 1 1
1 1 0 1 1 1 1 1
1 0 1 0 1 1 1 1
1 0 0 0 1 0 0 0
0 1 1 0 1 1 1 1
0 1 0 0 0 1 0 0
0 0 1 0 1 1 1 1
0 0 0 0 0 0 0 0
hence the two statements are logically equivalent.
(iv)Let G=(p∨ q)∧¬r and H=(p∧¬r)∨ (q∧¬r).
The combined truth table for G and H is
p q r ¬r p∨ q p∧¬r q∧¬r G H
1 1 1 0 1 0 0 0 0
1 1 0 1 1 1 1 1 1
1 0 1 0 1 0 0 0 0
1 0 0 1 1 1 0 1 1
0 1 1 0 1 0 0 0 0
0 1 0 1 1 0 1 1 1
0 0 1 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0
hence the two statements are logically equivalent.
C 4.3. a) T; b) F; c) T; d) F; e) F; f) F; g) T; h) T; i) T;
25
One obtains (the 3 variables method is covered in the theoretical
background) i) (p ∧ q) ∨ (p ∧ ¬q) ∨ (¬p ∧ ¬q);
ii) p ∧ ¬q; iii) (p ∧ q ∧ r) ∨ (p ∧
¬q ∧ r) ∨ (p ∧ q ∧ ¬r);
C 4.8. (i) ((y < 3) ∨ ((y < 10) ∧ (y > 6))) ∧ ¬(y = 6);
(ii) FIRST(s) = ‘b‘ ∧ FIRST(FIRST(s)) = ‘a‘;
(iii) (FIRST(s) = ‘c‘) ⇒FIRST(t) = ‘c‘;
(iv) FIRST(s) = FIRST(t)∧ 6= (FIRST(FIRST(s)) = FIRST(FIRST(t));
S 4.6. One needs to construct the truth table for each expression, then write the
brackets corresponding to the 1 (or T) values and finally connect them using ∨
(disjunction).
26
5 C.n.f, negation of quantifiers, proof and argument
5.1 Brief theoretical background
In general, one may use the set {0, 1} instead of the boolean values B = {True,
False}.
Disjunctive normal form (d.n.f.) combines the basic literals, first using ∧ , then
using ∨ .
p ¬p q ¬q
¬p ∧ q ¬(¬p∧ q)
1 0 1 0 0 1
1 0 0 1 0 1
0 1 1 0 1 0
0 1 0 1 0 1
• De Morgan‘s Laws
¬(p ∧ q) = ¬p ∨ ¬q
¬(p ∨ q) = ¬p ∧ ¬q
• Distributive Law
p ∧ (q ∨ r) = (p
∧ q) ∨ (p ∧ r) p ∨
(q ∧ r) = (p ∨ q) ∧
(p ∨ r)
• Associative Law
27
p ∧ (q ∧ r) = (p
∧ q) ∧ (p ∧ r) p ∨
(q ∨ r) = (p ∨ q) ∨
(p ∨ r)
Conjunctive normal form (c.n.f)
Conjunctive normal form (c.n.f.) combines the basic literals, first using ∨ , then using ∧ .
• ∧ becomes ∨
• ∨ becomes ∧
Negation of quantifiers
• ∀ becomes ∃
• ∃ becomes ∀
p⇒q
p q ¬q ¬p
1 1 1 0 0
1 0 0 1 0
0 1 1 0 1
0 0 1 0 1
Deduction rules
Arguments
28
5.2 Compulsory questions
C 5.1. Find the d.n.f and c.n.f of the following statements
(i) p ∨ (q ∧ r);
(ii) ¬((p ∧ q) ∨ r);
(iii) p ⇔(q ∧ r);
C 5.2. Given the following truth table for a formula H, find the disjunctive normal
form for H and hence find the conjunctive normal form of H.
p q H
1 1 1
1 0 0
0 1 0
0 0 1
C 5.3. Given the following truth table for a formula G, find the d.n.f for G and
hence find the c.n.f of G. Also identify the corresponding regions in the Venn
diagram.
p q r G
1 1 1 0
1 1 0 1
1 0 1 0
1 0 0 0
0 1 1 0
0 1 0 1
0 0 1 1
0 0 0 1
C 5.4. Write the English statements that are the negations of each of the
sentences
(i) All dogs bark;
(ii) Some birds fly;
(iii) No cat likes to swim;
(iv) No computer science student does not know mathematics.
C 5.5. Find the negation of the following statements and evaluate their truth
values:
(i) ∀ x ∈ R [ x2 − 6x + 10 ≥ 0]; (ii) ∀ x ∈ R [ x2 ≥
x]; (iii) ∃ x ∈ N+ [ x2 + 2x − 2 ≤ 0]; (iv) ∃ x ∈
Q [ x = 3].
2
C 5.6. Prove Modus Ponens, Modus Tollens, Inverse Error and Converse Error
using the truth table from the previous page.
29
5.3 Supplementary questions
S 5.1. Find the d.n.f and c.n.f of the following
expressions: (i) ¬(p⇒q); (ii) p⇒(q∧ r); (iii) ¬(p⇔q).
S 5.4. Use Deduction Rules to prove which of the following arguments are valid
and which are fallacious, you may only use a deduction rule that you have
already proved via truth tables. No credit will be given for decisions that are not
justified.
(i) If the apple is ripe, then it will be sweet; The apple is sweet.
Therefore the apple is ripe.
(ii) If I go to the pub, I won‘t finish my revision;
If I don‘t finish my revision, I won‘t do well in the exam tomorrow.
Thus if I go to the pub, I won‘t do well in the exam tomorrow.
(iii) Gill is playing rugby if Tom is not in class;
If Gill is not playing rugby then Tom will be in class
Therefore Tom is not in class or Gill is not playing rugby.
(iv) Sam is studying maths or Sam is studying economics; Sam is
required to take logic if he is studying maths.
So Sam is an economics student or he is not required to take logic.
(v) English men wear bowler hats;
The man is wearing a bowler hat.
Therefore he must be English.
S 5.5. Comment on the following argument.
Storing on floppy disk is better than nothing. Nothing is better than a hard disk
drive.
Therefore, storing on floppy disk is better than a hard disk drive.
30
5.4 Answers for Tutorial 5
Compulsory problems
C 5.1. We first need to find the truth table for the expressions
A= p ∨ (q ∧ r), B= ¬((p ∧ q) ∨ r) and C= p ⇔(q ∧ r) and their negations.
p q r q∧ r p∧ q (p∧ q)∨ r A B C ¬A ¬B ¬C
1 1 1 1 1 1 1 0 1 0 1 0
1 1 0 0 1 1 1 0 0 0 1 1
1 0 1 0 0 1 1 0 0 0 1 1
1 0 0 0 0 0 1 1 0 0 0 1
0 1 1 1 0 1 1 0 0 0 1 1
0 1 0 0 0 0 0 1 1 1 0 0
0 0 1 0 0 1 0 0 1 1 1 0
0 0 0 0 0 0 0 1 1 1 0 0
(i) Using the columns corresponding to A and ¬A we obtain
d.n.f(A)= (p ∧ q ∧ r) ∨ (p ∧ q ∧ ¬r) ∨ (p ∧ ¬q ∧ r) ∨ (p ∧ ¬q ∧ ¬r) ∨ (¬p ∧ q ∧ r).
c.n.f(A)= ¬d.n.f(¬A)= (p ∨ ¬q ∨ r) ∧ (p ∨ q ∨ ¬r) ∧ (p ∨
q ∨ r). (ii) Using the columns corresponding to B and ¬B
we obtain d.n.f(B) = (p ∧ ¬q ∧ ¬r) ∨ (¬p ∧ q ∧ ¬r) ∨
(¬p ∧ ¬q ∧ ¬r).
c.n.f(B)= (¬p∨¬q∨¬r)∧(¬p∨¬q∨ r)∧(¬p∨ q∨¬r)∧(p∨¬q∨¬r)∧(p∨ q∨¬r).
(iii) Using the columns corresponding to C and ¬C we obtain
d.n.f(C) = (p ∧ q ∧ r) ∨ (¬p ∧ q ∧ ¬r) ∨ (¬p ∧ ¬q ∧ r) ∨ (¬p ∧ ¬q ∧ ¬r).
c.n.f(C)= ¬d.n.f(¬C)= (¬p ∨ ¬q ∨ ¬r) ∧ (¬p ∨ q ∨ ¬r) ∧ (¬p ∨ q ∨ r) ∧ (p ∨ ¬q ∨ ¬r).
C 5.6. The detailed proof is available in the lecture slides (Lecture 5).
31
6 Vectors and complex numbers
6.1 Brief theoretical background
Vector: A quantity having direction as well as magnitude.
−
→
a ,, a, aˆ
a = (a1, a2, a3), a = (ax, ay, az), a = [ax, ay, az]
a (column)
−→
A(a1, a2, a3), B(b1, b2, b3) ⇒AB = (b1 − a1, b2 − a2, b3 − a3).
• Substraction: a − b = a + (−1)b.
Special vectors:
• zero vector: 0 = (0, 0, 0) ∈ R3 (3D) or 0 = (0, 0) ∈ R2 (2D)
32
Centre of mass (with weights): The system of points A1, . . . , An with masses m1,
. . . , mn has the centre of mass M s.t.
−−→ −−→ −−→
−−→ m1OA1 + m2OA2 + ··· + mnOAn
OM = .
m1 + m2 + ··· + mn
Polygon addition rule: Let A, B, C, D be points in plane (space). Then
(same is true for a polygon A1, . . . , An)
Dot (scalar) product: Let a = (a1, a2, a3) and b = (b1, b2, b3) be two vectors.
a · b = a1 · b1 + a2 · b2 + a3 · b3
= kakkbk cos θ
Applications of the scalar product:
• The modulus of vector a = (a1, a2, a3) is obtained from the formula
a·b
cos θ =
kakkbk
θ = π/2 ⇔cos θ = 0 ⇔a · b = 0
a = kakaˆ
Cross product (Vector product) Let a = (a1, a2, a3) and b = (b1, b2, b3) be two
vectors. The cross (vector) product is equal to
i × j = k; j
× i = −k j × k =
i; k×j=
−i k × i = j; i
33
× k = −j i × i = j
×j=k×k=0
• The area of a triangle between vectors a = (a1, a2, a3) and b = (b1, b2, b3) is
obtained from the formula
S = k a × bk
θ = 0 ⇔sin θ = 0 ⇔a × b = 0
z = a + bi, a, b ∈ R
34
r = |z| = pa2 + b2,
z1/z2 = z1/z2
Modulus property:
• Addition:
• Substraction:
z1 a + bi (a + bi)(c − di)
= =
z2 c + di (c +
di)(c − di) ac +
bd bc − ad
= 2 + d2 +
c2 + d2 i
c
6.2 Compulsory questions
C 6.1. Decide which of the following are vector quantities: Velocity, mass,
acceleration, weight, area, temperature, force, potential energy, volume.
(1) z1 + z2;
36
(2) z1 − z2;
(3) z1z2;
(4) |z1|;
(5) z1/z2;
(6) z1 − z2;
(7) z1z2;
(8) z2z2;
;
;
6.3 Supplementary questions
S 6.1. Let ABCD be a quadrilateral. Find each of the single vectors equivalent to
−→ −→
(i) AB + BC ;
−→ −→ −→
(ii) AB + BC + CD;
−→ −→
(iii) AD + DC;
−→ −→
(iv) BC + CD;
−→ −→
(v) AB + DA;
−→ −→ −→
S 6.2. O, A, B, C, D are five points such that OA = a, AB = b , AB = a + 2b and
−→ −→−→−→−→ −→
OD = 2a − b. Express AB, BC, CD, AC and BD in terms of a and b.
S 6.3. Let ABCD be a quadrilateral, whose vertices have coordinates A(1,1),
B(7,3),
C(10,12), D(8,2). Find the vectors
−→ −→ −→ −→
(i) AB; (ii) AC; (iii) AD; (iv) BD;
−→ −→
S 6.4. For the quadrilateral ABCD in S 6.3. , check whether the diagonals AC and
BD are perpendicular. If not, what is the angle between them ?
S 6.5. Let ABCD be a quadrilateral, whose vertices are A(1,1), B(7,3), C(10,12),
D(8,2).
(i) Find the centre of mass G for the quadrilateral ABCD.
(ii) Find the centres of mass G1, G2, G3, G4 corresponding to each of the triangles
ABC, BCD, CDA, DAB.
37
(iii) Find the centre of mass G0 for the quadrilateral G1G2G3G4. What is the
relation between G0 and G?
S 6.5. , when the masses 1kg, 2kg, 3kg and 4kg are attached to A, B, C and D,
respectively.
(i) 1 3 4
(ii) 1+−
S 6.10. Given that z is not real and |z| = 1, prove that the number w is a
pure imaginary number.
6.4 Answers for Tutorial 6
Compulsory problems
C 6.2. 4 newtons.
√ √ √ √
C 6.3. (i) kak = 29; k bk = 21; k ck = 18; k dk = 13;
(ii) uˆ
; vˆ ; wˆ = √1 (i − 2j);
5
38
(iii) In each case we have to find a vector a = (x, y, z) s.t.
a) a · p = a · q = 0. Solution: a = (t, 9/5t, 17/10t), t ∈ R.
b) a · m = a · l = 0. Solution: a = (t, −7/2t, −16/13t), t ∈ R.
c) a · v = a · u = 0. Solution: a = (t, −t, 1/2t), t ∈ R.
Supplementary problems
;
7 Matrices
7.1 Brief theoretical background
Matrix: array of numbers called elements. Horizontal components are called
rows (or lines) while the vertical components are called columns. A matrix with
m rows and n columns is of dimension (size, order) m × n.
• column matrix
or
39
• square matrix - same number of rows as columns (i.e. m=n)
Matrix notation
• Matrices are usually denoted by capital letters.
A
. . . . .
• The zero matrix: all its elements are zero. The zero 2 × 2 matrix is
• Diagonal matrix: Square, elements outside the main diagonal are zero.
A , B
I , I
• same dimension
• Multiplication by a scalar:
Let A be a matrix and λ ∈ R a scalar (number).
The matrix λA is obtained by multiplying each element of A by λ.
λA
• Multiplication of two matrices: the rule of row-column multiplication. Let
A, B be matrices of sizes m × n and n × p respectively.
The element cij in C = AB is obtained by multiplying
• determinant of 2 × 2 matrix
• inverse of 2 × 2 matrix
41
Solution of a linear system of equations
Consider the system of linear equations
2x + 3y = 13
3x + 4y = 18
The solution is
(a) A B C D .
C 7.2. Indicate whether the following statements are true or false, for
(a) A B ,
(c ) C D E .
(i) D = A; (ii) D = E; (iii) B = C; (iv) A = B; (v) D − C = 0.
A , B , C ,
Compute each of the following
(i) A + C; (ii) A − B; (iii) 2A; (iv) -3C; (v) A − 2B + 4C; (vi) BT; (vii) B + CT.
C 7.4. Form the product of the following matrices, stating whether the result is a
column or row vector:
42
5x + 3y = 19
4x + 2y = 14
C 7.6.
Let A , B , C ,
Compute (i) AB; (ii) AC; (iii) CA.
Show that AC 6= CA, therefore the matrix multiplication is generally not true.
7.3 Supplementary questions
S 7.1. Compute (i) A + B; (ii) AT + BT; (iii) (A + B)T for the matrices below.
Let A , and B
What is the connection between the results for parts (i) and (ii) above?
S 7.2. Compute (i) C + D; (ii) C − D; (iii) C + CT; (iv) (C − D)T; (v) (CT)T for
C , and D
S 7.3. Compute AI and IA for the matrices
A , and I
What does this suggest about the multiplication by the identity matrix ?
S 7.4. Find (i) AT; (ii) AAT and (iii) ATA for the matrix A .
S 7.5. Given the following matrices
A , B , C , D ,
State the size of the following products and compute the ones that exist.
(i) AB; (ii) BA; (iii) CD; (iv) DC; (v) DB; (vi) BD; (vii) A2. (viii) C2.
A , B , C , D , E .
Find the inverses of the 2× 2 matrices B, C and D.
43
S 7.7. Solve the following systems of linear equations using the inverse matrix
method.
3x − y = 4; 2x − y = −11; 4x − 3y = 6; 3x − 4y = −9 x + 2y
= 13; x + 2y = 2; −2x + y = −4; x + 2y = 2
S 7.8. State the reason why the inverse matrix method may not be applied to the
system of equations 4x + 6y = 12; 1 + 3y = 14.
; ( v) ; (vi) BT ;
(vii) operation not defined.
S 7.1.
S 7.2.
S 7.3.
S 7.4.
S 7.5.
S 7.6.
S 7.7.
S 7.8.
44
8 Computer graphics in 2D: Matrix transformations
8.1 Brief theoretical background
Matrix representation: Matrices are useful for
X .
X , T .
TX X∗
X∗ TX
Transformation of lines:
X .
Scaling: Scales the horizontal and vertical coordinates. The transformation
matrix is
T ; X TX .
Rotation: The line from (0,0) to the point (x, y), is rotated by an angle θ.
T .
Reflections:
• in the X axis: changes the sign of the y co-ordinate
T ; X∗ = TX
T ; X∗ = TX
T ; X∗ = TX
T ; X∗ = TX
Shearing (optional): A shear is a distortion. The transformation matrix
46
The ’off-diagonal’ elements b and c determine the kind of shear produced.
• b produces x-direction shear, • c produces y-direction shear.
C 8.3. The point (3,1) is rotated anticlockwise about the origin through an angle
of 45◦ . Calculate the position of the new point.
C 8.5. Consider the 2D unit square having coordinates (0,0), (0,1), (1,0), (1,1).
Determine the new co-ordinates of the figure after the following
transformations:
(1) Translation of vector (1,2); (2) horizontal scaling of factor 2;
(3) vertical scaling of factor 3; (4) mixed scaling of factors 3 and 4;
(5) Rotation of angle π/6; (6) Rotation of angle 90◦ ; (7) Reflection in the X axis;
(8) Reflection in the Y axis; (9) Reflection in the y = x line;
(10) Reflection in the y = −x line.
C 8.6. Point (2,3) is reflected in Y axis, then reflected in y = x, and finally rotated
by 90◦ . Find the co-ordinates of the final point.
47
S 8.2. Let R be the rotation matrix about the origin through angle θ.
a) State the rotation matrix S representing a clockwise rotation through an angle
θ.
b) Calculate R−1 using the result of Question S 8.1. above.
c) What can be concluded from parts (a) and (b) above.
S 8.4. Point A(2,-1) is reflected in X axis, then rotated by 90◦ and finally reflected
in y = −x. Find the co-ordinates of the final point.
S 8.5. Find the coordinates of the unit square defined in C 8.6., subject to the
shear transformations given by the matrices:
48
8.5 Answers for Tutorial 8
Compulsory problems
C 8.2. a) T ; b) T .
.
2 cos π/6
(c) R.
3 sin π/6 cos
(d) The product is the identity matrix, as the two transformations cancel each other.
49
/6
(5)
sin π/6 cos
T , T , T
The final transformation is
T
The co-ordinates of the transformed point are (−3, −2).
Supplementary problems
S 8.1. The transformation matrix for a rotation of angle θ is
R T,
S 8.2. The answer can easily be obtained from S 8.3. and C 8.4.
T , T , T
50
The final transformation is
T
The co-ordinates of the transformed point are (−2, 1).
.
9 Elements of graph theory
9.1 Brief theoretical background
Graph: mathematical structure used to model pairwise relations between
objects from a certain collection.
• trail: sequence of arcs, where the end node of one arc is the start of the
next.
• cycle: path with an extra arc joining the final node to the initial node.
Example:
Special graphs
• complete: Any two vertices are connected by an arc (Notation: K3, K4, etc.)
51
• simple: A graph with no loops or multiple arcs
For t and r trees in BTREE(X) and s ∈ X one can define the function:
• Build a tree by working down the list choosing arcs provided they do not
form a cycle when added to the arcs already chosen
52
• Build a tree by choosing the minimum weight arc that joins a node that has
not yet been chosen to one that has. Add this arc and the node at its end
to the tree
• Repeat the tree building process until all the nodes have been chosen
Shortest path problem: Find the minimal cost path between two vertices in a
graph.
9.2 Compulsory problems
C 9.1. Prove that the sum of the degrees of the vertices of any finite graph is
even.
a b c d e a b c d e a b c d e
a 0 1 1 0 1 a 0 1 0 0 1 a 0 1 0 0 1
b 1 0 1 1 1 b 1 0 1 1 0 b 0 0 0 0 0
c 1 1 0 0 0 c 0 1 1 1 0 c 0 0 0 0 0
d 0 1 0 0 1 d 0 1 1 0 1 d 0 0 0 0 1
(i) e 1 1 0 1 0 ; (ii) e 1 0 0 1 1 ; (iii) e 0 0 0 0 0
C 9.4. In a group of people John likes Mary, Brian and Emma; Brian likes Mary
and Sue; Mary likes John and Sue; Emma likes Mary, John and Brian; Sue likes
nobody. Draw a graph showing who likes who.
53
MAKE(q,
gull, q);
v) MAKE (LEFT(p), ROOT(q), RIGHT(p)); vi)
MAKE(LEFT(LEFT(q)), ROOT(p), MAKE(q, puffin, RIGHT(p))).
S 9.2. Prove that a complete graph with n vertices (Kn) contains n(n − 1)/2 edges.
S 9.3. Show that every simple graph has two vertices of the same degree.
A - 10 5 4 3 - -
B 10 - 8 9 7 - 2
C 5 8 - - 5 - -
D 4 9 - - 10 6 4
E 3 7 5 10 - 8 9
F - - - 6 8 - 11
54
G - 2 - 4 9 11 -
(a) Find the minimum spanning tree using Prim’s algorithm.
(b) Find the minimum spanning tree using Kruskal’s algorithm.
(c) Find the shortest path between A and G.
9.4 Answers for Tutorial 9
Compulsory problems
C 9.1. Each arc contributes with 2 to the sum of degrees, therefore this sum
should be twice the number of arcs.
C 9.2. You just have to draw the vertices {a, b, c, d, e} and directed segments
from x to y if (x, y) = 1 in the adjacency matrix.
John 0 1 1 1 0
Mary 1 0 0 0 1
Brian 0 1 0 0 1
Emma 1 1 1 0 0
Sue 0 0 0 0 0
Drawing the graph is straightforward.
Supplementary
problems S 9.1.
S 9.2.
S 9.3.
S 9.4.
S 9.5.
S 9.6.
55
10 Elements of number theory and cryptography
10.1 Brief theoretical background
Prime number: n prime if his only positive divisors are 1 and itself.
where p1 < p2 < ... < pk are primes and ai are positive integers.
(ak,bk)
gcd(a, b)
ϕ(p) = p − 1
56
ϕ(pk) = pk−1(p −
1) ϕ(mn) =
ϕ(m)ϕ(n).
ϕ(n) = n .
Example:
Modular arithmetic: system of arithmetic for integers (clock arithmetic), where
numbers ”wrap around” upon reaching a certain value called modulus.
a≡ b (mod n),
• Addition: a1 + a2 ≡ b1 + b2 (mod n)
– 2 + 1 (mod 6) ≡ 3 (mod 6)
– 2 + 4 (mod 6) ≡ (2 + 4) (mod 6) = 0 (mod 6)
• Substraction a1 − a2 ≡ b1 − b2 (mod n)
– 2 − 1 (mod 6) ≡ 3 (mod 6)
– 2 − 4 (mod 6) ≡ (2 − 4) (mod 6) = 4 (mod 6)
– 2 × 2 (mod 6) ≡ 4 (mod 6)
– 2 × 3 (mod 6) ≡ 6 (mod 6) = 0 (mod 6)
Caesar cypher:
• Alphabet: A = {A, . . . , Z} so n = 26 (or numbers 0..25).
57
• Method:
C 10.2. Factorize the numbers 96, 144, 286, 777 and 1001.
C 10.5. Compute (find results in the set {0, . . . , n − 1} for (mod n)):
5 + 2 (mod 2), 3 × 5 (mod 2)
C 10.7. Code the message ”I LIKE MATHS” using a Caesar cipher with key e = 10.
S 10.5. Factorize the numbers 703, 779, 968, 1002, 1440, 1547, 1763, 2261.
58
S 10.6. Find gcd(1440, 968), gcd(1002, 703), gcd(2261, 1547) and gcd(779,
1763). S 10.7. Find lcm(1440, 968), lcm(1002, 703), lcm(2261, 1547) and
gcd(779, 1763).
S 10.8. Solve the following equations (in the set {0, . . . , n − 1} for (mod n)):
1+x=0 (mod 2), 3 × x = 1 (mod 2)
3+x=1 (mod 8), 3 − x = 6 (mod 8), 4 × x = 7 (mod 8).
5+x=3 (mod 11), 3 − x = 7 (mod 11), 4 × x = 8 (mod 11).
S 10.9. Find the ϕ(n) function for the numbers n = 19, 31, 28, 48, 144, 169, 1001.
S 10.10. Find the RSA key d for the public key e = 5, for n = 65.
10.4 Answers for Tutorial 10
Compulsory problems
C 10.1. (3,4,5), (5,12,13), (7, 24, 25), ( 8, 15, 17), ( 9, 40, 41).
C 10.3.
C 10.4.
C 10.5.
C 10.6. One just needs to factorise the numbers and apply the multiplicity of
ϕ(n).
59
ϕ(11) = 10;
ϕ(21) = ϕ(3 · 7) = ϕ(3) · ϕ(7) = 2 · 6 =
12; ϕ(21) = ϕ(3 · 7) = ϕ(3) · ϕ(7) = 2 ·
6 = 12; ϕ(24) = ϕ(23 · 3) = ϕ(23) · ϕ(3)
= 4 · 2 = 8; ϕ(36) = ϕ(22 · 32) = ϕ(22) ·
ϕ(32) = 2 · 6 = 12; ϕ(49) = ϕ(72) =
C 10.7. Each letter in the string needs to be shifted to the right by 10 positions.
If the transformed letter is after Z, we use the order:
A, B, C, D, . . . , X,Y, Z, A, B, C, . . .
Supplementary problems
S 10.1. 997.
S 10.2. Example: 4 = 2 + 2; 6 = 3 + 3; 8 = 3 + 5; 10 = 3 + 7; 12 = 5 + 7; 14 = 3 +
11; 16 = 3 + 13; 18 = 5 + 13; 20 = 3 + 17; . . . ; 96 = 7 + 89; 98 = 19 + 79; 100 = 3
+ 97.
S 10.3. (3,5), (5,7), (11,13), (17, 19), (29, 31), (41, 43), (59, 61), (71, 73), (101,
103).
S 10.5.
703 = 19 · 37;
779 = 19 · 41;
968 = 23 · 112;
1002 = 2 · 3 · 167;
1440 = 25 · 32 · 5;
1547 = 7 · 13 · 17;
1763 = 41 · 43;
2261 = 7 · 17 · 19;
60
S 10.6. gcd(1440, 968) = 23 = 8; gcd(1002,
703) = 1;
gcd(2261, 1547) = 7 · 17 = 119;
gcd(779, 1763) = 41.
S 10.7.
lcm(1440, 968) = 25 · 32 · 5 · 112; lcm(1002,
703) = 2 · 3 · 19 · 37 · 167;
lcm(2261, 1547) = 7 · 13 · 17 · 19; lcm(779,
1763) = 19 · 41 · 43.
S 10.8.
x=1 (mod 2), x=1 (mod 2)
x = 6 (mod 8), x = 5 (mod 8), there is no such x.
x = 9 (mod 11), x = 7 (mod 11), x=2 (mod 11).
S 10.9. One just needs to factorise the numbers and apply the multiplicity of
ϕ(n).
ϕ(11) = 10;
ϕ(21) = ϕ(3 · 7) = ϕ(3) · ϕ(7) = 2 · 6 =
12; ϕ(21) = ϕ(3 · 7) = ϕ(3) · ϕ(7) = 2 ·
6 = 12; ϕ(24) = ϕ(23 · 3) = ϕ(23) · ϕ(3)
= 4 · 2 = 8; ϕ(36) = ϕ(22 · 32) = ϕ(22) ·
ϕ(32) = 2 · 6 = 12; ϕ(49) = ϕ(72) =
61
11 Elements of Calculus
11.1 Brief theoretical background
Sequence: ordered list of objects. Discrete function x : N →X, x(n) = xn.
f 0(x) = lim
f(x
+ h) − f(x) h→0 h
Differentiation of elementary functions
62
f(x) = sin(x) : f 0(x) =
cos(x) f(x) = cos(x) : f
0(x) = − sin(x) Definite
integral: Let the function f
defined on [a, b]. The
definite integral denoted
by
Zb
f
(
x
)
d
x
• the x-axis,
Z b f(x)dx =
F(b) − F(a) a
Integration of elementary functions
• polynomials: f(x) = ax + b; F C
(a, b, C: constants)
• trigonometric functions:
Z
f(x) = sin(x) : F(x) = f(x)dx = − cos(x) + C
Z f(x)dx = sin(x) + C
f(x) = cos(x) :
F(x) =
.
Numerical implementation: Dividing the interval [a, b] into N intervals we
define the
• Step: h (step);
• Partition: x0 = a, x1 = a + h, x2 = a + 2h,...,xN = a + Nh = b.
We apply the trapezium rule and obtain the following approximation for the
area
hN
∑ (f(xk−1)
2 k=1 b − a
+ f(xk)) a
= (f(x0) + 2f(x1) + 2f(x2) + . . . + 2f(xN−1) + f(xN)).
2N
11.2 Compulsory problems
C 11.1. Find the limit of the following sequences
C 11.2. Prove that f(x) = 2x2 + 2x − 5 has a root in the intervals [1, 2] and [-3,-2].
C 11.3. Prove that the cubic function f(x) = 2x3 + 2x2 − 3 has a root x0 ∈ [0, 1].
C 11.4. Differentiate the following functions: (1) f(x) = 2x + 1; (2) f(x) = 2x2 + 3.
C 11.5. Integrate the functions: (1) f(x) = 1; (2) f(x) = 2x + 3; (3) f(x) = 2x2 + 3.
64
2n
(1) xn = ;
n−4
(2) xn = (−1)n 2n ;
n!
(3) xn = n2 − 5n;
√ √
(4) xn = n + 1 − n.
S 11.2. Find the number of real roots of f : R →R given by f(x) = 8x3 +12x2 −2x−3.
S 11.5. Integrate the functions: (1) f(x) = 2x + 7 cos(x)+ 3 sin(x); (2) f(x) = 2x3 +
1. S 11.6. Find the area between the curves f(x) = −x2 + 6x − 2 and g(x) = 2x + 1.
C 11.1. (1) 0; (2) 0; (3) 0; (4) 0; (5) 1; (6) 23/99; (7) 423/990.
65
When N = 4 we have h = 2/4 = 1/2 and the formula gives the approximation
T
Supplementary problems
66