Codimension is a
relative concept: it is only defined for one object
inside another. There is no "codimension of a vector space (in isolation)", only the codimension of a vector
subspace. If
W is a
linear subspace of a
finite-dimensional vector space V, then the
codimension of
W in
V is the difference between the dimensions: :\operatorname{codim}(W) = \dim(V) - \dim(W). It is the complement of the dimension of
W, in that, with the dimension of
W, it adds up to the dimension of the
ambient space V: :\dim(W) + \operatorname{codim}(W) = \dim(V). Similarly, if
N is a submanifold or subvariety in
M, then the codimension of
N in
M is :\operatorname{codim}(N) = \dim(M) - \dim(N). Just as the dimension of a submanifold is the dimension of the
tangent bundle (the number of dimensions that you can move
on the submanifold), the codimension is the dimension of the
normal bundle (the number of dimensions you can move
off the submanifold). More generally, if
W is a
linear subspace of a (possibly infinite dimensional)
vector space V then the codimension of
W in
V is the dimension (possibly infinite) of the
quotient space V/
W, which is more abstractly known as the
cokernel of the inclusion. For finite-dimensional vector spaces, this agrees with the previous definition :\operatorname{codim}(W) = \dim(V/W) = \dim \operatorname{coker} ( W \to V ) = \dim(V) - \dim(W), and is dual to the relative dimension as the dimension of the
kernel. Finite-codimensional subspaces of infinite-dimensional spaces are often useful in the study of
topological vector spaces. ==Additivity of codimension and dimension counting==