Question 5: Generate a random matrix A which has the size of 4 ×4and is diagonalizable.. A square matrix is said to be diagonalizable if it is similar to a diagonal matrix.. problem: In
Trang 1VIETNAM NATIONAL UNIVERSITY HO CHI MINHCITY UNIVERSITY OF TECHNOLOGY FACULTY OF
APPLIED SCIENCE -*** -
Lecturer: Phan Thi Huong
Submission date: Saturday, May 14 th , 2022
0
1
0
Trang 2● 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 f as below, find the dimension
and one basic of Im(f):
Trang 32
Trang 4e1 = 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
- If we are given vector images of a basis E in �㔼ÿ, that
is we know f(E), then where�㔼
ÿ×Āmatrix.
3
0
Trang 6where f(E), E are two matrices formed by
vector of basis, vector of basis in
Ā = {ÿ1, ÿ2, ÿ., ÿĀ}
- Let f : �㔼Ā
basis for �㔼 Then
is called the matrix representation of f with respect to E
Trang 70 0
Trang 82.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
Line 6: Find f(1;2;9) by using the formula [f(x)]T = A
Question 3: Let F = {(2; -1; 3); (1; 1; 2); (3; 0; 1); (-1; -4; a)} be a subspace of R3
with the inner product < x; y >= 3x1y1 - x1y2 - x2y1 + 4x2y2 + 4x3y3.
a)Find a basis and the dimension of F ⊥
b)Find the vector projection of w = (3; -2; 1) onto F
I Theory:
Definition 1:
Two vectors x , yV in an inner product space V is called orthogonal
<x, y>=0 We denote it by x ⊥ y (x perp y)
Vector x is orthogonal to the set M V if x is orthogonal to every vector in
M We denote it by x ⊥ M
5
Trang 9Theorem 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 {x1 , x2, …, 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
Scheme of finding F⊥ of a subspace F:
Find a basis of F Assume that basic of F contains vectors {e1 , e2, …, en}
Find the dim and a basic of this null space
Scheme of finding y = projFx
- Find a basis of F, let it be S = {e1 , e2, …, em}
Trang 12elseif (r == 2)
3
Trang 13E = [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)
F =
2-1
Fo =
5-4
7dimFo =
0
E =
1479
The projection of w onto F:
ans=
[ 3, -2, 1]
4
Trang 14Question 4: Determine the currents I1, I2, I3 and for the given electrical network.
1 Solution:
Eauation (1), (2) & (3) in
Trang 16clc, 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 = ');
Trang 17if result(i,i) == 0
6
Trang 19disp('Infinity Solution');
disp([num2str(k - rresult) ' free variable']);
Trang 20Question 5: Generate a random matrix A which has the size of 4 ×4
and is diagonalizable
Then, return its eigenvalues, the corresponding eigenvectors and compute A100.
1 What is a diagonalizable matrix?
A square matrix is said to be diagonalizable if it is similar to a diagonal matrix
That is, A is diagonalizable if there is an invertible matrix P and a diagonal matrix
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, v is a non-zero n-by-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 A It is
sometimes also called the characteristic value
9
Trang 21The vector, v, which corresponds to this value is called an eigenvector The
eigenvalue problem can be rewritten as:
This equation is called the characteristic equation of A, and is an nth order
polynomial in λ with n roots These roots are called the eigenvalues of A
We will 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:
If �㔼 = [
Then the
characteristic equation is
And the two eigenvalues are:
All that's left is to find the two
associated with the eigenvalue, λ1=-1, first
so clearly from the
Note that if we took the
In either case we
which the two elements have equal magnitude and opposite sign
where k
1
could have used any two quantities of equal magnitude and opposite sign.
Going through the same procedure for the second eigenvalue:
Trang 2210
Trang 232 = 222 ].[+1
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
Diagonal matrices are relatively easy to compute with, and similar matrices sharemany properties, so diagonalizable matrices are well-suited for computation
In particular, many applications involve computing large powers of a matrix,
Choose the ma trix �㔼
The unit matrix is � 㔼
Then we have
So that
Trang 2411
Trang 25Solve this equation we have:
,which are the eige nva lue s of the matrix �㔼 2
Trang 275 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?
Trang 28%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
%Ask the user to input another matrix
disp("The matrix is not diagonalizable Let's try another
Trang 32FIGURE 1
Howeve r, if we input a ma trix tha t is not diagona lizable �㔼
The result will be:
0
16
0