Since every affine set is a translate of some (unique) subspace, it is natural to define the dimension of an affine set as the dimension of this subspace.
The dimension of a nonempty affine set is the dimension of the subspace parallel to it. By convention, $\varnothing$ has dimension $-1$. Naturally, the points, lines and planes are affine sets of dimension 0, 1, and 2 respectively.
If an affine set has dimension $r$, then we often call it an $r$-flat.
For any $S \subset \R ^n$, we define the dimension of $A$ to be the dimension of the affine hull of $A$.
We denote the dimension of the set $S \subset
\R ^n$ by $\dim S$
We have defined it so that
\[
\dim S = \dim \aff S
\]