Linear Algebra Homework Solutions: Finding Inverse Matrices and Regression Lines, Assignments of Linear Algebra

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

Pre 2010

Uploaded on 02/10/2009

koofers-user-hl3
koofers-user-hl3 🇺🇸

10 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Homework Solutions Section 5.3
>restart:
>with(linalg):
Warning, the protected names norm and trace have been redefined and
unprotected
1 Problem 1
1.1 Problem 1a)
>A1 := array(1..3,1..2,[[1,1],[2,-3],[0,0]]);
A1 :=
1 1
23
0 0
>b1 := array(1..3,1..1,[[3],[1],[2]]);
b1 :=
3
1
2
>inv := multiply(
>inverse(multiply(transpose(A1),A1)), transpose(A1));
inv :=
3
5
1
50
2
5
1
50
>x1 := multiply(inv,b1);
x1 := 2
1
1.2 Problem 1b)
>A2 := array(1..3,1..2,[[-1,1],[2,1],[1,-2]]);
A2 :=
1 1
2 1
12
>b2 := array(1..3,1..1,[[10],[5],[20]]);
b2 :=
10
5
20
>inv := multiply(
>inverse(multiply(transpose(A2),A2)), transpose(A2));
inv :=
1
7
13
35
4
35
1
7
8
35
11
35
>x2 := multiply(inv,b2);
pf3
pf4
pf5

Partial preview of the text

Download Linear Algebra Homework Solutions: Finding Inverse Matrices and Regression Lines and more Assignments Linear Algebra in PDF only on Docsity!

Homework Solutions Section 5.

(^) restart:

(^) with(linalg):

Warning, the protected names norm and trace have been redefined and

unprotected

1 Problem 1

1.1 Problem 1a)

(^) A1 := array(1..3,1..2,[[1,1],[2,-3],[0,0]]);

A1 :=

(^) 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 :=

[

]

1.2 Problem 1b)

(^) A2 := array(1..3,1..2,[[-1,1],[2,1],[1,-2]]);

A2 :=

(^) 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 :=

1.3 Problem 1c)

(^) A3 := array(1..4,1..3,[[1,1,1],[-1,1,1],[0,-1,1],[1,0,1]]);

A3 :=

(^) 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

2.1 Problem 2a)

(^) p1 := multiply(A1,x1);

p1 :=

(^) r1 := matadd(p1,-b1);

r1 :=

(^) transpose(A1);

(^) multiply(transpose(A3),r3); 

3 Problem 3

3.1 Problem 3a)

(^) A := array(1..3,1..2,[[1,2],[2,4],[-1,-2]]);

A :=

(^) 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);

ATA :=

[

]

(^) 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 = α

3.2 Problem 3b)

(^) A := array(1..3,1..3,[[1,1,3],[-1,3,1],[1,2,4]]);

A :=

(^) 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);

ATA :=

(^) 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]]);

A :=

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]]);

A :=

(^) 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

  • (y + .6426151799)

2 = 7. 426480985