Prof. Alex Suciu           MTH U371 Linear Algebra              Spring 2005

Final Exam: Solutions

Problem 1

v1={2,-6,8}; v2={7,3,-2}; v3={9,1,1};

A=Transpose[{v1,v2,v3}];  MatrixForm[A]

( 2    7    9  )            -6   3    1            8    -2   1

Part (a)

RowReduce[A]//MatrixForm

(           5  )                     --           1    0    12                      7                     -           0    1    6              0    0    0

-(5/12)*v1-(7/6)*v2+v3

{0, 0, 0}

Alternate method:

NullSpace[A]

{{-5, -14, 12}}

-5*v1-14*v2+12*v3

{0, 0, 0}

Part (b)

b={10,-2,5};

(* Take columns of A corresponding to pivots, and adjoin b *)

Ab=Transpose[{v1,v2,b}]; MatrixForm[Ab]

( 2    7    10 )            -6   3    -2            8    -2   5

RowReduce[Ab]//MatrixForm

(           11 )                     --           1    0    12                      7                     -           0    1    6              0    0    0

b==(11/12)*v1+(7/6)*v2

True

Alternate method:

sol={x,y,z}/.Solve[A.{x,y,z}==b,{x,y,z}]

{{11/12 - (5 z)/12, 7/6 - (7 z)/6, z}}

(* Now pick any value for z (say, z=0, or z=1) to find coefficients
expressing b as a linear combination of v1, v2, v3.*)

sol/.{z->0}

{{11/12, 7/6, 0}}

b==(11/12)*v1+(7/6)*v2

True

sol/.{z->1}

{{1/2, 0, 1}}

b==v1/2+v3

True

Problem 2

A={{1,-3,5,-4,2,4},{2,-6,10,-8,7,2},{-3,9,-15,-12,0,18},{0,0,0,1,2,3}};

RowReduce[A]

{{1, -3, 5, 0, 0, 0}, {0, 0, 0, 1, 0, 0}, {0, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 0, 1}}

im=Transpose[A][[{1,4,5,6}]]   (* basis for im(A) *)

{{1, 2, -3, 0}, {-4, -8, -12, 1}, {2, 7, 0, 2}, {4, 2, 18, 3}}

Length[im]  (* rank A *)

4

ker=NullSpace[A]   (* basis for ker(A) *)

{{-5, 0, 1, 0, 0, 0}, {3, 1, 0, 0, 0, 0}}

Length[ker]   (* dim ker(A) *)

2

4-Length[im]    (*  dim (im A)^\perp *)

0

6-Length[NullSpace[A]]    (*  dim (ker A)^\perp  *)

4

Problem 3

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

Solve[A.{y,z}==b,{y,z}]

{}

Transpose[A].A

{{10, 14}, {14, 21}}

Inverse[Transpose[A].A]

{{3/2, -1}, {-1, 5/7}}

Factor[Det[%]]

1/14

P=Inverse[Transpose[A].A].Transpose[A]

{{-1/2, 1/2, -1}, {3/7, -1/7, 5/7}}

x=P.b

{1, 2/7}

A.P

{{5/14, 3/14, 3/7}, {3/14, 13/14, -1/7}, {3/7, -1/7, 5/7}}

A.P.b

{11/7, 29/7, 2/7}

b - A . P . b

{24/7, -8/7, -16/7}

Norm[b - A . P . b]

8 2/7^(1/2)

N[%]

4.27618

Problem 4

v1={3,4,0};v2={0,0,2};v3={-2,1,1};
A=Transpose[{v1,v2,v3}]; MatrixForm[A]

( 3    0    -2 )            4    0    1            0    2    1

<<LinearAlgebra`Orthogonalization`

Q=Transpose[GramSchmidt[{v1,v2,v3}]]; MatrixForm[Q]

( 3          4 )           -         --           5    0     5            4         3           -         -           5    0    5              0    1    0

R=QRDecomposition[A][[2]]; MatrixForm[R]

(            2 )                     --           5    0     5              0    2    1                      11                     --           0    0    5

A==Q.R

True

Problem 5

A={{-1,0,0},{0,Cos[45*Degree],-Sin[45*Degree]},
{0,Sin[45*Degree],Cos[45*Degree]}};
MatrixForm[A]

(                                )            -1         0          0          ...       1          1                      -------    -------           0          Sqrt[2]    Sqrt[2]

Transpose[A].A == IdentityMatrix[3]  (* yes, A is othogonal *)

True

Det[A]

-1

MatrixForm[Transpose[A]]   (* inverse of A just the transpose *)

(                                )            -1         0          0          ...        1         1                      --------   -------           0           Sqrt[2]   Sqrt[2]

A.{2, Sqrt[2], 2*Sqrt[2]}

{-2, -1, 3}

Problem 6

S={{1,0,1},{0,1,0},{1,2,3}};

S.DiagonalMatrix[{3,3,-1}].Inverse[S]

{{5, 4, -2}, {0, 3, 0}, {6, 12, -3}}

A={{5,4,-2},{0,3,0},{6,12,-3}}; MatrixForm[A]

( 5    4    -2 )            0    3    0            6    12   -3

Factor[Det[t*IdentityMatrix[3]-A]]

(-3 + t)^2 (1 + t)

Eigenvalues[A]

{3, 3, -1}

Eigenvectors[A]

{{1, 0, 1}, {-2, 1, 0}, {1, 0, 3}}

S=Transpose[Eigenvectors[A]]; MatrixForm[S]

( 1    -2   1  )            0    1    0            1    0    3

d=DiagonalMatrix[Eigenvalues[A]]

{{3, 0, 0}, {0, 3, 0}, {0, 0, -1}}

A==S.d.Inverse[S]

True

Problem 7

S={{3,2},{-2,-1}}; MatrixForm[S]

( 3    2  )            -2   -1

A=S.DiagonalMatrix[{-4,3}].Inverse[S]

{{24, 42}, {-14, -25}}

{Tr[A],Det[A]}

{-1, -12}

{Tr[A.A],Det[A.A]}

{25, 144}

Det[5*A]

-300

MatrixPower[A,3]

{{300, 546}, {-182, -337}}

Problem 8

A={{2,3},{0,2}};MatrixForm[A]

( 2   3 )            0   2

B=Transpose[A].A

{{4, 6}, {6, 13}}

Eigenvalues[B]

{16, 1}

{s1,s2}=Sqrt[%]

{4, 1}

{w1,w2}=Eigenvectors[B]

{{1, 2}, {-2, 1}}

{v1,v2}={w1/Sqrt[w1.w1], w2/Sqrt[w2.w2]}

{{1/5^(1/2), 2/5^(1/2)}, {-2/5^(1/2), 1/5^(1/2)}}

V=Transpose[{v1,v2}]; MatrixForm[V]

(    1           2    )           -------    --------           Sqrt[5]     Sqrt[5]               2          1           -------    -------           Sqrt[5]    Sqrt[5]

u1=A.v1/s1

{2/5^(1/2), 1/5^(1/2)}

u2=A.v2/s2

{-1/5^(1/2), 2/5^(1/2)}

U=Transpose[{u1,u2}]; MatrixForm[U]

(    2           1    )           -------    --------           Sqrt[5]     Sqrt[5]               1          2           -------    -------           Sqrt[5]    Sqrt[5]

A==U.DiagonalMatrix[{s1,s2}].Transpose[V]

True

SingularValueDecomposition[N[A]]

RowBox[{{, RowBox[{RowBox[{{, RowBox[{RowBox[{{, RowBox[{RowBox[{-, 0.894427}], ,, RowBox[{-,  ... , 0.894427}]}], }}], ,, RowBox[{{, RowBox[{RowBox[{-, 0.894427}], ,, 0.447214}], }}]}], }}]}], }}]


Created by Mathematica  (April 22, 2005)

Back to MTH U371-Linear Algebra.