HOME

TheInfoList



OR:

In
linear algebra Linear algebra is the branch of mathematics concerning linear equations such as: :a_1x_1+\cdots +a_nx_n=b, linear maps such as: :(x_1, \ldots, x_n) \mapsto a_1x_1+\cdots +a_nx_n, and their representations in vector spaces and through matric ...
,
linear transformation In mathematics, and more specifically in linear algebra, a linear map (also called a linear mapping, linear transformation, vector space homomorphism, or in some contexts linear function) is a mapping V \to W between two vector spaces that pr ...
s can be represented by matrices. If T is a linear transformation mapping \mathbb^n to \mathbb^m and \mathbf x is a
column vector In linear algebra, a column vector with m elements is an m \times 1 matrix consisting of a single column of m entries, for example, \boldsymbol = \begin x_1 \\ x_2 \\ \vdots \\ x_m \end. Similarly, a row vector is a 1 \times n matrix for some n, ...
with n entries, then T( \mathbf x ) = A \mathbf x for some m \times n matrix A, called the transformation matrix of T. Note that A has m rows and n columns, whereas the transformation T is from \mathbb^n to \mathbb^m. There are alternative expressions of transformation matrices involving
row vector In linear algebra, a column vector with m elements is an m \times 1 matrix consisting of a single column of m entries, for example, \boldsymbol = \begin x_1 \\ x_2 \\ \vdots \\ x_m \end. Similarly, a row vector is a 1 \times n matrix for some n, c ...
s that are preferred by some authors.


Uses

Matrices allow arbitrary linear transformations to be displayed in a consistent format, suitable for computation. This also allows transformations to be
composed Composition or Compositions may refer to: Arts and literature *Composition (dance), practice and teaching of choreography *Composition (language), in literature and rhetoric, producing a work in spoken tradition and written discourse, to include v ...
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 Euclidean space is the fundamental space of geometry, intended to represent physical space. Originally, that is, in Euclid's ''Elements'', it was the three-dimensional space of Euclidean geometry, but in modern mathematics there are Euclidean sp ...
R''n'' can be represented as linear transformations on the ''n''+1-dimensional space R''n''+1. These include both
affine transformations In Euclidean geometry, an affine transformation or affinity (from the Latin, ''affinis'', "connected with") is a geometric transformation that preserves lines and parallelism, but not necessarily Euclidean distances and angles. More generally, ...
(such as
translation Translation is the communication of the Meaning (linguistic), meaning of a #Source and target languages, source-language text by means of an Dynamic and formal equivalence, equivalent #Source and target languages, target-language text. The ...
) and
projective transformation In projective geometry, a homography is an isomorphism of projective spaces, induced by an isomorphism of the vector spaces from which the projective spaces derive. It is a bijection that maps lines to lines, and thus a collineation. In genera ...
s. For this reason, 4×4 transformation matrices are widely used in
3D computer graphics 3D computer graphics, or “3D graphics,” sometimes called CGI, 3D-CGI or three-dimensional computer graphics are graphics that use a three-dimensional representation of geometric data (often Cartesian) that is stored in the computer for t ...
. 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 Physical science is a branch of natural science that studies non-living systems, in contrast to life science. It in turn has many branches, each referred to as a "physical science", together called the "physical sciences". Definition Phy ...
, an
active transformation Active may refer to: Music * ''Active'' (album), a 1992 album by Casiopea * Active Records, a record label Ships * ''Active'' (ship), several commercial ships by that name * HMS ''Active'', the name of various ships of the British Roya ...
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 Passive may refer to: * Passive voice, a grammatical voice common in many languages, see also Pseudopassive * Passive language, a language from which an interpreter works * Passivity (behavior), the condition of submitting to the influence of on ...
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'',
mathematician A mathematician is someone who uses an extensive knowledge of mathematics in their work, typically to solve mathematical problems. Mathematicians are concerned with numbers, data, quantity, mathematical structure, structure, space, Mathematica ...
s usually mean active transformations, while
physicist A physicist is a scientist who specializes in the field of physics, which encompasses the interactions of matter and energy at all length and time scales in the physical universe. Physicists generally are interested in the root or ultimate ca ...
s 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 T(x) in functional form, it is easy to determine the transformation matrix ''A'' by transforming each of the vectors of the
standard basis In mathematics, the standard basis (also called natural basis or canonical basis) of a coordinate vector space (such as \mathbb^n or \mathbb^n) is the set of vectors whose components are all zero, except one that equals 1. For example, in th ...
by ''T'', then inserting the result into the columns of a matrix. In other words, A = \begin T( \mathbf e_1 ) & T( \mathbf e_2 ) & \cdots & T( \mathbf e_n ) \end For example, the function T(x) = 5x is a linear transformation. Applying the above process (suppose that ''n'' = 2 in this case) reveals that T( \mathbf ) = 5 \mathbf = 5I\mathbf = \begin 5 & 0 \\ 0 & 5 \end \mathbf 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 \mathbf v can be represented in basis vectors, E = \begin\mathbf e_1 & \mathbf e_2 & \cdots & \mathbf e_n\end with coordinates mathbf vE = \begin v_1 & v_2 & \cdots & v_n \end^\mathrm: \mathbf v = v_1 \mathbf e_1 + v_2 \mathbf e_2 + \cdots + v_n \mathbf e_n = \sum_i v_i \mathbf e_i = E mathbf vE Now, express the result of the transformation matrix ''A'' upon \mathbf v, in the given basis: \begin A(\mathbf v) &= A \left(\sum_i v_i \mathbf e_i \right) = \sum_i \\ &= \beginA(\mathbf e_1) & A(\mathbf e_2) & \cdots & A(\mathbf e_n)\end mathbf vE = A \cdot mathbf vE \\ pt &= \begin\mathbf e_1 & \mathbf e_2 & \cdots & \mathbf e_n \end \begin a_ & a_ & \cdots & a_ \\ a_ & a_ & \cdots & a_ \\ \vdots & \vdots & \ddots & \vdots \\ a_ & a_ & \cdots & a_ \\ \end \begin v_1 \\ v_2 \\ \vdots \\ v_n\end \end The a_ elements of matrix ''A'' are determined for a given basis ''E'' by applying ''A'' to every \mathbf e_j = \begin 0 & 0 & \cdots & (v_j=1) & \cdots & 0 \end^\mathrm, and observing the response vector A \mathbf e_j = a_ \mathbf e_1 + a_ \mathbf e_2 + \cdots + a_ \mathbf e_n = \sum_i a_ \mathbf e_i. This equation defines the wanted elements, a_, of ''j''-th column of the matrix ''A''.


Eigenbasis and diagonal matrix

Yet, there is a special basis for an operator in which the components form a
diagonal matrix In linear algebra, a diagonal matrix is a matrix in which the entries outside the main diagonal are all zero; the term usually refers to square matrices. Elements of the main diagonal can either be zero or nonzero. An example of a 2×2 diagonal ...
and, thus, multiplication complexity reduces to . Being diagonal means that all coefficients a_ except a_ are zeros leaving only one term in the sum \sum a_ \mathbf e_i above. The surviving diagonal elements, a_, are known as eigenvalues and designated with \lambda_i in the defining equation, which reduces to A \mathbf e_i = \lambda_i \mathbf e_i. The resulting equation is known as eigenvalue equation. The eigenvectors and eigenvalues are derived from it via the characteristic polynomial. With diagonalization, it is often possible to
translate Translation is the communication of the meaning of a source-language text by means of an equivalent target-language text. The English language draws a terminological distinction (which does not exist in every language) between ''transla ...
to and from eigenbases.


Examples in 2 dimensions

Most common
geometric transformation In mathematics, a geometric transformation is any bijection of a set to itself (or to another such set) with some salient geometrical underpinning. More specifically, it is a function whose domain and range are sets of points — most often ...
s 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 ; for some positive constant . (Note that if , then this really is a "stretch"; if , it is technically a "compression", but we still call it a stretch. Also, if , then the transformation is an identity, i.e. it has no effect.) The matrix associated with a stretch by a factor along the x-axis is given by: \begin k & 0 \\ 0 & 1 \end Similarly, a stretch by a factor k along the y-axis has the form ; , so the matrix associated with this transformation is \begin 1 & 0 \\ 0 & k \end


Squeezing

If the two stretches above are combined with reciprocal values, then the transformation matrix represents a squeeze mapping: \begin k & 0 \\ 0 & 1/k \end . 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 Rotation, or spin, is the circular movement of an object around a '' central axis''. A two-dimensional rotating object has only one possible central axis and can rotate in either a clockwise or counterclockwise direction. A three-dimensional ...
by an angle θ counterclockwise (positive direction) about the origin the functional form is x' = x \cos \theta - y \sin \theta and y' = x \sin \theta + y \cos \theta. Written in matrix form, this becomes: \begin x' \\ y' \end = \begin \cos \theta & -\sin\theta \\ \sin \theta & \cos \theta \end \begin x \\ y \end Similarly, for a rotation clockwise (negative direction) about the origin, the functional form is x' = x \cos \theta + y \sin \theta and y' = -x \sin \theta + y \cos \theta the matrix form is: \begin x' \\ y' \end = \begin \cos \theta & \sin\theta \\ -\sin \theta & \cos \theta \end \begin x \\ y \end 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 x' = x + ky and y' = y. Written in matrix form, this becomes: \begin x' \\ y' \end = \begin 1 & k \\ 0 & 1 \end \begin x \\ y \end A shear parallel to the ''y'' axis has x' = x and y' = y + kx, which has matrix form: \begin x' \\ y' \end = \begin 1 & 0 \\ k & 1 \end \begin x \\ y \end


Reflection

For reflection about a line that goes through the origin, let \mathbf = (l_x, l_y) be a
vector Vector most often refers to: *Euclidean vector, a quantity with a magnitude and a direction *Vector (epidemiology), an agent that carries and transmits an infectious pathogen into another living organism Vector may also refer to: Mathematic ...
in the direction of the line. Then use the transformation matrix: \mathbf = \frac \begin l_x^2 - l_y^2 & 2 l_x l_y \\ 2 l_x l_y & l_y^2 - l_x^2 \end


Orthogonal projection

To project a vector orthogonally onto a line that goes through the origin, let \mathbf = (u_x, u_y) be a
vector Vector most often refers to: *Euclidean vector, a quantity with a magnitude and a direction *Vector (epidemiology), an agent that carries and transmits an infectious pathogen into another living organism Vector may also refer to: Mathematic ...
in the direction of the line. Then use the transformation matrix: \mathbf = \frac \begin u_x^2 & u_x u_y \\ u_x u_y & u_y^2 \end 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 In mathematics, homogeneous coordinates or projective coordinates, introduced by August Ferdinand Möbius in his 1827 work , are a system of coordinates used in projective geometry, just as Cartesian coordinates are used in Euclidean geometry. ...
can be used.


Examples in 3D computer graphics


Rotation

The matrix to rotate an angle ''θ'' about any axis defined by
unit vector In mathematics, a unit vector in a normed vector space is a vector (often a spatial vector) of length 1. A unit vector is often denoted by a lowercase letter with a circumflex, or "hat", as in \hat (pronounced "v-hat"). The term ''direction ve ...
(''x'',''y'',''z'') is \begin xx(1-\cos \theta)+\cos\theta & yx(1-\cos\theta)-z\sin\theta & zx(1-\cos\theta)+y\sin\theta\\ xy(1-\cos\theta)+z\sin\theta & yy(1-\cos\theta)+\cos\theta & zy(1-\cos\theta)-x\sin\theta \\ xz(1-\cos\theta)-y\sin\theta & yz(1-\cos\theta)+x\sin\theta & zz(1-\cos\theta)+\cos\theta \end.


Reflection

To reflect a point through a plane ax + by + cz = 0 (which goes through the origin), one can use \mathbf = \mathbf - 2\mathbf^\mathrm , where \mathbf is the 3×3 identity matrix and \mathbf is the three-dimensional
unit vector In mathematics, a unit vector in a normed vector space is a vector (often a spatial vector) of length 1. A unit vector is often denoted by a lowercase letter with a circumflex, or "hat", as in \hat (pronounced "v-hat"). The term ''direction ve ...
for the vector normal of the plane. If the ''L''2 norm of a, b, and c is unity, the transformation matrix can be expressed as: \mathbf = \begin 1 - 2 a^2 & - 2 a b & - 2 a c \\ - 2 a b & 1 - 2 b^2 & - 2 b c \\ - 2 a c & - 2 b c & 1 - 2c^2 \end 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 In Euclidean geometry, an affine transformation or affinity (from the Latin, ''affinis'', "connected with") is a geometric transformation that preserves lines and parallelism, but not necessarily Euclidean distances and angles. More generall ...
— as a 4×4 affine transformation matrix, it can be expressed as follows (assuming the normal is a unit vector): \begin x' \\ y' \\ z' \\ 1 \end = \begin 1 - 2 a^2 & - 2 a b & - 2 a c & - 2 a d \\ - 2 a b & 1 - 2 b^2 & - 2 b c & - 2 b d \\ - 2 a c & - 2 b c & 1 - 2c^2 & - 2 c d \\ 0 & 0 & 0 & 1 \end \begin x \\ y \\ z \\ 1 \end where d = -\mathbf \cdot \mathbf for some point \mathbf on the plane, or equivalently, ax + by + cz + d = 0. 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 In mathematics, homogeneous coordinates or projective coordinates, introduced by August Ferdinand Möbius in his 1827 work , are a system of coordinates used in projective geometry, just as Cartesian coordinates are used in Euclidean geometry. ...
and
affine transformations In Euclidean geometry, an affine transformation or affinity (from the Latin, ''affinis'', "connected with") is a geometric transformation that preserves lines and parallelism, but not necessarily Euclidean distances and angles. More generally, ...
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 Composition or Compositions may refer to: Arts and literature *Composition (dance), practice and teaching of choreography *Composition (language), in literature and rhetoric, producing a work in spoken tradition and written discourse, to include v ...
and inverted. Composition is accomplished by
matrix multiplication In mathematics, particularly in linear algebra, matrix multiplication is a binary operation that produces a matrix from two matrices. For matrix multiplication, the number of columns in the first matrix must be equal to the number of rows in the ...
.
Row and column vectors In linear algebra, a column vector with m elements is an m \times 1 matrix consisting of a single column of m entries, for example, \boldsymbol = \begin x_1 \\ x_2 \\ \vdots \\ x_m \end. Similarly, a row vector is a 1 \times n matrix for some n, c ...
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 \mathbf is given by: \mathbf(\mathbf \mathbf x) = (\mathbf) \mathbf x. 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 In linear algebra, an -by- square matrix is called invertible (also nonsingular or nondegenerate), if there exists an -by- square matrix such that :\mathbf = \mathbf = \mathbf_n \ where denotes the -by- identity matrix and the multiplicati ...
there is a matrix A−1 that represents a transformation that "undoes" A since its composition with A is the
identity matrix In linear algebra, the identity matrix of size n is the n\times n square matrix with ones on the main diagonal and zeros elsewhere. Terminology and notation The identity matrix is often denoted by I_n, or simply by I if the size is immaterial ...
. 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

To represent
affine transformation In Euclidean geometry, an affine transformation or affinity (from the Latin, ''affinis'', "connected with") is a geometric transformation that preserves lines and parallelism, but not necessarily Euclidean distances and angles. More generall ...
s with matrices, we can use
homogeneous coordinates In mathematics, homogeneous coordinates or projective coordinates, introduced by August Ferdinand Möbius in his 1827 work , are a system of coordinates used in projective geometry, just as Cartesian coordinates are used in Euclidean geometry. ...
. 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 x' = x + t_x; y' = y + t_y becomes: \begin x' \\ y' \\ 1 \end = \begin 1 & 0 & t_x \\ 0 & 1 & t_y \\ 0 & 0 & 1 \end \begin x \\ y \\ 1 \end. 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: \begin \cos \theta & -\sin \theta & 0 \\ \sin \theta & \cos \theta & 0 \\ 0 & 0 & 1 \end 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 plane in real projective space, and so translation in real
Euclidean space Euclidean space is the fundamental space of geometry, intended to represent physical space. Originally, that is, in Euclid's ''Elements'', it was the three-dimensional space of Euclidean geometry, but in modern mathematics there are Euclidean sp ...
can be represented as a shear in real projective space. Although a translation is a non-
linear transformation In mathematics, and more specifically in linear algebra, a linear map (also called a linear mapping, linear transformation, vector space homomorphism, or in some contexts linear function) is a mapping V \to W between two vector spaces that pr ...
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 (t'_x, t'_y), a rotation R by an angle θ counter-clockwise, a scaling S with factors (s_x, s_y) and a translation T of vector (t_x, t_y), the result M of T'RST is: \begin s_x \cos \theta & - s_y \sin \theta & t_x s_x \cos \theta - t_y s_y \sin \theta + t'_x \\ s_x \sin \theta & s_y \cos \theta & t_x s_x \sin \theta + t_y s_y \cos \theta + t'_y \\ 0 & 0 & 1 \end 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

Another type of transformation, of importance in
3D computer graphics 3D computer graphics, or “3D graphics,” sometimes called CGI, 3D-CGI or three-dimensional computer graphics are graphics that use a three-dimensional representation of geometric data (often Cartesian) that is stored in the computer for t ...
, is the
perspective projection Linear or point-projection perspective (from la, perspicere 'to see through') is one of two types of graphical projection perspective in the graphic arts; the other is parallel projection. Linear perspective is an approximate representation, ...
. 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 z = 1 as the image plane. The functional form of this transformation is then x' = x / z; y' = y / z. We can express this in
homogeneous coordinates In mathematics, homogeneous coordinates or projective coordinates, introduced by August Ferdinand Möbius in his 1827 work , are a system of coordinates used in projective geometry, just as Cartesian coordinates are used in Euclidean geometry. ...
as: \begin x_c \\ y_c \\ z_c \\ w_c \end = \begin 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 1 & 0 \end \begin x \\ y \\ z \\ 1 \end After carrying out the
matrix multiplication In mathematics, particularly in linear algebra, matrix multiplication is a binary operation that produces a matrix from two matrices. For matrix multiplication, the number of columns in the first matrix must be equal to the number of rows in the ...
, the homogeneous component w_c will be equal to the value of z 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 w_c: \begin x' \\ y' \\ z' \\ 1 \end = \frac \begin x_c \\ y_c \\ z_c \\ w_c \end 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

*
3D projection A 3D projection (or graphical projection) is a design technique used to display a three-dimensional (3D) object on a two-dimensional (2D) surface. These projections rely on visual perspective and aspect analysis to project a complex object fo ...
* Change of basis * Image rectification * Pose (computer vision) *
Rigid transformation In mathematics, a rigid transformation (also called Euclidean transformation or Euclidean isometry) is a geometric transformation of a Euclidean space that preserves the Euclidean distance between every pair of points. The rigid transformatio ...
*
Transformation (function) In mathematics, a transformation is a function ''f'', usually with some geometrical underpinning, that maps a set ''X'' to itself, i.e. . Examples include linear transformations of vector spaces and geometric transformations, which inclu ...
* Transformation geometry


References


External links


The Matrix Page
Practical examples in
POV-Ray The Persistence of Vision Ray Tracer, most commonly acronymed as POV-Ray, is a cross-platform ray-tracing program that generates images from a text-based scene description. It was originally based on DKBTrace, written by David Kirk Buck and Aaro ...

Reference page
- Rotation of axes
Linear Transformation Calculator


- Generate matrices from 2D transformations and vice versa.


Excel Fun - Build 3D graphics from a spreadsheet
{{Matrix classes Computer graphics Matrices Transformation (function) Articles containing video clips