The Moore-Penrose Inverse in Art
Year: 2013 Authors: D Huylebrouck
Core claim
The Moore-Penrose inverse can support least-squares approximation in visual domains such as color mixing and shape fitting in art and architecture.
Topics
generalized inverse, least squares fitting, color mixing, curve fitting, visual approximation
Domains
linear algebra, matrix pseudoinverse, least squares, conic fitting, color theory, architecture, painting, visual design
Methods
matrix equations, least-squares approximation, RGB modeling, curve fitting
Media
architectural drawings, paintings, computer screens, plaid fabrics
Paper text
The text below is the locally extracted OCR/Markdown version of the paper. Raw PDF files remain local and are not published here.
Proceedings of Bridges 2013: Mathematics, Music, Art, Architecture, Culture
The Moore-Penrose Inverse in Art
D Huylebrouck LUCA Department for Architecture KULEuven Paleizenstraat 65-67 1030 Brussels BELGIUM Huylebrouck@gmail.com
Abstract
The “Moore-Penrose inverse” of a matrix corresponds to the (unique) matrix solution of the system , , , . This generalized inverse has many applications, ranging from Gauss’ historical prediction for finding Ceres to modern electrical engineering problems. The present paper provides some applications related to art: one about mathematical color theory, and one about curve fitting in architectural drawings or paintings.
The generalized inverse
In 1955 Roger Penrose (1931-) independently described a type of matrix pseudoinverse that had been proposed earlier by the American mathematician Eliakim Hastings Moore (1862-1932). As was the case in other fields on which Penrose laid hands (such as the Penrose tiles or the Penrose triangle), this pseudoinverse then became widely used and popular.
Consider a system of equations
written in matrix form as . Here, is a real matrix and a real vector. The system has a unique solution if and only if the matrix is invertible, in which case it is given by . If is not invertible, the so-called “Moore-Penrose inverse” or “MP”-inverse, can be used to get a convenient approximation, the word “convenient” being motivated by a least squares interpretation given below. This “generalized inverse” of a matrix is the (unique) solution of the system of matrix equations ( denotes transposition): , , and . A common notation for this is , and this matrix is also called “the” generalized inverse of . If the matrix has an inverse matrix, it coincides with this generalized inverse. The link to the least squares method is important here, and we follow the algebraic formulation by Campbell and Meyer (see [1]).
Suppose and ; a vector is called “a least squares solution” to if for all . A vector is called “the minimal least squares solution” to if is a least squares solution to and \|\mathbf{u}\| < \|\mathbf{w}\| for all other least squares solutions . The
denomination “least squares” refers to the squares in the common Euclidean norm of a vector . The link to the Moore-Penrose generalized inverse is that is the minimal least squares solution to , for given and (see [2]).
Other generalizations of the notion of inverse of a matrix exist, and one such notion needed here is the so-called “constraint generalized inverse”. The set of least square solutions of is called the
Huylebrouck
set of constraints. The problem of interest now is to find the unique minimum in among the points of for which is minimal. It appears to be the vector , where . When there are no constraints, , and thus , whence again as above .
Elements of color theory
The R(ed)-G(reen)-B(lue) values of a color C are denoted in a vector: . A color with an R-value of 0.30 has of red, being white. Three arbitrary but identical RGB values yield , the value indicating the amount of white in this gray. Special cases are , where the letter K is used for “black” to avoid confusion with “Blue”, and , or, more accurately, “pure light”.
There are two main ways to mix colors: “additive” and “subtractive”. In the most usual examples, the first corresponds to a projection of light, thus “adding” light for each projection, while the second puts transparent layers in front of a projection, thus “subtracting” light.
Figure 1: Additive (far left), subtractive (middle left) and weighted color mixing (right; the images on a computer screen or a dress are best observed from a distance).
In the additive case, the RGB-values are added, but in the subtractive case they are multiplied:
Computer screens or plaid fabrics provide typical examples of additive color mixing. Given colors , each used for an amount with and (in fact, and 0 < \rho_i < 1 ), the RGB-coordinates of the composed color will be given by:
Example 1. A “complementary” color of a given color is such that the simultaneous projection of a light beam of the given color and the complementary color yields white: and are complementary iff . For instance, the “main color” Cyan and a double layer of transparent disks of the other main colors Magenta and Yellow are complementary: .
Thus cyan and the other main colors magenta and yellow have the property that the additive mixture of the first with the subtractive mixture of the second and the third is white.
Example 2. Suppose colors , , and are mixed at rates of respectively , , , and . The mixing can be considered as a simple additive mixing of a gray, a dark green, a very dark cyan and black (adding nothing at all, of course), or it can be interpreted as a weighted mean:
The Moore-Penrose Inverse in Art
Figure 2: A dark green surface illustrating the expression .
Application of the Moore-Penrose inverse
A given color can be obtained in many ways, but on the other hand it is not always possible to form a desired color when only some given colors are available. Here, a least squares technique may help, since the situation corresponds to a matrix equation or
where the columns of contain the available colors and the desired color. The constraint , becomes, in matrix notation, , with , and . The “best solution” in terms of least squares corresponds to , where .
Example 3. Suppose the green color of the above example is given, , but that is has to be made using , , and . There are no values such that , with , but the Moore-Penrose inverse allows one to obtain ‘the best possible solution’. Now, , , and . Thus we consider , since . MATHEMATICA shows . Thus, and .
Huylebrouck
If, for instance, 180 threads are used, the computation proposes 1 red, 91 green, 42 blue and 46 dark yellow threads for making a plaid piece of textile that resembles the “best” (in the “least squares” meaning) to the desired green, though the obtained color, , does not seem a very good solution when compared to the desired . This “best” approximation, using a single thread of red for every 180 threads, would have been hard to guess without the mathematical approach.
Space here does not permit presenting an additional application such as the often occurring problem for color specialists of finding out if given colors are “well balanced”, that is, finding out if combinations provide perfectly complementary colors or, at least, gray without shades of a color. Some critique to the method will be discussed too, since the (subjective) observation of colors probably involves other parameters. For sure, color theory as taught in many art schools seems in need of a more mathematical approach. Steve Campbell formulated it as follows in an e-mail contact about this topic: “The color theory application is one that many in mathematics may not be aware of, is timely, and would be fun to present to students.”
Curve fitting
Another application of the Moore-Penrose inverse can be found in the common practice to draw all kinds of geometric figures on images of artworks and buildings. Usually, simple triangles, rectangles, pentagons or circles suffice and still recognizing these mathematical shapes is seen as an “interpretation” of an architectural edifice or painting. Today, research on the borderline of mathematics and architecture tends to reject these “geometric readings in art” (see [3]).
However, a way to meet the shortcomings of this seemingly arbitrary drawing method is to use a similarity between these geometric studies in art and celestial mechanics. In the latter field, use of the least squares method is well established, ever since Carl Friedrich Gauss found Ceres, the “lost planet” astronomer G. Piazzi had briefly observed in January of 1801. Of course, it can be opposed that, unlike for celestial mechanics with its involved applications, such a mathematical method would present a serious overkill with respect to the intended straightforward artistic applications. This was true in the past, but nowadays software allows reducing the computational aspects to a few computer clicks. One can only wonder why this widespread and straightforward mathematical technique has not been applied before in art.
Figure 3: As any sketch class learns how to draw a human face starting from an ellipse (left), fitting an ellipse around the Mona Lisa (middle, right) makes sense, more than for, for instance, a rectangle.
Consider for instance the case of the Mona Lisa and finding the closed ellipse used to draw its face. Now, the data are not based on astronomical observations through a telescope, but on measurements made on a reproduction of the Mona Lisa as given in the illustration:
These will be filled in the matrices
The Moore-Penrose Inverse in Art
In this matrix notation, the curve fitting problem implies should be minimal, and the numerical values can be found by computing the product of the Moore-Penrose inverse of and . This is easily done using MathematicaTM:
PseudoInverse[X].j
Norm[X.PseudoInverse[X].j]^2/Norm[j]
It results in an ellipse
We can conclude that a rectangle with a proportion of 1.54… provides the closest fit and the word “closest” can be substantiated: the fit is “99.55%” (and 1.54… is closer to, say, 1.5, than to the golden number of 1.618…).
Example 4. Gaudi is known for his use of hyperbolic cosine functions. He used bags suspended by ropes which he inverted to get chain curves. Clearly, this way a not so continuous curve is obtained, yet nevertheless it is a classic statement among Gaudi specialists the architect did indeed use the catenary. Still, even if this is the case, for instance because further approximations were used, the question remains if a non-informed spectator can actually see this in Gaudi’s work, that is, if a spectator can notice, by mere observation, that a Gaudi gate, entrance or window, has a hyperbolic cosine shape.
Figure 4: Fitting curves on the Paelle Guell (left) and on the Collegio Teresiano (right).
We first tried this for the Paelle Guell: we wrote down coordinates of as many points we accurately could distinguish. Using the Moore-Penrose inverse, it turned out the parabola with equation , fits at , while the hyperbolic cosine and it fits at . This difference in closeness of fit can indeed be noticed, as the illustration shows. We executed a similar computation for a picture of Gaudi’s Collegio Teresiano, but there no difference can be noticed between the closed fit parabola and hyperbolic cosine. During the “Mathematics and Design 2007” conference in Blumenau, Brazil, I was most happy to learn Barcelona Prof. Amadeo Monreal shared this view, based on his knowledge of Gaudi’s work (see [4]).
Example 5. Suppose we want to determine the shape of a nuclear power plant.
Surprisingly, an ellipse fits well here:
- fits at .
Huylebrouck
Still, if we lift the x-axis over 5 units, we can propose the standard form equation for a hyperbola: , and this is close. Thus, we can faithfully claim the shape of a nuclear plant is seen as a hyperbola, as the adaptations on the top of the building, for reasons of resistance to wind, can hardly be detected.
Figure 5: Determining the profile of a nuclear plant. The profile of a nuclear plant, and the approximating shapes, a hyperbola and an ellipse.
Further ‘research’
The color theory approach could be applied to any list of ‘preferences’ that have to be combined. For instance, consider the ‘art’ of gastronomy: there are 4 main tastes, salt (Sa), bitter (Bi), sweet (Sw), sour (So). Food without salt gets a 0 on the salt scale, and an imaginary plate consisting of only salt a 1, and so on. The Sa-Bi-Sw-So values of some food are denoted in a vector: . Tastes can be mixed in an additive way, when spices are simply thrown one upon another. Subtractive mixing is also possible, when the spices go through two layers of disks with holes like in many common spice containers. And so, the question now becomes how to get the taste that comes close to a given taste? Surely more work in the kitchen is needed to explore whether the Moore-Penrose inverse gives the most delicious answer.
Figure 6: In gastronomy, it isn’t light beams going through a filter that are considered, but spices going through holes (left). The principles of additive (middle) and subtractive (right) mixing are similar.
References
[1] Campbell S. L. and Meyer, C. D. Jr, Generalized Inverses of Linear Transformations, Pitman Publishing Limited, London, 1979. [2] Dirk Huylebrouck, Generalized Inverses of a Sum with Radical Element, Applications, Linear Algebra and its Applications, 246 (1996), 159-175. [3] Huylebrouck D., Curve Fitting in Architecture, Nexus Network Journal, Vol. 9, no. 1, Spring, Ed. Kim Williams 2007 p. 59 - 70. [4] Monreal A., Gaudi en el Siglo XXI, Journal of Mathematics & Design, Volume 7, Number 1, Proceedings of the Mathematics and Design conference, Blumenau, Brazil, 2007.