PROF. A. SUCIU

MTH 1230 - LINEAR ALGEBRA - FALL 1997

QUIZ 2

Problem 1.

Let

A={{3,0,1},{-6,4,-3},{3,2,1}};

Part (a)

Find the LU-decomposition of  A

lud=LUDecomposition[A]

Upper[LU] := 
      LU Table[If[i ≤ j, 1, 0], {i, Length[LU]}, {j, Length[LU]}]

Lower[LU] := LU - Upper[LU] + IdentityMatrix[Length[LU]]

Perm[v_]:=IdentityMatrix[Length[v]][[v]]

U=Upper[lud[[1]]]

L=Lower[lud[[1]]]

P=Perm[lud[[2]]]

P.L.U==A

Part (b)

Use the LU-decomposition of A from part (a) to solve A.{x[1],x[2],x[3]}={3,4,2}.

{{y[1]},{y[2]},{y[3]}}/.Solve[P.L.{{y[1]},{y[2]},{y[3]}}
=={{3},{4},{2}},{y[1],y[2],y[3]}][[1]]

{x[1],x[2],x[3]}/.Solve[U.{{x[1]},{x[2]},{x[3]}}
==%,{x[1],x[2],x[3]}][[1]]

Direct solution (without LU decomposition):

{x[1],x[2],x[3]}/.Solve[A.{{x[1]},{x[2]},{x[3]}}
=={{3},{4},{2}},{x[1],x[2],x[3]}][[1]]

Problem 2.

Use Gaussian elimination to find the inverse of the matrix

A={{1,0,1},{2,2,0},{1,1,1}};

Solution

Inverse[A]

Problem 3.

Consider the matrix

A={{1,2},{3,4}};

Part (a)

Find elementary matrices e[1], e[2], and e[3] such that e[3].e[2].e[1].A = I.

{f[3],f[2],f[1]}=Flatten[ElementaryDecomposition[A,Padded->True],1];

e[i_]:=Inverse[f[i]]

TableForm[e[1]]

TableForm[e[2]]

TableForm[e[3]]

Part (b)

Use part (a) to express A as a product of elementary matrices.

TableForm[f[1]]

TableForm[f[2]]

TableForm[f[3]]

A==f[3].f[2].f[1]

Part (c)

Use part (a) to express A-1 as a product of elementary matrices.

Inverse[A]==e[1].e[2].e[3]

Part (d)

Use (c) to find A-1.

e[1].e[2].e[3]

Problem 4.

Let

a={1,1,-1}; b={2,1,2};

Part (a)

Find unit vectors in the direction of a and b, respectively.

Normalize[a]

Normalize[b]

Part (b)

Find the lengths of a and b, and compute the dot product a . b.

Norm[x_]:=Sqrt[Apply[Plus,x^2]]

Norm[a]

Norm[b]

a.b

Part (c)

Find the angle between a and b.  Are a and b orthogonal?

N[ArcCos[(a.b)/(Norm[a]*Norm[b])]]

%==N[Pi/2]

Part (d)

Find the projection of a onto b.

Projection[a,b]

Part (e)

Find the projection of b onto a.

Projection[b,a]