A function f: ℝn → ℝm is affine if— for any x, y ∈ ℝn and for any α, Β ∈ ℝm with any α + Β = 1 — f(αx + Βy) = α f(x) + Β f(y)
The notation f: ℝn → ℝm indicates the function has a domain that’s a subset of ℝn and a range that’s a subset of ℝm. To put that another way, the function takes a vector with n coordinates for input and outputs a vector with m coordinates.
Affine Function Examples
The familiar equation y = mx + b is usually called linear, but should more correctly be called affine (Boyd, 2007).
Other (Slightly Different) Definitions
Many authors define the affine function slightly differently, which can be a source of confusion. For example:
- “An affine function is a first degree polynomial” (Dartmouth, 2020). This is a true statement, but a polynomial of degree zero is also affine,
- De La Fuente (2000) states that “A function is affine if it is the sum of a linear function and a constant”. Also a true statement, although simplified.
In addition, an affine function is sometimes defined as a linear form plus a number. A linear form has the format c1x1 + … + cnxn, so an affine function would be defined as:
c1x1 + … + cnxn + b
- c = a scalar or matrix coefficient,
- b = a scalar or column vector constant.
In addition, every affine function is convex and concave (Aliprantis & Border, 2007).
Affine transformation is any transformation that keeps the original collinearity and distance ratios of the original object. It is a linear mapping that preserves planes, points, and straight lines (Ranjan & Senthamilarasu, 2020); If a set of points is on a line in the original image or map, then those points will still be on a line in a transformed map. The midpoint is also preserved (Panigrahi, 2014), as are any parallel lines. The method, from the Latin Affinis (“connected with”) could more precisely be described as a mapping between two affine spaces.
Parameters of the Affine Transformation
Six independent parameters are involved in affine transformation (Acton & Ray, 2006). A matrix
orientation-preserving if the determinant of the matrix is positive. If the determinant is negative, then it’s orientation-reversing (i.e. a mirror reflection).
Two parameters [tx, ty] are the transformation.
Affine Transformation vs. Linear Regression
Affine transformation and linear regression are intimately connected. Linear regression tries to fit a line to the equation
y′ = b + ax
which is essentially the same as the slope formula y = mx + b.
The problem comes with the terminology: y = mx + b is not really a linear function; It’s an affine function, (which is defined as a linear function plus a transformation). More precisely, y’ is a function of the intercept (b) plus an affine transformation of x (Hada, 2017). So, essentially, a linear regression is actually an affine regression, not a linear one.
Affine Function: References
Aliprantis, C. & Border, K. (2007). Infinite Dimensional Analysis: A Hitchhiker’s Guide. Springer.
Acton, S. & Ray, N. (2006). Biomedical Image Analysis. Morgan & Claypool Publishers.
Boyd, S. (2007). EE263 homework 1 solutions. Retrieved September 1, 2020 from: https://web.stanford.edu/class/archive/ee/ee263/ee263.1082/hw/hw1sol.pdf
Chen , J. (2010). Linear and Affine Functions. Retrieved May 27, 2020 from: http://www3.nccu.edu.tw/~joe/IO2010S
Christophersen, F. (2007). Optimal Control of Constrained Piecewise Affine Systems (Lecture Notes in Control and Information Sciences). Springer Berlin Heidelberg.
Chong et al., E. (2013). An Introduction to Optimization. Wiley.
Dartmouth. Best Affine Approximations. Retrieved September 1, 2020 from: https://math.dartmouth.edu/opencalc2/dcsbook/c3pdf/sec31.pdf
De La Fuente, A. (2000). Mathematical methods and models for economists. Cambridge University Press.
Hada, E. (2017). Linear Regression (1/1/17), STA613/CBB540: Statistical methods in computational biology. Retrieved September 2, 2020 from: https://www.cs.princeton.edu/~bee/courses/lec/lec_jan17.pdf
Hogben, L. (Ed.). (2006). Handbook of Linear Algebra. (Discrete Mathematics and Its Applications) 2nd Edition. CRC Press.
Panigrahi, N. (2014). Computing in Geographic Information Systems. Taylor & Francis.
Ranjan, S. & Senthamilarasu, S. (2020). Applied Deep Learning and Computer Vision for Self-Driving Cars: Build Autonomous Vehicles Using Deep Neural Networks and Behavior-cloning Techniques. Packt Publishing.