How did a colour scientist come up with linear algebra?

It is a story about a colour theory by Grassmann, credited with inventing linear algebra.

MCMC Addict
The Quantastic Journal
13 min readApr 14, 2024

--

It is well known that linear algebra plays a fundamental and crucial role in modern artificial intelligence (AI). It provides a mathematical framework for representing and manipulating data, especially in high-dimensional spaces, essential for developing algorithms and models in machine learning and AI applications. Less well-known is a scientist who invented linear algebra to propose his theory of colour[1].

Hermann Günther Grassmann (1809–1877) was a mathematician and physicist who significantly contributed to several fields, including colour science. Grassmann first published a monumental work on linear algebra in his book titled "Die lineale Ausdehnungslehre, ein neuer Zweig der Mathematik (The Theory of Linear Extension, a New Branch of Mathematics)", published in 1844. Based on this mathematics, in 1853, he proposed a systematic approach to understanding the perception and mixing of colours, which appears in his book "Zur Theorie der Farbenmischung (On the Theory of Color Mixing)".

Figure 1. Newton, Goethe and Grassmann proposed colour circles.

In this seminal work, Grassmann developed a mathematical framework for colour mixing and introduced the concept of the "colour triangle" based on the idea of three primary colours. Considering that even Johann Wolfgang von Goethe published a book in 1810 and 1840 in English entitled 'Theory of Colours', where the poet expressed his views on the nature of colours and how humans perceive them, colour science must have been an exciting subject. Look at the colour circles of three masters in Figure 1, where Grassmann, in particular, shows zero and the directions of the hues. His colour circle allows us to guess his intention to quantify colour.

In this article, I will mathematically describe linear algebra, vector space, and linear transformations between vector spaces. Then, I will introduce Grassmann's colour theory to see how linear algebra helps us understand colour in a modern description of vector space.

Linear Algebra

Linear algebra is the branch of mathematics that studies vector spaces and the linear mappings between them. It covers various topics such as systems of linear equations, matrices, determinants, eigenvalues and eigenvectors, inner product spaces, and more. Linear algebra provides powerful tools and methods for analysing and solving problems related to vector spaces and linear transformations.

Until the 19th century, linear algebra was introduced through systems of linear equations and matrices. In modern mathematics, the representation by vector spaces is generally preferred because it is more synthetic, more general (not limited to the finite-dimensional case), and conceptually more straightforward, though more abstract.

Vector spaces provide the basic structure for linear algebra. When we study linear transformations (mappings between vector spaces that preserve vector addition and scalar multiplication), we are essentially exploring the properties and behaviour of vector spaces.

In the previous article, I mentioned a homomorphism, which is a structure-preserving onto-map between two algebraic structures of the same type. However, an isomorphism is a homomorphism with the additional requirement that the map is also one-to-one. In general, vector spaces can be isomorphic to each other. Two vector spaces V and W are isomorphic if there exists a bijective linear transformation (a linear map that is one-to-one and onto) between them. Even if two vector spaces look different in their basis or dimension, they can share the same underlying structure and are, therefore, considered to be isomorphic.

Many real-world problems in mathematics, physics, engineering, computer science, economics and other fields can be modelled and solved using concepts from linear algebra. For example, solving systems of linear equations, finding eigenvalues and eigenvectors (which are crucial in various scientific computations), or performing transformations in computer graphics all rely heavily on linear algebra.

Vector Spaces

A vector space over a field F (often the real or complex numbers) is a mathematical structure of a set V equipped with two binary operations satisfying the following axioms. Let the elements of V be called vectors and the elements of F are called scalars. The first operation, vector addition, takes any two vectors v and w and outputs a third vector v + w. The second operation, scalar multiplication, takes any scalar a and any vector v and outputs a new vector av. The axioms that addition and scalar multiplication must satisfy are as follows:

For arbitrary elements, u, v and w of V, and arbitrary scalars, a and b in the field F,

  1. Existence of the zero vector in V such that v + 0 = v for all v in V (Identity element)
  2. Existence of the inverse element -v in V such that v + (−v) = 0 for all v in V (inverse elements)
  3. u + (v + w) = (u + v) + w (associativity)
  4. u + v = v + u (commutativity)
  5. 1v = v (existence of identity 1 of scalar multiplication)
  6. a(bv) = (ab)v (compatibility of scalar multiplication with field multiplication)
  7. a(u + v) = au + av (distributivity of scalar multiplication on vector addition)

The above axioms 1 to 3 correspond to those of a group under addition, and the fourth axiom allows V to be called an abelian group.

Figure 2. Euclidean vectors with addition and scalar multiplication operations satisfy the axioms for a vector space.

Let's represent Euclidean vectors in a plane as arrows to indicate their directions and magnitudes (by their lengths). Suppose we define an addition of two vectors as the diagonal arrow of the parallelogram formed by the two vectors with their tails overlapping and scalar multiplication as the expansion or contraction of the length of the arrow by the scalar factor, as shown in Figure 2. In that case, we can easily show that all the above axioms are satisfied. Here, a negative vector has been defined as only reversing the direction and keeping the same length.

Linear transformation (linear map)

Figure 3. Isomorphism between V and W, where the vector-space structure(expressed by the seven axioms above) is preserved. In this case, T is called a linear transformation.

Linear maps are mappings between vector spaces that preserve the structure of the vector space. Given two vector spaces V and W over a field F, a linear map is a map T:VW that is compatible with the 7 axioms above, including addition and scalar multiplication as shown in Figure 3, where u, v, w, x and y are vectors in V and a and b are arbitrary scalars in F. In general, the vector space V differs from the vector space W. In particular, if V = W are the same vector space, a linear map T : VV is also called a linear operator on V.

Figure 2 shows a bijective linear map between two vector spaces, which is an isomorphism. Since an isomorphism preserves the linear structure, two isomorphic vector spaces are essentially the same from a linear algebra point of view. They cannot be distinguished by using vector space properties. An essential question in linear algebra is testing whether a linear map is an isomorphism or not. These questions can be answered simply by using Gaussian elimination. If we know that the vector space V is not suitable for our purpose but that a vector space W is suitable, our problem is to find a linear transformation that maps isomorphically between V and W. Gaussian elimination is a series of processes to obtain the transformation matrix.

Grassmann's colour theory

Colour is a phenomenon of human visual perception that results from the interaction of light with the human eye and brain. It is a sensation produced when light enters the eye and stimulates specialised cells (called cones) in the retina. Different wavelengths of light correspond to different colours perceived by humans. Colour perception is influenced by the brightness and wavelength of the light.

Colorimetry is a branch of colour science that objectively quantifies and describes colour. It involves measuring and specifying colours based on numerical values that can be consistently reproduced. A key empirical operation in colourimetry is colour mixing, while colour matching is a key binary relation. Colour mixing is achieved by superimposing different colours on a spatial field of view, while colour matching is realised by the same colour perception of two colours, illuminating each half of the field of view. All colours can be matched by varying the brightnesses of three primary stimuli (usually red, green and blue colours) and mixing them.

Figure 4. Hue and chroma (purity) in colour circles for three brightness levels. This circle is used to choose colours in PowerPoint.

Grassmann developed his theory by proposing the laws of colour mixing. He considered that mixing coloured lights on a perfect white spatial field of view could be treated mathematically as an addition of vectors.

First law: Two coloured lights appear different if they differ in either hue (determined by dominant wavelength), brightness or chroma(purity).

Corollary 1: For every coloured light there exists a light with a complementary colour such that a mixture of both lights either desaturates the more intense component or gives uncolored (grey/white) light.

The first law suggests that these 3 independent variables are sufficient and necessary to specify a coloured stimulus. The intensities of the primary colours (red, green and blue lights) can be another set of independent variables. Using these variables, we can construct a 3-dimensional vector space with a set of orthonormal bases. Any colour can be specified by a linear combination of three independent variables. Figure 4 shows that all colours with a different hue or chroma can be expressed as a position vector within the circular plane, and their brightness requires an additional independent coordinate.

Figure 5. Mix two colours when complementary (left) and non-complementary (right). Red is complementary to green. The white point in the centre acts as a zero vector, setting two colour vectors to zero. The diagram on the right is taken from Grassnann's 1853 illustration, coloured by the author.

Corollary 1 can be explained by the left-hand colour circle in Figure 5, where two colours (R, G) are complementary. In addition, in operation concerning the central white point, a zero vector, one of the two vectors is the inverse of the other. In this case, mixing two vectors on their connecting line will result in a vector somewhere in between.

Second law: The appearance of a mixture of light made from two components changes if either component changes.

Corollary 2: A mixture of two coloured lights that are non-complementary result in a mixture that varies in hue with relative intensities of each light and in saturation according to the distance between the hues of each light.

Corollary 2, on the other hand, describes the case where two colours are not complementary, and the line connecting the two vectors (A, B) does not cross the zero vector (the right one in Figure 5). In this case, mixing two vectors will result in the vector determined by an intersection point, C. Its hue will be somewhere on the circumference between A and B, depending on the intensity portions of A and B. Corollaries 1 and 2 indicate that the addition of any two colours will result in a colour within the colour circle of hue and chroma. This means that the addition is closed in the set bounded by the colour circle, which is a basic requirement for a group to be a vector space.

Third law: Lights of the same colour produce identical effects in a mixture, regardless of their spectral composition.

Corollary 3: Two lights of the same colour added to two other lights of the same colour produce mixtures that are also the same colour, i.e. if colour A ⇄ colour B and colour C ⇄ colour D, then colour A + colour C ⇄ colour B + colour D, where ⇄ means colour matching.

Assuming that the set V has two elements of colour A and colour C and the set W has two elements of colour B and colour D, Corollary 3 suggests that the mapping by colour matching between V and W preserves the colour addition operation, i.e. the two sets are isomorphic. This means that it is possible to express the empirical operation with colours by a mathematical addition of vectors.

Fourth law: The total intensity of a mixture is the sum of the intensities of the separate components in the mixture, i.e. if colour A + colour B ⇄ colour C, then (colour A + colour B)/2 ⇄colour C/2 or (colour A + colour B)* 2⇄ colour C* 2

The fourth law, also known as Abney's law, is an empirical law which states that if two coloured stimuli, A and B, are perceived as having the same lightness and two other coloured stimuli, C and D, are perceived as having the same lightness, then the additive mixtures of A with C and B with D will also be perceived as having the same lightness. This suggests that the distributivity of scalar multiplication on vector addition (axiom 7 of vector space) is preserved by mapping through colour matching. In short, I can say that Grassmann's laws and corollaries above support the vector space axioms.

According to the first law, if we choose the primaries (R, G, B) as the orthonormal basis for representing a colour in a vector space, the intensities of the two colours, C1 and C2, can be expressed as follows.
L(C1) = U1 R + V1 G + W1 B,
L(C2) = U2 R + V2 G + W2 B.

Grassmann's laws provide a method of defining colour mixtures by simple vector addition in a 3-dimensional space:
L(C1) + L(C2) = (U1 + U2) R + (V1 + V2) G + (W1 + W2) B.

So far, since the intensity units for the primaries and the mixtures are arbitrary and unrelated to the perceived brightness of a stimulus, it is necessary to derive the unit trichromatic equation from colour mixture equations. Then, the equation can provide relative (rather than absolute) intensity coefficients for each primary and can reduce trichromatic colour mixture data to that in a 2-D coordinate system. This is done by dividing each intensity value by the sum of the primaries' intensities. For example, a standard white stimulus (S) can be expressed as
Ls(S) = Us R + Vs G + Ws B.

Assuming L = Ls / (Us + Vs + Ws), x = Us / (Us + Vs + Ws), y=Vs / (Us+Vs+ Ws), z=Ws / (Us+Vs+ Ws), then any coloured stimulus C can be expressed as
C = xR + yG + zB, where x + y + z = 1.
Since a white stimulus, S has equal components of the primaries
S = (1/3)R + (1/3)G + (1/3)B

Figure 6. Grassmann colour triangle (left) and that with spectrum locus(right)

Setting z = 0, we can represent a 3-dimensional colour mixing space on a chromaticity diagram plane. Setting z = 0 is a vector operation to project a 3-D space onto a 2-D space (x-y plane). In this 2-D colour space, any coloured light can be expressed by a pair of coordinates bounded by the colour triangle as shown in Figure 6 (left), i.e.

C = (x, y); y = 1- x.

The white point is at (x = 1/3, y =1/3) on the diagram and obviously z = 1/3. As z increases, the chromaticity triangle projected onto an x-y plane reduces to a similar triangle with the white point at (x = 1/3, y =1/3). We can imagine that the 3D colour space looks like a triangular pyramid formed by these chromaticity triangles, where the pyramid is not regular, and its apex is the white point of the plane.

In 1927, British physicists David Wright and John Guild conducted a colour-matching experiment to determine how the average person perceives colour using monochromatic primaries of 650, 530 and 460 nm. The right-hand side of Figure 6 shows the colour triangle together with the spectral locus and the location of the spectral colours on a chromaticity diagram. Grassmann's theory of colour states that all visible stimuli must lie within the spectrum locus. Based on Grassmann's mathematical foundations and further colour-matching experiments by scientists after Wright, the CIE could finally publish the CIE 1931 chromaticity diagram.

Figure 7. Relations between colour spaces now available by a python library( https://pypi.org/project/colour-science/)

Although I have not been able to give an example of a linear transformation between vector spaces, several transformations between colour spaces take place to arrive at the CIE1931 diagram. Even after the CIE1931, the same method is used to search for a colour space more suitable for describing human perception (see Figure 7).

Summary

Hermann Grassmann's contributions to colour science centred on his mathematical treatment of colour mixing and representation, which provided a systematic framework for understanding colour perception and the behaviour of light. His work helped bridge the gap between mathematics and experimental science in studying colour and impacted visual perception and colour theory.

Let me summarise key aspects of Grassmann's colour theory:

  • The Color Triangle: Grassmann represented colours as points within a triangular diagram, where each triangle vertex corresponds to a primary colour (typically red, green, and blue). This triangular representation allowed for visualising and analysing colour mixtures and relationships.
  • Colour Mixing and Spectral Analysis: Grassmann's colour theory emphasises the idea that any colour can be produced by combining three primary colours in varying proportions. This concept prefigured the later development of additive colour mixing, which is fundamental to modern colour display technologies.
  • Mathematical Formalism: Grassmann applied mathematical principles, particularly vector spaces and linear algebra, to describe colour mixing and transformations. He introduced the concept of "colour coordinates" and used algebraic operations to represent colour transformations and spectral analysis.
  • Influence on Later Scientists: Grassmann's ideas on colour influenced subsequent researchers in colour science, including James Clerk Maxwell and Albert Einstein. Maxwell, in particular, built upon Grassmann's work to develop the theory of colour perception and the trichromatic theory of vision.

While Grassmann's contributions to colour theory were innovative, it's important to note that his work was primarily theoretical and laid the groundwork for later experimental investigations into colour perception and light. His mathematical approach to colour laid a foundation for the development of modern colour science and its applications in physics, physiology, and technology.

This year, the International Commission on Lighting (CIE) celebrates the 100th anniversary of the V(λ) curve, which more quantitatively describes how our eyes respond to different wavelengths of light. Measuring instruments are designed so that their detectors effectively see the light as the human eye sees it. This, in turn, enables us to meet the standards for visibility, safety and comfort. Although the V(λ) curve was established by other scientists, we cannot deny that Grassmann's colour theory and mathematical framework were the basis for its establishment.

More than 10 years ago, I became involved in research into the measurement science of colour because it is closely related to photometry, for which I was responsible. As colour science is partly concerned with our human perception, I was so interested that I wanted to write an article. I am glad to be able to start it now. I hope to be able to keep up a series of articles on colourimetry.

Reference

  1. Fearnley-Sander, Desmond, "Hermann Grassmann and the Creation of Linear Algebra", American Mathematical Monthly 86 (1979), pp. 809–817.
  2. https://web.archive.org/web/20180105180347/https://www.opt.uh.edu/onlinecoursematerials/stevenson-5320/vis_sci_02.pdf
  3. https://elementary-physics.tistory.com/66
  4. https://pypi.org/project/colour-science/

--

--