Linear transformation

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Engineering Mathematics-II

Scilab

Lab-04: Matrix representation of a linear


transformation.
Objective: To find Matrix representation of any linear
transformation T and use it to determine the inverse of T if the
inverse exists.

Exercise:
Let T: R3 to R3 be a linear transformation with basis
B={(1, 1,1), (1,1,0), (1,0,0)} and
B’ ={(1, 0,1), (-1,2,1), (2,1,1)} respectively
and defined by T(a,b,c)= (3a+b, a+b, a-b).
(i) Find matrix [T;B,B’]
(ii) Determine, if T is invertible.
Theory
• Let T: U to V with basis • Tu1=T(u1(1),u1(2),u1(3))=
B={u1=(u1(1),u1(2),u1(3)), (3*u1(1)+u1(2), u1(1)+u1(3),
u2=(u2(1),u2(2),u2(3)), u1(1)-u1(3))
u3=(u3(1),u3(2),u3(3)) =a11.v1+a21.v2+a31.v3
and basis // coordinates a11, a21 and a31 are
B’={v1=(v1(1),v1(2),v1(3)), unknown and form first column
v2=(v2(1),v2(2),v2(3)), X1of required matrix [T;B,B’]
v3=(v3(1),v3(2),v3(3))} After simplification:
respectively
and defined as
é3*u1(1)+u1(2) ù é v1(1) v2(1) v3(1) ù éa11ù
T(a,b,c)=(3a+b,a+c,a-c) ê u1(1)+u1(3) ú = ê v1(2) v2(2) v3(2) ú * êa21ú
• To find matrix [T;B,B’] ê ú ê ú ê ú
êë u1(1)-u1(3) úû êë v1(3) v2(3) v3(3) úû êëa31úû
• b1 = A* X1

So, X1= A\b1= First column of


Matrix of T
Continued…….
• Similarly, And,
Tu2=T(u2(1),u2(2),u2(3))= • Tu3=T(u3(1),u3(2),u3(3))=
(3*u2(1)+u2(2), (3*u3(1)+u3(2),
u2(1)+u2(3), u2(1)-u2(3)) u3(1)+u3(3), u3(1)-u3(3))
=a12.v1+a22.v2+a32.v3 =a13.v1+a23.v2+a33.v3

é3*u2(1)+u2(2) ù é v1(1) v2(1) v3(1) ù éa12ù é3*u3(1)+u3(2) ù é v1(1) v2(1) v3(1) ù éa13ù
ê u2(1)+u2(3) ú = ê v1(2) v2(2) v3(2) ú * êa22ú ê u3(1)+u3(3) ú = ê v1(2) v2(2) v3(2) ú * êa23ú
ê ú ê ú ê ú ê ú ê ú ê ú
êë u2(1)-u2(3) úû êë v1(3) v2(3) v3(3) úû êëa32úû êë u3(1)-u3(3) úû êë v1(3) v2(3) v3(3) úû êëa33úû
b2 = A* X2 b3 = A* X3
So, X2=A\b2= 2nd column So, X3=A\b3= 3rd column
of matrix of T of matrix of T
• [T;B,B’]=[X1,X2,X3]
Algorithm
1. Write clc and clear commands
2. Enter the Basis vectors {v1,v2,v3} of Domain vector space and {w1,w2,w3} of codomain
vector space. (Either directly or using input command.)
3. Evaluate the vectors Tv1, Tv2 and Tv3 where T(a,b,c)=(3a+b,a+c,a-c)
Tv1=[3*v1(1)+v1(2),v1(1)+v1(3),v1(1)-v1(3)]
Tv2=[3*v2(1)+v2(2),v2(1)+v2(3),v2(1)-v2(3)]
Tv3=[3*v3(1)+v3(2),v3(1)+v3(3),v3(1)-v3(3)]
4. Form a matrix A=[Tv1;Tv2;Tv3]’ (Matrix of L.T. T with respect to the standard basis of
codomain)
4. Assign transpose of matrix formed by basis w1,w2,w3 to B. B=[w1;w2;w3]’
5. Find solution of B*C1=Tv1, B*C2=Tv2, B*C3=Tv3
C1= B^(-1)Tv1, C2= B^(-1) Tv2, C3= B^(-1) Tv3
6. C= [C1,C2,C3]
Display the matrix C
7. If det(C) is not equal to zero, the inverse of C exists otherwise, the inverse of C does not
exist.
8. Matrix of Inverse of linear transformation T is given by inv(C), display inverse of linear map T
using inv(C).
Finding Matrix of a linear map T(x,y)=(x-y, x+y) with
respect to standard matrix.
clc clear
function T=linear(x)
T(1,1)=(x(1,1)- x(1,2)); T(1,2)=(x(1,1)+ x(1,2))
endfunction
v1=input("Enter v1 of Basis of domain vector space")
v2=input("Enter v2 of Basis of domain vector space ")
w1=input("Enter w1 of Basis of co-domain vector space ")
w2=input("Enter w2 of Basis of co-domain vector space ")
Tv1=linear(v1); Tv2=linear(v2);
B=[w1;w2]’
c1=inv(B)*Tv1’; c2=inv(B)*Tv2’;
C=[c1,c2]
disp("Matrix of Linear map with respect to (A,B) is given by the
matrix",C)
//Finding Matrix of a linear map T(x,y,z)=(2x+2y,2y+2z,2z+2x)
with respect to standard matrix.
clc
clear
function T=linear(x)
T(1,1)=2*(x(1,1)+ x(1,2))
T(1,2)=2*(x(1,2)+x(1,3))
T(1,3)=3*(x(1,3)+x(1,1))
endfunction
v1=input("Enter v1 of Basis of domain vector space")
v2=input("Enter v2 of Basis of domain vector space")
v3=input("Enter v3 of Basis of domain vector space")
//Matrix representation with respect to the standard basis of Co-domain vector space
Tv1=linear(v1)
Tv2=linear(v2)
Tv3=linear(v3)
A=[Tv1;Tv2;Tv3]’
disp("Linear map T with respect to standard basis of co-domain is given by the
matrix", A)
Finding Matrix of a linear map T(x,y,z)=(2x+2y,2y+2z,2z+2x)
with respect to user input basis.
clc clear
function T=linear(x)
T(1,1)=2*(x(1,1)+ x(1,2)); T(1,2)=2*(x(1,2)+x(1,3)); T(1,3)=3*(x(1,3)+x(1,1))
endfunction
v1=input("Enter v1 of Basis of domain vector space")
v2=input("Enter v2 of Basis of domain vector space")
v3=input("Enter v3 of Basis of domain vector space")
w1=input("Enter w1 of Basis of co-domain vector space")
w2=input("Enter w2 of Basis of co-domain vector space")
w3=input("Enter w3 of Basis of co-domain vector space")
Tv1=linear(v1); Tv2=linear(v2); Tv3=linear(v3);
B=[w1;w2;w3]’;
c1=inv(B)*Tv1’; c2=inv(B)*Tv2’; c3=inv(B)*Tv3’;
C=[c1,c2,c3]
disp("Matrix of Linear map with respect to (A,B) is given by the matrix",C)
Problems

You might also like