(*^ ::[ Information = "This is a Mathematica Notebook file. It contains ASCII text, and can be transferred by email, ftp, or other text-file transfer utility. It should be read or edited using a copy of Mathematica or MathReader. If you received this as email, use your mail application or copy/paste to save everything from the line containing (*^ down to the line containing ^*) into a plain text file. On some systems you may have to give the file a name ending with ".ma" to allow Mathematica to recognize it as a Notebook. The line below identifies what version of Mathematica created this file, but it can be opened using any other version as well."; FrontEndVersion = "Macintosh Mathematica Notebook Front End Version 2.2"; MacintoshStandardFontEncoding; fontset = title, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e8, 24, "Times"; fontset = subtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, bold, e6, 18, "Times"; fontset = subsubtitle, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeTitle, center, M7, italic, e6, 14, "Times"; fontset = section, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, grayBox, M22, bold, a20, 18, "Times"; fontset = subsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, blackBox, M19, bold, a15, 14, "Times"; fontset = subsubsection, inactive, noPageBreakBelow, nohscroll, preserveAspect, groupLikeSection, whiteBox, M18, bold, a12, 12, "Times"; fontset = text, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = smalltext, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = input, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeInput, M42, N23, bold, L-5, 12, "Courier"; fontset = output, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = message, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, R65535, L-5, 12, "Courier"; fontset = print, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, L-5, 12, "Courier"; fontset = info, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeOutput, M42, N23, B65535, L-5, 12, "Courier"; fontset = postscript, PostScript, formatAsPostScript, output, inactive, noPageBreakInGroup, nowordwrap, preserveAspect, groupLikeGraphics, M7, l34, w282, h287, 12, "Courier"; fontset = name, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, italic, 10, "Geneva"; fontset = header, inactive, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = leftheader, inactive, L2, 12, "Times"; fontset = footer, inactive, noKeepOnOnePage, preserveAspect, center, M7, 12, "Times"; fontset = leftfooter, inactive, L2, 12, "Times"; fontset = help, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 10, "Times"; fontset = clipboard, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = completions, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special1, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special2, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special3, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special4, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; fontset = special5, inactive, nohscroll, noKeepOnOnePage, preserveAspect, M7, 12, "Times"; paletteColors = 128; automaticGrouping; currentKernel; ] :[font = input; initialization; preserveAspect] *) Exercise 2.1.1 a) (* :[font = input; initialization; preserveAspect; startGroup] *) u=Table[i!,{i,5}] (* :[font = output; output; inactive; preserveAspect; endGroup] {1, 2, 6, 24, 120} ;[o] {1, 2, 6, 24, 120} :[font = input; initialization; preserveAspect] *) b) (* :[font = input; initialization; preserveAspect; startGroup] *) v=Array[#^#&,5] (* :[font = output; output; inactive; preserveAspect; endGroup] {1, 4, 27, 256, 3125} ;[o] {1, 4, 27, 256, 3125} :[font = input; initialization; preserveAspect] *) c) (* :[font = input; initialization; preserveAspect; startGroup] *) w={-1,1,-1,1,-1} (* :[font = output; output; inactive; preserveAspect; endGroup] {-1, 1, -1, 1, -1} ;[o] {-1, 1, -1, 1, -1} :[font = input; initialization; preserveAspect] *) Exercise 2.1.2 a) (* :[font = input; initialization; preserveAspect; startGroup] *) u.v (* :[font = output; output; inactive; preserveAspect; endGroup] 381315 ;[o] 381315 :[font = input; initialization; preserveAspect] *) b) (* :[font = input; initialization; preserveAspect; startGroup] *) (u.u)^(1/2) (* :[font = output; output; inactive; preserveAspect; endGroup] 15017^(1/2) ;[o] Sqrt[15017] :[font = input; initialization; preserveAspect; startGroup] *) %//N (* :[font = output; output; inactive; preserveAspect; endGroup] 122.5438696957134613 ;[o] 122.544 :[font = input; initialization; preserveAspect] *) c) (* :[font = input; initialization; preserveAspect] *) norm[a_]:=(a.a)^(1/2) (* :[font = input; initialization; preserveAspect; startGroup] *) norm[u-v]+norm[v-w]-norm[u-w]//N (* :[font = output; output; inactive; preserveAspect; endGroup] 6027.141164310649666 ;[o] 6027.14 :[font = input; initialization; preserveAspect] *) d) (* :[font = input; initialization; preserveAspect; startGroup] *) norm[u]norm[v]-(u.v)//N (* :[font = output; output; inactive; preserveAspect; endGroup] 2931.987521047456823 ;[o] 2931.99 :[font = input; initialization; preserveAspect] *) Exercise 2.1.3 (* :[font = input; initialization; preserveAspect; startGroup] *) $Post:=If[MatrixQ[#],MatrixForm[#],#]& A=Array[Max,{3,5}] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{1, 2, 3, 4, 5}, {2, 2, 3, 4, 5}, {3, 3, 3, 4, 5}}] ;[o] 1 2 3 4 5 2 2 3 4 5 3 3 3 4 5 :[font = input; initialization; preserveAspect; startGroup] *) u=Array[#!&,{3}] (* :[font = output; output; inactive; preserveAspect; endGroup] {1, 2, 6} ;[o] {1, 2, 6} :[font = input; initialization; preserveAspect; startGroup] *) v=Array[(-1)^#&,{5}] (* :[font = output; output; inactive; preserveAspect; endGroup] {-1, 1, -1, 1, -1} ;[o] {-1, 1, -1, 1, -1} :[font = input; initialization; preserveAspect] *) a) (* :[font = input; initialization; preserveAspect; startGroup] *) u.A (* :[font = output; output; inactive; preserveAspect; endGroup] {23, 24, 27, 36, 45} ;[o] {23, 24, 27, 36, 45} :[font = input; initialization; preserveAspect] *) b) (* :[font = input; initialization; preserveAspect] *) A.u : not defined (* :[font = input; initialization; preserveAspect] *) c) (* :[font = input; initialization; preserveAspect] *) v.A : not defined (* :[font = input; initialization; preserveAspect] *) d) (* :[font = input; initialization; preserveAspect; startGroup] *) A.v (* :[font = output; output; inactive; preserveAspect; endGroup] {-3, -4, -4} ;[o] {-3, -4, -4} :[font = input; initialization; preserveAspect] *) Exercise 2.1.4 (* :[font = input; initialization; preserveAspect; startGroup] *) M=Table[Append[A[[i]],u[[i]]],{i,3}] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{1, 2, 3, 4, 5, 1}, {2, 2, 3, 4, 5, 2}, {3, 3, 3, 4, 5, 6}}] ;[o] 1 2 3 4 5 1 2 2 3 4 5 2 3 3 3 4 5 6 :[font = input; initialization; preserveAspect; startGroup] *) R=RowReduce[M] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{1, 0, 0, 0, 0, 1}, {0, 1, 0, 0, 0, 3}, {0, 0, 1, 4/3, 5/3, -2}}] ;[o] 1 0 0 0 0 1 0 1 0 0 0 3 4 5 - - 0 0 1 3 3 -2 :[font = input; initialization; preserveAspect; startGroup] *) Clear[x] Do[x[i]=R[[i,6]],{i,1,3}] x[3]+=-5x[5]/3-4x[4]/3; {x[1],x[2],x[3],x[4],x[5]} (* :[font = output; output; inactive; preserveAspect; endGroup] {1, 3, -2 - (4*x[4])/3 - (5*x[5])/3, x[4], x[5]} ;[o] 4 x[4] 5 x[5] {1, 3, -2 - ------ - ------, x[4], x[5]} 3 3 :[font = input; initialization; preserveAspect] *) Exercise 2.1.5 (* :[font = input; initialization; preserveAspect; startGroup] *) Transpose[Append[Transpose[A],u]] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{1, 2, 3, 4, 5, 1}, {2, 2, 3, 4, 5, 2}, {3, 3, 3, 4, 5, 6}}] ;[o] 1 2 3 4 5 1 2 2 3 4 5 2 3 3 3 4 5 6 :[font = input; initialization; preserveAspect] *) Exercise 2.1.6 (* :[font = input; initialization; preserveAspect] *) xA=u <==>Transpose[A].x=u (* :[font = input; initialization; preserveAspect; startGroup] *) u={1,2,3,4,5}; LinearSolve[Transpose[A],u] (* :[font = output; output; inactive; preserveAspect; endGroup] {1, 0, 0} ;[o] {1, 0, 0} :[font = input; initialization; preserveAspect] *) Since the rank of A is less or equal 3, we check that this is indeed the most general solution: (* :[font = input; initialization; preserveAspect; startGroup] *) RowReduce[Transpose[Append[A,u]]] (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{1, 0, 0, 1}, {0, 1, 0, 0}, {0, 0, 1, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}}] ;[o] 1 0 0 1 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 :[font = input; initialization; preserveAspect] *) Exercise 2.1.7 (* :[font = input; initialization; preserveAspect] *) There is no such example, i.e. associativity holds, and one can check it with symbolic matrices/vectors (valid for other dimensions than 5, too): (* :[font = input; initialization; preserveAspect; startGroup] *) Clear[a,b,u]; A=Array[a,{5,5}]; B=Array[b,{5,5}]; U=Array[u,5]; Together[(A.U).B-A.(U.B)] (* :[font = output; output; inactive; preserveAspect; endGroup] {0, 0, 0, 0, 0} ;[o] {0, 0, 0, 0, 0} :[font = input; initialization; preserveAspect] *) Exercise 2.1.8 (* :[font = input; initialization; preserveAspect] *) A=Array[Max,{5,5}]; Id=IdentityMatrix[5]; Inv=Array[0&,{5,5}]; (* :[font = input; initialization; preserveAspect] *) We solve by appending the identity matrix one column at a time and solving by row reduction, for each one column of the inverse. No check for the row reduction is made here, since the inverse is verified in the end by multiplication. The symmetry of both A and Id is used to skip trans- posing. Same for the inverse of A. (* :[font = input; initialization; preserveAspect; startGroup] *) Do[Inv[[j]]=Transpose[RowReduce[ Transpose[Append[A,Id[[j]]]]]][[6]],{j,1,5}]; Inv (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{-1, 1, 0, 0, 0}, {1, -2, 1, 0, 0}, {0, 1, -2, 1, 0}, {0, 0, 1, -2, 1}, {0, 0, 0, 1, -4/5}}] ;[o] -1 1 0 0 0 1 -2 1 0 0 0 1 -2 1 0 0 0 1 -2 1 4 -(-) 0 0 0 1 5 :[font = input; initialization; preserveAspect; startGroup] *) A.Inv (* :[font = output; output; inactive; preserveAspect; endGroup] MatrixForm[{{1, 0, 0, 0, 0}, {0, 1, 0, 0, 0}, {0, 0, 1, 0, 0}, {0, 0, 0, 1, 0}, {0, 0, 0, 0, 1}}] ;[o] 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 ^*)