If W is a vector space of dimension n, and V a linear subspace of W of dimension k, then the codimension of V is
- n − k.
The fundamental property of codimension lies in its relation to intersection: if W1 has codimension k1, and W2 has codimension k2, then if U is their intersection with codimension j we have
- max (k1, k2) ≤ j ≤ k1 + k2.
- codimensions (at most) add.
In terms of the dual space, it is quite evident why that is. The subspaces being defined by the vanishing of a certain number of linear functionals, which we can take to be linearly independent, that number is the codimension. Therefore we see that U is defined by taking the union of the sets of linear functionals defining the Wi. That union may introduce some degree of linear dependence: the possible values of j express that dependence, with the RHS sum being the case where there is no dependence.
- the two sets of constraints may not be independent;
- the two sets of constraints may not be compatible.
The first of these is often expressed as the principle of counting constants: if we have a number N of parameters to adjust (i.e. we have N degrees of freedom), and a constraint means we have to 'consume' a parameter to satisfy it, then the codimension of the solution set is at most the number of constraints. We do not expect to be able to find a solution if the predicted codimension, i.e. the number of independent constraints, exceeds N (in the linear algebra case, there is always a trivial, null vector solution, which is therefore discounted).
The second is a matter of geometry, on the model of parallel lines; it is something that can be discussed for linear problems by methods of linear algebra, and for non-linear problems in projective space, over the complex number field.
Codimension also has some clear meaning in geometric topology: on a manifold (real) codimension 1 is the dimension of topological disconnection by a submanifold, while codimension 2 is the dimension of ramification and knot theory.