[Above is a screenshot of the applet, as a stand-in since Flash has been disabled in most browsers.
Or download the .swf file and Adobe's standalone flash player.
This player used to be downloadable from adobe.com, but they have retired it. Fortunately, I retained a copy, which is here:
https://drive.google.com/file/d/1ykFX8aKCBCIWPd0m75KajDH-2UVXwujU/view?usp=sharing
Download and unzip this archive, creating Flash Player.app, then drag and drop any of the .swf files onto the app.]
Additive versus subtractive color mixing
While Thomas Young was the first to propose that the human eye contains three types of receptors, artists have known for centuries that most colors could be produced by mixing three primary colors. Certainly it was understood by Jakob Le Blon, who in 1721 developed a three-color printing process to make color book illustrations (Kemp 1990). The primary colors used by artists and publishers mix "subtractively", that is, each layer of dye absorbs some of the wavelengths of light falling on the canvas or paper, or striking one side of a piece of colored glass. The primary colors used in theatrical lighting, color television, and tapestry weaving on the other hand mix additively, by superimposing colored beams in the case of lighting, or placing colored objects close together in the case of weaving and the pixels of color televisions. In these technologies the light in each beam or the light leaving each thread converge simultaneously at the eye, independently stimulating the three receptor systems.
Let's put additive and subtractive color mixing on a slightly more mathematical footing. As Isaac Newton showed in his experimentum crucis (crucial experiment), a beam of sunlight is composed of roughly equal amounts of light of all wavelengths in the visible spectrum. Colored lights, by contrast, contain more or less of particular wavelengths. A plot giving the amount of light of each wavelength present in a light beam is called its spectral power distribution (SPD), or spectrum for short. In subtractive color mixing, to compute the SPD of light arriving at your eye after reflection from a colored surface (or transmission through a thickness of colored glass), you multiply at each wavelength the SPD of light falling on the surface by the reflectance (or transmittance) of the surface material at that wavelength. This yields a new SPD, which is what you see. In additive color mixing, to compute the SPD of light arriving at each spot on the eye's retina from a color display screen (or woven fabric), you add at each wavelength the SPDs of the light coming from each pixel or thread that are focused on that spot. If the spot is roughly the size of a cone cell, you don't see the individual threads, only the mixture color.
Additive mixing using pure-wavelength primaries
In this applet we consider only additive color mixing. The three sliders at left are positioned at three different wavelengths in the visible spectrum: 590 nanometers, 540 nanometers, and 445 nanometers. These will be our three primary colors. As we know from the first applet, we can look up the sensitivity of our rho, gamma, and beta receptor systems to these wavelengths, and we can plot them as points in 3D colorspace. If "show in locus" is checked, you can see these points. Spin the colorspace around to get a sense for where the points fall in 3D. Since each primary is a single wavelength, it represents a color in the rainbow, and indeed each point falls somewhere along the locus of spectral colors.
What happens if you turn the red primary to half-intensity, leaving the green and blue primaries dark? Psychophysical measurements show that if the intensity of a stimulus of a single wavelength is decreased, our response (at the retinal level) is reduced in proportion. For example, our response to a half-strength beam of the red primary would be a point halfway between the origin and the spectral locus, i.e. halfway along the straight red line on the diagram. Stated mathematically, this means our visual system obeys scaling.
Psychophysical measurements also show that our response (at the retinal level) to simultaneous stimulation by two lights of different wavelengths is the sum of our responses to the two lights considered separately. Thus, our response to stimulation by a half-strength red beam and a half-strength green beam can be computed by adding together the rho responses to each beam to obtain a composite rho response, and similarly for the gamma and beta responses. Stated mathematically, this means our visual system obeys superposition. Any system that obeys both scaling and superposition is called a linear system. Linearity means we can use vector addition to compute responses to mixtures of lights. Adding a vector that stretches from the origin halfway along the red line and a vector that stretches from the origin halfway along the green line yields, as you probably remember from high school, a point halfway between the endpoints of the (full-length) red and green lines.
Generalizing this principle, we can state that any fractional additive mixture of two primaries, i.e. a mixture whose total intensity is constant, will lie on a line connecting the endpoints of the two primaries. Extending this idea to three primaries, any fractional mixture of them will lie on a triangle connecting the endpoints of the three primaries. This triangle is called the gamut of reproducible colors for these particular primaries. Click on the "show gamut" button to view this triangle. Spin the colorspace around to get a sense of its shape.
The RGB cube and reference white
If you click on "scale primaries", you'll see an RGB cube appear in 3D colorspace. This cube represents the range of colors that can be produced using mixtures of the red, green, and blue primaries, where the mixture sums to 1.0. For this purpose, 1.0 along the red, green, or blue axes is defined as the point where each axis touches the spectral locus; higher values means more intensity. One corner of this cube is rooted at the origin. It is produced by setting red = green = blue = 0.0, and it will appear black. The opposite corner, denoted with a small black dot, is produced by setting red + green + blue = 1.0. If the primary scales at the left side of the applet are at their initial values of 1/3,1/3,1/3, then this dot will be at red = green = blue = 1/3. If you click on "show gamut", you'll notice that the black dot sits on the gamut triangle, and it coincides with a gray in the middle of the triangle.
Now pretend that this cube represents a color reproduction system, let's say a computer display with 8 bits for each of R, G, and B. In this case (R,G,B) = (0,0,0) will appear black, and (R,G,B) = (255,255,255) will appear gray. If the brightest R or G or B you can produce lies at the intersections of this cube with the red, green, and blue axes, respectively, e.g. (R,G,B) = (255,0,0) for the red axis, then you'll come to call (255,255,255) white rather than gray. In other words, grayness versus whiteness is relative to the brightness of your primaries; within the little world of your computer display's RGB cube, (255,255,255) represents your white point, a.k.a. reference white.
Now fiddle with the sliders. As you increase the scaling factor applied to one primary, the others decrease, so that their sum stays 1.0. This moves the black dot around on the color gamut. If you move it just slightly, you can make the RGB cube's (255,255,255) appear slightly reddish or slightly blueish. What you are doing is changing the reference white of your make-pretend computer display. If you own an old-style television set, you can think of these sliders as lying behind the flip-up door you're never supposed to open. If you own a modern LCD, the reference white is set for you by the manufacturer, typically to a slightly blueish-white called D6500. This is the color given off by a black body radiator heated to 6500 degrees Kelvin. You can sometimes change this reference white by fiddling with menus provided by the LCD manufacturer, but you're asking for trouble later on - your colors won't match the rest of the world. By the way, although our applet won't let you do it, you might also imagine increasing all three scaling parameters at once. If you increase them in proportion, e.g. multiply each by 120%, what you've done is make your RGB cube bigger. Doing so makes your computer display brighter without changing the "chromaticity" of its white point.
As you make the transition from this applet, in which features are visualized in rho-gamma-beta space, to the next applet, in which which features are visualized relative to an RGB cube, keep in mind that this is the cube we'll be talking about, and there is a hidden set of scaling parameters that must be adjusted before using the RGB cube.
The trichromatic matching functions
In a separate applet, we explore Maxwell's trichromatic matching experiment. That experiment shows that for a given choice of three primaries, one can record the amount of each primary required to visually match each color in the rainbow. This record can be plotted as three curves, shown above in the graph labeled "trichromatic matching functions". Unfortunately, as Maxwell discovered it is not possible using three pure-wavelength primaries to successfully match every color in the rainbow. Whenever it proved impossible (which was most of the time), he allowed that rainbow color to be desaturated by adding a bit of one of the primaries to it. He recorded this "cheating" as a negative value of the corresponding matching function.
If you've having trouble making sense of these matching functions, and understanding how they relate to the sensitivity functions, here's another way to think about it. We said earlier that the XYZ coordinates of each point on the locus of spectral colors, or more accurately, their coordinates relative to the rho, gamma, and beta axes of 3D colorspace, are given by the rho, gamma, and beta sensitivity functions. Now click on "show in locus", and use your fingers to block out the rho, gamma, and beta axes. What you're looking at now is a 3D colorspace whose axes are the lines defining the currently chosen red, green, and blue primaries. One could easily define the XYZ coordinates of each point on the locus of spectral colors relative to these axes, i.e. a certain distance along the red primary, followed by distances along the green and blue primaries. These distances given by the red, green, and blue matching functions!
Stated mathematically, we say that the locus of spectral colors is a curve in 3D space, whose shape can be defined using a parametric equation having a single parameter lambda (wavelength), which gives position along the curve. If the axes of the space are taken to be rho, gamma, and beta, then the shape of this curve is specified by three coordinate functions (rho(lambda), gamma(lambda),and beta(lambda)). These are the sensitivity functions. Alternatively, if the axes of the space are taken to be red, green, and blue for three chosen primaries, then the shape of the curve is equally well specified by three coordinate functions (red(lambda), green(lambda),and blue(lambda)). These are the matching functions for these primaries.
Once you understand this principle, there are some cool insights waiting for you. Spin the 3D colorspace diagram until the lines denoting the red and blue primaries line up (or fall atop one another). Note how the locus bows out to the left (between 600 and 650 nanometers if you've checked "show tic marks"). This bowing represents negative values of the green primary. Looking at the matching functions, you can see how the green matching function goes negative in exactly this part of the rainbow! Try the same thing for the green and blue axes; can you find the cause of the big negative-going lobe of the red matching function? The blue matching function goes negative as well, but just barely; it's hard to see in this applet.
Alternative primaries and gamuts