{
  "id": "affine-map",
  "title": "Affine map",
  "lang": "en",
  "source_lang": "en",
  "summary": "An affine map preserves affine combinations and can be expressed, after choosing coordinates, as a linear map followed by a translation.",
  "category": "mathematics",
  "subcategory": "geometry",
  "type": "concept",
  "aliases": [
    "Affine mapping",
    "Affine function"
  ],
  "generated_at": "2026-10-04",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/affine-map/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/affine-map/",
      "json": "https://aiwiki.page/zh/affine-map.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "An affine map is a function between affine spaces that preserves affine combinations of points. In coordinates, it has the form \\(f(x)=Ax+b\\), where \\(A\\) represents a linear map and \\(b\\) 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)"
    },
    {
      "heading": "Definition and coordinate representation",
      "text": "Let \\(E\\) and \\(F\\) be affine spaces over the same field \\(K\\), with associated direction vector spaces \\(V\\) and \\(W\\). A map \\(f:E\\to F\\) is affine if there is a \\(K\\)-linear map \\(L:V\\to W\\) such that\n\n\\[f(p+v)=f(p)+L(v)\\]\n\nfor every point \\(p\\in E\\) and vector \\(v\\in V\\). The uniquely determined map \\(L\\) is its linear part. Thus, one image point and the linear part determine the entire map. (cis.upenn.edu)\n\nEquivalently, for every finite family of points \\(p_i\\) and scalars \\(\\lambda_i\\) satisfying \\(\\sum_i\\lambda_i=1\\),\n\n\\[f\\!\\left(\\sum_i\\lambda_i p_i\\right) =\\sum_i\\lambda_i f(p_i).\\]\n\nThe 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)\n\nAfter choosing origins and a basis in each direction space, a finite-dimensional affine map becomes\n\n\\[f:K^n\\to K^m,\\qquad f(x)=Ax+b,\\]\n\nwith an \\(m\\times n\\) matrix \\(A\\) and \\(b\\in K^m\\). In these coordinates \\(b=f(0)\\), so the map is linear precisely when \\(b=0\\). Changing origins can change \\(b\\) without changing the underlying affine map. (cis.upenn.edu)"
    },
    {
      "heading": "Geometric properties and examples",
      "text": "For points in a real affine space,\n\n\\[f((1-t)p+tq)=(1-t)f(p)+tf(q),\\qquad t\\in\\mathbb R.\\]\n\nConsequently, 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)\n\nExamples include translations, rotations, reflections, scalings, shears, and their compositions. In two dimensions, the map\n\n\\[f(x,y)=(x+sy+a,\\ y+b)\\]\n\ncombines a shear with a translation. A singular example is \\(f(x,y)=(x,0)\\), which collapses vertical lines to points. The constant map \\(f(x)=b\\) has zero linear part. These examples follow directly from the coordinate form \\(Ax+b\\). (cs.yale.edu)\n\nAn 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\n\n\\[f(x)-f(y)=A(x-y).\\]\n\nThus metric properties depend on \\(A\\), not on \\(b\\). (cs.yale.edu)"
    },
    {
      "heading": "Rank, image, and invertibility",
      "text": "For \\(f:K^n\\to K^m\\), the image is\n\n\\[f(K^n)=b+\\operatorname{im}A,\\]\n\na translate of a linear subspace, with dimension equal to the rank of \\(A\\). If \\(f(x_0)=y\\), the complete fiber over \\(y\\) is\n\n\\[f^{-1}(\\{y\\})=x_0+\\ker A.\\]\n\nThe kernel therefore describes which input displacements the map loses. By the rank–nullity theorem, every nonempty fiber has dimension \\(n-\\operatorname{rank}A\\). These statements are direct consequences of \\(Ax+b=y\\). (cis.upenn.edu)\n\nThe map is injective exactly when \\(A\\) has rank \\(n\\), and surjective exactly when it has rank \\(m\\). For \\(m=n\\), it is invertible precisely when \\(\\det A\\ne0\\), and its inverse is\n\n\\[f^{-1}(y)=A^{-1}(y-b).\\]\n\nHere \\(A^{-1}\\) is the inverse matrix. The inverse is again affine. (cs.yale.edu)"
    },
    {
      "heading": "Composition and homogeneous coordinates",
      "text": "Affine maps are closed under composition. If \\(f(x)=Ax+b\\) and \\(g(y)=Cy+d\\), substitution gives\n\n\\[(g\\circ f)(x)=CAx+Cb+d.\\]\n\nIn 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)\n\nUsing homogeneous coordinates, the same map can be written as\n\n\\[\\begin{pmatrix}f(x)\\\\1\\end{pmatrix} = \\begin{pmatrix}A&b\\\\0&1\\end{pmatrix} \\begin{pmatrix}x\\\\1\\end{pmatrix}.\\]\n\nThis 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)"
    },
    {
      "heading": "Convexity and computational uses",
      "text": "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)\n\nAffine 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)"
    }
  ],
  "links": [
    "mathematical-function",
    "affine-space",
    "affine-combination",
    "linear-map",
    "linear-algebra",
    "field-mathematics",
    "vector-space",
    "linear-combination",
    "basis-linear-algebra",
    "matrix",
    "isometry",
    "euclidean-space",
    "orthogonal-matrix",
    "linear-subspace",
    "matrix-rank",
    "kernel-linear-map",
    "rank-nullity-theorem",
    "injective-function",
    "surjective-function",
    "inverse-function",
    "inverse-matrix",
    "function-composition",
    "homogeneous-coordinates",
    "convex-combination",
    "convex-set",
    "convex-function",
    "convex-optimization",
    "artificial-neural-network",
    "activation-function"
  ],
  "sources": [
    {
      "title": "cis.upenn.edu/~jean/gma-v2-root.pdf",
      "url": "https://www.cis.upenn.edu/~jean/gma-v2-root.pdf"
    },
    {
      "title": "cis.upenn.edu/~cis5150/ws-book-Ia.pdf",
      "url": "https://www.cis.upenn.edu/~cis5150/ws-book-Ia.pdf"
    },
    {
      "title": "cs.cornell.edu/courses/cs4620/2015fa/lectures/09transforms2dWeb.pdf",
      "url": "https://www.cs.cornell.edu/courses/cs4620/2015fa/lectures/09transforms2dWeb.pdf"
    },
    {
      "title": "cs.yale.edu/homes/aspnes/pinewiki/LinearAlgebra.html",
      "url": "https://www.cs.yale.edu/homes/aspnes/pinewiki/LinearAlgebra.html"
    },
    {
      "title": "stanford.edu/~boyd/cvxbook/bv_cvxbook.pdf",
      "url": "https://www.stanford.edu/~boyd/cvxbook/bv_cvxbook.pdf"
    },
    {
      "title": "docs.pytorch.org/docs/main/generated/torch.nn.Linear.html",
      "url": "https://docs.pytorch.org/docs/main/generated/torch.nn.Linear.html"
    }
  ],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}