Transformation matrix

Last updated

In linear algebra, linear transformations can be represented by matrices. If is a linear transformation mapping to and is a column vector with entries, then

Contents

for some matrix , called the transformation matrix of .[ citation needed ] Note that has rows and columns, whereas the transformation is from to . There are alternative expressions of transformation matrices involving row vectors that are preferred by some authors. [1] [2]

Uses

Matrices allow arbitrary linear transformations to be displayed in a consistent format, suitable for computation. [3] This also allows transformations to be composed easily (by multiplying their matrices).

Linear transformations are not the only ones that can be represented by matrices. Some transformations that are non-linear on an n-dimensional Euclidean space Rn can be represented as linear transformations on the n+1-dimensional space Rn+1. These include both affine transformations (such as translation) and projective transformations. For this reason, 4×4 transformation matrices are widely used in 3D computer graphics. These n+1-dimensional transformation matrices are called, depending on their application, affine transformation matrices, projective transformation matrices, or more generally non-linear transformation matrices. With respect to an n-dimensional matrix, an n+1-dimensional matrix can be described as an augmented matrix.

In the physical sciences, an active transformation is one which actually changes the physical position of a system, and makes sense even in the absence of a coordinate system whereas a passive transformation is a change in the coordinate description of the physical system (change of basis). The distinction between active and passive transformations is important. By default, by transformation, mathematicians usually mean active transformations, while physicists could mean either.

Put differently, a passive transformation refers to description of the same object as viewed from two different coordinate frames.

Finding the matrix of a transformation

If one has a linear transformation in functional form, it is easy to determine the transformation matrix A by transforming each of the vectors of the standard basis by T, then inserting the result into the columns of a matrix. In other words,

For example, the function is a linear transformation. Applying the above process (suppose that n = 2 in this case) reveals that

The matrix representation of vectors and operators depends on the chosen basis; a similar matrix will result from an alternate basis. Nevertheless, the method to find the components remains the same.

To elaborate, vector can be represented in basis vectors, with coordinates :

Now, express the result of the transformation matrix A upon , in the given basis:

The elements of matrix A are determined for a given basis E by applying A to every , and observing the response vector

This equation defines the wanted elements, , of j-th column of the matrix A. [4]

Eigenbasis and diagonal matrix

Yet, there is a special basis for an operator in which the components form a diagonal matrix and, thus, multiplication complexity reduces to n. Being diagonal means that all coefficients except are zeros leaving only one term in the sum above. The surviving diagonal elements, , are known as eigenvalues and designated with in the defining equation, which reduces to . The resulting equation is known as eigenvalue equation. [5] The eigenvectors and eigenvalues are derived from it via the characteristic polynomial.

With diagonalization, it is often possible to translate to and from eigenbases.

Examples in 2 dimensions

Most common geometric transformations that keep the origin fixed are linear, including rotation, scaling, shearing, reflection, and orthogonal projection; if an affine transformation is not a pure translation it keeps some point fixed, and that point can be chosen as origin to make the transformation linear. In two dimensions, linear transformations can be represented using a 2×2 transformation matrix.

Stretching

A stretch in the xy-plane is a linear transformation which enlarges all distances in a particular direction by a constant factor but does not affect distances in the perpendicular direction. We only consider stretches along the x-axis and y-axis. A stretch along the x-axis has the form x' = kx; y' = y for some positive constant k. (Note that if k> 1, then this really is a "stretch"; if k< 1, it is technically a "compression", but we still call it a stretch. Also, if k = 1, then the transformation is an identity, i.e. it has no effect.)

The matrix associated with a stretch by a factor k along the x-axis is given by:

Similarly, a stretch by a factor k along the y-axis has the form x' = x; y' = ky, so the matrix associated with this transformation is

Squeezing

If the two stretches above are combined with reciprocal values, then the transformation matrix represents a squeeze mapping:

A square with sides parallel to the axes is transformed to a rectangle that has the same area as the square. The reciprocal stretch and compression leave the area invariant.

Rotation

For rotation by an angle θ counterclockwise (positive direction) about the origin the functional form is and . Written in matrix form, this becomes: [6]

Similarly, for a rotation clockwise (negative direction) about the origin, the functional form is and the matrix form is:

These formulae assume that the x axis points right and the y axis points up.

Shearing

For shear mapping (visually similar to slanting), there are two possibilities.

A shear parallel to the x axis has and . Written in matrix form, this becomes:

A shear parallel to the y axis has and , which has matrix form:

Reflection

For reflection about a line that goes through the origin, let be a vector in the direction of the line. Then use the transformation matrix:

Orthogonal projection

To project a vector orthogonally onto a line that goes through the origin, let be a vector in the direction of the line. Then use the transformation matrix:

As with reflections, the orthogonal projection onto a line that does not pass through the origin is an affine, not linear, transformation.

Parallel projections are also linear transformations and can be represented simply by a matrix. However, perspective projections are not, and to represent these with a matrix, homogeneous coordinates can be used.

Examples in 3D computer graphics

Rotation

The matrix to rotate an angle θ about any axis defined by unit vector (x,y,z) is [7]

Reflection

To reflect a point through a plane (which goes through the origin), one can use , where is the 3×3 identity matrix and is the three-dimensional unit vector for the vector normal of the plane. If the L2 norm of , , and is unity, the transformation matrix can be expressed as:

Note that these are particular cases of a Householder reflection in two and three dimensions. A reflection about a line or plane that does not go through the origin is not a linear transformation — it is an affine transformation — as a 4×4 affine transformation matrix, it can be expressed as follows (assuming the normal is a unit vector):

where for some point on the plane, or equivalently, .

If the 4th component of the vector is 0 instead of 1, then only the vector's direction is reflected and its magnitude remains unchanged, as if it were mirrored through a parallel plane that passes through the origin. This is a useful property as it allows the transformation of both positional vectors and normal vectors with the same matrix. See homogeneous coordinates and affine transformations below for further explanation.

Composing and inverting transformations

One of the main motivations for using matrices to represent linear transformations is that transformations can then be easily composed and inverted.

Composition is accomplished by matrix multiplication. Row and column vectors are operated upon by matrices, rows on the left and columns on the right. Since text reads from left to right, column vectors are preferred when transformation matrices are composed:

If A and B are the matrices of two linear transformations, then the effect of first applying A and then B to a column vector is given by:

In other words, the matrix of the combined transformation A followed by B is simply the product of the individual matrices.

When A is an invertible matrix there is a matrix A−1 that represents a transformation that "undoes" A since its composition with A is the identity matrix. In some practical applications, inversion can be computed using general inversion algorithms or by performing inverse operations (that have obvious geometric interpretation, like rotating in opposite direction) and then composing them in reverse order. Reflection matrices are a special case because they are their own inverses and don't need to be separately calculated.

Other kinds of transformations

Affine transformations

Effect of applying various 2D affine transformation matrices on a unit square. Note that the reflection matrices are special cases of the scaling matrix. 2D affine transformation matrix.svg
Effect of applying various 2D affine transformation matrices on a unit square. Note that the reflection matrices are special cases of the scaling matrix.
Affine transformations on the 2D plane can be performed in three dimensions. Translation is done by shearing parallel to the xy plane, and rotation is performed around the z axis.

To represent affine transformations with matrices, we can use homogeneous coordinates. This means representing a 2-vector (x, y) as a 3-vector (x, y, 1), and similarly for higher dimensions. Using this system, translation can be expressed with matrix multiplication. The functional form becomes:

All ordinary linear transformations are included in the set of affine transformations, and can be described as a simplified form of affine transformations. Therefore, any linear transformation can also be represented by a general transformation matrix. The latter is obtained by expanding the corresponding linear transformation matrix by one row and column, filling the extra space with zeros except for the lower-right corner, which must be set to 1. For example, the counter-clockwise rotation matrix from above becomes:

Using transformation matrices containing homogeneous coordinates, translations become linear, and thus can be seamlessly intermixed with all other types of transformations. The reason is that the real plane is mapped to the w = 1 plane in real projective space, and so translation in real Euclidean space can be represented as a shear in real projective space. Although a translation is a non-linear transformation in a 2-D or 3-D Euclidean space described by Cartesian coordinates (i.e. it can't be combined with other transformations while preserving commutativity and other properties), it becomes, in a 3-D or 4-D projective space described by homogeneous coordinates, a simple linear transformation (a shear).

More affine transformations can be obtained by composition of two or more affine transformations. For example, given a translation T' with vector a rotation R by an angle θ counter-clockwise, a scaling S with factors and a translation T of vector the result M of T'RST is: [8]

When using affine transformations, the homogeneous component of a coordinate vector (normally called w) will never be altered. One can therefore safely assume that it is always 1 and ignore it. However, this is not true when using perspective projections.

Perspective projection

Comparison of the effects of applying 2D affine and perspective transformation matrices on a unit square. Perspective transformation matrix 2D.svg
Comparison of the effects of applying 2D affine and perspective transformation matrices on a unit square.

Another type of transformation, of importance in 3D computer graphics, is the perspective projection. Whereas parallel projections are used to project points onto the image plane along parallel lines, the perspective projection projects points onto the image plane along lines that emanate from a single point, called the center of projection. This means that an object has a smaller projection when it is far away from the center of projection and a larger projection when it is closer (see also reciprocal function).

The simplest perspective projection uses the origin as the center of projection, and the plane at as the image plane. The functional form of this transformation is then ; . We can express this in homogeneous coordinates as:

After carrying out the matrix multiplication, the homogeneous component will be equal to the value of and the other three will not change. Therefore, to map back into the real plane we must perform the homogeneous divide or perspective divide by dividing each component by :

More complicated perspective projections can be composed by combining this one with rotations, scales, translations, and shears to move the image plane and center of projection wherever they are desired.

See also

Related Research Articles

<span class="mw-page-title-main">Pauli matrices</span> Matrices important in quantum mechanics and the study of spin

In mathematical physics and mathematics, the Pauli matrices are a set of three 2 × 2 complex matrices that are Hermitian, involutory and unitary. Usually indicated by the Greek letter sigma, they are occasionally denoted by tau when used in connection with isospin symmetries.

<span class="mw-page-title-main">2D computer graphics</span> Computer-based generation of digital images

2D computer graphics is the computer-based generation of digital images—mostly from two-dimensional models and by techniques specific to them. It may refer to the branch of computer science that comprises such techniques or to the models themselves.

Kinematics is a subfield of physics and mathematics, developed in classical mechanics, that describes the motion of points, bodies (objects), and systems of bodies without considering the forces that cause them to move. Kinematics, as a field of study, is often referred to as the "geometry of motion" and is occasionally seen as a branch of both applied and pure mathematics since it can be studied without considering the mass of a body or the forces acting upon it. A kinematics problem begins by describing the geometry of the system and declaring the initial conditions of any known values of position, velocity and/or acceleration of points within the system. Then, using arguments from geometry, the position, velocity and acceleration of any unknown parts of the system can be determined. The study of how forces act on bodies falls within kinetics, not kinematics. For further details, see analytical dynamics.

In linear algebra, an orthogonal matrix, or orthonormal matrix, is a real square matrix whose columns and rows are orthonormal vectors.

<span class="mw-page-title-main">Ellipsoid</span> Quadric surface that looks like a deformed sphere

An ellipsoid is a surface that can be obtained from a sphere by deforming it by means of directional scalings, or more generally, of an affine transformation.

<span class="mw-page-title-main">Unit vector</span> Vector of length one

In mathematics, a unit vector in a normed vector space is a vector of length 1. A unit vector is often denoted by a lowercase letter with a circumflex, or "hat", as in .

Ray transfer matrix analysis is a mathematical form for performing ray tracing calculations in sufficiently simple problems which can be solved considering only paraxial rays. Each optical element is described by a 2×2 ray transfer matrix which operates on a vector describing an incoming light ray to calculate the outgoing ray. Multiplication of the successive matrices thus yields a concise ray transfer matrix describing the entire optical system. The same mathematics is also used in accelerator physics to track particles through the magnet installations of a particle accelerator, see electron optics.

In mechanics and geometry, the 3D rotation group, often denoted SO(3), is the group of all rotations about the origin of three-dimensional Euclidean space under the operation of composition.

In vector calculus, the Jacobian matrix of a vector-valued function of several variables is the matrix of all its first-order partial derivatives. When this matrix is square, that is, when the function takes the same number of variables as input as the number of vector components of its output, its determinant is referred to as the Jacobian determinant. Both the matrix and the determinant are often referred to simply as the Jacobian in literature.

In mathematics, the conjugate transpose, also known as the Hermitian transpose, of an complex matrix is an matrix obtained by transposing and applying complex conjugation to each entry. There are several notations, such as or , , or .

<span class="mw-page-title-main">Lorentz group</span> Lie group of Lorentz transformations

In physics and mathematics, the Lorentz group is the group of all Lorentz transformations of Minkowski spacetime, the classical and quantum setting for all (non-gravitational) physical phenomena. The Lorentz group is named for the Dutch physicist Hendrik Lorentz.

<span class="mw-page-title-main">Rotation (mathematics)</span> Motion of a certain space that preserves at least one point

Rotation in mathematics is a concept originating in geometry. Any rotation is a motion of a certain space that preserves at least one point. It can describe, for example, the motion of a rigid body around a fixed point. Rotation can have a sign (as in the sign of an angle): a clockwise rotation is a negative magnitude so a counterclockwise turn has a positive magnitude. A rotation is different from other types of motions: translations, which have no fixed points, and (hyperplane) reflections, each of them having an entire (n − 1)-dimensional flat of fixed points in a n-dimensional space.

An infinitesimal rotation matrix or differential rotation matrix is a matrix representing an infinitely small rotation.

In numerical linear algebra, a Givens rotation is a rotation in the plane spanned by two coordinates axes. Givens rotations are named after Wallace Givens, who introduced them to numerical analysts in the 1950s while he was working at Argonne National Laboratory.

<span class="mw-page-title-main">Bloch sphere</span> Geometrical representation of the pure state space of a two-level quantum mechanical system

In quantum mechanics and computing, the Bloch sphere is a geometrical representation of the pure state space of a two-level quantum mechanical system (qubit), named after the physicist Felix Bloch.

In linear algebra, a rotation matrix is a transformation matrix that is used to perform a rotation in Euclidean space. For example, using the convention below, the matrix

In mathematics, the Cayley transform, named after Arthur Cayley, is any of a cluster of related things. As originally described by Cayley (1846), the Cayley transform is a mapping between skew-symmetric matrices and special orthogonal matrices. The transform is a homography used in real analysis, complex analysis, and quaternionic analysis. In the theory of Hilbert spaces, the Cayley transform is a mapping between linear operators.

In the theory of three-dimensional rotation, Rodrigues' rotation formula, named after Olinde Rodrigues, is an efficient algorithm for rotating a vector in space, given an axis and angle of rotation. By extension, this can be used to transform all three basis vectors to compute a rotation matrix in SO(3), the group of all rotation matrices, from an axis–angle representation. In terms of Lie theory, the Rodrigues' formula provides an algorithm to compute the exponential map from the Lie algebra so(3) to its Lie group SO(3).

In geometry, various formalisms exist to express a rotation in three dimensions as a mathematical transformation. In physics, this concept is applied to classical mechanics where rotational kinematics is the science of quantitative description of a purely rotational motion. The orientation of an object at a given instant is described with the same tools, as it is defined as an imaginary rotation from a reference placement in space, rather than an actually observed rotation from a previous placement in space.

<span class="mw-page-title-main">Axis–angle representation</span> Parameterization of a rotation into a unit vector and angle

In mathematics, the axis–angle representation parameterizes a rotation in a three-dimensional Euclidean space by two quantities: a unit vector e indicating the direction (geometry) of an axis of rotation, and an angle of rotation θ describing the magnitude and sense of the rotation about the axis. Only two numbers, not three, are needed to define the direction of a unit vector e rooted at the origin because the magnitude of e is constrained. For example, the elevation and azimuth angles of e suffice to locate it in any particular Cartesian coordinate frame.

References

  1. Rafael Artzy (1965) Linear Geometry
  2. J. W. P. Hirschfeld (1979) Projective Geometry of Finite Fields, Clarendon Press
  3. Gentle, James E. (2007). "Matrix Transformations and Factorizations". Matrix Algebra: Theory, Computations, and Applications in Statistics. Springer. ISBN   9780387708737.
  4. Nearing, James (2010). "Chapter 7.3 Examples of Operators" (PDF). Mathematical Tools for Physics. ISBN   978-0486482125 . Retrieved January 1, 2012.
  5. Nearing, James (2010). "Chapter 7.9: Eigenvalues and Eigenvectors" (PDF). Mathematical Tools for Physics. ISBN   978-0486482125 . Retrieved January 1, 2012.
  6. http://ocw.mit.edu/courses/aeronautics-and-astronautics/16-07-dynamics-fall-2009/lecture-notes/MIT16_07F09_Lec03.pdf [ bare URL PDF ]
  7. Szymanski, John E. (1989). Basic Mathematics for Electronic Engineers:Models and Applications. Taylor & Francis. p. 154. ISBN   0278000681.
  8. Cédric Jules (February 25, 2015). "2D transformation matrices baking".