1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Group assignments given a linear transformation as below, find the f dimension and one basic of im( )

20 29 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Group Assignments
Người hướng dẫn Phan Thi Huong
Trường học Vietnam National University Ho Chi Minh City, University of Technology
Chuyên ngành Linear Algebra
Thể loại assignment
Năm xuất bản 2022
Thành phố Ho Chi Minh City
Định dạng
Số trang 20
Dung lượng 0,95 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

ĀĀ = �㔴Ā ⇔ �㔴 = ĀĀĀ21 where fE, E are two matrices formed by putting image vector of basis, vector of basis in column, respectively.. A square matrix is said to be diagonalizable if it i

Trang 1

VIETNAM NATIONAL UNIVERSITY HO CHI MINH CITY

UNIVERSITY OF TECHNOLOGY FACULTY OF APPLIED SCIENCE -*** -

Linear Algebra (MT1008)

Group Assignments

Topic: 1

Group: 9

Team members:

1 Trần Quốc Thái - 2153795

2 Bùi Văn Nhật Thanh - 2152280

3 Hà Huy Thành - 2152967

4 Lê Thành - 2052706

5 Trịnh Hoài Thanh - 2053427

Semester: HK212

Lecturer: Phan Thi Huong

Submission date: Saturday, May 14 , 2022 th

Trang 2

REQUIREMENTS:

● Students work on your assigned groups

● Detailed explanations must be provided to get full scores

● To solve the following questions, please let the constant a be your group ID

● All given exercises must be done by both methods: manual solving and

using Matlab or Python

TABLE OF CONTENT Project details for each question:

I Theories summary

II Solution details

III Coding details

Question 1: Given a linear transformation as below, find the dimension and one f

basic of Im( ): f

f(x ,x ,x1 2 3) = (x + x 1 2;x2 + x3;x1 - ax3), ( = 9) a

I Theory:

The set of all vectors in F that are images under of at least one vector in E is f

called the range of : f

�㔼�㕚(Ā) = {þ ∈ ā: ∃ý ∈ Ā, þ = Ā(ý)} = Ā(Ā)

If f: E F is a linear transformation, then: Im( ) of is a subspace of f f f

II Solution details:

1 Manual solving:

2 MATLAB code and explanation:

a Coding details:

clc;

syms e1 e2 e3

%y=f(x)=x1(e1)+x2(e2)+x3(e3)

%a,b,c are constants

Trang 3

e1 = input('e1 = [a b c]=');

e2 = input('e2 = [a b c]=');

e3 = input('e3 = [a b c]=');

A = [e1', e2', e3'];

%Find the rank of A

r = rank(A);

%Find basics of Im(f)

if (r == 1)

Basic = [e1];

disp('Basic of Imf = ');disp([e1])

dimImf = 1

elseif (r == 2)

Basic = [e1;e2];

disp('Basic of Imf = ');disp([e1',e2'])

dimImf = 2

elseif (r == 3)

Basic = [e1;e2;e3];

disp('Basic of Imf = ');disp([e1',e2',e3'])

dimImf = 3

end

b Results:

e1 = [a b c]=[1 0 1]

e2 = [a b c]=[1 1 0]

e3 = [a b c]=[0 1 -9]

Basic of Imf =

1 1 0

0 1 1

1 0 -9

dimImf =

3

Question 2: Given f : �㕅3³ �㕅2 and the matrix representation of f in E = {(1; 1; 1);

(1; 0; 1); (1; 1; 0)}, and F = {(1; 1); (2; 1)} is �㔴ýþ= ; find f(1; 2; 9)

I Theory:

- Every linear transformation from �㕅Ā ³ �㕅ÿ can be

represented by an m n matrix Conversely, every matrix ×

m×n represents a linear transformation from �㕅Ā ³ �㕅ÿ,

i.e, we can always write a linear transformation in the

form

[Ā(ý)]� 㕇 = �㔴ý�㕇 where �㔴ÿ×Ā matrix

- If we are given vector images of a basis E in �㕅ÿ, that is we

know f(E), then

Trang 4

Ā(Ā) = �㔴Ā ⇔ �㔴 = Ā(Ā)Ā21 where f(E), E are two matrices formed by putting image

vector of basis, vector of basis in column, respectively

- Let f : �㕅Ā ³ �㕅ÿ be a linear transformation and

Ā = ÿ{ 1, ÿ2, ., ÿĀ} be a basis for �㕅Ā, ā = Ā{ 1, Ā2, ,ĀĀ} be a

basis for �㕅ÿ Then

is called the matrix representation of f with respect to E

and F

�㔴 = ā Ā(Ā)ý,þ 21

II Solution details:

1 Manual solving:

E =

F =

�㔴ýþ=

ý� 㕇 =

*�㔴 = ā Ā(Ā)ý,þ 21 = ā21�㔴Ā

[Ā(ý)]� 㕇 = �㔴ý�㕇 ⇔ f(1;2;9) = =

2 MATLAB code and explanation:

2.1 MATLAB code:

Trang 5

2.2 Explanation:

Line 1, 2, 3, 4: Create the matrix E, F, x, AEF respectively

Line 5: Find the matrix A through the formula A = F A E-1× EF×

Line 6: Find f(1;2;9) by using the formula [f(x)] = A xT × T

Question 3: Let = {(2; -1; 3); (1; 1; 2); (3; 0; 1); (-1; -4; )} be a subspace of R F a 3 with the inner product < x; y >= 3x 1y - x1y2 1 - x 2y1 + 4x 2y2 + 4x 3y3

a) Find a basis and the dimension of F⊥

b) Find the vector projection of = (3w ; - 2; 1) onto F

I Theory:

Definition 1:

Two vectors x y, Vin an inner product space V is called orthogonal

 <x, y>=0 We denote it by xy (x perp y)

Vector x is orthogonal to the set MV if x is orthogonal to every vector in M

We denote it by xM

Trang 6

Theorem 1: Vector x is orthogonal to a subspace F if and only if x is orthogonal with a basic of F

Definition 2:

A set of two or more vectors in a real inner product space {x , x1 2, …, xn} is called orthogonal  all pairs of distinct vectors in the set are orthogonal

An orthogonal set in which each vector has norm 1 is said to be orthogonal

1, ( 1, 2, , )

k

x = k= n

Definition 3: If F is a subspace of a real inner product space V, then the set F of ⊥ all vectors in V that are orthogonal to F is called the orthogonal complement of F

Theorem 2: Let R be a subspace of a real inner product space V then F is a ⊥

subspace of V, and:

dim F + dim F = dim V ⊥ Scheme of finding F of a subspace F: ⊥

Find a basis of F Assume that basic of F contains vectors {e , e1 2, …, en}

1

( , , , ) , 0

n n

e y

F y y y e y

e y

 Find the dim and a basic of this null space

Scheme of finding y = proj x F

- Find a basis of F, let it be S = {e , e1 2, …, em}

- Since y  F => y = 1 1e + 2 2e + + m m e

- x = y + z, then: y =  1 1e +  2 2e + + m m e + z

1 1 2 2

x e e e e e e e

x e e e e e e e

y proj x e e e

x e e e e e e e

ý

ÿ

þ

II Solution details:

1 Manual solving:

a) Find a basis and the dimension of F⊥

1 4 0

A

Find the rank of the subspace :F

Trang 7

3 3 2

2 2 1

3 3 1

3 2

2 3

r r r

r r r

r r r

( ) 3

dim 3

dim 0

r F

F

F

A basis of F is S = {(2, -1, 3), (1, 1, 2), (3, 0, 1)}

Fnull SA

 A basis of F is {(0, 0, 0)} ⊥

b) Find the vector projection of = (3w ; - 2; 1) onto F

Since y  F => y = 1 1e + 2 2e + + m m e

1 2 3

T T T

x e e e e e e e

x e e e e e e e

x e e e e e e e

x x e x e x e

A e e e

ý

þ

ö ö

÷ ÷

÷ ÷

÷ ÷

5 33

25 21 14

33 14 31

1

3

5 6

7

6

5 6

ÿ

= ÿþ

1 1 2 2 3 3 (3, 2,1)

F

y proj xeee

2 MATLAB code and explanation:

a Coding details:

clc;

syms x y z

A =[3 -1 0;-1 4 0; 0 0 4];

%Input the matrix of spanning set of F

e1 = [2 -1 3];

e2 = [1 1 2];

e3 = [3 0 1];

e4 = [-1 -4 9];

F = [e1;e2;e3;e4]'

r = rank(F)

if (r == 1)

S = e1

elseif (r == 2)

Trang 8

S = [e1;e2]

elseif (r == 3)

S = [e1;e2;e3]

end

%Input the matrix of the inner product

%Fo: Orthogonal F

Fo =(S')*A

kerf=null(Fo);

dimFo = size(ker,2)

% b)Find the vector projection of w = (3; -2; 1) onto F

x = [3;-2;1];

E = [dot(e1,e1) dot(e1,e2) dot(e1,e3); dot(e2,e1) dot(e2,e2) dot(e2,e3); dot(e3,e1) dot(e3,e2) dot(e3,e3)]

D = [dot(x,e1); dot(x,e2) ; dot(x,e3)];

X = mldivide(sym(E), sym(D)) ;

fprintf('The projection of w onto F: ')

(X(1,1)*e1 + X(2,1)*e2 + X(3,1)*e3)

b Results:

F =

2 1 3 -1

-1 1 0 -4

3 2 1 9

r =

3

S =

2 -1 3

1 1 2

3 0 1

Fo =

5 2 12

-4 5 0

7 5 4

dimFo =

0

E =

14 7 9

7 6 5

9 5 10

The projection of w onto F:

ans=

[ 3, -2, 1]

Trang 9

Question 4: Determine the currents I , I , I and for the given electrical network 1 2 3

1 Solution:

3 2 4�㔼12 3�㔼2 = 0 4�㔼1+ 3�㔼2 = 3 ³ (1)

4 2 1�㕅32 3�㔼2 = 0

�㕅 + 3�㔼3 2 = 4 ³ (2)

3 2 4�㔼1+ 1�㕅32 4 = 0 4�㔼12 �㕅3 = 1 ³ (3) Eauation (1), (2) & (3) in matrix form as,

[0 3 14 3 0

4 0 21

3 4

1] ´ �㕅3 ³ �㕅 2 �㕅3 1 [4 3 00 3 1

0 3 21

3 4

22] ´ �㕅3³ �㕅 + �㕅3 2 [4 3 00 3 1

0 0 0

3 4

2] ´ �㕅3 ³ �㕅 × 03 [4 3 00 3 1

0 0 0

3 4

0] 3�㔼2+ �㔼3 = 4 3�㔼2 = 4 2 �㔼3

�㔼23 2= 4�㔼3 3 4�㔼1 = 3 2 3�㔼2

Trang 10

4�㔼4�㔼1 = 3 2 3 [1 = 3 2 4 + �㔼4 2 �㔼3 ] 33 4�㔼1 = 21 + �㔼3

�㔼1 = 21

4 +

�㔼4 3 Dependent solution if �㔼3 = 1 �㕎�㕚þ

�㔼1 = 0 �㕎�㕚þ

�㔼2 = 1 �㕎�㕚þ

If �㔼3 = 2 amp

�㔼4�㕎�㕚þ 1 = 1

�㔼23=�㕎�㕚þ 2

2 Matlab

a) The code:

function ex3

clc, clear, close all;

disp('Solve the systems AX = B using gaussian elimination');

n = input('Input number of equations n = ');

k = input('Input number of variables k = ');

result = zeros(0,0);

disp('Example for input equation: [1 2 3 4] means x1 + 2*x2 + 3*x3 = 4');

for i = 1:n

T = input(['Input equation ' num2str(i) ' : ']);

result = [result; T];

end

disp('The system of equations :'); disp(result);

for i = 1:(n-1)

disp(' -');

disp(['Step ' num2str(i)]);

for j = (i+1):n

result(i,i) == 0 if

Trang 11

temp = result(j,:);

result(j,:) = result(i,:);

result(i,:) = temp;

else

result(j,:) = result(j,:) -(result(j,i)/result(i,i))*result(i,:);

end

end

disp(result);

disp('Press Enter to continue');

pause;

end

disp(' -');

A = result(:,1:k);

rresult = 0; rA = 0;

for i = 1:n

for j = 1:(k+1)

abs(result(i,j)) > 0.0001 if

rresult = rresult + 1;

break;

end

end

end

for i = 1:n

for j = 1:k

abs(A(i,j)) > 0.0001 if

rA = rA + 1;

break;

end

Trang 12

end

end

rresult ~= rA if

disp('No solution !');

elseif rresult == rA

rresult == n if

disp('Unique Solution');

x = zeros(k,1);

for s = 1:n

i = n+1-s;

sum = 0;

for j = (i+1):k

sum = sum + result(i,j)*x(j);

end

x(i) = (result(i,k+1) - sum)/result(i,i);

end

disp('Solution: ');disp(x);

else

disp('Infinity Solution');

disp([num2str(k - rresult) ' free variable']);

end

end

end

b) On the screen:

Trang 13

Question 5: Generate a random matrix which has the size of 4 4 and is A ×

diagonalizable

Then, return its eigenvalues, the corresponding eigenvectors and compute A100

I Theories summary

1 What is a diagonalizable matrix?

A square matrix is said to be diagonalizable if it is similar to a diagonal matrix

That is, is diagonalizable if there is an invertible matrix P and a diagonal matrix A

D such that A=PDP -1

2 What are eigenvalues and the corresponding eigenvectors of a matrix?

Many problems present themselves in terms of an eigenvalue problem:

�㔴 �㕣 = �㔆 �㕣

In this equation A is an n-by-n matrix, is a non-zero n-by- v 1 vector and λ is a scalar (which may be either real or complex) Any value of λ for which this

equation has a solution is known as an eigenvalue of the matrix It is sometimes A

also called the characteristic value

Trang 14

The vector, , which corresponds to this value is called an eigenvector The v

eigenvalue problem can be rewritten as:

�㔴 �㕣 2 �㔆 �㕣 = 0

�㔴 �㕣 2 �㔆 �㔼 �㕣 = 0 (�㔴 2 �㔆.�㔼) �㕣 = 0

If v is non-zero, this equation will only have a solution if

|�㔴 2 �㔆 �㔼| = 0 This equation is called the characteristic equation of , and is an n order A th

polynomial in λ with n roots These roots are called the eigenvalues of We will A

only deal with the case of n distinct roots, though they may be repeated For each eigenvalue there will be an eigenvector for which the eigenvalue equation is true This is most easily demonstrated by example:

Find Eigenvalues and Eigenvectors of a 2x2 Matrix

If �㔴 = [ 022 23]1

Then the characteristic equation is |�㔴 2 �㔆 �㔼| = | [ 022 23] 2 [�㔆 00 �㔆]1 |=0 |[2�㔆22 23 2 �㔆]| =1 �㔆2+ 3�㔆 + 2 = 0 And the two eigenvalues are: {�㔆�㔆 = 211

All that's left is to find the two eigenvectors Let's find the eigenvector, �㕣1, associated with the eigenvalue, λ1=-1, first

�㔴 �㕣1 = �㔆 �㕣1

(�㔴 2 �㔆1).�㕣1= 0 [222 23 2 �㔆�㔆1 1

1] �㕣1 = 0 [ 122 22] 1 �㕣1 = [ 122 22] [1 �㕣�㕣1,11,2] = 0

so clearly from the top row of the equations we get

�㕣1,1+ �㕣1,2 = 0 ý�㕟 �㕣1,1 = 2�㕣1,2

Note that if we took the second row we would get

(22).�㕣1,1+ ( )22 �㕣1,2 = 0 ý�㕟 �㕣1,1 = 2�㕣1,2

In either case we find that the first eigenvector is any 2 element column vector in which the two elements have equal magnitude and opposite sign

�㕣1 = �㕘21]1.[+1 where k is an arbitrary constant Note that we didn't have to use +1 and -1, we 1

could have used any two quantities of equal magnitude and opposite sign

Going through the same procedure for the second eigenvalue:

�㔴 �㕣 = �㔆 �㕣2 2

(�㔴 2 �㔆2) �㕣22 23 2 �㔆2=[2�㔆2 1

2] �㕣222 21] [= [ 2 1�㕣�㕣2,12,2] = 0

So 2 �㕣2,1+ 1 �㕣 = 0 2,2

2.�㕣 = 2�㕣2,1 2,2

Trang 15

�㕣 = �㕘 [2 2 +1

22]

Again, the choice of +1 and -2 for the eigenvector was arbitrary; only their ratio is

important This is demonstrated in the MatLab code below

3 The application of diagonal matrix

Diagonal matrices are relatively easy to compute with, and similar matrices share

many properties, so diagonalizable matrices are well-suited for computation

In particular, many applications involve computing large powers of a matrix,

which is easy if the matrix is diagonal But if A=PDP -1, then

�㔴Ā = (�㕃ÿ�㕃21)Ā = (�㕃ÿ�㕃21)(�㕃ÿ�㕃21)(& )(�㕃ÿ�㕃21)= �㕃ÿ

because the �㕃21�㕃 terms in the middle all collapse

4 Solution details

Choose the matrix �㔴 = [

1 2 3 4

2 4 5 2

4 2 1 4

2 3 4 5

] The unit matrix is �㔼 = [

1 0 0 0

0 1 0 0

0 0 1 0

0 0 0 1

]

Then we have

|�㔴 2 �㔆 �㔼| = 0

So that

|[

1 2 3 4

2 4 5 2

4 2 1 4

2 3 4 5

]2 �㔆.[

1 0 0 0

0 1 0 0

0 0 1 0

0 0 0 1

]| = 0

Trang 16

1 224� 4 2㔆2� 1 22㔆� 35㔆 424

]| = 0 Solve this equation we have:

�㔆1 = 12.2111

�㔆2 = 22.2111

�㔆3= 1.0000

�㔆4= 0.0000 ,which are the eigenvalues of the matrix �㔴 = [

1 2 3 4

2 4 5 2

4 2 1 4

2 3 4 5

] With �㔆1 = 12.2111 the eigenvector is [

20.4234 20.5217 20.4531 20.5858

]

With �㔆2 = 22.2111 the eigenvector is [

20.2156 20.5249 20.8059 20.1688

] With �㔆3 = 1.0000 the eigenvector is [

20.3455 0.7775 20.5183 0.0864

] With �㔆4 = 0.0000 the eigenvector is [

0.2641 20.8805 0.3522 0.1761

]

So we have �㕃 = [

20.4234 20.2156 20.3455 0.2641

20.5217 20.5249 0.7775 20.8805

20.4531 20.8059 20.5183 0.3522

20.5858 20.1688 0.0864 0.1761

] and

ÿ = [

] Then �㔴100 = �㕃ÿ �㕃100 21 =

[

20.4234 20.2156 20.3455 0.2641

20.5217 20.5249 0.7775 20.8805

20.4531 20.8059 20.5183 0.3522

20.5858 20.1688 0.0864 0.1761

] [

] 10

Trang 17

20.20.20.423452174531 20.20.20.2156 20.3455 0.264152498059 20.5183 0.35220.7775 20.8805

20.5858 20.1688 0.0864 0.1761

] 21

= 10108 [

0.76070.9375 1.1102 1.2984 1.54810.8142 0.9642 1.1276 1.34460.9008 1.0535 1.2562 1.0526 1.2466 1.4578 1.7383

]

5 Coding details

a Full MATLAB code:

%Clear all text from the Command Window

clear all;

clc;

%Input the matrix 4x4 that we need to use in this problem

A=input('Enter the matrix A: ')

%Check the matrix if it is already diagonal?

check=isdiag(A);

if check==true

disp('The matrix is already diagonal');

%Calculate A power 100

fprintf('A power of 100 = A^100:')

A100 = A^100;

ANSWER = real(A100)

else

F=size(A,1);

%Check the matrix whether it is diagonalizable or not?

syms lambda

I = eye(F);

lambda1 = solve(det(A - I*lambda)==0);

numrows=size(lambda1,1);

V=[];

for i = 1:numrows

v = null(A-lambda1(i,1)*I);

V=[V,v];

end

Trang 18

B=transpose(V);

C=rank(B);

E=size(B,1);

if C==F

disp("The matrix is diagonalizable")

p =poly(A);

eigs = roots(p);

M=[];

for i=1:4

m= eigs(i);

M=[M,m];

end

disp("The eigenvalues are:")

disp(M)

%Show the output of the problem: V is the matrix concluding all

%eigenvectors and D is a diagonal matrix with eigenvalues located on the

%main diagonal

fprintf('Eigenvectors are:\n')

[V,D] = eig(A)

%Calculate A power 100

fprintf('A power of 100 = V*D^100*inv(V):')

A100 = V*D^100*inv(V);

ANSWER = real(A100)

else

%Ask the user to input another matrix

disp("The matrix is not diagonalizable Let's try another matrix")

end

end

b Results and explanation:

If we input a diagonal matrix, this code will help us to find �㔴100 directly:

Ngày đăng: 21/12/2022, 08:34

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm

w