Figures in Primer 2: Matrix Algebra

Clear["Global`*"]

Figure P2.1

axisplot is just used to generate the proper axes and plot range:

axisplot=Plot[0,{x,0,0.00001},PlotRange->{{0,2.5},{0,2.5}}]

Show[axisplot,
Graphics[{Arrow[{{0,0},{1,1}}],Arrow[{{0,0},{0.5,2}}],Arrow[{{0,0},{2,0.5}}]}],
PlotRange->{{0,2.5},{0,2.5}}]

Show[axisplot,Graphics[{Arrow[{{0,0},{1,1}}],Dashing[{0.01}],Arrow[{{0,0},{0.5,2}}],Dashing[{0.04}],Arrow[{{0,0},{2,0.5}}]}],
PlotRange->{{0,2.5},{0,2.5}}]

On this plot, we draw arrows, whose color is specified by Hue[]:

Show[axisplot,Graphics[{Arrow[{{0,0},{1,1}}],Hue[0],Arrow[{{0,0},{0.5,2}}],Hue[0.7],Arrow[{{0,0},{2,0.5}}]}]]

Figure P2.2

axisplot is just used to generate the proper axes and plot range:

axisplot3D=Plot3D[0,{x,0,0.0001},{y,0,0.0001},PlotRange->{{0,2.5},{0,2.5},{0,2.5}}]

Show[axisplot3D,
Graphics3D[{Arrow[{{0,0,0},{0,2,1}}],Arrow[{{0,0,0},{2,0,1}}],Arrow[{{0,0,0},{1,2,2}}],Arrow[{{0,0,0},{2,2,1}}]}]
]

Figure P2.3

axisplot is just used to generate the proper axes and plot range:

axisplot=Plot[0,{x,0,0.00001},PlotRange->{{0,2.5},{0,2.5}}]

mat={{1,0},{0,1}};

Show[axisplot,
Graphics[{Arrow[{{0,0},mat.{1,1}}],{Dashed,Arrow[{{0,0},mat.{0.5,1}}]}}],
PlotRange->{{-2.1,2.1},{-2.1,2.1}},AspectRatio->1]

mat={{2,0},{0,2}};

Show[axisplot,Graphics[{Arrow[{{0,0},mat.{1,1}}],{Dashed,Arrow[{{0,0},mat.{0.5,1}}]}}],
PlotRange->{{-2.1,2.1},{-2.1,2.1}},AspectRatio->1]

mat={{2,0},{0,0.5}};

Show[axisplot,Graphics[{Arrow[{{0,0},mat.{1,1}}],{Dashed,Arrow[{{0,0},mat.{0.5,1}}]}}],
PlotRange->{{-2.1,2.1},{-2.1,2.1}},AspectRatio->1]

mat={{-1,0},{0,1}};

Show[axisplot,Graphics[{Arrow[{{0,0},mat.{1,1}}],{Dashed,Arrow[{{0,0},mat.{0.5,1}}]}}],
PlotRange->{{-2.1,2.1},{-2.1,2.1}},AspectRatio->1]

mat={{Cos[theta],-Sin[theta]},{Sin[theta],Cos[theta]}}/.theta->150/360 *2 Pi;

Show[axisplot,Graphics[{Arrow[{{0,0},mat.{1,1}}],{Dashed,Arrow[{{0,0},mat.{0.5,1}}]}}],
PlotRange->{{-2.1,2.1},{-2.1,2.1}},AspectRatio->1]

mat={{0,1},{1,0}};

Show[axisplot,Graphics[{Arrow[{{0,0},mat.{1,1}}],{Dashed,Arrow[{{0,0},mat.{0.5,1}}]}}],
PlotRange->{{-2.1,2.1},{-2.1,2.1}},AspectRatio->1]

Figure P2.4

axisplot is just used to generate the proper axes and plot range:

axisplot=Plot[0,{x,0,0.00001},PlotRange->{{0,2.5},{0,2.5}}]

Show[axisplot,Graphics[{Arrow[{{0,0},{4,7}}],Arrow[{{4,7},{6,5}}],Arrow[{{0,0},{6,5}}]}],
PlotRange->{{0,8},{0,8}}]

Figure P2.5

axisplot is just used to generate the proper axes and plot range:

axisplot=Plot[0,{x,0,0.00001},PlotRange->{{0,2.5},{0,2.5}}]

plot1=Show[axisplot,Graphics[{{Thick,Arrow[{{0,0},{1,1}}]},Arrow[{{0,0},{0.5,1}}]}],
PlotRange->{{-2.1,2.1},{-2.1,2.1}},AspectRatio->1]

scalar=2;

plot2=Show[axisplot,Graphics[{Dashing[0.05],{{Thick,Arrow[{{0,0},scalar {1,1}}]},Arrow[{{0,0},scalar {0.5,1}}]}}],
PlotRange->{{-2.1,2.1},{-2.1,2.1}},AspectRatio->1]

scalar=-1;

plot3=Show[axisplot,Graphics[{Dashing[0.02],{Thick,Arrow[{{0,0},scalar {1,1}}]},Arrow[{{0,0},scalar {0.5,1}}]}],
PlotRange->{{-2.1,2.1},{-2.1,2.1}},AspectRatio->1]

Show[plot1,plot2,plot3]

Figure P2.6

axisplot is just used to generate the proper axes and plot range:

axisplot=Plot[0,{x,0,0.00001},PlotRange->{{0,2.5},{0,2.5}}]

PlotRangeVectors={{-3,3},{-3,3}};

theta=RandomReal[] 2 π;
vec1={Cos[theta],Sin[theta]};
theta=RandomReal[] 2 π;
vec2={Cos[theta],Sin[theta]};
theta=RandomReal[] 2 π;
vec3={Cos[theta],Sin[theta]};
theta=RandomReal[] 2 π;
vec4={Cos[theta],Sin[theta]};
theta=RandomReal[] 2 π;
vec5={Cos[theta],Sin[theta]};

vec1={0.128284,0.991737};

vec2={0.935425,-0.353525};

vec3={-0.922269,-0.386548};

vec4={-0.170201,0.985409};

vec5={0.91,0.414608};

mat={{1,0},{0,1}};

Show[axisplot,Graphics[{Arrow[{{0,0},mat.vec1}],Arrow[{{0,0},mat.vec2}],Arrow[{{0,0},mat.vec3}],Arrow[{{0,0},mat.vec4}],Arrow[{{0,0},mat.vec5}]}],
PlotRange->PlotRangeVectors,AspectRatio->1]

mat={{0.5,1},{-1,2}};

Show[axisplot,Graphics[{Arrow[{{0,0},mat.vec1}],Arrow[{{0,0},mat.vec2}],Arrow[{{0,0},mat.vec3}],Arrow[{{0,0},mat.vec4}],Arrow[{{0,0},mat.vec5}]}],
PlotRange->PlotRangeVectors,AspectRatio->1]

mat={{0.5,1},{1,2}};

Show[axisplot,Graphics[{Arrow[{{0,0},mat.vec1}],Arrow[{{0,0},mat.vec2}],Arrow[{{0,0},mat.vec3}],Arrow[{{0,0},mat.vec4}],Arrow[{{0,0},mat.vec5}]}],
PlotRange->PlotRangeVectors,AspectRatio->1]

Figure P2.7

axisplot is just used to generate the proper axes and plot range:

axisplot=Plot[0,{x,0,0.00001},PlotRange->{{0,2.5},{0,2.5}}]

PlotRangeVectors={{-7,7},{-7,7}};

mat={{1,2},{3,2}};
Eigensystem[mat]

vec1={1,3/2};
vec2={4,-4};
vec3={-2,-0.5};
vec4={-2,0.5};
vec5={3,-1};

mat={{1,0},{0,1}};

Show[axisplot,Graphics[{Arrow[{{0,0},mat.vec1}],Arrow[{{0,0},mat.vec2}],Arrow[{{0,0},mat.vec3}],Arrow[{{0,0},mat.vec4}],Arrow[{{0,0},mat.vec5}]}],
PlotRange->PlotRangeVectors,AspectRatio->1]

mat={{1,2},{3,2}};

Show[axisplot,Graphics[{Arrow[{{0,0},mat.vec1}],Arrow[{{0,0},mat.vec2}],Arrow[{{0,0},mat.vec3}],Arrow[{{0,0},mat.vec4}],Arrow[{{0,0},mat.vec5}]}],
PlotRange->PlotRangeVectors,AspectRatio->1]

Show[axisplot,Graphics[{Arrow[{{0,0},vec1}],Arrow[{{0,0},mat.vec1}],Arrow[{{0,0},vec2}],Arrow[{{0,0},mat.vec2}]}],
PlotRange->PlotRangeVectors,AspectRatio->1]

Show[axisplot,Graphics[{Arrow[{{0,0},vec3}],Arrow[{{0,0},mat.vec3}],Arrow[{{0,0},vec5}],Arrow[{{0,0},mat.vec5}]}],
PlotRange->PlotRangeVectors,AspectRatio->1]

Figure P2.8

matA={{ 4,1},{1,3}};

mat=matA.{{3/2,0},{0,3}}.Inverse[matA]

Eigensystem[mat]

axisplot is just used to generate the proper axes and plot range:

axisplot=Plot[0,{x,0,0.00001},PlotRange->{{0,2.5},{0,2.5}}]

PlotRangeVectors={{0,5},{0,5}};

vec1={ 4,1};
vec2={1,3};
vec3={2,1};

mat.vec3

Show[axisplot,Graphics[{Arrow[{{0,0},vec1}],Arrow[{{0,0},vec2}],Arrow[{{0,0},vec3}],Arrow[{{0,0},mat.vec3}]}],
PlotRange->PlotRangeVectors,AspectRatio->1]