Properties of Linear Transformations
Does a linear transformation lose information, and can it reach every output? These are the questions of one-to-one and onto, and for a linear map both are answered by counting pivots of . Maps that are both are invertible, and their inverse is the inverse matrix.
Kernel and image
For a linear map with standard matrix :
| Name | Definition | Equals |
|---|---|---|
| kernel | , a subspace of | |
| image (range) | , a subspace of |
These are the null space and column space from Column Space, Row Space and Null Space, now with a geometric meaning: the kernel is what crushes to zero, the image is what can reach. Rank-nullity reads .
One-to-one
is one-to-one (injective) if different inputs always give different outputs: .
Theorem. A linear is one-to-one .
Proof: if , then , so . If the kernel is , . Conversely, if some had , would not be one-to-one.
In terms of : one-to-one has only pivot in every column the columns are independent . This requires : you cannot squeeze into without collisions.
Onto
is onto (surjective) if every is an output: is solvable for all .
In terms of : onto pivot in every row the columns span . This requires : cannot cover .
| Shape of () | can be one-to-one? | can be onto? |
|---|---|---|
| tall, | yes, if | never |
| wide, | never | yes, if |
| square, | yes onto invertible | yes one-to-one invertible |
For square matrices the two properties coincide: pivots means a pivot in every row and every column.
from sympy import Matrix
def describe(A):
r = A.rank()
m, n = A.shape
return f"{m}x{n}, rank {r}: one-to-one={r == n}, onto={r == m}, kernel dim={n - r}"
print("embed R^2 in R^3 :", describe(Matrix([[1, 0], [0, 1], [1, 1]])))
print("project R^3->R^2 :", describe(Matrix([[1, 0, 0], [0, 1, 0]])))
print("rotation in R^2 :", describe(Matrix([[0, -1], [1, 0]])))
print("collapse to line :", describe(Matrix([[1, 2], [2, 4]])))embed R^2 in R^3 : 3x2, rank 2: one-to-one=True, onto=False, kernel dim=0
project R^3->R^2 : 2x3, rank 2: one-to-one=False, onto=True, kernel dim=1
rotation in R^2 : 2x2, rank 2: one-to-one=True, onto=True, kernel dim=0
collapse to line : 2x2, rank 1: one-to-one=False, onto=False, kernel dim=1
Invertible transformations
is invertible if there is a map with and for all . This happens exactly when is one-to-one and onto, and then:
- is again linear, and
- its standard matrix is (Matrix Inverses).
Linearity of : for outputs and , , so ; scalars work the same way.
Geometrically: the inverse of rotation by is rotation by , the inverse of scaling by 2 is scaling by , the inverse of a shear by is a shear by , and a reflection is its own inverse. Projections have no inverse: they have a non-zero kernel.
from sympy import Matrix, Rational
shear = Matrix([[1, 3], [0, 1]])
print("shear inverse:", shear.inv().tolist())
T = Matrix([[2, 1], [5, 3]])
y = T * Matrix([4, -1])
print("T(x) =", list(y), "-> T^-1 recovers x =", list(T.inv() * y))
P = Matrix([[1, 0], [0, 0]]) # projection onto the x-axis
print("projection: kernel basis", [list(v) for v in P.nullspace()], " invertible:", P.det() != 0)
print("P sends [3, 5] and [3, -2] to the same point:", list(P * Matrix([3, 5])), list(P * Matrix([3, -2])))shear inverse: [[1, -3], [0, 1]]
T(x) = [7, 17] -> T^-1 recovers x = [4, -1]
projection: kernel basis [[0, 1]] invertible: False
P sends [3, 5] and [3, -2] to the same point: [3, 0] [3, 0]
In software
- Rendering loses depth. Projecting a 3D scene onto a 2D screen is not one-to-one: every point along a viewing ray lands on the same pixel. That is why "screen to world" picking cannot return a point, only a ray, which is then intersected with the scene (Screen-to-World Rays).
- Lossy vs lossless. A transformation with a non-trivial kernel destroys information. Dimensionality reduction (PCA to 2 components) and a neural layer that maps 4096 features to 1024 cannot be undone; an invertible layer can, which is the principle behind "normalizing flow" generative models built from invertible maps.
- Undo. Editors that store transforms (rotate, scale, shear a selection) undo them by applying the inverse matrix; a "flatten" or "squash to zero width" operation cannot be undone that way and must store the original data.
- Embeddings into larger spaces (one-to-one, not onto): an embedding layer maps tokens into ; most vectors of correspond to no token at all.
Exercises
Exercise 1: Classify
For each matrix, say whether is one-to-one and whether it is onto: (a) , (b) , (c) .
Answer
(a) one-to-one, not onto; (b) neither; (c) both (invertible).
Solution
Exercise 2: Find the kernel
Find a basis of for .
Answer
.
Solution
from sympy import Matrix
print([list(v) for v in Matrix([[1, 1, -1], [2, -1, 1]]).nullspace()])[[0, 1, 1]]
Exercise 3: Invert a transformation
rotates by 90° counter-clockwise and then scales by 2. Find the matrix of and of , and describe geometrically.
Answer
, : scale by , then rotate by 90° clockwise.
Solution
(Here the two factors commute, so the order of "scale" and "rotate back" does not matter.)
from sympy import Matrix
T = Matrix([[0, -2], [2, 0]])
print(T.inv().tolist())[[0, 1/2], [-1/2, 0]]
Exercise 4: Can it be onto?
Can a linear map be onto? Can a linear map be one-to-one? Explain with ranks.
Answer
No and no.
Solution
A map has a 7×5 matrix of rank at most , so its image is at most 5-dimensional and cannot be . A map has a 5×7 matrix with rank at most 5, so by rank-nullity its kernel has dimension at least , and it is not one-to-one.
Test yourself
with of size 3×3 and rank 3. Which is true?
- is one-to-one but not onto
- is onto but not one-to-one
- has a non-zero kernel
- is invertible
A linear map is one-to-one exactly when…
- its image is everything
- its matrix is square
- its kernel is
- its matrix is symmetric
Why can't a mouse click on the screen be turned back into a single 3D point?
- Floating-point error
- Perspective projection is not one-to-one: a whole ray maps to one pixel
- The GPU discards the matrix
- Screens are not linear