© 1988-2015 by Vincent S. Cronin.  Revised 7 February 2017.  Accessible via http://CroninProjects.org/Vince/PlateKinematics/KinematicsPrimer/

3.1  Getting ready to learn

The material that follows is often covered in courses in vector analysis or linear algebra or structural geology or rigid-body mechanics, although in different ways and for different purposes.  Consequently, there are many textbook treatments of this available, at different academic levels and written for different audiences.  I have adapted material from a vector analysis textbook by Harry Davis and Arthur Snider (1987) for this chapter.

3.2  Coordinates of a point in two different 2-D coordinate systems

It has long been a classic homework problem in undergraduate structural geology courses to consider a specified vector, defined in one coordinate system, and determine its coordinates in another coordinate system.  Here, we will be using right orthogonal Cartesian coordinate systems whose length units are the same.  This type of problem is referred to as a problem in coordinate transformation.

We will take the first baby steps by thinking about a 2-D example of coordinate transformation.  Imagine a point Q whose location is specified by vector q in an X-Y orthogonal coordinate system (Figure 3-1).

___________________________________________________________________________

Figure 3-1.  Location vector to point Q is {1, 2} in the X-Y coordinate system.  The X’-Y’ coordinate system is identical to the X-Y coordinate system in all respects, except that it is oriented by θ = +30° (i.e., 30° anti-clockwise) from the X-Y coordinate system.  The length of vector q is ~2.24.

___________________________________________________________________________

The coordinates of vector q in the X-Y coordinate system are given by

q={1,2};

An infinite number of other coordinate systems that use the same origin can be specified in the X-Y plane.  Let us specify a second coordinate system, called the X’-Y’ system, in which the X’ axis is oriented θ=30° in a positive or anti-clockwise direction from the X axis, and the Y’ axis is θ=30° from the Y axis.  What are the coordinates of point Q in the X’-Y’ coordinate system, given the angle θ (theta) and the coordinates in the X-Y coordinate system?

We can determine the length of vector q using the built-in Mathematica function Norm, and display its numerical value

N[Norm[q]]

We can determine the angle ϕ (phi) between vector q and the X axis using trigonometry (remember the SOH CAH TOA mnemonic for the solution of right-triangle problems?), and display the results in degrees using the conversion factor (180/π) to convert from radians.

phi=N[(ArcTan[q[[2]]/q[[1]]])(180/π)]

The angle between the X and X’ axis is θ = 30°.

theta=30

The angle between vector q and the X’ axis is ϕ – θ, so the X’ coordinate of the location vector to point Q is

qXprime=Norm[q]Cos[(phi-theta)Degree];

and the Y’ coordinate of the location vector to point Q is

qYprime=Norm[q]Sin[(phi-theta)Degree];

The coordinates of point Q in the X’-Y’ coordinate system are given by

qPrimeMan={N[qXprime],N[qYprime]}

That was a lot of work, and thankfully there is a better and (ultimately) simpler way of doing this kind of problem.  But before we get to the simpler way, we need to learn a little bit about how to work with vectors as matrices and how to multiply matrices together.

3.3  Some matrix basics in Mathematica

First, let us define two matrices to play with.  Matrix a is known as a 3x1 matrix because it has three rows and one column.  The element in row 2 column 1  of matrix a is called (Subscript[a, 21]).

a = (({{(Subscript[a, 11])}, {(Subscript[a, 21])}, {(Subscript[a, 31])}}))

We have already learned about how to introduce vectors into Mathematica code in section 2.5.  The components of a vector are expressed as a list, so the components of a sample vector might be input between curly brackets as follows:

sampleVector={13, 4, 28};

Matrices can be thought of as lists, or lists of lists, or lists of vectors in Mathematica.  There are a couple of ways of writing the input code for matrices of other shapes in Mathematica.  The manual method uses curly brackets to organize lists of numbers or variables into columns and rows.  A matrix with 3 columns and 3 rows might be input directly using curly brackets as follows:

testMatrix1={{1,2,3},{4,5,6},{7,8,9}}

We can use the MatrixForm function to make it look like a 3x3 square matrix.

MatrixForm[testMatrix1]

Alternatively, we can use the matrix tool in the Typesetting part of the Basic Math Assistant palette.  Look for the symbol that looks like this:

(({{□, □}, {□, □}}))

Extra columns are created by inserting the cursor inside the parentheses in the default 4x4 matrix, then pressing [Ctrl ,] (that is, press the comma key with the control key depressed), and extra rows are created by pressing [Ctrl ⏎].  When you get a matrix template that looks like this

(({{□, □, □}, {□, □, □}, {□, □, □}}))

you can click on each individual square to insert a value or variable name in that space.

3.4  Recognizing different types of matrix

A square matrix has the same number of rows as columns.  In this 3x3 square matrix,

(({{A, 0, 0}, {0, B, 0}, {0, 0, C}}))

the part of the matrix that has all of the capital letters (A, B, C) is called the diagonal or axis of the matrix.  Values that are in the positions occuppied by the 0s are said to be off-axis terms.

In a symmetric matrix, like the one below, the off-axis terms in the upper right of the matrix are identical to the values in the lower left of the matrix, directly across the diagonal.

(({{A, d, e}, {d, B, f}, {e, f, C}}))

In an antisymmetric matrix, the values across the diagonal from each other have the same magnitude but different sign.

(({{A, d, -e}, {-d, B, f}, {e, -f, C}}))

An asymmetric matrix, like

(({{A, d, e}, {g, B, h}, {n, -f, C}}))

lacks at least some of the symmetries we have just examined.

If we define a matrix M as follows,

M =  (({{A, d, e}, {g, B, h}, {n, -f, C}}))

the transpose of matrix M is represented by (M^T) and is

(M^T) = (({{A, g, n}, {d, B, -f}, {e, h, C}}))

The values along the diagonal of the transposed matrix (M^T) are unchanged from the original matrix M, but the values across the diagonal from each other are swapped.

The inverse of a matrix M is indicated by (M^(-1)).  If a matrix is multiplied by its inverse, the result is the identity matrix whose diagonal terms are all 1s and whose off-axis terms are all 0s.

M · (M^(-1)) = (({{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}))

Finally, if the transpose of a matrix is the same as the inverse of the matrix (i.e., if (M^T)= (M^(-1))), that matrix (M) is called an orthogonal matrix.

3.5  A taste of matrix mathematics

Let us define two matrices to play with.  Matrix a is known as a 3x1 matrix because it has three rows and one column.  The element in row 2 column 1  of matrix a is called (Subscript[a, 21]).

a = (({{(Subscript[a, 11])}, {(Subscript[a, 21])}, {(Subscript[a, 31])}}))

Matrix b is known as a 3x3 matrix because it has three rows and three columns.  The element in row 2 column 3 of matrix b is called (Subscript[b, 23]).

b = (({{(Subscript[b, 11]), (Subscript[b, 12]), (Subscript[b, 13])}, {(Subscript[b, 21]), (Subscript[b, 22]), (Subscript[b, 23])}, {(Subscript[b, 31]), (Subscript[b, 32]), (Subscript[b, 33])}}))

We now want to learn how to multiply matrices a and b together to yield a product:  matrix c.

c = b · a

This can be expanded and made explicit by components as follows:

(({{(Subscript[c, 11])}, {(Subscript[c, 21])}, {(Subscript[c, 31])}}))=(({{(Subscript[b, 11]), (Subscript[b, 12]), (Subscript[b, 13])}, {(Subscript[b, 21]), (Subscript[b, 22]), (Subscript[b, 23])}, {(Subscript[b, 31]), (Subscript[b, 32]), (Subscript[b, 33])}}))(({{(Subscript[a, 11])}, {(Subscript[a, 21])}, {(Subscript[a, 31])}}))

We can think of matrix b as a set of coordinates associated with three 3-component vectors:

bTopRow = {(Subscript[b, 11]), (Subscript[b, 12]), (Subscript[b, 13])}

bMiddleRow = {(Subscript[b, 21]), (Subscript[b, 22]), (Subscript[b, 23])}

bBottomRow = {(Subscript[b, 31]), (Subscript[b, 32]), (Subscript[b, 33])}

so we can write this as

(c)=(({{bTopRow}, {bMiddleRow}, {bBottomRow}}))(a)

The three components of c are each found by taking a dot product of two vectors

(c)=(({{(bTopRow · a)}, {(bMiddleRow · a)}, {(bBottomRow · a)}})) =(({{((Subscript[b, 11])(Subscript[a, 11]))+((Subscript[b, 12])(Subscript[a, 21]))+((Subscript[b, 13])(Subscript[a, 31]))}, {((Subscript[b, 21])(Subscript[a, 11]))+((Subscript[b, 22])(Subscript[a, 21]))+((Subscript[b, 23])(Subscript[a, 31]))}, {((Subscript[b, 31])(Subscript[a, 11]))+((Subscript[b, 32])(Subscript[a, 21]))+((Subscript[b, 33])(Subscript[a, 31]))}}))

And so the product (c) of multiplying a 3x1 matrix (vector a) by a 3x3 matrix (matrix b) is a matrix with three components:  a vector.

In these examples, we start the process of multiplying from the right end of the equation, where we will find a 3x1 matrix representing a vector.  Multiplying a 3x1 matrix by the next matrix to the left (a 3x3 matrix) yields another 3-component matrix representing a vector.

Example.  Find the result of the following matrix multiplication:

(({{0.2, 0.6, 0.5}, {0.8, 0.9, 0.7}, {0.4, 0.1, 0.3}}))(({{11}, {15}, {18}}))

Solution

(({{0.2, 0.6, 0.5}, {0.8, 0.9, 0.7}, {0.4, 0.1, 0.3}}))(({{11}, {15}, {18}})) = (({{(0.2*11)+(0.6*15)+(0.5*18)}, {(0.8*11)+(0.9*15)+(0.7*18)}, {(0.4*11)+(0.1*15)+(0.3*18)}}))  = (({{20.2}, {34.9}, {11.3}}))

So the product of the two matrices is the following 3-component vector:  {20.2, 34.9, 11.3}

Let’s code the preceding example using Mathematica and see if we get the same answer.  We use the period symbol between the matrix names to indicate matrix (dot) multiplication.

a=(({{11}, {15}, {18}}));

b=(({{0.2, 0.6, 0.5}, {0.8, 0.9, 0.7}, {0.4, 0.1, 0.3}}));

c=b.a;

Our result using Mathematica to help us multiply the two matrices together follows:

N[c]

This is the same results we obtained by hand.

Example.  Find the result of the following matrix multiplication:

(({{3, 4, 6}, {1, 2, 8}, {9, 7, 5}}))(({{0.2, 0.6, 0.5}, {0.8, 0.9, 0.7}, {0.4, 0.1, 0.3}}))(({{11}, {15}, {18}}))

Solution, step 1

(({{0.2, 0.6, 0.5}, {0.8, 0.9, 0.7}, {0.4, 0.1, 0.3}}))(({{11}, {15}, {18}})) = (({{(0.2*11)+(0.6*15)+(0.5*18)}, {(0.8*11)+(0.9*15)+(0.7*18)}, {(0.4*11)+(0.1*15)+(0.3*18)}}))  = (({{20.2}, {34.9}, {11.3}}))

Solution, step 2

(({{3, 4, 6}, {1, 2, 8}, {9, 7, 5}}))(({{20.2}, {34.9}, {11.3}})) = (({{(3*20.2)+(4*34.9)+(6*11.3)}, {(1*20.2)+(2*34.9)+(8*11.3)}, {(9*20.2)+(7*34.9)+(5*11.3)}})) = (({{268}, {180.4}, {482.6}}))

So the product of the three matrices is the following 3-component vector:  {268, 180.4, 482.6}

3.6  Transformation matrix and its inverse

First, let’s find a unit vector along the X axis and call it (OverHat[i]), which is often called “i-hat” since the diacritic circumflex symbol (^) above the i looks vaguely like a hat.  We will use the ^ over a vector symbol to indicate that it is a unit vector.  Next, we’ll find a unit vector along the Y axis (yielding unit vector (OverHat[j]) ), Z axis ( (OverHat[k]) ), X’ axis ( (OverHat[i']) ),  Y’ axis ( (OverHat[j']) ) and Z’ axis ( (OverHat[ k']) ).  We can define a coordinate transformation matrix J given by

J = (({{(OverHat[i'])·(OverHat[i]), (OverHat[i'])·(OverHat[j]), (OverHat[i'])·(OverHat[k])}, {(OverHat[j'])·(OverHat[i]), (OverHat[j'])·(OverHat[j]), (OverHat[j'])·(OverHat[k])}, {(OverHat[k'])·(OverHat[i]), (OverHat[k'])·(OverHat[j]), (OverHat[k'])·(OverHat[k])}}))

where the 9 elements of the matrix are each dot products of unit vectors along coordinate axes.  Geometrically, (OverHat[i'])·(OverHat[i]) is the cosine of the angle between the X and X’ axes (i.e., between (OverHat[i'])and (OverHat[i]) ).  This is also called a direction cosine in this application.

The inverse of transformation matrix J is

(J^(-1)) = (({{(OverHat[i'])·(OverHat[i]), (OverHat[j'])·(OverHat[i]), (OverHat[k'])·(OverHat[i])}, {(OverHat[i'])·(OverHat[j]), (OverHat[j'])·(OverHat[j]), (OverHat[k'])·(OverHat[j])}, {(OverHat[i'])·(OverHat[k]), (OverHat[j'])·(OverHat[k]), (OverHat[k'])·(OverHat[k])}}))

Multiplication of a square matrix like J by its inverse (J^(-1)) yields the identity matrix, which is composed of 1s along the diagonal and 0s in the off-axis positions.

J· (J^(-1)) = (({{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}))

Transformation matrix J is an orthogonal matrix, so its inverse is the same as its transpose.  If that sentence seems to contain mysterious or obscure truths, you should review section 3.4.

3.7  Transforming a vector from one coordinate system to another

And now for the good news.  If you know the coordinates of a vector in one coordinate system (X-Y), you can multiply that vector by the appropriate transformation matrix to obtain the coordinates of that same vector in a different coordinate system (X’-Y’) where both coordinate systems have the same origin.  For the 2-D problem we began with, involving vector q, the matrix j transforms the coordinates from the original coordinate system to a new coordinate system that is rotated theta degrees from the original in the same plane (Figure 3-2).

___________________________________________________________________________

Figure 3 - 2.  Projections of rotated unit vectors onto unit vectors along the axes of the original X - Y coordinate system.

___________________________________________________________________________

Adapting the 2-D solution from the 3-D solution shown above, we have

j = (({{(OverHat[i'])·(OverHat[i]), (OverHat[i'])·(OverHat[j])}, {(OverHat[j'])·(OverHat[i]), (OverHat[j'])·(OverHat[j])}}))

The components of j are the direction cosines of the new coordinate axes (X’-Y’) relative to the old axes (X-Y).

Another way of visualizing the components of j in 2-D is

j = (({{X coordinate of unit vector (OverHat[i']), Y coordinate of unit vector (OverHat[i'])}, {X coordinate of unit vector (OverHat[j']), Y coordinate of unit vector (OverHat[j'])}}))

and in 3-D is

j = (({{X coordinate of (OverHat[i']), Y coordinate of (OverHat[i']), Z coordinate of (OverHat[i'])}, {X coordinate of (OverHat[j']), Y coordinate of (OverHat[j']), Z coordinate of (OverHat[j'])}, {X coordinate of (OverHat[k']), Y coordinate of (OverHat[k']), Z coordinate of (OverHat[k'])}}))

If, in our 2-D example, the X’ axis is a positive (counter-clockwise) rotation from the X axis as in Fig. 3-2, the matrix j is defined for our purposes as follows:

j=(({{Cos[theta Degree], Sin[theta Degree]}, {-Sin[theta Degree], Cos[theta Degree]}}));

Let’s see if we get the same results as we derived by hand.  The coordinates of q in the X-Y coordinate system are

q

The matrix solution is computed using the following expression,

qPrimeMat=j.q;

which yields the following numerical solution:

N[qPrimeMat]

The manual results were

qPrimeMan

so matrix mathematics provided the same answer as the process of drawing a picture and solving trigonometry problems.  It is a good thing to know multiple ways of solving a problem, particularly if one of them proves to be computationally easier or faster under a given set of circumstances.

Exercise 3.1  Write a Mathematica notebook that solves 2-D problems of the sort described in Exercises 3.1a and 3.1b that works with any vector when the angle between the two coordinate systems is a positive number and also works when that angle is a negative number.                                                                                                                    . (a) You are given a vector a with components {2, 3} in an X-Y coordinate system.  Write a Mathematica notebook that determines the components of that vector in an X'-Y' coordinate system that is oriented 20° (i.e., in a positive or counter-clockwise direction) from the X-Y system, shares a common origin, and is in the X-Y plane.                             . (b) You are given a vector b with components {4, 7} in an X-Y coordinate system.  Write a Mathematica notebook that determines the components of that vector in an X’-Y’ coordinate system that is oriented -50° (i.e., clockwise) from the X-Y system, shares a common origin, and is in the X-Y plane.

3.8  References

Davis, H.F., and Snider, A.D., 1987, Introduction to vector analysis [fifth edition]:  Boston, Allyn and Bacon, 365 p., ISBN 0-205-10263-8.

Web resources

Weisstein, E.W., Coordinate System:  available online via MathWorld -- a Wolfram web resource, and accessed 18 January 2012.       http://mathworld.wolfram.com/CoordinateSystem.html

Weisstein, E.W., Matrix:  available online via MathWorld -- a Wolfram web resource, and accessed 18 January 2012.      http://mathworld.wolfram.com/Matrix.html

Weisstein, E.W., Matrix Inversion:  available online via MathWorld -- a Wolfram web resource, and accessed 18 January 2012.        http://mathworld.wolfram.com/MatrixInversion.html

Weisstein, E.W., Matrix Multiplication:  available online via MathWorld -- a Wolfram web resource, and accessed 18 January 2012.        http://mathworld.wolfram.com/MatrixMultiplication.html