In
geometry
Geometry (; ) is a branch of mathematics concerned with properties of space such as the distance, shape, size, and relative position of figures. Geometry is, along with arithmetic, one of the oldest branches of mathematics. A mathematician w ...
, the Peano curve is the first example of a
space-filling curve
In mathematical analysis, a space-filling curve is a curve whose Range of a function, range reaches every point in a higher dimensional region, typically the unit square (or more generally an ''n''-dimensional unit hypercube). Because Giuseppe Pea ...
to be discovered, by
Giuseppe Peano
Giuseppe Peano (; ; 27 August 1858 – 20 April 1932) was an Italian mathematician and glottologist. The author of over 200 books and papers, he was a founder of mathematical logic and set theory, to which he contributed much Mathematical notati ...
in 1890. Peano's curve is a
surjective
In mathematics, a surjective function (also known as surjection, or onto function ) is a function such that, for every element of the function's codomain, there exists one element in the function's domain such that . In other words, for a f ...
,
continuous function
In mathematics, a continuous function is a function such that a small variation of the argument induces a small variation of the value of the function. This implies there are no abrupt changes in value, known as '' discontinuities''. More preci ...
from the
unit interval
In mathematics, the unit interval is the closed interval , that is, the set of all real numbers that are greater than or equal to 0 and less than or equal to 1. It is often denoted ' (capital letter ). In addition to its role in real analysi ...
onto
In mathematics, a surjective function (also known as surjection, or onto function ) is a function such that, for every element of the function's codomain, there exists one element in the function's domain such that . In other words, for a f ...
the
unit square
In mathematics, a unit square is a square whose sides have length . Often, ''the'' unit square refers specifically to the square in the Cartesian plane with corners at the four points ), , , and .
Cartesian coordinates
In a Cartesian coordinat ...
, however it is not
injective
In mathematics, an injective function (also known as injection, or one-to-one function ) is a function that maps distinct elements of its domain to distinct elements of its codomain; that is, implies (equivalently by contraposition, impl ...
. Peano was motivated by an earlier result of
Georg Cantor
Georg Ferdinand Ludwig Philipp Cantor ( ; ; – 6 January 1918) was a mathematician who played a pivotal role in the creation of set theory, which has become a foundations of mathematics, fundamental theory in mathematics. Cantor establi ...
that these two sets have the same
cardinality
The thumb is the first digit of the hand, next to the index finger. When a person is standing in the medical anatomical position (where the palm is facing to the front), the thumb is the outermost digit. The Medical Latin English noun for thum ...
. Because of this example, some authors use the phrase "Peano curve" to refer more generally to any space-filling curve.
Construction
Peano's curve may be constructed by a sequence of steps, where the
th step constructs a set
of squares, and a sequence
of the centers of the squares, from the set and sequence constructed in the previous step. As a base case,
consists of the single unit square, and
is the one-element sequence consisting of its center point.
In step
, each square
of
is partitioned into nine smaller equal squares, and its center point
is replaced by a contiguous subsequence of the centers of these nine smaller squares.
This subsequence is formed by grouping the nine smaller squares into three columns, ordering the centers contiguously within each column, and then ordering the columns from one side of the square to the other, in such a way that the distance between each consecutive pair of points in the subsequence equals the side length of the small squares. There are four such orderings possible:
*Left three centers bottom to top, middle three centers top to bottom, and right three centers bottom to top
*Right three centers bottom to top, middle three centers top to bottom, and left three centers bottom to top
*Left three centers top to bottom, middle three centers bottom to top, and right three centers top to bottom
*Right three centers top to bottom, middle three centers bottom to top, and left three centers top to bottom
Among these four orderings, the one for
is chosen in such a way that the distance between the first point of the ordering and its predecessor in
also equals the side length of the small squares. If
was the first point in its ordering, then the first of these four orderings is chosen for the nine centers that replace
.
[.]
The Peano curve itself is the
limit of the curves through the sequences of square centers, as
goes to infinity.
L-system construction
The Peano curve shown in the introduction can be constructed using a
Lindenmayer system. This L-system can be described as follows:
where "" means "draw forward", "+" means "turn clockwise 90°", and "−" means "turn anticlockwise 90°". The image in the introduction shows the images of the first three iterations of the rules.
The curve shown in the 'construction' section be constructed as follows:
where "" means "draw forward", "+" means "turn clockwise 90°", and "−" means "turn anticlockwise 90°". The image above shows the first two iterations of the rule.
Variants

In the definition of the Peano curve, it is possible to perform some or all of the steps by making the centers of each row of three squares be contiguous, rather than the centers of each column of squares. These choices lead to many different variants of the Peano curve.
A "multiple radix" variant of this curve with different numbers of subdivisions in different directions can be used to fill rectangles of arbitrary shapes.
The
Hilbert curve
The Hilbert curve (also known as the Hilbert space-filling curve) is a Geometric continuity, continuous fractal curve, fractal space-filling curve first described by the German mathematician David Hilbert in 1891, as a variant of the space-filling ...
is a simpler variant of the same idea, based on subdividing squares into four equal smaller squares instead of into nine equal smaller squares.
References
{{Fractals
Theory of continuous functions
Fractal curves