logo

Linear Algebra Questions and Solutions

   

Added on  2023-05-29

10 Pages2154 Words216 Views
 | 
 | 
 | 
Table of Contents
........................................................................................................................................ 1
Question 1 ......................................................................................................................... 1
Question 2 ......................................................................................................................... 2
Question 3 ......................................................................................................................... 3
Question 4 ......................................................................................................................... 4
Question 5 ......................................................................................................................... 7
format short
clear
close all
clc
Question 1
disp('-------------------------------------------------------------------')
disp('Question 1 Loading...')
%Part a
u1=[1;1;2;2];
u2=[2;3;5;6];
u3=[2;1;3;6];
u=[u1 u2 u3];
v=[0;5;3;0];
X=u\v % determines the linear combination coordinates for each value
disp('For the First output')
fprintf('%.3fu1+ %.3fu2 %.3fu3 \n ',X(1),X(2),X(3));
%Part B
vr=[1;6;1;4];
Xb=u\vr; % determines the linear combination coordinates for each
value
disp('For the second output')
fprintf('%.1fu1+ %.1fu2 %.1fu3 \n ',Xb(1),Xb(2),Xb(3));
-------------------------------------------------------------------
Question 1 Loading...
X =
-2.0000
2.8333
-2.1667
For the First output
-2.000u1+ 2.833u2 -2.167u3
For the second output
-7.0u1+ 4.0u2 -1.0u3
1
Linear Algebra Questions and Solutions_1

Question 2
clear
disp('-------------------------------------------------------------------')
disp('Question 2 Loading...')
q1=[1;-2;3;4];
q2=[2;4;5;0];
q3=[-1;0;0;4];
q4=[3;2;1;-4];
q=[q1 q2 q3 q4]
rank(q) %determining the rank of a vector
Qr=rref(q) %Determining the basis of a vector space
%part 2
e1=[0;1;1;1];
e2=[2;2;3;1];
e3=[7;0;1;0];
e4=[5;2;2;1];
e=[e1 e2 e3 e4]
rank(e) %determining the rank of a vector
Er=rref(e) %Determining the basis of a vector space
-------------------------------------------------------------------
Question 2 Loading...
q =
1 2 -1 3
-2 4 0 2
3 5 0 1
4 0 4 -4
ans =
4
Qr =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
e =
0 2 7 5
1 2 0 2
2
Linear Algebra Questions and Solutions_2

1 3 1 2
1 1 0 1
ans =
4
Er =
1 0 0 0
0 1 0 0
0 0 1 0
0 0 0 1
Question 3
%Part A
clear
% Determining if a set is linearly independent or dependent
disp('-------------------------------------------------------------------')
disp('Question 3 Loading...')
clear
A1=[0,1,-3,4];
A2=[-1,0,0,2];
A3=[0,5,3,0];
A4=[-1,7,-3,-6];
A=[A1;A2;A3;A4] %The set of vectors that form the vector space
R=rank(A)
[rows,~]=size(A)
%Testing for linear dependence
if(R==rows)
disp('The set is linearly independent');
elseif(R < rows)
disp('The set is linearly dependent');
end
% Part B
B1=[0,0,1,2,3];
B2=[0,0,2,3,1];
B3=[1,2,3,4,5];
B4=[2,1,0,0,0];
B5=[-1,-3,-5,0,0];
B=[B1;B2;B3;B4;B5]
R1=rank(B)
[rowb,~]=size(B)
3
Linear Algebra Questions and Solutions_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents