Colour is the subjective sensation when the retina is illuminated
by light in the visible region of the spectrum. The resulting colour depends on
the spectral power distribution of the light, i.e. what frequencies the power
is concentrated to.

Since the 1860s, it has been known that colour is essentially
three-dimensional, because there are three types of colour receptors (cones)
in the retina which are sensitive to different wavelengths. Thus, three
numbers are sufficient to completely describe the response to a given spectral
power distribution. We can model the response of the receptors as being the
integral over all wavelengths of the intensity of the incoming light multiplied by one of three
weighting functions. In general, the more power is concentrated to a small
region of the spectrum (monochromatic light) the more saturated the colour
will appear, while light that contains power at all wavelengths will appear
white or gray.

By showing a human observer a monochromatic and a composite light source,
and adjusting the proportions until they appear the same, one can find out what
the weighting functions are. This is the basis for the CIE XYZ colour
standard, which assigns each spectral power distribution three "tristimulus
values" (called X, Y and Z). Almost per definition XYZ-space is linear, in
the sense that if one adds light from two sources, then the (X,Y,Z) coordinates
of the resulting colour will be the weighted average of the two lightsources.

There is an additional complication here. The sensitivity curves
of the three colour receptor types overlap with their neighbours, so any given
wavelength that triggers one of them will also trigger another to some extent.
This interference means that it is not possible to find three specific frequencies that can be mixed to yield all possible colour
sensations. What happens experimentally is that we show a composite light
source, and provide the test subject with knobs to turn to control the
comparison mix of monochromatic green and blue. No matter what proportions are
used the colours cannot be made to agree; however, if some monochromatic red is
added *to the composite source* a perfect match is obtained. It is as if
its colour is a mix of positive amounts of blue and green and a negative amount
of red. Figure 1 shows a sketch of the situation. Glorious ASCII-art!
Diagram not shown to scale. Serving suggestion only. Void where
prohibited. It would be possibly to specify all colours as sums of
monochromatic primaries provided that they are allowed to range over negative
values in this way. CIE instead decided to normalise the XYZ coordinates so they
always are non-negative. This is sometimes referred to as hypersaturated
primaries: in order to create a lightsource with the colour (X,Y,Z)=(1,0,0)
one would need a lightsource "more saturated" than if it was
concentrated to a single wavelength.

| | |
b b ............. g g | r r
b | b : g g r | r
b | : b : g | g r | r
b | : b : g | g r | r
b | : b : g | r g | r
b | : b : g r g | r
b | : b r| g | r
b | : g : b r | g | r
b | : g : rb | g | r
b | : g : r b | g | r
--------------------------------------------------------------------> λ
r,g,b sensitivity curves of colour receptors
| The three chosen monochromatic primaries
: The colour to be approximated

The choice of weighting functions is somewhat arbitrary: as long as they
are linearly independent and spans all possible colours we can uniquely
identify a colour sensation using them. XYZ is designed so that the Y
component roughly corresponds to the perceived brightness of a light source.
The quantity Y is also called CIE Luminance. It does not perfectly model
subjective brightness, because Y is a linear function of the power distribution
while human perception is nonlinear - we are more sensitive to changes in
brightness in a dim lightsource than in a bright one. For that reason, CIE
also defines a quantity Lightness, L*, which is a nonlinear function of Y.

In many situations we are more interested in colour independent from
luminance. CIE defines the quantities x and y: x = X/(X+Y+Z), y = Y/(X+Y+Z).
From knowing x, y, and Y we can calculate X,Y,Z, so these quantities can be
used to represent colours instead. In an (x,y,Y) triple, Y is the usual
luminance and represent the relative brightness of the lightsource, which (x,y)
is known as the *chromaticity* and approximately code the hue and
saturation of the colour. If we let XYZ run through the colours of all
power spectra and plot (x,y), we obtain the *CIE chromaticity diagram*,
also known as the CIE shark-fin. (Reproduced in ASCII art below). The curved
edge of it is called the *spectral locus*: it corresponds to the colour of
monochromatic lightsources as the wavelength runs from short (blue) to long
(red). The straight edge at the bottom is called the *line of purples*,
and corresponds to mixtures of red and blue

0.9 +----------------------------------------------------------+
| ***** |
| ** ** |
| * Green ** |
| * ** |
| * ** |
| * ** |
| * ** |
| * Yellow * |
| *Cyan ** |
| * * |
| * ** |
| * ** |
| * White/Grey ** |
| * * |
| * ** |
| * ** |
| * * |
| * ** |
| * * |
| * ** |
| * * |
| * ** |
| * * |
| * ** |
| * * |
| * Red * |
| * ****** |
| * Magenta ********* |
| * ********* |
| * Blue ********** |
| ********** |
0.0 +----------------------------------------------------------+
0.0 0.8

As noted above XYZ space is linear, which means that given a set
lightsources, the set of colours that can be mixed from combinations of them is
the convex hull of the points corresponding to the colour of the lightsources.
In particular, the set of colours that can be mixed using three primaries is
equal to the triangle with vertices at the three primary colours. The map from
XYZ to xy space is not completely linear, so the straight edges of the triangle
will be slightly distorted, but to a first approximation the same property
holds in xy space: the set of colours that can be mixed from a set of primaries
is the convex hull of those primaries.

The fact that the edges of the shark-fin are curved shows what was mentioned
above: no set of three primaries is enough to produce all colours. For no
matter which three points you choose, the triangle they form will miss some of
the colours at the edges of the space (corresponding to the most saturated
colours). This means for example that any computer monitor (which displays all
colours by mixing red, green and blue) will be unable to reproduce some
colours (cf CRT chromaticity gamut). The same statement is true for
traditional paints: with three primary colours you will be able to mix any hue,
but only in rather muted, grayish versions. To get completely saturated colours
more primaries are needed to start with. Indeed, no finite set will ever
completely fill up the shark-fin, although six or so primary colours turn out to
be enough in practice. As a final remark we can see why XYZ are known as
hypersaturated: if we plot the (x,y) values corresponding to (X,Y,Z) = (1,0,0),
(0,1,0), (0,0,1), they fall outside the shark-fin, and the triangle they form
contains it completely.