Tutorial 08
Vectors, Tensors, and Transformations

Copyright © 2003 by Bill Titus, Carleton College,
Department of Physics and Astronomy, Northfield, MN  55057-4025
March 1, 2003

Part 1 - Getting Started

Step 1.  Start up Mathematica and open the notebook  Tutorial08.nb.  Remember, this notebook is located in the workshop folder.

Step 2.  OPTIONAL.  Since you're going to edit this notebook, you need to make a copy of this notebook and work with that copy.  To do so, select  File / SaveAs  from the Mathematica menu and save the notebook in the workshop folder under the name  myTutorial08.nb.

Part 2 - Vectors

Topics and Skills

1.  A vector as a list of components
2.  The Mathematica commands  MatrixForm[]  and  Print[] 
3.  Basic vector operations:  addition and scalar multiplication
4.  Animation within Mathematica
5.  The Mathematica command  Flatten[]

Step 1.  Suppose  u  is a position vector to a particular point in a 2D space and measurements are taken with respect to a cartesian coordinate system with  x  and  y  axes.  Assume that the vector's x-component is  2.0  and its y-component is  4.0,  measured in appropriate units.  In Mathematica, the vector  u  is represented as a list, whose first entry is the x-component of the vector and whose second entry is the y-component.   Define this vector  u  in the cell below.

Comment 1

1.  You have just seen that in 2D,  the vector  u,  with x-component  x  and y-component   y,  has the form  {x, y}.   Not surprising, in 3D,  u  would be written in term of its three cartesian components as  {x, y, z}.

Step 2.  OK, you say, but aren't vectors written as column or rows?  Yes, but not in the world of Mathematica where lists rule supreme.  However, once you define a vector in Mathematica as a list, you can express it in traditional notation using the Mathematica function  MatrixForm[].  Get Mathematica help on this function and apply it to vector  u  defined in Step 1.

Comment 2

1.  Be aware that  MatrixForm[]  is used for display purposes.  However, Mathematica allows vectors that are expressed in matrix form to be manipulated; for example, adding the output of two matrix form vectors turns out to be equivalent to adding the two vectors in list form and then taking the matrix form of that results.  However I don't encourage you to do this.
2.  You'll work with the list version for vectors and matrices in this tutorial since it gives you a better feeling for what Mathematica actually does with vectors and matrices and can be generalized to higher rank tensors.

Step 3.  When I want to display a vector in matrix form, my preference is to use Mathematica's  Print[]  function to display the results.  Get help on  Print[]  and apply the function to  MatrixForm[u].

Step 4.  You can make the output look even nicer by having Mathematica print the relation   u = (({{x}, {y}})).   To see how do to this, look over the code below and then activate the cell.

Print["u = ", MatrixForm[u]];

Comment 4

1.  Here you've used that fact that  Print[] can take on multiple arguments.
2.  Note that when  Print[]  is used,  there is no  Out[] label on the output cell because  Print[]  technically doesn't return anything.  What appears is really a side effect of the function.

Step 5.  The most basic operations on vectors are scalar multiplication and vector addition.  Activate the cell below that shows the definitions of the multiplication of a vector by a scalar and the addition of two vectors.  For simplicity, you'll work in 2D space, although the definitions are easily generalized to 3D vectors.  Then, as practice, express   α*u1  and  u1 + u2   in more tradition matrix form using what you learned in Step 4; here  α  is a constant.

Clear[u1, u2, u3, u4, α, x1, y1, x2, 
      y2]
u1 = {x1, y1}
u2 = {x2, y2}
u3 = α*u1
u4  =  u1 + u2

Comment 5

1.  In terms of components, vector addition causes the respective components of the vectors to be added together and scalar multiplication by a constant  α   causes each component of the vector to be multiplied by  α.

Step 6.  You can visualize a vector as a point in space, relative to the origin of your coordinate system, or as arrow from the origin to the point in question.   Both viewpoints have there strengths and weaknesses, but you'll concentrate on the first one in this tutorial, which is helpful when investigating the transformation properties of vectors.

Now, in the cell below, define vectors,  (Subscript[u, 1])  and  (Subscript[u, 2])  as   {1, 3}   and   {2, 1},  respectively.  Also define  uList  to be the list containing these two vectors.

Comment 6

1.  You should find that   uList = {{1,3},{2,1}}.

Step 7.  You can use  ListPlot[]  to plot these two points in a frame diagram.  The code below does that.  A color is chosen for the points and the points are sufficiently large so that they're easily visible.  The plot has the range  -10.0  ≤  x  ≤  10.0  and  -10.0  ≤  y ≤  10.0.  The option  AspectRatio->Automatic  prevents any distortion of the plot due to an aspect ratio other than one.  Look over the code and then activate the cell.

ListPlot[uList, 
        PlotStyle -> {RGBColor[1, 0, 0], PointSize[0.02]}, 
        Frame -> True, PlotRange -> {{-10, 10}, {-10, 10}}, 
        AspectRatio -> Automatic];

Step 8.  Suppose you, as a geologist, have identified the four vectors,  {1, 2},  {-2, 3},  {2, -2},  and  {0, 1},  and you want to visually see what happens to them when each is displaced by the same vector  (Subscript[r, 0]) = {1, -2}.  (OK, you really know what this operation does, but this example will be a good entry into visualizing transformations of all types.)  In the cell below, code is written to define the four original vectors as  u1,  u2,  u3,  and  u4  and to use vector addition to find the vectors w1,  w2,  w3,  and  w4  after displacement, i.e.,  w1 = r0 + u1.  Look over the code and then activate the cell.

Clear[r0, u1, u2, u3, u3, uList, w1, w2, w3, w4, wList, plot1, 
      plot2]
r0 = {2, -4};
u1 = {1, 2}; u2 = {-2, 3}; u3 = {2, -2}; u4 = {0, 1}; 
    uList = {u1, u2, u3, u4};
w1 = u1 + r0; w2 = u2 + r0; w3 = u3 + r0; w4 = u4 + r0; 
    wList = {w1, w2, w3, w4};
plot1 = 
        ListPlot[uList, 
          PlotStyle -> {RGBColor[1, 0, 0], PointSize[0.02]}, 
          Frame -> True, 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic];
plot2 = 
        ListPlot[wList, 
          PlotStyle -> {RGBColor[0, 0, 1], PointSize[0.02]}, 
          Frame -> True, 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic];
Show[{plot1, plot2}];

Step 9.  It's not overly obvious from your composite plot that the points underwent simple translation since it's difficult to identity pairs of points.  One way around this is to operate on a particular set of points, like a line, a circle, or even a lattice.  Activate the cell below which shows the effect of  (Subscript[r, 0]) = {2, -4}  on a line composed for a large number of points.

Clear[a, b, oldLine]
a = 1; b = 2; 
\(oldLine = Table[{s, a*s + b}, {s, \(-2\), 2, 0.2}]; 
\)
Clear[r0, newLine]
r0 = {2, -4}; 
\(\(newLine = 
        oldLine /. {x_, y_} -> 
            r0 + {x, y};\)
\)
Clear[plot1, plot2]
plot1 = 
        ListPlot[oldLine, Frame -> True, 
          PlotStyle -> RGBColor[1, 0, 0], 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic, 
          DisplayFunction -> Identity];
plot2 = 
        ListPlot[newLine, Frame -> True, 
          PlotStyle -> RGBColor[0, 0, 1], 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic, 
          DisplayFunction -> Identity];
Show[{plot1, plot2}, 
        DisplayFunction -> $DisplayFunction];

Comment 9

1.  Notice that   Table[]   was used to generate a line with slope  a  and intercept  b  through the equation   y = ax + b.
2.  The vectors were translated using the data transformation technique discussed in Tutorial 05, that is, each element of the form  {x, y}  from the original list was replaced by   r0 + {x, y}  using   {x_, y_} -> r0 + {x, y}.
3.  Finally  plot1 and  plot2  were not shown individually by invoking the option  DisplayFunction->Identity  in the individual plot commands.  They then appear together in  Show[]  after using the Mathematica option  DisplayFunction->$DisplayFunction.

Step 10.  If this transformation process was do to very small translations in the same direction as the finite one, then Mathematica can animate the process.  How does you do that?  What you do is to produce separate frames after each small displacements and then run through all the frames consecutively to produce a movie.  Look over the code below and then activate the cell to create the frames.  Once the frames have been produced, double click on the cell bracket surrounding all the frames, after which only a single frame will show.  Then highlight the cell bracket and press  (apple)(y)  or go to the Mathematica menu and select  Cell / Animate Selected Graphics.

Clear[r0]
r0 = {2, -4};
Table[
        ListPlot[oldLine /. {x_, y_} -> s*r0 + {x, y}, 
          Frame -> True, 
          PlotStyle -> {RGBColor[1, 0, 0], PointSize[0.01]}, 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic], {s, 0, 2, 0.05}];

Comment 10

1.  When the move runs through once, it recycles back to the beginning and starts again.
2.  While the animation is running, there are some controls in the lower left hand corner that you can play with that affect the direction the movie plays and its speed.

Step 11.  Now you're going to do the same thing to a circle of radius  2.0.  Look over the code below and then activate the cell.

Clear[a, oldCircle]
a = 2; 
\(\(oldCircle = 
        Table[{a*Cos[ϕ], a*Sin[ϕ]}, {ϕ, 0, 
            2  π, π/8}];\)
\)
Clear[r0]
r0 = {2, -4};
Table[
        ListPlot[oldCircle /. {x_, y_} -> s*r0 + {x, y}, 
          Frame -> True, 
          PlotStyle -> {PointSize[0.01], RGBColor[1, 0, 0]}, 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic], {s, 0, 2, 0.1}];

Comment 11

1.  The original circle was produced using the expression for the cartesian coordinates  {x, y}  in terms of the polar coordinates  {r, ϕ},  i.e.  x = r cos[ϕ]  and  y = r sin[ϕ],  where  ϕ  is measured counterclockwise from the x-axis.

Step 12.  Finally do the same thing to the square lattice of points defined below.  Look over the code carefully; it's spread over several cells.  The code uses  Table[]  to produce a 2D array of points.  It then uses the Mathematica function  Flatten[]  to remove one set of parentheses from the 2D list to convert the list into a 1D list of points.  Once you understand how the code works, activate the cells.

Clear[a, oldLattice]
a = 1;
oldLattice = 
      Table[{m*a, n*a}, {m, -2, 2}, {n, -2, 2}]

?Flatten

oldLattice = Flatten[oldLattice, 1]

ListPlot[oldLattice, Frame -> True, 
        PlotStyle -> RGBColor[0, 0, 1], 
        PlotRange -> {{-10, 10}, {-10, 10}}, 
        AspectRatio -> Automatic];

Clear[r0]
r0 = {2, -4};
Table[
        ListPlot[oldLattice /. {x_, y_} -> s*r0 + {x, y}, 
          Frame -> True, 
          PlotStyle -> {PointSize[0.01], RGBColor[1, 0, 0]}, 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic], {s, 0, 2, 0.1}];

Comment 12

1.  The procedure indicated in the steps above is the only way to produce animations within Mathematica.  
2.  Note that the transformation equations used in the animations make use of both vector scalar multiplication and vector addition.

Part 3 - Some Basic Properties and Operations on Tensors in 2D Space

Topics and Skills

1.  Matrices as lists
2.  Basic matrices operations:  addition, scalar multiplication, multiplication
3.  Special matrices:  transpose, inverse, identity
4.  The Mathematica commands  Dot[],  Transpose[],  Inverse[],  Det[],  Simplify[]
5.  Eigenvectors and values and the Mathematica commands  Eigenvector[],  Eigenvalue[],  Eigensystem[]

Step 1.  Tensors, in general, can be used to transform vectors and other tensors.  For example, there's a set of elementary tensors corresponding to rotations, pure shear, simple shear, reflections, and inversions that transforms vectors from point to another.   You can generate more complex tensors by taking successive products of the elementary ones.  Traditionally, in 2D space, tensors are represented by  2×2 matrices.  Not surprisingly, Mathematica treats such tensors as a list of a list of points.  For example, a traditional matrix in 2D space, with element a[1, 1],  a[1, 2],  a[2, 1],  and  a[2, 2],  would be written as

				     (({{a[1, 1], a[1, 2]}, {a[2, 1], a[2, 2]}}))
							
Mathematica expresses this matrix as the list  { {a[1, 1],  a[1, 2]},  {a[2, 1],  a[1, 1} }.  Create the Mathematica matrix  g  in the cell below that corresponds to the traditional matrix

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

Step 2.  Display g   in matrix form by invoking   MatrixForm[].

Step 3.  The following cell show how one adds matrices, multiplies a matrix by a scalar  α,  and multiplies two matrices together.

Clear[g1, a, g2, b, α, g3, g4, g5]
g1 = {{a[1, 1], a[1, 2]}, {a[2, 1], a[2, 2]}};
\(\(\(g2 = {{b[1, 1], b[1, 2]}, {b[2, 1], b[2, 2]}};\)\(
\)
    \)\)
g3 = g1 + g2;
g4 = α*g1;
g5 = g1 . g2;

g1 // MatrixForm
g2 // MatrixForm
g3 // MatrixForm
g4 // MatrixForm
g5 // MatrixForm

Comment 3

1.  For variety sake, the function  MatrixForm[]  has been applied to the matrices using postfix notation, i.e., the function appears after the fact.
2.  The quantities  a[i,j]  and  b[i,j]  look like array elements, and can be thought of in that way.  However, as far as Mathematica is concerned,  a[]  and   b[]  are functions that take on values only for the integer arguments  i   and  j.
3.  Matrix multiplication is denoted by the symbol  .   and is equivalent to the function  Dot[].

Step 4.  Sometimes you need to perform special operations on a matrix.  For example, the transpose of a matrix yields a matrix whose elements correspond to those of the original matrix, but now reflected across the matrix diagonal.   The inverse of a matrix yields a matrix such that when it's multiplied by the original matrix, the result is the identity matrix, i.e., a matrix with  1's  on the diagonal and  0's  everywhere else.  

Suppose   g  is the matrix  { {a[1,1],  a[1, 2]},  {a[2, 1], a[2,2]} }.   The transpose of  g  can be found from the Mathematica function   Transpose[]  and the inverse of  g  from the function  Inverse[].  Define the matrix  g  in the cell below and then operate on it to find its transpose and inverse.  Display the results in matrix form.

Comment 4

1.  Be forewarned that every matrix doesn't have an inverse.  In particular, if the denominator in the expression above for the inverse is zero,  then the inverse isn't defined.  That denominator is nothing more than the determinant of  g.   Mathematica calculates the determinant of a matrix using its function  Det[].

Step 5.  If  g  is a matrix  and  (g^(-1))  is its inverse, then their matrix product must be the identity matrix.  Active the cell below to verify that this is indeed true when Mathematica's inverse function is used to defines  (g^(-1)).

Clear[g, a, gInv]
g = {{a[1, 1], a[1, 2]}, {a[2, 1], 
            a[2, 2]}};
gInv = Inverse[g];

    
g . gInv
gInv . g

Comment 5

1.  Well, that looks awful.  Mathematica hasn't simplified the algebra.  On the other hand, you have told it to do so.  But you can by invoking the function  Simplify[].  Go back to the cell in Step 5 and applied  Simplify[]  to   g.gInv  and  gInv.g   using postfix notation.  You'll be happy with the results.

Step 6.  A matrix  g  has an eigenvalue and eigenvector if there exists a vector  ψ  such that  g . ψ   is proportional to  ψ.  The constant of proportionality is the eigenvalue and  ψ  is the eigenvector.  Note that an eigenvector is always paired with an eigenvalue.  A given matrix can have between zero and two eigenvector/eigenvalue pairs.  Usually, considerable algebra must to implored to determine the eigenvalues and eigenvectors of a matrix, especially if the dimension of the matrix is greater than two.  But Mathematica is great at algebra and has three functions than can you help out.  Get help of the Mathematica functions  Eigenvalues[],  Eigenvectors[],  and   Eigensystem[].

Comment 6

1.  Note that  Eigensystem[] calculates both the eigenvectors and values and will be the one you use in the next step.

Step 7.  Define  g  to be the matrix  {{1,2},{3,4}}.  Then, in the cell below, find its eigenvalues and eigenvectors.

Comment 7

1.  It turns out that the sum of the eigenvalues is also equal to the sum of the diagonal matrix elements in the original matrix.  This can serve as a check for your calculation.

Step 8.  The following code verifies that the matrix in Step 7 does indeed have the eigenvalues and vectors as calculated by Mathematica.  Look over the code and try to understand what it's doing before you activate it.

Clear[g, λ1, λ2, u1, u2, lhs, 
      rhs]
g = {{1, 2}, {3, 4}};
{{λ1, λ2}, {u1, u2}} = 
        Eigensystem[g];

    
g . u1
λ1*u1

    
lhs = g . u1 // Simplify
rhs = λ1*u1 // Simplify

    
lhs == rhs

    
((g . u2) // Simplify)  == ((λ2*u2) // 
          Simplify)

Part 4 - The Rotation Matrix in 2D Space

Step 1.  Let  u = {x, y}  be a vector in 2D space.  If the vector is rotated by an angle  θ  in the counterclockwise direction, then the new vector has a  x-component,   x cos[θ]  -  y sin[θ],  and a  y-component,   x sin[θ]  +  y cos[θ].   This rotation operator can be represent by the 2×2 matrix

				rot  =  (({{cos[θ], -sin[θ]}, {sin[θ], cos[θ]}})) ,
			
such that the matrix  rot  times the vector  r  yields the rotated vector.

In the cell below, define the vector  r,   the matrix  rot,  and verify that  rot.r  gives the equations for the rotated vector stated above.

Step 2.  It's not overly obvious from these equations that  rot  does what it claims to do.  You can, however, look at the process visually by having Mathematica display the effect of  rot  on points, lines, circles, lattices, etc.  You'll start with a point on the x-axis and rotate it through an angle of  π/3  (60°)  in the counterclockwise direction.  Look over the code below and then activate the cell.  A single plot will be shown with the original point displayed in red and the rotated point in blue.

Clear[oldPoint, θ, rot, newPoint]
oldPoint = {5, 0};
θ = π/3; 
    rot = {{Cos[θ], -Sin[θ]}, {Sin[θ], 
          Cos[θ]}};
newPoint = 
        rot . oldPoint;

Clear[plot1, plot2]
plot1 = 
        ListPlot[{oldPoint}, Frame -> True, 
          PlotStyle -> {RGBColor[1, 0, 0], PointSize[0.02]}, 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic, 
          DisplayFunction -> Identity];
plot2 = 
        ListPlot[{newPoint}, Frame -> True, 
          PlotStyle -> {RGBColor[0, 0, 1], PointSize[0.02]}, 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic, 
          DisplayFunction -> Identity];
Show[{plot1, plot2}, 
        DisplayFunction -> $DisplayFunction];

Comment 2

1.  If you'd rather rotate the vector clockwise, then in the definition of the rotation matrix, replace  θ  by  -θ,  or equivalently,  sin[θ]  by  -sin[θ]  and  cos[θ]  by  cos[θ].

Step 3.  From this single plot, it's not clear that the rotated point lies on a circle of radius  2.  You can get a better visually sense of  rot  by having it operate on a line of points.  Activate the cell below that shows the effect of  rot  on a line of points that pass through the origin.

Clear[a, b, oldLine, θ, rot, newLine]
a = 1; b = 0; 
oldLine = Table[{s, a*s + b}, {s, -2, 2, 0.2}]; 
θ = π/3; 
    rot = {{Cos[θ], -Sin[θ]}, {Sin[θ], 
          Cos[θ]}}; 
\(\(newLine = 
        oldLine /. {x_, y_} -> 
            rot . {x, y};\)
\)
Clear[plot1, plot2]
plot1 = 
        ListPlot[oldLine, Frame -> True, 
          PlotStyle -> RGBColor[1, 0, 0], 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic, 
          DisplayFunction -> Identity];
plot2 = 
        ListPlot[newLine, Frame -> True, 
          PlotStyle -> RGBColor[0, 0, 1], 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic, 
          DisplayFunction -> Identity];
Show[{plot1, plot2}, 
        DisplayFunction -> $DisplayFunction];

Step 4.  If this transformation process was due to very small rotation in the same direction as the finite rotation,  Mathematica can animate the process.  As you did in Part 2, you produce separate frames after each small rotation and then run through all the frames consecutively to produce a movie.  Look over the code below and then activate the cell to create the frames.  Once the frames have been produced, double click on the cell bracket surrounding all the frames, after which only a single frame will show, and finally press  (apple)(y).

Clear[rot, θ]
rot[θ_] = {{Cos[θ], -Sin[θ]}, {Sin[θ], 
            Cos[θ]}};

Clear[a, b]
a = 1; b = 0;
\(\(oldLine = 
        Table[{s, a*s + b}, {s, \(-2\), 2, 
            0.2}];\)
\)
Table[
        ListPlot[oldLine /. {x_, y_} -> rot[θ] . {x, y}, 
          Frame -> True, 
          PlotStyle -> {RGBColor[1, 0, 0], PointSize[0.01]}, 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic], {θ, 
          0, π/6, π/60}];

Clear[rot, θ]
rot[θ_] = {{Cos[θ], -Sin[θ]}, {Sin[θ], 
            Cos[θ]}};

Clear[a, b]
a = 1; b = 2;
\(\(oldLine = 
        Table[{s, a*s + b}, {s, \(-2\), 2, 
            0.2}];\)
\)
Table[
        ListPlot[oldLine /. {x_, y_} -> rot[θ] . {x, y}, 
          Frame -> True, 
          PlotStyle -> {RGBColor[1, 0, 0], PointSize[0.01]}, 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic], {θ, 0, 
          2  π - π/10, π/10}];

Comment 4

1.  Go back to the code in Step 4 and see what happens if you put  b = 2  and leave  a  the same, and have  θ  go  from  0  to  2π  in steps of   π / 10.

Step 5.  Finally do the same thing to the rectangular lattice of points defined below.  Look over the code carefully before you activate the cell.

Clear[rot, θ]
rot[θ_] = {{Cos[θ], -Sin[θ]}, {Sin[θ], 
            Cos[θ]}};

Clear[a, oldLattice]
\(a = 1; 
    oldLattice = 
      Flatten[Table[{m*a, n*a}, {m, \(-2\), 2}, {n, \(-3\), 3}], 
        1];
\)
Table[
        ListPlot[oldLattice /. {x_, y_} -> rot[θ] . {x, y}, 
          Frame -> True, 
          PlotStyle -> {RGBColor[1, 0, 0], PointSize[0.01]}, 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic], {θ, 0, 
          2  π - π/10, π/10}];

Part 5 - The Simple Shear Matrix in 2D Space

Step 1.  Let  u = {x, y}  be a vector in 2D space.  If this vector undergoes simple shear with angular shear strain  γ  parallel to the x-axis, then the new vector has the x-component   x  +  γy   while the  y-component of the vector remains the same.  This simple shear operator can be represent by the 2×2 matrix

				simpleShear  =  (({{1, γ}, {0, 1}})) ,
			
such that the matrix  simpleShear  times the vector  u  yields the proper sheared vector.

In the cell below, define the vector  r,  the matrix  simpleShear,  and verify that  simpleShear.r  gives the equations for the sheared vector stated above.

Step 2.  It may not be obvious from the equations that  simpleShear  does what it claims to do.  You can, however, look at the process visually by having Mathematica display the effect of  simpleShare  on points, lines, circles, lattices, etc.  The code below shows the effect of simpleShear[],  with a value of  γ = 2  on a line, circle, and lattice.  Look over the code, be sure you understand it, and then activate the cell.

Clear[simpleShear, γ]
simpleShear[γ_] = {{1, γ}, {0, 
            1}};

    
γ = 2.2;

Clear[a, b, oldLine, newLine]
a = 1; b = 0;
oldLine = Table[{s, a*s + b}, {s, -2, 2, 0.2}];
newLine = 
        oldLine /. {x_, y_} -> 
            simpleShear[γ] . {x, 
                y};

Clear[r, oldCircle, newCircle]
r = 2;
oldCircle = 
        Table[{r*Cos[ϕ], r*Sin[ϕ]}, {ϕ, 0, 
              2  π, π/8}] // N;
newCircle = 
        oldCircle /. {x_, y_} -> 
            simpleShear[γ] . {x, 
                y};

Clear[a, oldLattice]
a = 1;
oldLattice = 
        Flatten[Table[{m*a, n*a}, {m, -2, 2}, {n, -3, 3}], 
          1];
newLattice = 
        oldLattice /. {x_, y_} -> 
            simpleShear[γ] . {x, 
                y};

Clear[plot1, plot2]
plot1 = 
        ListPlot[oldLine, Frame -> True, 
          PlotStyle -> RGBColor[1, 0, 0], 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic, 
          DisplayFunction -> Identity];
plot2 = 
        ListPlot[newLine, Frame -> True, 
          PlotStyle -> RGBColor[0, 0, 1], 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic, 
          DisplayFunction -> Identity];
Show[{plot1, plot2}, 
        DisplayFunction -> $DisplayFunction];

Clear[plot1, plot2]
plot1 = 
        ListPlot[oldCircle, Frame -> True, 
          PlotStyle -> RGBColor[1, 0, 0], 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic, 
          DisplayFunction -> Identity];
plot2 = 
        ListPlot[newCircle, Frame -> True, 
          PlotStyle -> RGBColor[0, 0, 1], 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic, 
          DisplayFunction -> Identity];
Show[{plot1, plot2}, 
        DisplayFunction -> $DisplayFunction];

Clear[plot1, plot2]
plot1 = 
        ListPlot[oldLattice, Frame -> True, 
          PlotStyle -> RGBColor[1, 0, 0], 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic, 
          DisplayFunction -> Identity];
plot2 = 
        ListPlot[newLattice, Frame -> True, 
          PlotStyle -> RGBColor[0, 0, 1], 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic, 
          DisplayFunction -> Identity];
Show[{plot1, plot2}, 
        DisplayFunction -> $DisplayFunction];

Step 3.  Note how much of the code above was repetitious.  The code below uses  Module[]  to define a single function that plots the effect of shear on an arbitrary collection of points.  Activate the code and then apply it to a circle of radius  4.0  that is composed of  30  equally spaced points.

Clear[ssOperation, pointList, γ]
ssOperation[
        pointList_, γ_] := 
Module[
{simpleShear, γγ, newPointList, plot1, 
          plot2}, 

simpleShear[γγ_] = {{1, γγ}, {0, 
              1}}; 

newPointList = 
          pointList /. {x_, y_} -> 
              simpleShear[γ] . {x, 
                  y}; 

plot1 = 
          ListPlot[pointList, Frame -> True, 
            PlotStyle -> RGBColor[1, 0, 0], 
            PlotRange -> {{-10, 10}, {-10, 10}}, 
            AspectRatio -> Automatic, 
            DisplayFunction -> Identity]; 
plot2 = 
          ListPlot[newPointList, Frame -> True, 
            PlotStyle -> RGBColor[0, 0, 1], 
            PlotRange -> {{-10, 10}, {-10, 10}}, 
            AspectRatio -> Automatic, 
            DisplayFunction -> 
              Identity]; 

Show[{plot1, 
            plot2}, DisplayFunction -> $DisplayFunction]
]

Clear[r, oldCircle, γ]
r = 4.0; 
    oldCircle = 
      Table[{r*Cos[ϕ], r*Sin[ϕ]}, {ϕ, 0, 2  π, π/60}] // 
        N;
γ = 2.0;ssOperation[
      oldCircle, γ];

Comment 3

1.  Note that in the module definition, the function  simpleShear[] was defined inside the module versus outside; in general, this will speed up the calculations.  However, if you define functions inside modules, be sure that their variables are different from any other internal or external variables.  For example, had the symbol  γ  been used in  simpleShear[] instead the module instead of  γγ,  Mathematica would have complained since  γ  is an external variable.

Step 4.  If this transformation process was due to very small shear in the same direction as the finite shear,  Mathematica can animate the process.  The following code shows the effect a simple shear on a circle.  As you have done before, look over the code, activate the cell, and animate it in the usual way.

Clear[simpleShear, γ]
\(simpleShear[γ_] = {{1, γ}, {0, 
          1}}; 
\)
Clear[r, oldCircle]
\(r = 3; 
    oldCircle = 
      Table[{r*Cos[ϕ], r*Sin[ϕ]}, {ϕ, 0, 2  π, π/16}] // 
        N;
\)
Table[
        ListPlot[
          oldCircle /. {x_, y_} -> simpleShear[γ] . {x, y}, 
          Frame -> True, 
          PlotStyle -> {RGBColor[1, 0, 0], PointSize[0.01]}, 
          PlotRange -> {{-10, 10}, {-10, 10}}, 
          AspectRatio -> Automatic], {γ, 0, 3, 
          0.2}];

Part 6 - Other Transformations in 2D Space

You now have the tools to examine the effects of other transformations on a vector in 2D space.  Here are some possibilities:

1.  Pure shear:   (({{k, 0}, {0, 1/k}})),  where  k  is a positive constant.

2.  Inversion through the origin:   (({{-1, 0}, {0, -1}})) .

3.  Reflection about the x-axis:   (({{1, 0}, {0, -1}})) .

4.  Reflection about the y-axis:   (({{-1, 0}, {0, 1}})) .

5.  Combinations of several elementary transformations, for example,  (({{k, 0}, {0, 1/k}}))(({{1, 0}, {0, -1}}))(({{cos[θ], -sin[θ]}, {sin[θ], cos[θ]}}))(({{1, γ}, {0, 1}})) .

Part 7 - Save Your Notebook (OPTIONAL)

Step 1.  Remove all output cells from this notebook, and to do one final save of your notebook before you quit Mathematica.