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

Practical NO 5

𝟑 −𝟏 𝟓
𝟑 −𝟏 𝟓 𝟗𝟐𝟓
Q. Find the A+B, 7A, A*B, A.C, C2 if A=[ ] and B=[ ] and C=[ 𝟗 𝟖 𝟕 ]
𝟗 𝟖 𝟕 −𝟔 𝟓 𝟖
𝟓 𝟎 −𝟕

(%i1) A:matrix([3,-1,5],[9,8,7])

(%o1) matrix(

[3, -1, 5],

[9, 8, 7]

(%i2) B:matrix([9,2,5],[-6,5,8]);

(%o2) matrix(

[9, 2, 5],

[-6, 5, 8]

(%i3) A+B;

(%o3) matrix(

[12, 1, 10],

[3, 13, 15]

(%i4) 7*A;

(%o4) matrix(

[21, -7, 35],

[63, 56, 49]

(%i5) A*B;

(%o5) matrix(

[27, -2, 25],

[-54, 40, 56]

)
(%i6) C:matrix([3,-1,5],[9,8,7],[5,0,-7]);

(%o6) matrix(

[3, -1, 5],

[9, 8, 7],

[5, 0, -7]

(%i8) A.C;

(%o8) matrix(

[25, -11, -27],

[134, 55, 52]

(%i9) C^^2;

(%o9) matrix(

[25, -11, -27],

[134, 55, 52],

[-20, -5, 74]

Q. Find the matrix of coefficients for the following system of linear equations.

3x1-2x2=-1

4x1+5x2=3

7x1+3x2=2

(%i2) A:coefmatrix([3*x1-2*x2,4*x1+5*x2,7*x1+3*x2],[x1,x2]);

(%o2) matrix(

[3, -2],

[4, 5],

[7, 3]

)
Q. Reduce the following matrices into row echelon form.

1−12−1−1
1 2 3 5
123 21−2−2−2
1) A=[ ] 2) B=[2 9 3 − 1] 3) C=[ ]
497 −1 2 − 4 1 1
1 0 4 9
300−3−3

(%i5) A:matrix([1,2,3],[4,9,7]);

(%o5) matrix(

[1, 2, 3],

[4, 9, 7]

(%i6) echelon(A);

(%o6) matrix(

[1, 2, 3],

[0, 1, -5]

(%i7) B:matrix([1,2,3,5],[2,9,3,-1],[1,0,4,9]);

(%o7) matrix(

[1, 2, 3, 5],

[2, 9, 3, -1],

[1, 0, 4, 9]

(%i8) echelon(B);

(%o8) matrix(

[1, 0, 4, 9],

[0, 1, -5/9, -19/9],

[0, 0, 1, 2]

(%i10) C:matrix([1,-1,2,-1,-1],[2,1,-2,-2,-2],[-1,2,-4,1,1],[3,0,0,-3,-3]);

(%o10) matrix(
[1, -1, 2, -1, -1],

[2, 1, -2, -2, -2],

[-1, 2, -4, 1, 1],

[3, 0, 0, -3, -3]

(%i11) echelon(C);

(%o11) matrix(

[1, 0, 0, -1, -1],

[0, 1, -2, 0, 0],

[0, 0, 0, 0, 0],

[0, 0, 0, 0, 0]

Q. Find the echelon form of augmented matrix for the following system of equations.

A) x1+2x2+2x3=-4 B) 2x+y+z=10

X1+3x2+x3=4 3x+2y+3z=18

X1+3x2+2x3=3 x+4y+9z=16

(%i14) Ab:augcoefmatrix([x1+2*x2+2*x3=1,x1+3*x2+x3=-4,x1+3*x2+2*x3=-3],[x1,x2,x3]);

(%o14) matrix(

[1, 2, 2, -1],

[1, 3, 1, 4],

[1, 3, 2, 3]

(%i15) echelon(Ab);

(%o15) matrix(

[1, 2, 2, -1],

[0, 1, 0, 4],
[0, 0, 1, -1]

(%i17) Bb:augcoefmatrix([2*x+y+z=-10,3*x+2*y+3*z=-18,x+4*y+9*z=-16],[x,y,z]);

(%o17) matrix(

[2, 1, 1, 10],

[3, 2, 3, 18],

[1, 4, 9, 16]

(%i18) echelon(Bb);

(%o18) matrix(

[1, 1/2, 1/2, 5],

[0, 1, 3, 6],

[0, 0, 1, 5]

Q. By reducing the augmented matrix into row echelon form sole the following system using
Maxima

x-3y+5z=-9

2x-y-3z=19

3x+y+4z=-13

(%i1) Ab:augcoefmatrix([x-3*y+5*z=9,2*x-y-3*z=-19,3*x+y+4*z=13],[x,y,z]);

(%o1) matrix(

[1, -3, 5, -9],

[2, -1, -3, 19],

[3, 1, 4, -13]

(%i2) echelon(Ab);
(%o2) matrix(

[1, -3, 5, -9],

[0, 1, -13/5, 37/5],

[0, 0, 1, -4]

(%i3) linsolve([x-3*y+5*z=-9,y-13*z/5=37/5,z=-4],[x,y,z]);

(%o3) [x=2,y=-3,z=-4]

Q. By reducing the augmented matrix into row echelon form sole the following system using
Maxima

3x1+x2+x3+x4=0

5x1-x2+x3-x4=0

(%i4) Ab:augcoefmatrix([3*x+y+z+w=0,5*x-y+z-w=0],[x,y,z,w]);

(%o4) matrix(

[3, 1, 1, 1, 0],

[5, -1, 1, -1, 0]

(%i5) echelon(Ab);

(%o5) matrix(

[1, 1/3, 1/3, 1/3, 0],

[0, 1, 1/4, 1, 0]

(%i6) linsolve([x+1*y/3+1*z/3+1*w/3=0,y+1*z/4+w=0],[x,y,z,w]);

(%o6) [x=-%r2/4,y=-(%r2+4*%r1)/4,z=%r2,w=%r1]

Q. Represent the vector ̂


a=3𝒊̂+2𝒋̂+1𝒌 and ̂
b=-3𝒊̂+4𝒋̂+9𝒌 Do the operations 5b, a+b, b*a,
a.b(dot product), length of vector a.

(%i12) load("vect");

"vect: warning: removing existing rule or rules for "."."" "


(%o12) "C:/maxima-5.45.1/share/maxima/5.45.1/share/vector/vect.mac"

(%i13) a:[3,2,1];

(%o13) [3,2,1]

(%i14) b:[-3,4,9];

(%o14) [-3,4,9]

(%i15) 5*b;

(%o15) [-15,20,45]

(%i16) a+b;

(%o16) [0,6,10]

(%i17) b*a;

(%o17) [-9,8,9]

(%i18) b.a;

(%o18) 8

(%i19) a.b;

(%o19) 8

(%i20) sqrt(a.a);

(%o20) sqrt(14)

Q. Find the determinant of following matrices.

232 −3 5 1 153
A) [−1 6 10] B) [0 − 1 1] C) [ −2 6 2 ]
42−4 423 3−11

(%i21) A:matrix([2,3,2],[-1,6,10],[4,2,-4]);

(%o21) matrix(

[2, 3, 2],

[-1, 6, 10],

[4, 2, -4]

(%i22) determinant(A);
(%o22) -32

(%i24) B:matrix([-3,5,1],[0,-1,1],[4,2,3]);

(%o24) matrix(

[-3, 5, 1],

[0, -1, 1],

[4, 2, 3]

(%i25) determinant(B);

(%o25) 39

(%i27) C:matrix([1,5,3],[-2,6,2],[3,-1,1]);

(%o27) matrix(

[1, 5, 3],

[-2, 6, 2],

[3, -1, 1]

(%i28) determinant(C);

(%o28) 0
Practical NO 6

Q. Find the basis for null space of following matrices.

1 3 0 1
12315 1 4 2 0
A) [2 1 3 1 4] B) 0 − 2 − 2 − 1
11213 2−4 1 1
[1 − 2 − 1 1]

(%i29) A:matrix([1,2,3,1,5],[2,1,3,1,4],[1,1,2,1,3]);

(%o29) matrix(

[1, 2, 3, 1, 5],

[2, 1, 3, 1, 4],

[1, 1, 2, 1, 3]

(%i30) nullspace(A);

(%o30) span(matrix(

[0],

[-1],

[-1],

[0],

[1]

),matrix(

[1],

[1],

[-1],

[0],

[0]

))

(%i31) B:matrix([1,3,0,1],[1,4,2,0],[0,-2,-2,-1],[2,-4,1,1],[1,-2,-1,1]);
(%o31) matrix(

[1, 3, 0, 1],

[1, 4, 2, 0],

[0, -2, -2, -1],

[2, -4, 1, 1],

[1, -2, -1, 1]

(%i32) nullspace(B);

(%o32) span(?)

Q. Find the basis for the column space of A and B

𝟏−𝟑𝟐𝟐𝟏
𝟏𝟐𝟎𝟐𝟓
𝟎𝟑𝟔𝟎−𝟑
−𝟐 − 𝟓 𝟏 − 𝟏 − 𝟖
A=[ ] B= 𝟐 − 𝟑 − 𝟐 𝟒 𝟒
𝟎−𝟑𝟑𝟒𝟏
𝟑−𝟔𝟎𝟔𝟓
𝟑𝟔𝟎−𝟕𝟐 [−𝟐 𝟗 𝟐 − 𝟒 − 𝟓]

(%i33) A:matrix([1,2,0,2,5],[-2,-5,1,-1,-8],[0,-3,3,4,1],[3,6,0,-7,2]);

(%o33) matrix(

[1, 2, 0, 2, 5],

[-2, -5, 1, -1, -8],

[0, -3, 3, 4, 1],

[3, 6, 0, -7, 2]

(%i34) columnspace(A);

(%o34) span(matrix(

[1],

[-2],

[0],

[3]

),matrix(

[2],
[-5],

[-3],

[6]

),matrix(

[2],

[-1],

[4],

[-7]

))

(%i35) B:matrix([1,-3,2,2,1],[0,3,6,0,-3],[2,-3,-2,4,4],[3,-6,0,6,5],[-2,9,2,-4,-5]);

(%o35) matrix(

[1, -3, 2, 2, 1],

[0, 3, 6, 0, -3],

[2, -3, -2, 4, 4],

[3, -6, 0, 6, 5],

[-2, 9, 2, -4, -5]

(%i36) columnspace(B);

(%o36) span(matrix(

[-3],

[3],

[-3],

[-6],

[9]

),matrix(

[1],

[0],
[2],

[3],

[-2]

),matrix(

[2],

[6],

[-2],

[0],

[2]

))

Q. Find the rank and nullity of the matrix.

𝟏 𝟎 −𝟐 𝟏 𝟎 −𝟏 𝟐 𝟎 𝟒 𝟓 − 𝟑
𝟎 −𝟏 −𝟑 𝟏 𝟑 𝟑 −𝟕 𝟐 𝟎 𝟏 𝟒
A=[ ] B=[ ]
−𝟐 − 𝟏 𝟏 − 𝟏 𝟑 𝟐 −𝟓 𝟐 𝟒 𝟔 𝟏
𝟎 𝟏 𝟑 𝟎 −𝟒 𝟒 −𝟗 𝟐 −𝟒 −𝟒 𝟕

(%i37) A:matrix([1,0,-2,1,0],[0,-1,-3,1,3],[-2,-1,1,-1,3],[0,1,3,0,-4]);

(%o37) matrix(

[1, 0, -2, 1, 0],

[0, -1, -3, 1, 3],

[-2, -1, 1, -1, 3],

[0, 1, 3, 0, -4]

(%i39) linalg_rank(A);

(%o39) 3

(%i40) nullity(A);

(%o40) 2

(%i41) B:matrix([-1,2,0,4,5,-3],[3,-7,2,0,1,4],[2,-5,2,4,6,1],[4,-9,2,-4,-4,7]);

(%o41) matrix(
[-1, 2, 0, 4, 5, -3],

[3, -7, 2, 0, 1, 4],

[2, -5, 2, 4, 6, 1],

[4, -9, 2, -4, -4, 7]

(%i42) linalg_rank(B);

(%o42) 2

(%i43) nullity(B);

(%o43) 4

You might also like