



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Solutions to homework problems in linear algebra, including finding the inverse of matrices and determining the regression line. The problems involve multiplying and transposing matrices, calculating determinants, and using gaussian elimination.
Typology: Assignments
1 / 7
This page cannot be seen from the preview
Don't miss anything!




(^) restart:
(^) with(linalg):
Warning, the protected names norm and trace have been redefined and
unprotected
(^) A1 := array(1..3,1..2,[[1,1],[2,-3],[0,0]]);
(^) b1 := array(1..3,1..1,[[3],[1],[2]]);
b1 :=
(^) inv := multiply(
(^) inverse(multiply(transpose(A1),A1)), transpose(A1));
inv :=
(^) x1 := multiply(inv,b1);
x1 :=
(^) A2 := array(1..3,1..2,[[-1,1],[2,1],[1,-2]]);
(^) b2 := array(1..3,1..1,[[10],[5],[20]]);
b2 :=
(^) inv := multiply(
(^) inverse(multiply(transpose(A2),A2)), transpose(A2));
inv :=
(^) x2 := multiply(inv,b2);
x2 :=
(^) A3 := array(1..4,1..3,[[1,1,1],[-1,1,1],[0,-1,1],[1,0,1]]);
(^) b3 := array(1..4,1..1,[[4],[0],[1],[2]]);
b3 :=
(^) inv := multiply(
(^) inverse(multiply(transpose(A3),A3)), transpose(A3));
inv :=
(^) x3 := multiply(inv,b3);
x3 :=
2 Problem 2
(^) p1 := multiply(A1,x1);
p1 :=
(^) r1 := matadd(p1,-b1);
r1 :=
(^) transpose(A1);
(^) multiply(transpose(A3),r3);
3 Problem 3
(^) A := array(1..3,1..2,[[1,2],[2,4],[-1,-2]]);
(^) rank(A);
deficient rank, so A
T A is singular!
(^) b := array(1..3,1..1,[[3],[2],[1]]);
b :=
(^) ATA := multiply(transpose(A),A);
(^) ATb := multiply(transpose(A),b);
ATb :=
(^) aug := augment(ATA,ATb);
aug :=
(^) gaussjord(aug); [ 1 2 1
0 0 0
(^) solve( x1+2*x2=1,{x1,x2});
{x2 = x2 , x1 = − 2 x2 + 1}
(^) x1 = -2*alpha + 1, x2 = alpha;
x1 = − 2 α + 1, x2 = α
(^) A := array(1..3,1..3,[[1,1,3],[-1,3,1],[1,2,4]]);
(^) rank(A);
deficient rank, so A T A is singular!
(^) b := array(1..3,1..1,[[-2],[0],[8]]);
b :=
(^) ATA := multiply(transpose(A),A);
(^) ATb := multiply(transpose(A),b);
ATb :=
(^) aug := augment(ATA,ATb);
aug :=
(^) gaussjord(aug);
solve( {x1+2*x3=2,x2+x3=1},{x1,x2,x3});
{x2 = 1 − x3 , x1 = 2 − 2 x3 , x3 = x3 }
(^) x1 = 2-2*alpha, x2 = 1-alpha, x3=alpha;
x1 = 2 − 2 α, x2 = 1 − α, x3 = α
4 Problem 7
(^) A := array(1..5,1..2,[[x1,1],[x2,1],[x3,1],[x4,1],[xN,1]]);
x1 1
x2 1
x3 1
x4 1
xN 1
6 Problem 13
(^) A := array(1..4,1..3,[[-12,-22,1],[02,2.42,1],
[1.12,-42,1],[2.42,-1.62,1]]);
(^) b := array(1..4,1..1,[[1ˆ2+2ˆ2],[0ˆ2+2.4ˆ2],
(^) [1.1ˆ2+4ˆ2],[2.4ˆ2+1.6ˆ2]]);
b :=
(^) inv := multiply(
(^) inverse(multiply(transpose(A),A)), transpose(A));
inv :=
(^) c := multiply(inv,b);
c :=
(^) r := sqrt(c[3,1]+c[1,1]ˆ2+c[2,1]ˆ2);
r := 2. 725157057
The equation of the circle of best fit is therefore
(^) (x-c[1,1])ˆ2+(y-c[2,1])ˆ2 = rˆ2;
(x − .5754905350)
2
2 = 7. 426480985