Prof. Alex Suciu           MTH U371 Linear Algebra              Spring 2005

Practice Final Exam: Solutions

Problem 1

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

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

NullSpace[A]

{{-1, 4, 3}}

-v1+4*v2+3*v3

{0, 0, 0}

Problem 2

v1={1,2,-1};v2={2,1,0};v3={-1,0,1};

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

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

NullSpace[A]

{}

b={1,-7,5};

Inverse[A].b

{-5, 3, 0}

b==-5*v1+3*v2

True

Problem 3

v1={1,2,5};v2={6,2,4};v3={-7,1,4};

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

( 1    6    -7 )            2    2    1            5    4    4

NullSpace[A]

{{-4, 3, 2}}

b={-2,1,3};

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

{{1 - 2 z, -1/2 + (3 z)/2, z}}

%/.{z->0}

{{1, -1/2, 0}}

b==v1-v2/2

True

Problem 4

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

( 2    0    3  )            4    5    7            -6   10   -7

b={-2,-3,8};

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

{{-1 - (3 z)/2, 1/5 - z/5, z}}

RowReduce[A]   

{{1, 0, 3/2}, {0, 1, 1/5}, {0, 0, 0}}

b=Transpose[A][[{1,2}]]
(* Basis vectors for im(A) are the first two columns of A *)

{{2, 4, -6}, {0, 5, 10}}

NullSpace[A]

{{-15, -2, 10}}

Length[b]  (* Rank of A is size of basis for im(A) *)

2

NullSpace[{{2,0,3},{-6,10,-7}}]  (* Same answer as for ker(A) *)

{{-15, -2, 10}}

Problem 5

A={{1,2,3,1,0},{2,3,5,2,1},{3,5,8,3,1},{4,7,11,4,1}};

RowReduce[A]

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

Transpose[A][[{1,2}]]   (* basis for im(A) *)

{{1, 2, 3, 4}, {2, 3, 5, 7}}

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

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

Length[NullSpace[Transpose[A]]]  (* rank(A) *)

2

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

3

4-Length[NullSpace[Transpose[A]]]    (* dim im(A^T) *)

2

5-Length[NullSpace[A]]    (* dim ker(A^T) *)

2

Problem 6

A={{1,2,3,4,5},{6,7,8,9,10},{11,12,13,14,15},
{16,17,18,19,20}};

RowReduce[A]

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

Transpose[A][[{1,2}]]   (* basis for im(A) *)

{{1, 6, 11, 16}, {2, 7, 12, 17}}

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

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

Length[NullSpace[Transpose[A]]]  (* rank(A) *)

2

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

3

4-Length[NullSpace[Transpose[A]]]    (* dim im(A^T) *)

2

5-Length[NullSpace[A]]    (* dim ker(A^T) *)

2

Problem 7

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

(                                )            -1         0          0          ...                    Sqrt[3]   1                      --------   -           0              2      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          ...                   Sqrt[3]    1                      -------    -           0             2       2

A.{-3, 2, 1}

{3, 1 + 3^(1/2)/2, 1/2 - 3^(1/2)}

Problem 8

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

( 3 Sqrt[3]   0           -3        )            0           6           0            3           0           3 Sqrt[3]

A.{5, 4, 3}

{-9 + 15 3^(1/2), 24, 15 + 9 3^(1/2)}

Problem 9

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

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

Det[A]

-1

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

True

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

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

A.{-2, 5, 1}

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

Problem 14

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

Transpose[A].A

{{14, 6}, {6, 4}}

Inverse[Transpose[A].A]

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

PseudoInverse[A]

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

{m,b}=Inverse[Transpose[A].A].Transpose[A].y

{3/2, 1}

4*m+b

7

Problem 15

a1={3,4};a2={-1,1};
A=Transpose[{a1,a2}]; MatrixForm[A]

( 3    -1 )            4    1

u1=a1/Sqrt[a1.a1]

{3/5, 4/5}

u2=a2/Sqrt[a2.a2]

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

{Sqrt[a1.a1],Sqrt[a2.a2],a1.a2}

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

theta=N[ArcCos[(a1.a2)/(Sqrt[a1.a1]*Sqrt[a2.a2])]]

1.4289

<<LinearAlgebra`Orthogonalization`

Q=Transpose[GramSchmidt[{a1,a2}]]; MatrixForm[Q]

( 3     4 )           -    --           5     5            4    3           -    -           5    5

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

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

A==Q.R

True

Problem 16

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

( 1   0   0 )            0   1   1            1   1   2

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

(    1           1          1    )           -------    --------   --------    ...       1          1           -------    -------    -------           Sqrt[2]    Sqrt[6]    Sqrt[3]

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

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

A==Q.R

True

Problem 17

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

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

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

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

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

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

A==Q.R

True

Problem 18

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

( 2   2 )            3   1

Factor[Det[x IdentityMatrix[2]-A]]

(-4 + x) (1 + x)

Eigenvalues[A]

{4, -1}

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

( 1    -2 )            1    3

d=DiagonalMatrix[Eigenvalues[A]]

{{4, 0}, {0, -1}}

A==S.d.Inverse[S]

True

Problem 19

A={{5,6,0},{7,6,0},{0,0,3}}; MatrixForm[A]

( 5   6   0 )            7   6   0            0   0   3

Eigenvalues[A]

{12, 3, -1}

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

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

d=DiagonalMatrix[Eigenvalues[A]]

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

A==S.d.Inverse[S]

True

Problem 20

A={{4,0,0},{0,2,0},{0,9,-5}}; MatrixForm[A]

( 4    0    0  )            0    2    0            0    9    -5

Factor[Det[x IdentityMatrix[3]-A]]

(-4 + x) (-2 + x) (5 + x)

Eigenvalues[A]

{-5, 4, 2}

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

( 0   1   0 )            0   0   7            1   0   9

d=DiagonalMatrix[Eigenvalues[A]]

{{-5, 0, 0}, {0, 4, 0}, {0, 0, 2}}

A==S.d.Inverse[S]

True

Problem 21

A=DiagonalMatrix[{-1,2,2,3,4}];  
    (* For simplicity, I will pretend A is diagonal *)

{Tr[A],Det[A]}

{10, -48}

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

{34, 2304}

Det[3*IdentityMatrix[5]-A]

0

Det[3*A]

-11664

Det[A]=!=0

True

Transpose[A].A==IdentityMatrix[5]

False

Problem 22

A=DiagonalMatrix[{-2,1,3,4}];  
    (* For simplicity, I will pretend A is diagonal *)

Det[t*IdentityMatrix[4]-A]

-24 + 26 t + 3 t^2 - 6 t^3 + t^4

{Tr[A],Det[A]}

{6, -24}

Det[-2*A]

-384

Det[A+2*IdentityMatrix[4]]

0

Eigenvalues[MatrixPower[A,3]]

{64, 27, -8, 1}

Det[A]=!=0

True

Transpose[A].A==IdentityMatrix[4]

False

Complement[Union[Eigenvalues[A]],Eigenvalues[A]]=={}

True

Problem 23

S={{4,1},{2,1}};MatrixForm[S]

( 4   1 )            2   1

d={{-2,0},{0,5}}

{{-2, 0}, {0, 5}}

A=S.d.Inverse[S]

{{-9, 14}, {-7, 12}}

Problem 24

A={{27,-12},{56,-25}};MatrixForm[A]

( 27    -12 )            56    -25

Simplify[MatrixPower[A,t]]

{{-6 (-1)^t + 7 3^t, 3 ((-1)^t - 3^t)}, {14 (-(-1)^t + 3^t), 7 (-1)^t - 2 3^(1 + t)}}

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

( 1   3 )            2   7

d=DiagonalMatrix[Eigenvalues[A]]

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

At=S.MatrixPower[d,t].Inverse[S]; MatrixForm[At]

(       t      t                  t      t        )           7 (-2)  - 6 5    ... t  1 + t       t          t  1 + t      t           7 (-1)  2      - 14 5    -3 (-1)  2      + 7 5

Problem 25

S={{1,4},{5,-1}};MatrixForm[S]

( 1    4  )            5    -1

d={{2,0},{0,3}}

{{2, 0}, {0, 3}}

A=S.d.Inverse[S]; MatrixForm[A]

( 62     4  )           --    ---           21     21             5    43           ---   --            21   21

At=S.MatrixPower[d,t].Inverse[S]; MatrixForm[At]

(  t       -1 + t       2 + t      -1 + t )           2    20 3            2   ... 3           ---- - ---------     -------- + -------            21        7            21         7

Problem 26

λ[1]=4;

sol=Solve[{λ[1]+λ[2]+λ[3]==8,λ[1]*λ[2]*λ[3]==52},{λ[2],λ[3]}][[1]]

{λ[2] 2 - 3 , λ[3] 2 + 3 }

eval2={λ[1],λ[2],λ[3]}^2/.sol

{16, -5 - 12 , -5 + 12 }

Total[eval2]

6

Apply[Times,eval2]

2704

Problem 27

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

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

x[0]={2,1};

x[t_]:=MatrixPower[A,t].x[0]

Simplify[x[t]]

{2^(1 - t) 3^t, 2^(-t)}

data=Table[N[x[t]],{t,-2,2}]

RowBox[{{, RowBox[{RowBox[{{, RowBox[{0.888889, ,, 4.}], }}], ,, RowBox[{{, RowBox[{1.33333, , ... }], }}], ,, RowBox[{{, RowBox[{3., ,, 0.5}], }}], ,, RowBox[{{, RowBox[{4.5, ,, 0.25}], }}]}], }}]

ListPlot[data,PlotRange->{0,4},PlotJoined->True,PlotStyle->Hue[.7],
AxesOrigin->{2,0}]

[Graphics:HTMLFiles/index_117.gif]

Problem 28

A={{3/5,3/10},{2/5,7/10}};MatrixForm[A]

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

x[0]={1,1};

x[t_]:=MatrixPower[A,t].x[0]

Simplify[x[t]]

{1/7 (6 + (3/10)^t), 1/7 (8 - (3/10)^t)}

data=Table[N[x[t]],{t,-2,8}]

RowBox[{{, RowBox[{RowBox[{{, RowBox[{2.44444, ,, RowBox[{-, 0.444444}]}], }}], ,, RowBox[{{,  ... [{{, RowBox[{0.857174, ,, 1.14283}], }}], ,, RowBox[{{, RowBox[{0.857152, ,, 1.14285}], }}]}], }}]

ListPlot[data,PlotRange->{-0.5,1.5},PlotJoined->False,
PlotStyle->PointSize[0.015], PlotStyle->Hue[.7],AxesOrigin->{1,0}]

[Graphics:HTMLFiles/index_121.gif]

Limit[Simplify[x[t]],t->Infinity]

{6/7, 8/7}

Problem 29

A={{2,2},{2,-5}};MatrixForm[A]

( 2    2  )            2    -5

evalues=Eigenvalues[A]

{1/2 (-3 - 65^(1/2)), 1/2 (-3 + 65^(1/2))}

{w1,w2}=Eigenvectors[A]

{{5/2 + 1/4 (-3 - 65^(1/2)), 1}, {5/2 + 1/4 (-3 + 65^(1/2)), 1}}

v1=N[w1/Sqrt[w1.w1]]

RowBox[{{, RowBox[{RowBox[{-, 0.256668}], ,, 0.9665}], }}]

v2=N[w2/Sqrt[w2.w2]]

RowBox[{{, RowBox[{0.9665, ,, 0.256668}], }}]

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

( -0.25666793515702413`   0.9664996487646695`   )            0.9664996487646696`     0.25666793515702424`

d=DiagonalMatrix[N[evalues]]

RowBox[{{, RowBox[{RowBox[{{, RowBox[{RowBox[{-, 5.53113}], ,, 0}], }}], ,, RowBox[{{, RowBox[{0, ,, 2.53113}], }}]}], }}]

A==S.d.Transpose[S]

True

Problem 30

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

( 1   0   1 )            0   2   0            1   0   1

evalues=Eigenvalues[A]

{2, 2, 0}

{w1,w2,w3}=Eigenvectors[A]

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

v1=w1/Sqrt[w1.w1]

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

v2=w2/Sqrt[w2.w2]

{0, 1, 0}

v3=w3/Sqrt[w3.w3]

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

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

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

d=DiagonalMatrix[evalues]

{{2, 0, 0}, {0, 2, 0}, {0, 0, 0}}

A==S.d.Transpose[S]

True

Problem 31

A={{1,2},{2,4}};MatrixForm[A]

( 1   2 )            2   4

B=Transpose[A].A

{{5, 10}, {10, 20}}

Eigenvalues[B]

{25, 0}

{s1,s2}=Sqrt[%]

{5, 0}

{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

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

u2=v2

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

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

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

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

True

SingularValueDecomposition[N[A]]

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

Problem 32

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

( 6    3  )            -1   2

B=Transpose[A].A

{{37, 16}, {16, 13}}

Eigenvalues[B]

{45, 5}

{s1,s2}=Sqrt[%]

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

{w1,w2}=Eigenvectors[B]

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

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

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

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

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

u1=A.v1/s1

{1, 0}

u2=A.v2/s2

{0, 1}

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

( 1   0 )            0   1

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

True

SingularValueDecomposition[N[A]]

RowBox[{{, RowBox[{RowBox[{{, RowBox[{RowBox[{{, RowBox[{RowBox[{-, 1.}], ,, 0.}], }}], ,, Row ... , 0.447214}]}], }}], ,, RowBox[{{, RowBox[{RowBox[{-, 0.447214}], ,, 0.894427}], }}]}], }}]}], }}]


Created by Mathematica  (April 15, 2005)

Back to MTH U371-Linear Algebra.