Matrices#
Matrices as linear transformations#
We saw previously that the elements of a vector can be thought of as the coefficients in a linear combination of basis vectors, i.e.
This means that a specific vector is only meaningful if the corresponding basis is defined. A suitable choice of basis vectors depends on the problem we are interested in solving, and there are many situations where it can be useful to change from one set of basis vectors to another: for example a molecular dynamics simulation might use atomic positions, velocities, and accelerations in Cartesian coordinates, corresponding to a Cartesian basis, and usually called the lab frame of reference. The dynamics of individual molecules, however, might be easier to describe within a molecular frame of reference, with basis vectors aligned with specific bonds or along rotational axes. In this case, modelling our system involves transforming between these two sets of basis vectors.
As an example consider the following figure:
Fig. 20 An example of a linear transformation: rotation by 90° anticlockwise.#
This shows an initial basis with
We now rotate our basis by 90° anti-clockwise, which gives us a new vector
where a prime symbol indicates we are in the new basis.
What is the vector
We start by expressing the new basis vectors,
We can now expand the vector
We can also write this as a single matrix equation, where we multiply each element of our original vector
which looks like
If we denote our matrix as
Inverse matrix operations#
We now have a matrix that describes a 90° anti-clockwise rotation. What if we want to invert this rotation, and rotate by 90° in a clockwise direction? If we follow the same procedure as above, we end up with a matrix
The matrix
Fig. 21 Rotating back by 90° clockwise is the inverse of our previous 90° anti-clockwise rotation, and is described by the inverse matrix operation.#
Matrix–matrix multiplication#
What happens if we perform two matrix operations, one after the other? For example we perform two successive 90° rotations—giving a 180° rotation?
Mathematically this looks like
We first operate on
Written out,
We can determine the corresponding matrix for a 180° rotation by considering what happens to the basis vectors
As we saw above, the first operation (working from right to left) converts
Doing the same for
And we remember that the columns of a matrix describe the new basis functions, in this case
Fig. 22 Rotating by 180° corresponds to rotating by 90° twice. We can calculate the corresponding matrix operation by considering what happens when we operate on our original basis twice with our 90°-rotation matrix.#