Mathematical Foundations of Data science
ASSIGNMENT -
1 .
Given A = 0 -2
03 O
201_
To solve /XI-Al
eigenvalues 0
=
I 007 [00 I
xi +
+
=
00 I
( % ) -0 I
xF -
A =
-
I I
= X -
1 02
O x -
3 O
2 O x -
1
1 XI-Al =
0 ,
then
I I
X -
1 O 2
=
0
O X -
3 O
2 0 X-1
-
o(x 1)(0) -
-
(0)(2) + (x -
3)((x -
1)(X D
-
-
4) -
0 =
0
I
(x -
3)((x -
x -
x+ 1 -
a)) =
0
(x 3)(x2- -
2x -
3) =
0
-
X2-2X-3
Solving for 0 we
get
=
,
X2 -
2X -
3 =
0
2
X -
3X + X -
3 = 0
x(x 3) + 1(x 3)
- - =
0
(x 3)(x + 1)= = 0
from equation O , we have
(x -
3)(x 3)(x + 1) - =
0
X = 3 3 .
-1
,
Therefore ,
the
eiganvalves are X =
3 ,
3 - 1
Eigenspace for X =
3
(31-A) X =
0
I 30- I
(31 A)
-
=
·
I 30 %
)
=
202
(31 A)
-
X =
0
i .
.
2
I 2020)
RE, !
O
1200
R
,
-
R1/2
I%
O
we
equation
get the x+ z =
0
x = -
therefore the
ciganspace for X = 3 is
11
A = I
O
-
Eigenspace where X = I
( -
I =
A) X =
0
(E +A) X =
0
I I
(I + A) =
2 0 -
O
O 4
-
2 O 2
The system of equations is
2x -
22 = 0
4y = 0
2n + 22 =
0
i .
e x =
2 0
y
=
.
,
Therefore the
eigenspace for X =
-1 is
(0)
* -
I I
2 .
a) Given B =
2 a -
O 2 b
-- I -
13
()(i)
Given
Figurectors v =
we know that Br , =
xv
-
@
(f)
Br =
I + ) (2
- 2 +
=
1 + 1 + 0
substituting the result in
eqn ① we
get
I ) (: ):
O
=
2 -
a = X -
②
-
2 =
- X
get
X 2
substituting X C in
equ we
get
=
we =
,
2 -
a =
2
a = 0
similarly Brc = Xvz-
solving get
I [i]
Bvz we = 2 O
O
-
I I
=> 2(1) + o + 2( -
1)
O + 2) 1) -
+ 2b
1 + 1 + 6
(e)
=
subtituting the above result in
egn we
get
I I (i)
=
8
the system of equations are
x X
4 = 4
-
=
-
=
2b -
2= -
X
Since ,
X =
4 ,
2b -
2 = -
4
2b = -2
b =
I
-
therefore the values
of a and b are o and I
respectively
.
2b .
Trace (B) =
b11 + b22 +
bas
=
2 + 2 + 3 = 7
know that
we
eigenvalues of B are
x1 = 2
x z =
4
By properties of rigevalues
Xi + x2 + X3 = trace (B)
2 + 4 + xz = 7
* 3 = 7 -
6
* 1
3
=
therefore ,
the
remaining eigenvalue of B is 43 = .
1
I I
3a .
Given D = I -0
2 23
20 A
we know that PD" = I
Performing row operations to turn P into I
by using
(PII)
augmented matrix
I I I
(P(l) = I -
1 O I 00
2 2 301 O
2 0 + 001
R2 +
Rc =
2 R1 , R3-R3-2R
I I I
I -
I ⑧ I O O
O 4 3 -
2 I O
02 I -
2 O I
R2 -
R2 X /4
( I I
1 1 O
yz9 %
-
3/4
-
O I
02 1 -
201
R1 - R + R2 , R3-R3-2R2
I I
I O 3/4 12 O
O I 314- 240
-
-2 1
-
O O 21
-
R3 +
2Rz
-
I I I
I O 34 "10
3/4 120
-
O I
00 12 / -
RI - R ,
-
3/4R3 , R2-Rc-3/4R3
I :
I ]
10
O I
O O I 21 -
(i)
=
therefore
2 I -
2
3b . Matrin C can be written as PDP
: .
Ch = ( PDP + )n
+
= PDnp
I I
D =
10 O
O O O
O O C
1608 I
Dn =
00 ch
PD"D+
Solving
/100 I
= 312
2 1 -
(2 % ) I
=
21 -
I I
: 1
(-1) + 0 + 01 t(z) + 0 + 0 1(3(2) + o + 0
2( -
1) + o + 3c(2)2() + o + 3 2(32) + + (2)(3c)
o
2) 1)-
+o + 2 2( + 2) +o + ch2(32) + o + 1 2)c
-
=on I
3/2
6ch-2
ch -
1 2ch -
3
7/30/24, 12:03 PM MFDS_A5_Q4 - Jupyter Notebook
MATHS7027 Mathematical Foundations of
Data Science
Assignment 5 - Question 4
0
Consider the network comprising nodes 𝐴 , 𝐵 , 𝐶 , and 𝐷, and represented by the matrix
1
0 0
1
2
𝑀= .
1 1
0
0 0
2 2
1
0
0 0
2
1 1
2 2
4(a)
Enter 𝑀 as an array .
In [10]: #importing libraries
import numpy as np
#defining M matrix
M = [Link]([
[0, 0, 0, 0.5],
[1, 0, 0.5, 0.5],
[0, 0.5, 0, 0],
[0, 0.5, 0.5, 0]
])
print (M)
[[0. 0. 0. 0.5]
[1. 0. 0.5 0.5]
[0. 0.5 0. 0. ]
[0. 0.5 0.5 0. ]]
4(b)
𝑥𝐴
Let 𝒙 =
𝑥𝐵
. Use the PageRank algorithm to solve 𝑀𝒙 = 𝒙.
𝐶
𝑥𝐷
𝑥
Hint: You may find Computer Exercise 5
([Link] helpful.
localhost:8888/notebooks/MFDS_A5_Q4.ipynb 1/2
7/30/24, 12:04 PM MFDS_A5_Q4 - Jupyter Notebook
In [15]: results = [Link](M)
eigenvector = results[1][:,0].real
# Try comparing this eigenvector to the answer you got for x above.
eigenvector
Out[15]: array([0.26832816, 0.71554175, 0.35777088, 0.53665631])
4(c)
Hence, order the nodes 𝐴 , 𝐵 , 𝐶 , and 𝐷 from most important to least important.
In [14]: # Define the corresponding nodes
nodes = ['A', 'B', 'C', 'D']
# Create a list of tuples where each tuple is (node, value)
paired_nodes = list(zip(nodes, eigenvector))
# Sorting the list of tuples based on the value in descending order
sorted_nodes = sorted(paired_nodes, key=lambda x: x[1], reverse=True)
# Extracting the sorted nodes
sorted_nodes = [node for node, value in sorted_nodes]
print("The order of the nodes A, B, C and D from most important to least im
The order of the nodes A, B, C and D from most important to least importan
t is ['B', 'D', 'C', 'A']
localhost:8888/notebooks/MFDS_A5_Q4.ipynb 2/2