Engineering/Mathematics/Linear Transformations
Rank and Nullity of a Linear Transformation
The rank of a linear transformation is the dimension of its range and the nullity is the dimension of its kernel. These two numbers always sum to the dimension of the domain, which turns most questions about a transformation into arithmetic.
- Advanced level
- Stream: transformations
- Reading time 15 min
- Ref KVS-ENG-MATH-0104
- Taxonomy
- Engineering / Mathematics
- Prerequisite
- Kernel, range, basis, dimension
- Central identity
- Injective test
- Surjective test
- Note
- The sum uses the domain dimension, never the codomain
Overview
Every linear transformation carries two subspaces with it. The kernel sits inside the domain and collects everything the map annihilates; the range sits inside the codomain and collects everything the map can produce. Both are subspaces, so both have a dimension, and those two numbers are named: the rank is the dimension of the range, the nullity is the dimension of the kernel.
Individually each number answers a qualitative question. A nullity of zero says the kernel is trivial and therefore that is injective: distinct inputs give distinct outputs. A rank equal to says the range fills the codomain and therefore that is surjective: every target is achievable. Between them they decide invertibility, and each is a single integer rather than a set-theoretic argument.
The reason this topic carries real weight is that the two numbers are not independent. They always satisfy . The domain dimension is a fixed budget, and the transformation spends it: whatever is not collapsed into the kernel emerges as range. Increase the kernel and the range must shrink by the same amount. This is the rank-nullity theorem for transformations, and it is the abstract source of the more familiar statement that the rank and nullity of a matrix sum to its column count.
Practically, the identity converts hard structural questions into counting. A transformation from a six-dimensional space to a six-dimensional space with a trivial kernel must be surjective, hence invertible, with no further work. A transformation from a four-dimensional space to a three-dimensional one must have nullity at least one, so it can never be injective and every consistent system it represents has infinitely many solutions. Both conclusions follow from dimensions alone, before any coefficient is examined.
Definition
Rank of a Linear Transformation
ROLTFor a linear transformation , the rank of , written , is the dimension of its range:
.
Because the range is a subspace of , the rank never exceeds ; because the range is the image of , it never exceeds either.
Rank measures how much of the codomain the transformation actually reaches, not how large the codomain was declared to be.
Nullity of a Linear Transformation
NOLTFor a linear transformation , the nullity of , written , is the dimension of its kernel:
.
The kernel is a subspace of , so , with the lower extreme signalling an injective map and the upper extreme the zero transformation.
Nullity counts the degrees of freedom that the transformation destroys — the dimension of the family of inputs indistinguishable from zero.
Rank-Nullity Theorem
RPNDDFor any linear transformation with finite-dimensional,
.
The dimension of the domain is split between the part of that collapses to zero and the part that survives as range. The codomain dimension plays no part in the identity.
Concepts
Rank is a surjectivity gauge
The range is always a subspace of the codomain, so with equality precisely when . That is the definition of surjectivity, so the statement is surjective if and only if follows immediately. What makes it useful is that it replaces a claim about every vector in the codomain with a comparison of two integers.
The gap is itself meaningful: it counts the independent directions in the codomain that the transformation cannot reach. In a modelling context those directions are the outputs that no admissible input can generate, which is exactly the set of specifications that will produce an inconsistent system.
Nullity is an injectivity gauge
A linear transformation is injective exactly when its kernel is trivial, and a subspace is trivial exactly when its dimension is zero. Hence is injective if and only if . Again the value is in the reduction: rather than showing that forces for all pairs, one solves a single homogeneous problem and counts free parameters.
When the nullity is positive it quantifies the ambiguity. Every non-empty pre-image is a translate of the kernel, so a nullity of means each achievable output is produced by an -parameter family of inputs. In an inverse-problem setting that family is precisely the set of models the data cannot distinguish.
Why the two numbers must sum to the domain dimension
The proof constructs a basis of the domain in two parts. Take a basis of the kernel, and a basis of the range. Each lies in the range, so it has a non-empty pre-image; choose one representative with . The claim is that the combined set of vectors is a basis of .
Independence: apply to a relation of linear dependence. The kernel vectors vanish, leaving a relation among the independent , so their coefficients are zero; what remains is a relation among the kernel basis alone, so those coefficients vanish too. Spanning: given any , expand in the range basis, form the matching combination of the , and observe that , so lies in the kernel and is expressible in the kernel basis. Counting the basis gives .
The codomain never enters the identity
The most persistent error with this theorem is substituting for . The identity is a statement about how the domain is partitioned, and enlarging the codomain by embedding in a larger space changes neither the kernel nor the range, so it cannot change either side. A transformation from to still satisfies , and its rank can never exceed four no matter how much room the codomain offers.
The codomain does enter the surjectivity test, which compares with . Keeping the two roles apart — domain dimension in the budget identity, codomain dimension in the surjectivity comparison — removes most of the confusion around dimension arguments.
Dimension counting as a diagnostic
Because rank is bounded above by both and , the identity yields a lower bound on nullity that costs nothing to evaluate: . A map from a four-dimensional space to a three-dimensional one therefore has nullity at least one and cannot be injective. Translated into systems of equations, this is the classical observation that more unknowns than equations guarantees a non-trivial homogeneous solution.
In the other direction, a single computation can settle everything for a map between spaces of equal dimension. If with has a trivial kernel, then forces , so is surjective as well as injective, and therefore invertible. Establishing one property and consulting the identity is usually cheaper than establishing both directly.
Recovering the matrix statement
Given an matrix , define by . The kernel of is the null space and the range of is the column space , so and . The domain is , of dimension , and the identity becomes the familiar statement that the rank and nullity of a matrix sum to its number of columns.
The abstract version is the stronger one because it applies where no matrix exists until a basis is fixed — to differentiation on a polynomial space, to trace on a matrix space, to any map defined by a formula rather than an array. Choosing bases and reading the ranks off a matrix representation is a valid tactic, and it must give the same integers, since rank and nullity do not depend on the bases used to represent the map.
Dimension-counting workflow for a linear transformation
Equations
Rank as the dimension of the range
EQ-RNLT-01The number of independent directions the transformation can actually produce in the codomain.
Nullity as the dimension of the kernel
EQ-RNLT-02The number of independent directions in the domain that are sent to the zero vector.
Rank-nullity theorem
EQ-RNLT-03The domain dimension is a budget split between what survives and what collapses. Valid for any linear transformation with a finite-dimensional domain.
Surjectivity criterion
EQ-RNLT-04The range fills the codomain exactly when their dimensions agree, since the range is always a subspace of the codomain.
Injectivity criterion
EQ-RNLT-05A trivial kernel is equivalent to injectivity, and triviality of a subspace is equivalent to zero dimension.
Free lower bound on nullity
EQ-RNLT-06Immediate from the identity and . A map into a smaller space always destroys at least the difference in dimensions.
Equal dimensions collapse the three tests to one
EQ-RNLT-07With matching dimensions, computing the kernel alone decides injectivity, surjectivity and invertibility simultaneously.
Variable Definitions
| Symbol | Name | Meaning | Domain / type |
|---|---|---|---|
| Linear transformation | The map whose structure is being measured | linear map U to V | |
| Rank | Dimension of the range; how many independent outputs are achievable | 0 to min(dim U, dim V) | |
| Nullity | Dimension of the kernel; how many independent input directions are destroyed | 0 to dim U | |
| Range | The set of all achievable outputs, a subspace of the codomain | subspace of V | |
| Kernel | The set of inputs sent to the zero vector, a subspace of the domain | subspace of U | |
| Domain dimension | The budget that rank and nullity divide between them | non-negative integer | |
| Codomain dimension | The benchmark against which rank is compared for surjectivity | non-negative integer | |
| Lifted range basis vector | A chosen pre-image of the th range basis vector, used to build a basis of the domain | vector in U | |
| Kernel basis size | The number of vectors in a basis of the kernel, equal to | non-negative integer |
Worked Numerical Example
Problem statement
A monitoring rig reports four raw gauge readings arranged as a block, and firmware condenses them into three derived indicators expressed as the coefficients of a quadratic. Determine the rank and nullity of the condensation map, decide whether information is lost, and identify which indicator combinations can never be produced.
State the transformation
Write the raw readings as a matrix in and the derived indicators as the coefficients of a polynomial in . Firmware implements the linear map
Set up the kernel condition
A reading block lies in when all three indicators vanish. Equating each coefficient to zero gives a homogeneous system in the four raw readings.
Solve and count the nullity
The second equation gives . Substituting into the third gives , that is , which is exactly what the first equation says — the third condition is redundant. So and are free and the remaining readings follow, giving a two-parameter family.
Verify the kernel basis
Substitute the first candidate, , , , : the indicators are , and . Substitute the second, , , , : the indicators are , and . Both map to the zero polynomial, and neither is a multiple of the other, so they form a basis of a two-dimensional kernel.
Apply rank-nullity
The domain is , of dimension four. The identity determines the rank without any further computation, and it is worth noting that the codomain dimension of three plays no part in this step.
Confirm the rank independently
Apply to the four standard basis blocks. The images are , , and . The third is the negative of the first, and the fourth is the second minus the first, so the range is spanned by two independent polynomials.
Test injectivity and surjectivity
Since , the map is not injective: distinct reading blocks produce identical indicator triples. Since and , the rank falls short of the codomain dimension, so the map is not surjective either. It is therefore not invertible.
Exhibit an unreachable indicator triple
Ask whether lies in the range. Writing and matching coefficients requires from the linear term and from the quadratic term, but then the constant term is , not . No solution exists, so the indicator triple corresponding to can never be produced by the rig.
The condensation destroys two of the four available degrees of freedom and reaches only a two-dimensional slice of the three-dimensional indicator space. Every achievable indicator triple is produced by a two-parameter family of raw readings, so a fault diagnosis based on indicators alone cannot localise the reading that changed. The unreachable direction is equally diagnostic: an indicator triple outside the range can only arise from a firmware or instrumentation fault, never from legitimate raw data.
Applications & Industry Use
Manipulator Jacobians and singular configurations
The Jacobian maps joint rates to end-effector velocity. Its rank is the number of independent task-space directions available at the current pose, and its nullity counts self-motions that move the joints without moving the tool. A drop in rank at a singular configuration is exactly a rise in nullity, and the rank-nullity identity is what guarantees that one cannot fall without the other rising.
Mechanisms and self-stress states
For a pin-jointed assembly, the equilibrium map from member forces to nodal loads has a kernel of self-stress states and a range of achievable load patterns. Nullity counts the independent prestress patterns; the shortfall of rank against the number of equilibrium equations counts the mechanisms. Dimension counting delivers both before any member is sized.
Datum defect in network adjustment
A least-squares adjustment of a levelling or triangulation network has a design map whose kernel corresponds to the undefined datum — a rigid translation, rotation or scale that no observation constrains. The nullity is the datum defect, and it dictates exactly how many constraints must be imposed before a unique solution exists.
Identifiability and residual degrees of freedom
In a linear model the map from parameters to fitted values has rank equal to the number of estimable parameter combinations. Any nullity means some parameters are unidentifiable, and the rank-nullity split explains why adding redundant predictors increases the parameter count without increasing the fitted-value space or the model's explanatory reach.
Controllable and unobservable subspaces
The controllability map from input histories to reachable states has a range that is the controllable subspace; the observability map from initial states to output histories has a kernel that is the unobservable subspace. Kalman decomposition partitions the state space along exactly these lines, and the ranks involved size each block.
Effective dimension of a feature map
A linear feature extractor applied to high-dimensional data has rank equal to the number of independent features it genuinely produces. Nullity counts the input directions it discards. Reporting both makes the compression explicit and identifies whether an apparent dimensionality reduction is doing useful work or merely deleting information.
Design Considerations
Compute the cheaper subspace and infer the other
The identity means only one of the two numbers ever needs direct computation. The kernel is usually cheaper because it is the solution set of a homogeneous problem, whereas a range basis requires deciding independence among images. Compute , subtract from , and only build a range basis when the range itself — not merely its dimension — is needed.
Use the identity as an arithmetic checksum
When both numbers have been computed independently, their sum must equal the domain dimension. Any discrepancy is proof of an error, usually a missed free parameter in the kernel or a dependent vector counted as independent in the range. This is one of the few cheap end-to-end checks available in a hand computation.
Rank does not depend on the bases chosen
Representing by a matrix requires choosing bases for the domain and codomain, and different choices give different matrices. Their ranks are nevertheless identical, because rank is defined by the dimension of the range, which no change of coordinates can alter. Quoting a rank therefore requires no basis disclosure, in contrast to quoting the matrix entries themselves.
Numerical rank is a threshold decision
In exact arithmetic rank is an integer determined by the transformation. In floating point a nearly dependent set of images is indistinguishable from a dependent one, so a computed rank depends on a tolerance. Any rank reported from measured data must state that tolerance, and a singular value decomposition — where the tolerance has a clear interpretation as a magnitude cut-off — is a more defensible instrument than row reduction.
A kernel basis is not unique
Nullity is a well-defined integer, but the basis exhibiting it is not. Different solution orderings produce different spanning sets for the same kernel. Downstream code that keys off specific kernel vectors — a set of self-stress patterns, say — must either fix a canonical construction or be written to tolerate any valid basis.
Check that the domain is finite-dimensional
The identity as stated requires to be finite. Differentiation on the space of all polynomials is surjective with a one-dimensional kernel, and no finite budget is being divided. When working with function spaces, confirm that the domain has a finite basis before invoking the theorem, or replace it with the appropriate infinite-dimensional statement.
Standards & Codes
Notation, interchange and numerical standards that govern how this material is written down, stored and computed in production systems.
| Reference | Title | Relevance to this topic |
|---|---|---|
ISO 80000-2 | Quantities and units — Part 2: Mathematics | Prescribes upright type for the operators , and and italic for the transformation symbol, which is the convention followed throughout this page. |
LAPACK / BLAS reference | Linear Algebra PACKage reference implementation | Supplies the rank-revealing tools used in practice: xGESDD for a singular value decomposition, xGEQP3 for pivoted QR and xGELSY for rank-deficient least squares, each of which returns a numerical rank against a supplied tolerance. |
IEEE 754-2019 | IEEE Standard for Floating-Point Arithmetic | Defines the rounding that makes an exact rank test impossible on measured data, and fixes the representable magnitude range within which a singular-value cut-off must be chosen. |
IEEE 1788-2015 | IEEE Standard for Interval Arithmetic | Offers a route to a certified rank statement: computing with intervals produces bounds on singular values, so a rank can be reported as guaranteed rather than as the result of a heuristic threshold. |
W3C WCAG 2.1 AA | Web Content Accessibility Guidelines | The dimension identities and matrix displays here are published as semantic MathML with alternative text, so rank and nullity statements remain readable by screen readers and at high magnification. |
Material Selection
For a mathematical topic, "material" is the numeric representation: the scalar field, storage format and precision the computation is built from.
| Representation | Select when | Trade-off |
|---|---|---|
| Exact rational arithmetic | The transformation is defined symbolically or by integers and the rank must be certain, as in a structural mechanism count. | Delivers an unambiguous integer with no tolerance to justify, but intermediate fractions grow and the approach does not scale to large models. |
| IEEE 754 binary64 with SVD tolerance | Rank must be determined from measured or simulated data of moderate size. | Robust and well understood, with the tolerance expressible as a multiple of the largest singular value and machine epsilon, but costs several times more than a factorisation and requires the tolerance to be documented. |
| Pivoted QR factorisation | A rank estimate and a basis for the range are both required, and the matrix is large enough that an SVD is uneconomic. | Considerably cheaper than an SVD and produces range and kernel bases directly, but the rank estimate can be misleading for a small family of contrived matrices. |
| IEEE 754 binary32 | Throughput-bound settings such as real-time robot Jacobian monitoring on accelerator hardware. | Halves memory traffic and suits streaming rank checks, but roughly seven significant digits leaves little headroom between a small singular value and a rounding artefact. |
| Finite field arithmetic | Rank of a coding or combinatorial map, or a modular certification of a rational rank. | Exact, fast and free of growth in operand size, but the rank over a field of characteristic can be lower than the rank over the rationals for unlucky choices of . |
| Sparse storage with symbolic ordering | Very large network, finite element or design matrices where most entries are zero. | Keeps the problem tractable and exposes structural rank cheaply, but fill-in during factorisation can be severe and structural rank may exceed numerical rank. |
Manufacturing Notes
Implementation notes — how the result is actually produced by hand, by algorithm and by library, including cost and numerical behaviour.
Computing the numbers from a representation
Fix bases, assemble the matrix whose columns are the coordinate vectors of the images of the domain basis, and row-reduce. The number of pivot columns is and the number of non-pivot columns is . For a domain of dimension and codomain of dimension this costs about operations, the same order as a single factorisation.
Extracting a kernel basis
Set each free variable to one in turn with the others at zero and back-substitute. This yields exactly vectors, automatically independent because each carries a distinguishing one in its own free position. The construction is the standard way to produce self-stress patterns, null-space motions or datum constraints as concrete vectors rather than as a dimension count.
Library behaviour
NumPy offers numpy.linalg.matrix_rank, which uses an SVD with a default tolerance proportional to the largest singular value and the machine epsilon; SciPy adds scipy.linalg.null_space and scipy.linalg.orth, which return orthonormal bases for the kernel and range. SymPy's Matrix.rank and Matrix.nullspace work over the rationals and give exact answers for symbolic transformations. Mixing the two families in one workflow is a common source of contradictory rank reports.
Verification without recomputation
Two independent checks are worth building into any implementation. First, confirm that the computed rank and nullity sum to the domain dimension. Second, apply the transformation to each computed kernel basis vector and confirm the result is zero to within tolerance. Together these catch both counting errors and arithmetic slips, and neither requires the calculation to be repeated by a second method.
Diagnosing a rank that varies with input
When a rank computed from a parametrised family of transformations changes as the parameter moves, the transition is a genuine structural event, not noise — a robot passing through a singularity, a mechanism forming, an observation network losing a constraint. Log the smallest singular value alongside the rank so the approach to the transition is visible before the integer changes.
Failure Modes & Common Mistakes
| Failure mode / mistake | Impact | Root cause | Prevention & detection |
|---|---|---|---|
| Using the codomain dimension in the identity | high | Writing by analogy with the surjectivity test. | Anchor the identity to the domain: it describes how is partitioned. A quick sanity check is a map into a very large codomain, where the wrong version fails immediately. |
| Confusing rank with codomain dimension | high | Assuming that a transformation into has rank because that is where the outputs are declared to live. | Compute the range, or use . Rank is bounded by both dimensions and is often strictly less than either. |
| Exact-zero rank test in floating point | high | Deciding independence of image vectors by testing computed entries against zero on rounded data. | Use a singular value decomposition with a stated tolerance scaled to the largest singular value, and report the tolerance alongside the rank. |
| Treating a kernel basis as canonical | medium | Downstream code keyed to specific kernel vectors that change when the solution order or the solver changes. | Fix a deterministic construction, or orthonormalise the kernel basis so results are reproducible up to a well-defined transformation. |
| Applying the theorem with an infinite-dimensional domain | medium | Invoking the identity for differentiation or integration on a space of all polynomials or all smooth functions. | Confirm that the domain has a finite basis. Where it does not, work with a finite-dimensional subspace or use the appropriate operator-theoretic statement. |
| Counting equations instead of unknowns | medium | For a matrix-induced map, using the row count rather than the column count as the domain dimension. | The domain of is where is the number of columns. Rank and nullity sum to the column count, never to the row count. |
| Assuming a rank drop is a numerical artefact | medium | Suppressing a genuine structural singularity by raising the tolerance until the rank looks full. | Track the smallest singular value as a continuous quantity. A structural singularity drives it smoothly to zero; a numerical artefact does not. |
| Reporting nullity as the number of zero rows | low | Carrying over a habit from row reduction, where zero rows count rank deficiency rather than kernel dimension. | Nullity is the count of non-pivot columns, not of zero rows. The two coincide only when the representing matrix is square. |
FAQs
Why does the rank-nullity theorem use the dimension of the domain rather than the codomain?
Because it describes how the domain is divided. The proof builds a basis of from a basis of the kernel together with one chosen pre-image for each basis vector of the range, so the count is a count of vectors in . Embedding the codomain in a larger space changes neither the kernel nor the range, so it cannot change either side of the identity.
Can the rank of a transformation exceed the dimension of the domain?
No. The range is the image of the domain, and a linear map cannot produce more independent directions than it is given. Combined with the fact that the range is a subspace of the codomain, this gives , which is the bound behind most quick feasibility arguments.
How do I use rank and nullity to decide invertibility?
Invertibility requires injectivity, which is , and surjectivity, which is . When the identity makes these equivalent, so a single kernel computation settles the matter. When the dimensions differ, invertibility is impossible and no computation is needed.
Does the rank change if I choose different bases to represent the transformation?
No. Rank is the dimension of the range, a subspace of the codomain that exists independently of any coordinate system. Different bases produce different matrix representations, but all of them have the same rank. This is why rank can be quoted without stating which bases were used, unlike the matrix entries themselves.
What does a nullity of two actually mean for a physical model?
It means the map cannot distinguish inputs that differ by any vector in a two-dimensional family. Every achievable output is produced by a two-parameter set of inputs, so measurements alone cannot pin down which of them occurred. In an inverse problem this is the ambiguity that must be resolved by additional data or by a regularisation choice.
Is there an analogous identity for the codomain?
Not in the same form. The codomain splits into the range and a complement of dimension , but that complement is not canonically determined without extra structure such as an inner product. The shortfall is nevertheless meaningful: it counts the independent output directions that cannot be reached.
Why does a map from a larger space to a smaller one always have a non-trivial kernel?
Rank cannot exceed the codomain dimension, so . The identity then gives , which is strictly positive when the domain is larger. In the language of systems of equations, more unknowns than equations guarantees a non-trivial homogeneous solution.
References
- Beezer, R. A. A First Course in Linear Algebra, Version 0.70. University of Puget Sound, 2006. Section IVLT, Subsection RNLT. Licensed under the GNU Free Documentation License v1.2.
- Strang, G. Linear Algebra and Its Applications, 4th edition. Cengage, 2006.
- Golub, G. H. and Van Loan, C. F. Matrix Computations, 4th edition. Johns Hopkins University Press, 2013.
- ISO 80000-2:2019, Quantities and units — Part 2: Mathematics. International Organization for Standardization.
- IEEE 1788-2015, IEEE Standard for Interval Arithmetic. Institute of Electrical and Electronics Engineers.
- Pellegrino, S. and Calladine, C. R. Matrix analysis of statically and kinematically indeterminate frameworks. International Journal of Solids and Structures, 22(4), 1986.
AI Suggested Questions
- Take the differentiation map on and compute its rank and nullity, then explain why the same map on the space of all polynomials breaks the identity.
- Show how the rank and nullity of a robot Jacobian change as the manipulator passes through a wrist singularity, and what the kernel vectors mean physically.
- Given a matrix of measured data, walk through choosing an SVD tolerance and justify the resulting numerical rank.
- Prove that rank is unchanged by a change of basis in either the domain or the codomain, using the definition as the dimension of the range.
- Construct a linear transformation from to with rank three, and exhibit bases for both its kernel and its range.
- Explain how the rank-nullity identity yields the datum defect in a levelling network and how many constraints are needed to fix it.
Related Calculators
Enter a transformation by its action on a basis and receive , and a check that they sum to the domain dimension.
Kernel Basis CalculatorSolve and return an explicit basis for the kernel with the free parameters identified.
Range Basis CalculatorReduce the images of a domain basis to an independent spanning set for the range and report the resulting rank.
Numerical Rank Tolerance ToolDisplay the singular value spectrum of a matrix representation and show how the reported rank varies with the chosen cut-off.
