[gmd6] Matrices

Clear["Global`*"]

Matrices as lists

AA={{1,2,3},{3,4,5}}

MatrixForm[AA]

BB={{1,-2,3},{-3,4,-5}}

MatrixForm[BB]

CC={{3,4,5}}

MatrixForm[CC]

DD={{6},{-4},{-3}}

MatrixForm[DD]

EE={{2,3},{3,5},{7,-2}}

MatrixForm[EE]

FF={{6,2,-3},{1,2,3},{3,4,5}}

MatrixForm[FF]

GG={{1,5,4},{6,-2,4},{7,4,-5}}

MatrixForm[GG]

Matrix additions

AA+BB

AA+BB //MatrixForm

AA+CC

Matrix multiplications

CC.DD

CC.DD  // MatrixForm

DD.CC

DD.CC//MatrixForm

MatrixForm[AA.DD]

MatrixForm[AA.EE]

MatrixForm[AA.AA]

FF.FF//MatrixForm

MatrixPower[FF,2] //MatrixForm

MatrixPower[GG,3] //MatrixForm

Matrix transposition

AA//MatrixForm

Transpose[AA] //MatrixForm

Transpose[FF.GG] //MatrixForm

Transpose[GG].Transpose[FF] //MatrixForm

Transpose[AA.FF.GG] //MatrixForm

Transpose[GG].Transpose[FF].Transpose[AA] // MatrixForm

Symmetrization and antisymmetrization

(FF+Transpose[FF])/2 // MatrixForm

(FF-Transpose[FF])/2 //MatrixForm

Conjugate transpose and Hermitian matrix

JJ={{1+I,3-I},{2-2I,4+5I}}

MatrixForm[JJ]

ConjugateTranspose[JJ]//MatrixForm

(JJ+ConjugateTranspose[JJ])/2//MatrixForm

Trace and Determinant

Tr[JJ]

Det[JJ]

Laplace expansion of determinant

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

MatrixForm[HH]

HH[[2,3]]

Det[HH]

Minors[HH]//MatrixForm

Reverse[Minors[HH],{1,2}]//MatrixForm

Minors[HH][[1,1]]

Reverse[Minors[HH],{1,2}][[1,1]]

Det[{{2,5,0},{0,-2,2},{-2,3,1}}]

Det[{{2,-1,1},{-3,2,5},{1,0,-2}}]

Sum[HH[[1,j]]*Reverse[Minors[HH],{1,2}][[1,j]]*(-1)^(1+j),{j,1,4}]

Sum[HH[[2,j]]*Reverse[Minors[HH],{1,2}][[2,j]]*(-1)^(2+j),{j,1,4}]

Sum[HH[[3,j]]*Reverse[Minors[HH],{1,2}][[3,j]]*(-1)^(3+j),{j,1,4}]

Sum[HH[[4,j]]*Reverse[Minors[HH],{1,2}][[4,j]]*(-1)^(4+j),{j,1,4}]

Sum[HH[[i,1]]*Reverse[Minors[HH],{1,2}][[i,1]]*(-1)^(i+1),{i,1,4}]

Sum[HH[[i,2]]*Reverse[Minors[HH],{1,2}][[i,2]]*(-1)^(i+2),{i,1,4}]

Sum[HH[[i,3]]*Reverse[Minors[HH],{1,2}][[i,3]]*(-1)^(i+3),{i,1,4}]

Sum[HH[[i,4]]*Reverse[Minors[HH],{1,2}][[i,4]]*(-1)^(i+4),{i,1,4}]

MatrixForm[FF.GG]

MatrixForm[GG.FF]

Det[FF.GG]

Det[GG.FF]

Det[FF]*Det[GG]

Inverse matrix

HH

MatrixForm[HH]

Det[HH]

HHI=Inverse[HH]

MatrixForm[HHI]

Det[HHI]

MatrixForm[HH.HHI]

MatrixForm[HHI.HH]

Minors[HH]//MatrixForm

HHmin=Reverse[Minors[HH],{1,2}]

MatrixForm[HHmin]

Do[HHij[i,j]=HHmin[[i,j]]*(-1)^(i+j),{i,1,4},{j,1,4}]

Hij=Array[HHij,{4,4}]

MatrixForm[Hij]

Transpose[Hij]/Det[HH]//MatrixForm

HHI//MatrixForm

Inverse[FF]//MatrixForm

Inverse[GG]//MatrixForm

Inverse[FF.GG]//MatrixForm

Inverse[GG].Inverse[FF]//MatrixForm

Linear equations

FF //MatrixForm

FF

DD//MatrixForm

DD

LinearSolve[FF,DD]

Inverse[FF].DD

Solve[{3x1+4x2==7,5x1-8x2==9},{x1,x2}]

Eigenvalues and eigenvectors

FF

FFT=Transpose[FF]

II={{1,0,0},{0,1,0},{0,0,1}}

MatrixForm[II]

NSolve[Det[FF-lam*II]==0,lam]

N[Eigenvalues[FF]]

N[Eigenvalues[FFT]]

lam1=N[Eigenvalues[FFT]][[1]]

lam2=N[Eigenvalues[FFT]][[2]]

lam3=N[Eigenvalues[FFT]][[3]]

rightev=N[Eigenvectors[FF]]

leftev=N[Eigenvectors[FFT]]

rev1=N[Eigenvectors[FF]][[1]]

rev2=N[Eigenvectors[FF]][[2]]

rev3=N[Eigenvectors[FF]][[3]]

lev1=N[Eigenvectors[FFT]][[1]]

lev2=N[Eigenvectors[FFT]][[2]]

lev3=N[Eigenvectors[FFT]][[3]]

lev1n=lev1/Norm[lev1]

lev2n=lev2/Norm[lev2]

lev3n=lev3/Norm[lev3]

rev1n=rev1/Norm[rev1]

rev2n=rev2/Norm[rev2]

rev3n=rev3/Norm[rev3]

lev1n.Transpose[rev2n]