















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Machine Learning Essentials FOR BEGGINERS
Typology: Exercises
1 / 23
This page cannot be seen from the preview
Don't miss anything!
















Solutions 11(a) 1
Complete solutions to Exercise 11(a)
(Generally A + B = B + A ).
(c)
(d)
(e) Cannot be evaluated because A and C are different size matrices. Similarly (f) cannot be evaluated.
(g)
(h)
(i) ; cannot be evaluated because of the
different size matrices involved.
(j)
det 1 7 5 3 8 5 7
det 1 7 3 5 8 3 7
det 1 3 5 2 13 5 3
det 1 3 2 5 13 2 3
(c) , det
A B (^) A = det B =
The matrix A is transposed (rows→ columns) to give matrix B. The same numbers on each of the diagonals, so the determinant is the same, det A = det B.
det det det a b a c a b ad cb ad bc ad cb c d b d c d
(iii) det A × det B = − 9 × 22 = − 198
(11.1) det^
a b ad cb c d
Solutions 11(a) 2
(iv)
(iii) det^ A^ ×^ det^ B = −1701.5^ ×^ 624.3^ = −1062246.
(iv)
(iii) det^ A^ ×^ det^ B = −21.4^ ×^ 79.27^ = −1696.
(iv)
(b) 1
(c) In this case A is the identity matrix, and so.
det 5 4 5 1 3 4 7 3 1
det 3 6 3 8 7 6 24 42 18 7 8
1 1 3 6 1 8 6 8 18^ 6 18^ 4 9^ 1 3 7 8 18 7 3 7 18 3 18 7 18 1 6
− − (^) = ⎛^ ⎞^ = − ⎛^ −^ ⎞^ = ⎛^ −^ ⎞^ =⎛− A (^) ⎜⎝ ⎟⎠ ⎜⎝ (^) − ⎟⎠ ⎜⎝ (^) − ⎟⎠ ⎜⎝
a b^11 d b c d ad bc c a
Solutions 11(b) 2
(b) 1
(c) In this case A is the identity matrix, and so.
det 5 1 3 4 7 3 1
det 3 8 7 6 24 42 18 7 8
1 1 3 6 1 8 6 8 18^ 6 18^ 4 9^ 1 3 7 8 18 7 3 7 18 3 18 7 18 1 6
− − (^) = ⎛^ ⎞^ = − ⎛^ −^ ⎞^ = ⎛^ −^ ⎞^ =⎛− ⎜ ⎟ ⎜ (^) − ⎟ ⎜ (^) − ⎟ ⎜ ⎝ ⎠ ⎝ ⎠ ⎝ ⎠ ⎝
i i
We need to find the inverse of (^) ⎟. By (11.4)
Using (11.5) we have 1 2
i i
i 1 (^) = −1.25 A and i 2 =2.5 A
1 a b (^) 1 d b c d (^) ad bc c a
(11.5) u = A −^1 b
Solutions 11(b) 3
i i
Let A =
⎠. Then by (11.4)
Using (11.5) gives 1 2
i i
1 2
(^470 47) A and 270 27 A 950 95 950 95
i = = i = =
(c) x = 1 4 and y = − 1 3
a b^11 d b c d ad bc c a
(11.5) u = A −^1 b
Solutions 11(c) 2
N (^ )^ (^ (^ ))^ (^ )^ (^ )
by (11.1) 2 2 2
det 5 7 1det 0 3det 9 1 3 9 3 9 1 1 9 7 3 5 9 3
63 3 45 3 63 135 9 10 198
t t t t t t t t
t t t t t t t t
Since the determinant is zero we have t^2 − 10 t + 198 = 0 How do we solve this quadratic equation? Use (1.16) with a = 1, b = − 10 and c = 198
t j (^) j
Thus t^ =^5 +^ j^ 173, 5^ − j^173
det 3 0 1 7 7 1 0
Cofactor of 0 is
det 2 0 6 7 42 6 0
Cofactor of 5 is
( ( )) ( )
det 2 1 6 3 16 6 1
Cofactor of − 2 is
det 0 0 1 5 5 1 0
Cofactor of 3 is
det 1 0 6 5 30 6 0
Cofactor of 7 is
( ( )) ( )
det 1 1 6 0 1 6 1
(1.16) x = −^ b^ ±^ b
(^2) − 4 ac 2 a
(11.1) det^ a b (^) ad cb c d
Solutions 11(c) 3
Cofactor of 6 is
det 0 5 0 7 3 5 15 3 7
Cofactor of − 1 is
det 1 7 2 5 17 2 7
Cofactor of 0 is
det 1 3 2 0 3 2 3
Collecting the cofactors gives the cofactor matrix: 7 42 16 5 30 1 15 17 3
Transposing this matrix (interchanging rows and columns) gives 7 5 1 42 30 17 16 1 3
T
i i i
Let (^) ⎟. What do we need to find?
The inverse matrix, A −^1. The currents can be obtained from 1 2 1 3
i i i
−
To find A −^1 we have to evaluate the determinant and the adjoint of A.
( ) (^) ( ( )) ( ) ( ) ( ) ( )
det 2 1 7 3det 5 det 3det 4 5 10 5 10 4 10 4 5 3 1 5 4 7 5 2 5 10 7 3 2 4 10 1 147
Next we find adj , which is the cofactor matrix transposed. The cofactor matrix can be obtained using the method described in solution 5. Thus
Solutions 11(c) 5
(c) Expand along the first column since it contains 2 zeros:
det 0 3 7 1 det 3 7 0 det 5 1 0 det^5 0 2 9 2 9 2 9 3 7 1 3 9 2 7 0 0 13
(d) Expanding along the second column
det 13 0 2 5det 0 det 0 det 11 3 11 3 13 2 11 0 3 5 13 3 11 2 85
A:=<<1 | 2 | 3 | 4> , <5 | 6 | 7 | 8> , <9 | 10 | 11 | 12> , <13 | 14 | 15 | 16>>;
with(linalg): Warning, the protected names norm and trace have been redefined and unprotected
det(A); 0
B:=matrix([[-1.1, 4.23, 2.67, 7.45,9.62], [19.61, 6.40, 3.12, 11.89,2.36], [-17.5, -9.73, 5.23, 8.54,2.51], [6.19, 2.91, 17.64, 8.93,8.98],[3.98,11.84,4.78,9.85,3.22]]);
det(B); -509092.
Solutions 11(d) 1
Complete solutions of Exercise 11(d)
x y z
The augmented matrix can be written
1 2 3
We execute to get 0 in place of 2 in row 2. Similarly to achieve a 0 in place of 3 in row 3:
1 2 * 2 1 3 * 3 1
1 2 *
3 3 2
From the last row, R 3 **, we have 6 z = − 18 which gives z = − 3 From R 2 *we have
5 5 3 5 gives 4
y z y y
From first row, R 1 , we have x + 2 y − 3 z = 3 Substituting y = − 4 and z = − 3 gives
Thus x = 2, y = −4, z = − 3. Similarly (b) x = 1, y = 2, z = 3 (c) x = 1 2, y = 1 4, z = 1 8
Divide each row by 10 3 gives R 1 R 2
Interchanging row 1 and row 2 R 1 ' R 2 '
To get 0 in place of 9 we execute R 2 ' + 3 R 1 '
Solutions 11(d) 3
1 2 2 1 3
R R R g R g
Getting 0 in place of − 2 1 2 3 3 2
R g R R R g
From the last row we have
3 4 gives 4 3
T = g T = g
From R 2 'and substituting the above we have
2 2
(^4) which gives 4 3 3 x ^ + g = g x^ = − g + g = −^ g 3
From the first row, R 1 , we have (^1 ) x ^ =^ g .
R g R g R R R R g R g R R g R R R g
By R 3 ' we have (^5 4) which gives 1 3 5 T = g T = 2 g
Similarly from R 2 ' and R 1 we have
1 5 , (^25) x (^) = −^ g^ x = g
Dividing each row by 10 3 gives
Solutions 11(d) 4
1 2 3 1 3 2 3 3
−
−
Interchanging columns I 1 and I 3 : 3 2 1 3 1 2 3 3
−
−
Divide row 2, R 2 , by − 10 gives
1 3 2 3 3
−
−
To get 0 in place of 23 we need to execute R 3 − 23 R 2 ' 3 1 2 3 3
−
−
To achieve 0 in place of 31.4 we have to implement R 3 ' + 31. 3
1 3 2 3 3
−
−
Interchanging R 1 and R 2 ' gives 0's in the required position 3 2 1
3 3
− −
From the last row we have 3 3 3 1 1 34.967 89.667 10 which gives 89.667^10 2.564332 10
Substituting I 1 = 2.564332 × 10 −^3 into the penultimate row gives
2 3 3 3 3 5 2
− − − − −
From the first row we have I 3 − 1.8 I 2 + 0.3 I 1 = 0 () Substituting I 1 = 2.564332 × 10 −^3 and I 2 = 8.5776 × 10 −^5 into () yields
Solutions 11(e) 1
Complete solutions to Exercise 11(e)
We need to find the determinant of this matrix:
det 1det 3det 5det 3 8 2 8 2 3 8 3 3 56 2 5 21 2 294
Since det A ≠ 0 so by (11.16) we only have the trivial solution x = 0, y = 0, z = 0
det 2 3 2 5 4 3 2 0 4 5
By (11.13) x = 1, y = 1 is the unique solution of the given equations.
x y
A u b ⎞⎟ ⎠ We can find the determinant of A by using (11.1):
det 2 2 4 1 0 4 2
By (11.15) there are an infinite number of solutions for 2 0 ( 4 2 0 (**)
x y x y
From (*) we have y = − 2 x The general solution is x = a , y = − 2 a where a^ is any real number.
For question 1(a), let
A ⎟⎟ and so the determinant is given by
det 2 1 1 1det 2 det 3det 30 2 1 3 1 3 2 3 2 1
Since det A = − 30 ≠ 0 the solution to the given equations is unique.
Solutions 11(e) 2
Similarly for (b) det A = 8 (c)det A = − 8 Therefore the solutions are unique.
For question 4;. The solution is unique.
1 0 1 , det 3 0 2 1
For question 5; A. Solution is unique.
3 0 1 , det 5 0 2 1
Using the given A we have
det det 9 1 0 1 1 1 0 det 9 1 0 1 1 det 9 1 1 1 9 1 1 9 1 2 9 2
Solving the quadratic equation by putting it to zero gives
4 2 0 which gives 4, 2
(b) Similar to (a): 1 3 0 1 3 6 5 0 6 5
For a non trivial solution we need the determinant of this to be zero.
det 1 3 1 5 18 5 5 18 6 23 6 5
λ^2 − 6 λ + 23 = 0 Using the quadratic formula, (1.16), with a = 1, b = − 6 and c = 23 gives
x b^ b^ ac a
Solutions 11(f) 2
x y x y
Multiplying out the first row yields 11 3 0 3 11
x y x y
If y^ =1 then x = − 3 11, thus
v ⎞⎟ or using smallest integers gives
(b) Let
x y
u (^) be the eigenvector for λ = 1 : 5 1 2 0 4 1 1 0 4 2 0 4 2 0
x y x y
Multiplying out the matrix 4 2 4 2
x y x y
Solving these gives x = 1, y = 2. Thus is an eigenvector for
u λ = 1.
Let v = x y
⎠ be the eigenvector for^ λ^ =^3 : 5 3 2 0 4 1 3 0 2 2 0 4 4 0
x y x y
Multiplying gives 2 2 4 4
x y x y
Solving these gives x = y = 1. An eigenvector corresponding to λ = 3 is.
(c) Let
x y
u (^) be the eigenvector for λ = − 3.
x y x y
Solutions 11(f) 3
Solving gives x = −2, y = 1. An eigenvector is
⎟ corresponding to^ λ^ = −^3.
Let
x y
v (^) be an eigenvector for λ = 3 : 1 3 4 0 2 1 3 0 4 4 0 2 2 0
x y x y
Hence x = y = 1. The eigenvector corresponds to
λ = 3.
det 1 1 2 1 1 1 2 1 1 1 2 1 2 1 2
λ^ λ λ λ λ λ λ λ λ λ
Putting this quadratic to zero yields 2 2
1 which gives 1 j
λ λ λ
The system poles are λ 1 = j , λ 2 = − j
2 2 2 2
det 1 3 4 2 4 3 1 3 8 3 3 8 3 2 8 3 2 8 2 5
Putting the resulting quadratic to zero λ^2 + 2 λ + 5 = 0. How do we solve this quadratic? Using the quadratic formula (1.16) with a = 1, b = 2 and c = 5 gives
λ = −^ ±^ −^ × ×^ = −^ ±^ −^ = −^ ±^ j^ = − ± j
The system poles are λ 1 = − 1 + j 2, λ 2 = − 1 − j 2. (c) The system poles are given by the eigenvalues of the matrix.
(1.16) x = −^ b^ ±^ b
(^2) − 4 ac 2 a