An affine map is a function between affine spaces that preserves affine combinations of points. In coordinates, it has the form , where represents a linear map and is a fixed translation vector. Unlike a linear map, an affine map need not send the origin to the origin. It may connect spaces of different dimensions and need not be invertible; constant maps and projections are included. Affine maps link the coordinate methods of linear algebra with geometric structures that do not require a preferred origin. (cis.upenn.edu)
Definition and coordinate representation
Let and be affine spaces over the same field , with associated direction vector spaces and . A map is affine if there is a -linear map such that
for every point and vector . The uniquely determined map is its linear part. Thus, one image point and the linear part determine the entire map. (cis.upenn.edu)
Equivalently, for every finite family of points and scalars satisfying ,
The coefficient condition makes the combination independent of a choice of origin. Unlike a general linear combination, an affine combination is intrinsically meaningful for points. (cis.upenn.edu)
After choosing origins and a basis in each direction space, a finite-dimensional affine map becomes
with an matrix and . In these coordinates , so the map is linear precisely when . Changing origins can change without changing the underlying affine map. (cis.upenn.edu)
Geometric properties and examples
For points in a real affine space,
Consequently, a line maps either to a line or to a point. Midpoints and division parameters along a line are preserved; ratios of directed segments remain meaningful when the line is not collapsed. An invertible affine map preserves parallelism, but generally does not preserve lengths, angles, or perpendicularity. (cs.cornell.edu)
Examples include translations, rotations, reflections, scalings, shears, and their compositions. In two dimensions, the map
combines a shear with a translation. A singular example is , which collapses vertical lines to points. The constant map has zero linear part. These examples follow directly from the coordinate form . (cs.yale.edu)
An affine map is not necessarily an isometry. In real Euclidean space, a square affine map preserves distances exactly when its linear part is represented by an orthogonal matrix. Translation has no effect on distances because
Thus metric properties depend on , not on . (cs.yale.edu)
Rank, image, and invertibility
For , the image is
a translate of a linear subspace, with dimension equal to the rank of . If , the complete fiber over is
The kernel therefore describes which input displacements the map loses. By the rank–nullity theorem, every nonempty fiber has dimension . These statements are direct consequences of . (cis.upenn.edu)
The map is injective exactly when has rank , and surjective exactly when it has rank . For , it is invertible precisely when , and its inverse is
Here is the inverse matrix. The inverse is again affine. (cs.yale.edu)
Composition and homogeneous coordinates
Affine maps are closed under composition. If and , substitution gives
In particular, successive translations and linear operations can be combined into one affine map. Composition generally depends on order. Invertible affine self-maps form a group under composition, called the affine group. (cis.upenn.edu)
Using homogeneous coordinates, the same map can be written as
This represents translation and the linear part by a single matrix multiplication in one additional dimension. Matrix products then implement compositions. Displacement vectors use a final coordinate of zero, so the translation column does not affect them. (cis.upenn.edu)
Convexity and computational uses
Over the real numbers, affine maps preserve convex combinations. Consequently, the image of a convex set is convex, and the preimage of a convex set is also convex, even when the map is singular. A scalar affine function is both convex and concave. Composing a convex function with an affine map preserves convexity on the resulting domain, an important operation in convex optimization. (stanford.edu)
Affine maps also supply the weighted-input-plus-bias operation in artificial neural networks. PyTorch’s Linear layer, for example, is documented as an affine transformation. A sequence of affine layers without intervening nonlinear operations is still one affine map; nonlinear activation functions prevent that general collapse. In image processing, affine transformations implement combinations of rotation, translation, scaling, and shear, with interpolation handled separately when sampling the transformed image. (docs.pytorch.org)