0% found this document useful (0 votes)
3 views6 pages

Untitled 2

The document contains solutions to various mathematical problems, including vector operations, matrix manipulations, and verification of the Cayley-Hamilton theorem. It provides computed values for operations such as addition, subtraction, multiplication of matrices, and properties of eigenvalues and eigenvectors. Additionally, it discusses the formation of an orthonormal basis from given vectors.

Uploaded by

h240516z
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views6 pages

Untitled 2

The document contains solutions to various mathematical problems, including vector operations, matrix manipulations, and verification of the Cayley-Hamilton theorem. It provides computed values for operations such as addition, subtraction, multiplication of matrices, and properties of eigenvalues and eigenvectors. Additionally, it discusses the formation of an orthonormal basis from given vectors.

Uploaded by

h240516z
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

HIT 1202

ASSIGNMENT 1
JASTON H240331X HEEE

KAYOWE H240516Z HEEE

CHIKOWERO H240678V HEEE

Solution 1
v = linspace(81, 12, 9)

v = 1×9
81.0000 72.3750 63.7500 55.1250 46.5000 37.8750 29.2500 20.6250

Solution 2
sqrt_values = sqrt([9, 16, 23, 30])

sqrt_values = 1×4
3.0000 4.0000 4.7958 5.4772

Solution 3
cbrt_values = nthroot([9, 16, 23, 30],3)

cbrt_values = 1×4
2.0801 2.5198 2.8439 3.1072

Solution 4
m1 = 1

m1 =
1

m2 = 2

m2 =
2

m3 = 3

m3 =
3

A = [m1, 2, 5, 8, 4; 1, m2, 4, 3, 4; 2, 5, m3, 7, 9; 8, 5, 4, m3+1, 2; 1, 5, 2, 3,


m3+2]

1
A = 5×5
1 2 5 8 4
1 2 4 3 4
2 5 3 7 9
8 5 4 4 2
1 5 2 3 5

B = [1, 0, 1, 0, 4; 1, 1, 2, 4, 9; 3, 4, 7, 4, 6; 8, 2, 8, 6, 9; 5, 1, 3, 6, 2]

B = 5×5
1 0 1 0 4
1 1 2 4 9
3 4 7 4 6
8 2 8 6 9
5 1 3 6 2

A_plus_B = A + B

A_plus_B = 5×5
2 2 6 8 8
2 3 6 7 13
5 9 10 11 15
16 7 12 10 11
6 6 5 9 7

A_minus_B = A - B

A_minus_B = 5×5
0 2 4 8 0
0 1 2 -1 -5
-1 1 -4 3 3
0 3 -4 -2 -7
-4 4 -1 -3 3

A_times_B = A * B

A_times_B = 5×5
102 42 116 100 132
59 28 69 66 81
117 40 116 128 152
67 31 84 72 141
61 24 64 76 98

B_times_A = B * A

B_times_A = 5×5
7 27 16 27 33
47 79 49 68 79
59 99 80 119 129
83 135 114 177 169
62 67 66 94 73

A_transpose = A'

A_transpose = 5×5
1 1 2 8 1
2 2 5 5 5
5 4 3 4 2
8 3 7 4 3
4 4 9 2 5

det_A = det(A)

2
det_A =
-2104

char_poly_A = poly(A)

char_poly_A = 1×6
103 ×
0.0010 -0.0150 -0.1020 0.1460 1.3620 2.1040

eig_values_A = eig(A)

eig_values_A = 5×1 complex


19.6242 + 0.0000i
4.1061 + 0.0000i
-4.6478 + 0.0000i
-2.0412 + 1.2047i
-2.0412 - 1.2047i

[eig_vectors_A, ~] = eig(A)

eig_vectors_A = 5×5 complex


0.4746 + 0.0000i 0.4411 + 0.0000i 0.5748 + 0.0000i -0.2479 - 0.1546i
0.3132 + 0.0000i -0.2850 + 0.0000i -0.0869 + 0.0000i 0.3180 + 0.3865i
0.5462 + 0.0000i -0.2694 + 0.0000i 0.4047 + 0.0000i -0.5480 + 0.0000i
0.5242 + 0.0000i 0.6501 + 0.0000i -0.6960 + 0.0000i 0.4710 + 0.0846i
0.3218 + 0.0000i -0.4785 + 0.0000i 0.1180 + 0.0000i -0.1810 - 0.3195i

is_diagonalizable = det(eig_vectors_A) ~= 0

is_diagonalizable = logical
1

Solution 5
m1 = 1

m1 =
1

m2 = 2

m2 =
2

m3 = 3

m3 =
3

A = [m1, 2, 5, 8, 4; 1, m2, 4, 3, 4; 2, 5, m3, 7, 9; 8, 5, 4, m3+1, 2; 1, 5, 2, 3,


m3+1];
char_poly_A = poly(A)

char_poly_A = 1×6
103 ×
0.0010 -0.0140 -0.1120 0.0420 1.2770 2.5100

char_poly_A_matrix = polyvalm(char_poly_A, A);


cayley_hamilton_verified = norm(char_poly_A_matrix, 'fro') < 1e-10

3
cayley_hamilton_verified = logical
0

disp('5. Cayley-Hamilton Theorem Verification:')

5. Cayley-Hamilton Theorem Verification:

if cayley_hamilton_verified
disp('Cayley-Hamilton theorem is verified.')
else
disp('Cayley-Hamilton theorem is NOT verified.')
end

Cayley-Hamilton theorem is NOT verified.

Solution 6
v = [m1, m2, m3]

v = 1×3
1 2 3

w = [m2, m3, 2]

w = 1×3
2 3 2

v_plus_w = v + w

v_plus_w = 1×3
3 5 5

v_dot_w = dot(v, w)

v_dot_w =
14

v_cross_w = cross(v, w)

v_cross_w = 1×3
-5 4 -1

norm_v = norm(v)

norm_v =
3.7417

norm_w_val = norm(w)

norm_w_val =
4.1231

w_normalized = w / norm_w_val

w_normalized = 1×3
0.4851 0.7276 0.4851

4
disp('6. Vector Operations:')

6. Vector Operations:

disp('(a) v + w:')

(a) v + w:

disp(v_plus_w)

3 5 5

disp('(b) v . w:')

(b) v . w:

disp(v_plus_w)

3 5 5

disp('(d) Norm of v: ')

(d) Norm of v:

disp(norm_v)

3.7417

disp(' (e) Normalized w:')

(e) Normalized w:

disp(w_normalized)

0.4851 0.7276 0.4851

vectors = [m1, 0, 0; m2, 2, 0; 0, 2, 2]

vectors = 3×3

5
1 0 0
2 2 0
0 2 2

[Q, ~] = qr(vectors')

Q = 3×3
1 0 0
0 1 0
0 0 1

orthonormal_basis = Q(:, 1:3)

orthonormal_basis = 3×3
1 0 0
0 1 0
0 0 1

disp('7. Orthonormal Basis: ')

7. Orthonormal Basis:

disp(orthonormal_basis)

1 0 0
0 1 0
0 0 1

You might also like