Manuscript Offprint
arXiv:2608.23324Least-Squares and Low-Rank Approximation for Linear Relations Using a Diagrammatic Language
ARTICLE INFO
Keywords:
Linear Relations
String Diagrams
Least-Squares
Low-Rank Approximation
GSVD
Pseudoinverse
ABSTRACT
We employ the machinery of linear relations to the study of optimization problems in linear algebra. We first show that the relational version of the pseudo-inverse can be realized through a generalization of the least-squares problem. This allows one to prove that the pseudo-inverse realizes the solution of certain relational optimization problems. Our main result is showing that a certain truncation of this pseudo-inverse defines a solution to a relational version of the classical low-rank approximation problem which recovers both the Eckart-Young Theorem and several optimization problems involving pairs of matrices and vector spaces.
where is the Frobenius norm (i.e. finding a minimizer of the function over the set of all matrices of rank ). A solution is constructed as follows. First, one computes the Singular Value Decomposition (SVD) of , written as . The matrix is diagonal with non-decreasing diagonal entries called the singular values of . Let be the -th truncation of , i.e. the diagonal matrix whose -th entries are zero if , otherwise coincide with those of . Then, we have the Eckart-Young Theorem (EYT).
Theorem 1 (Eckart-Young). The optimization problem (1) has a (unique) solution given by the k-th truncation of A, i.e.
arXiv:2608.23324v1
This essentially answers all questions one might have about (1). For some natural variants of the problem, however, the solution is not so easy. For example, let W be a subspace of the domain of A. The restricted low-rank approximation problem
is very hard to solve using solely the SVD. One way to solve it is via an important work by De Moor and Golub [10, Theorem 6] which describes a solution (as well as sufficient conditions for the existence of a solution) to the more general optimization problem
*Corresponding author
juliamota@ufrj.br (J.d.A. Mota); iago@iagoleal.com (I. Leal de Freitas);
rufino.martelotte.lucas.c5@s.mail.nagoya-u.ac.jp (L. Rufino); jpaixao@ic.ufrj.br (J. Paixão)
ORCID(s): 0000-0002-9547-9629 (J.d.A. Mota); 0009-0001-6813-5863 (I. Leal de Freitas); 0009-0009-2402-7949 (L. Rufino); 0000-0002-1610-9022 (J. Paixão)
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 1 of 47
More concretely, a solution is given in terms of the so-called Restricted Singular Value Decomposition (RSVD) of the triplet . Going back to the restricted low-rank approximation problem (3), if one first computes a matrix whose image is , then
This is now in the format of (4), and so the problem is solved by applying the RSVD for the matrix triplet .
This solution, even though implementable, is arguably not completely satisfactory from a conceptual standpoint for a number of reasons, some examples given as follows.
• One first has to compute a basis or a generating set of the space W.
-
The existence of a solution is hard to describe. Indeed, a solution exists if and only if , where the terms are ranks of different blocked matrices involving the triplet (see Appendix B.2.2 for a precise definition).
-
The solution itself is delicate to describe: even defining the RSVD requires chopping up a blocked matrix into another ten-by-ten blocked matrix (100 blocks!), and the size of each block is given by a certain combination of the numbers in the previous item (see [10, Section 2]).
These conceptual issues often occur in linear algebra. Sometimes they are an inevitable reflex of the sheer difficulty of the problem. Other times, however, they are avoidable, which is often the case for problems mixing linear maps and vector spaces, just as (3). The key obstacle usually lies in the fact that the SVD, the RSVD and other famous matrix decompositions cannot receive vector spaces as input. This forced us to first compute a basis of W; in other cases one might have to resort to set-theoretical notation. A possible remedy is to change the language: instead of working with linear maps and vector spaces as if they were objects of different nature, one instead declares linear relations as the primary object of study.
1.1. The workflow of linear relations
Let , be two vector spaces. A linear relation from to is a subspace of the product , and we write . It is also standard to write to mean . Any vector space can be seen as a linear relation via the trivial inclusion . Moreover, any linear transformation can be seen as a linear relation via its graph . We say a linear relation is (or corresponds to) a linear transformation if it is equal to .
We now want to illustrate what can be called the "workflow" of linear relations, that is, how can one use them to sometimes put theorems of seemingly different natures into the same context. Let us consider, as an example, perhaps the most famous theorem in linear algebra: the Invertible Matrix Theorem (IMT). In order to be precise (since the IMT is often presented as an equivalence of more than 10 statements), we mean the following.
Theorem 2 (Invertible Matrix Theorem). For a square matrix M, the following are equivalent.
(i) M is surjective,
(iv) M is injective,
(ii) M has a right-inverse,
(v) M has a left-inverse,
(iii) M has full rank,
(vi) M has an inverse.
The IMT therefore "connects" together a number of statements concerning a single matrix M. To prove it, it is costumary to make use of a matrix decomposition, e.g. the canonical decomposition
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 2 of 47 where U, V are invertible matrices. It turns out that this decomposition can be generalized in a natural way to linear relations and, as a result, one can prove an analogous characterization theorem about linear relations which reduces to the IMT. Moreover, linear relations being more general than linear maps, this new theorem encodes much more information than the original IMT, which is not limited to statements about a single matrix anymore. This includes results about the existence of solutions to linear systems, and also the Exchange Lemma, which is a foundational lemma about vector spaces present in any proof-focused linear algebra textbook. For a more detailed account of this story, see [14]. Figure 1 illustrates the usual "workflow" of linear relations and how they can be used to put results mixing linear maps and vector spaces in the same context as results in which only one of the two appear.

Figure 1: How linear relations are used to "connect" theorems together.
1.2. Objectives
Following the notation of Figure 1, the goal of this paper, roughly speaking, is to apply this workflow when D is the SVD and T is the Eckart-Young Theorem. This is not so straightforward as the canonical decomposition of matrices mentioned earlier, the reasons being as follows.
- First, one needs to make sense of what the word "rank" means for linear relations. This is not a trivial question, since, for example, in the canonical decomposition of a linear relation one needs three numbers to describe the middle dimensions (as opposed to just one, in the case of linear maps). In this paper, we adopt a simpler approach and define the rank of a linear relation as the dimension of its image, i.e.
This of course matches the usual definition of rank when R is a linear transformation.
- The second problem is that the term in (1) is not well-defined since there is not a good candidate for what the norm of a linear relation should be. If corresponded to a linear transformation, we could make the (involutive) change of variables and make it so only appears inside of the norm. This "modified" version of the problem is the one we will consider in this paper.
Putting these two considerations together, the main result of this paper Theorem 27, which describes a solution (together with a sufficient condition for its existence) to the relational low-rank approximation problem
where and is a cofunction (i.e. it equals for some linear transformation ; here we define ). When itself is a cofunction, this reduces to the usual low-rank approximation problem (1) as we recover the Eckart-Young Theorem up to the uniqueness statement. Therefore, for the purposes of this explanation, let us call our main result the Generalized Eckart-Young Theorem (GEYT). What about when is a linear transformation? If , the relational low-rank approximation problem reduces to
where now S is a linear transformation. In other words, it is the problem of finding the smallest left-inverse of A. The solution is known to be the pseudo-inverse of A; it is the unique linear transformation satisfying the four Moore-Penrose equations [27], and can be characterized by the fact that it is a solution to the least-squares problem
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 3 of 47
If , we get a truncation (in the same sense of (2)) of the pseudo-inverse. This is the first conceptual advantage of the relational method: the Eckart-Young Theorem and the solution to the pseudo-inverse optimization problem (7) are particular cases of the same result.
In the same way that the proof of EYT uses the SVD, the proof of the GEYT uses a relational version of the SVD called the Generalized Singular Value Decomposition (GSVD), first introduced by [36] and later developed by many others [25, 33, 35, 5, 16, 13]. We therefore have completed the "workflow" diagram from Figure 1 with the exception of the mixed theorems, as illustrated in Figure 2.

Figure 2: The linear relation workflow applied to the Eckart-Young Theorem.
The remaining question is what fits in the remaining node of this diagram? In other words, what theorems we get by instantiating R as mixtures of linear maps and vector spaces? It turns out that, given a linear transformation A and a subspace W of the domain of A, if we instantiate R as the linear relation
we specialize to the restricted low-rank approximation problem (3), thus showing that both the restricted and non-restricted low-rank approximation problems are solved by applying the same theorem to different inputs (notice that we did not have to compute a basis for ). This, of course, is not the only approximation problem obtained from the GEYT. There are many other variants, seven of which can be seen, in a sense, dual versions of the restricted low-rank approximation problem; these are presented in Table 1.
Before proceeding, let us clarify some aspects of Table 1. The reader may be a little confused about the first column; it contains exactly the same information as the second column, but the relation R is now written using a syntax of string diagrams [29, 2] for Linear Algebra developed by Zanasi [39] called Graphical Linear Algebra (GLA) [8, 9, 6, 7, 26, 31]. Of course, the reader is not expected to understand the meaning of these diagrams yet. We, however, chose to include this column here to allow the reader to appreciate the fact that, even though the instances in the second column may feel arbitrary and/or taken "out-of-the-hat", the graphical syntax reveals how strikingly similar they truly are. According to Hinze and Marsden [20], string diagrams are a good tool for point-free reasoning and type-checking, and, in the authors' experience, they often greatly improve the readability of proofs. For that, and many other reasons, almost all of the proofs in this paper are done using the graphical syntax. Moreover, all proofs follow the calculational style [11], structured as sequences of diagram manipulations. Each step includes a "proof hint" in brackets, placed to the right of a diagram or statement, explaining which rule or result was used to arrive at it from the previous step.
1.3. Text Structure
Section 2 presents the theoretical foundations of this work, that is, the syntax and decompositions used throughout the text. Some concepts of Linear Algebra and Relations are revisited. Diagrammatic notation is presented, along with an explanation of how to reason with it. The decompositions used in the study of linear relations are introduced. The main objective of this chapter is to provide the reader with a “user manual” for understanding the concepts, notation, and results that will be developed in the following chapters.
Section 3 introduces the linear relations operations, generalizing the Least Squares problem to the context of linear relations. Building upon these characterizations, we revisit the definition of the pseudoinverse of relations and propose algorithms to calculate it. Instantiating R as a linear transformation, we obtain the Moore-Penrose pseudoinverse as a particular case. Finally, we present some applications of the problem in optimization problems.
Section 4, generalizes the Low-Rank Approximation problem to the context of linear relations. We introduce a low-rank approximation of a linear relation obtained from the truncation of the GSVD and prove that this is the cofunction
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 4 of 47
| R in Graphical Syntax | R in Point-full Syntax | Optimization Condition |
|---|---|---|
|  | ||
Table 1 Instantiations of GEYT, where A is a linear transformation, W is a subspace of the domain of A and V is a subspace of the codomain of A. Each line shows R in two different syntaxes and, on the last column, the condition on the comap S in the resulting optimization problem, i.e. (optimization problem) = : (optimization condition).
with the lowest rank and smallest norm that approximates the linear relation. Several instances of the problem are explored, showing how this approach recovers classical results.
2. Theoretical Foundations
This section presents the syntax and decompositions used in this work. Its main objective is to provide the reader with a “user manual” for understanding the concepts, notations, and results that will be developed in the following chapters. Whenever a proof is omitted, it is because it can be found in one of the published works [23, 14].
Throughout this work, we represent linear relations with string diagrams syntax. As noted by [20], these are well-known objects in category theory that allow equational reasoning without loss of type information. They characterize the arrows of free strict monoidal categories [29] and are, therefore, rigorous mathematical objects. Paixão et al. [26] apply string diagrams to develop a graphical syntax for Linear Algebra, known as Graphical Linear Algebra (GLA), which presents the laws of linear relations in an equational manner.
2.1. Graphical Notation for Linear Relations
We now present an introduction to how diagrams are constructed and outline the structures of how to manipulate and reason with them. Most of the results presented here have been published in [23]. For a more thorough account of Graphical Linear Algebra (GLA), we recommend the blog series by Paweł Sobociński [31].
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 5 of 47
An n-by-m linear relation can be written as a two-dimensional diagram with m dangling wires on the left and n on the right (the chamfered edge on the right is necessary because eventually we will need to start “flipping diagrams horizontally”, so it is important to retain directional information).
For example, a 2-by-1 linear relation can be written as a diagram — — with one wire on the left and two wires on the right. Generally, when is a -by- linear relation, it is more convenient to write — — , and when there is no confusion about the type information, we may omit the numbers and write it as — —. Lastly, when one of the numbers is zero, say, , then is called a linear subspace and we omit the dangling wire on the left, writing — —.
We also reserve different symbols based on how specialized the linear relation is: while the box symbol — — denotes a general linear relation, the curvy symbol — — is used when we know is a linear transformation. Moreover, the blue curvy symbol — — is used when is known to have an inverse (usually denoted by ), and the red curved symbol — — denotes orthogonal linear transformations.
In diagrammatic notation, the relational composition and Cartesian product operations become, respectively, the action of connecting diagrams horizontally and stacking them vertically, as shown in Definition 1. The opposite relation becomes simply the action of flipping the diagram to the opposite side.
Definition 1 (Operations on Linear Relations in Diagrams). The main operations on linear relations in diagrams are the following.
-
; = ,
-
= ,
-
= ,
-
= .
Notice that, similar to relational composition, to compute ; , R and S have to be compatible: the number of right-wires of R must be the same as the number of left-wires of S.
There are specific symbols commonly used for some linear relations, called identity, twist, zero, sum, copy, and discard. All of these graphs represent linear transformations and act as “building blocks” for more complex diagrams. Table 2 shows their diagrammatic symbols and corresponding linear transformations. Semantically, each diagram canonically represents a linear relation. We leave the details of how to manipulate such diagrams to Appendix A.1.
Subspaces can be thought of as relations where is the zero-dimensional space. In diagrammatic notation, these correspond to the diagrams with 0 wires on the left. In particular, the zero diagram can be thought of as the zero subspace , whereas the opposite of the discard, , can be thought of as the full space .
Definition 2 (Fundamental Subspaces of a Linear Relation). For every linear relation — —, we define:
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 6 of 47
(Identity)
(Twist)

(Zero)
(Sum)

(Discard)
(Copy)

Table 2
Special relations together with their names and graphical syntax.
With this definition, we can define surjectivity and injectivity graphically as
A is injective
A is surjective
In fact, as a side note, linear transformations can be defined as linear relations satisfying — and . If these equations hold, we say the relation is, respectively, deterministic and total. More concretely, all four properties (injectivity, surjectivity, determinism and totality) can be written in terms of the white and black structures (see Figure 19).
The diagrammatic manipulation rules, as well as useful theorems are presented in Appendix A. The appendix also showcases rules for converting between the graphical and the usual syntax for matrices and linear relations.
2.2. Orthogonal Projections
For a fixed subspace —, we denote by — the orthogonal projection onto —, defined as follows via linear relations:
Definition 3 (Orthogonal Projection). The orthogonal projection — into a subspace — is the linear relation:

In the following, we briefly recall the properties of an orthogonal projection in terms of linear relations.
Lemma 3. An orthogonal projection satisfies
-
,
-
,
-
.
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 7 of 47
2.3. Generalized Singular Value Decomposition for Linear Relations
Decomposition of linear transformations and linear subspaces are widely used tools in Linear Algebra, as they reveal fundamental properties of these objects. For linear relations, decomposition plays a similar role. Results such as the canonical decomposition of linear relations [19] and the characterization of canonical forms equivalent to Kronecker's [4] allow us to separate regular and singular components, providing a clear description of the kernels, images, and dimensions involved. More recently, we have shown how relational decompositions directly connect classical concepts of invertibility and rank to the general case of linear relations [14].
The study of linear relations allows the application of a classical result: every linear relation can be expressed both in the span form and in the cospan form. This is described in Proposition 4.
Proposition 4 (Span/Cospan form). For every linear relation , there exist , , , and such that:
(Span)
(Cospan)
It is always possible to switch between the span and cospan forms. Throughout the text, both representations will be employed according to the convenience. Expressing a linear relation in the span form is particularly useful for constructing visualizations, as illustrated in Example 1, whereas the cospan form is advantageous for verification: a pair belongs to the relation if and only if the equality holds.
Example 1 (Span Visualization). Let be a linear relation in span form, as described in Proposition 4. We choose and , where are orthogonal linear transformations, and
with such that . To illustrate how we can construct visualizations using span, we apply the linear transformations induced by and to the vectors
In Figure 3, the vectors are shown in the upper central illustration. On the right, their images are represented, and on the left, the corresponding images . Applying the orthogonal linear transformations and produces the lower illustrations, where and . For the linear relation , however, only the two lower figures are observable: we know the pairs but not the intermediate representations.
The choices of linear transformations A, B in the Example 1 were not random. Through a tool known as Generalized Singular Value Decomposition (GSVD), we can simultaneously decompose a pair of linear transformations into linear transformations with non-negative diagonal entries, structured by blocks as in S and C, plus two rotations. The GSVD was initially introduced by Van Loan [36] and later developed by many others [25, 33, 35, 5, 16, 13].
Theorem 5 (Generalized Singular Value Decomposition). For every pair of linear transformations and there exist numbers , , , , , , orthogonal linear transformations and , invertible diagonal linear transformations and , and a surjective linear transformation such that


J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 8 of 47

Figure 3: Visualization of a linear relation in span form.
Note that the linear transformation does not possess orthogonality or diagonality properties — we can only guarantee its surjectivity. Nevertheless, it does not stand a problem, since we will see below that vanishes when we apply Theorem 5 to a linear relation in span form as in Proposition 4.
Theorem 6 (GSVD for Linear Relations). For every linear relation , there exist numbers , , , , , orthogonal linear transformations and , and invertible linear transformations and , such that

Proof.
[Prop.4: Span]
[Thm.5: GSVD]
Fig.19-DET + SUR:
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 9 of 47
□
As this result will be used several times throughout this work, in order to avoid repetition, Definition 4 defines the “center” part of Theorem 6 as a diagonal linear relation.
Definition 4 (Diagonal Linear Relation in Graphical Version). Let such that and , and and be invertible diagonal linear transformations. The diagonal linear relation is defined by
Remark 1. From now on, for any linear relation , the notations , , and will always denote, respectively, the orthogonal linear transformations and the diagonal linear relation given by the GSVD (Theorem 6 and Definition 4).
Remark 2. Definition 4 presents the diagonal linear relation in span form. Note that, in graphical syntax, changing to cospan form is the same as inverting the invertible linear transformations and and sliding wires:
(Cospan)
Theorem 6 provides a GSVD for any linear relation . Since, by Proposition 4, every linear relation can be described in terms of two linear transformations, the following question arises: is it always possible to turn this GSVD into the GSVD of a pair of linear transformations by separately and compatibly decomposing the constituent factors and ? The answer is yes, but it requires the introduction of a linear transformation , which connects the two factorizations, as proved in [14, Section 3.1].
2.4. Fundamental properties and subspaces with the GSVD
The GSVD is powerful enough to characterize all fundamental properties and subspaces of a linear relation. We show in the next two lemmas that the vanishing of its middle wires determine the four fundamental properties, while the orthogonal transformations produce the fundamental subspaces. In both Lemma 7 and 8, let be decomposed as in Theorem 6, i.e.,

Lemma 7 (Fundamental properties via GSVD). For every linear relation , the vanishing of central wires of its GSVD determine the fundamental properties of :
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 10 of 47
Proof. We prove the TOT case. The other three cases are proven similarly.

[Lem 8]

Multiply
is orthogonal
Remove —● from both sides
[Fig.10]
Lemma 8 (Fundamental subspaces via GSVD). For every linear relation —R—, we have that:


Proof. We prove the case —Ker(R) . The other three cases are proven similarly.

[Def.2]
[Thm.6: GSVD]
is orthogonal
Fig.11 + Fig.12 + C and S invertible
□
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 11 of 47
3. Relational Least-Squares
The least-squares method has been a very important tool for data fitting since its original formulation by Legendre [22], and its developments extend across all areas of mathematical science. The method solves inconsistent linear systems of the form , where A is a linear transformation with more rows than columns. This section generalizes this method to the context of linear relations.
For illustrative purposes, consider the following motivating example: a natural disaster is about to occur, and the government needs to make quick decisions to shelter the city’s population. A diagram linking each person to the nearby shelters they have access to is displayed in Figure 4a. Some people, of course, may not have access to any shelter, in which case a natural measure would be to associate them to those accessible by the closest person in their vicinity, as shown in Figure 4b.
Roughly speaking, the problem receives as input a finite relation between shelters and people and returns a reasonable (which in mathematical terms would mean minimizing a certain norm) cofunction, i.e. an injective and surjective relations, from shelters to people. If the input relation were an injective function, the output would be a particular choice of left-inverse. We now make this discussion precise by defining operations which take a linear relation as input and return, respectively, something injective, surjective, total or deterministic.
Remark 3. From here on we often use the compact notation . This means taking the argmin with respect to the function over all elements x satisfying the property .
3.1. Least-Squares Operators

(a) Example of finite relation between houses and people in a city.


(b) Example of new finite relation between houses and people in a city, ensuring that all people are sheltered.


(c) Example of the new finite relation between houses and people in a city, ensuring that each person is assigned to only one house.
Figure 4: These examples illustrate how a linear relation can be turned injective or surjective.
Definition 5 (Generalized Least-Squares). For every linear relation R, define
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 12 of 47
-
,
-
,
-
,
-
.
Example 2 (Least-Squares with Equality Constraints [18]). If we set

the relation represents the solutions to that satisfy the equality constraint . The relation , from Definition 5, extends by associating with whenever there exists a that satisfies the equality constraints and minimizes the Euclidean distance to , which is originally associated with .
Example 3 (Minimum-Norm Solution Restricted to a Subspace). If we set

the relation represents the solutions to restricted to . The relation from Definition 5 selects only the with minimum norm among all possible solutions while maintaining the restrictions.
Example 4 (Orthogonal Projection onto an Affine Space). If we set

the relation represents the solutions to the affine equation , for all . The relation from Definition 5 expands by associating with whenever the orthogonal projection of into the affine subspace is originally related to .
Simply by looking at Definition 5, it is not clear, for example, that is still a linear relation. This is a consequence of Theorem 9 below, which shows that these operations can be written as certain linear projections of . For example, a linear relation can be canonically made injective by restricting it to . Similarly, it can be made total by composing it with the projection onto . Figure 5 presents a geometric visualization of the projections associated with surjectivity and injectivity.
Theorem 9 (Least-Squares as Projection). For every linear relation , the following statements hold:
-
= ,
-
= ,
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 13 of 47

(a) Given a linear relation and a vector , we project onto to obtain the nearest vector such that .

(b) Given a linear relation and a set of vectors , we select the projection with the smallest norm (obtained in ) such that .
Figure 5: Geometric visualization of the projections associated with surjectivity (left) and injectivity (right).
Proof. Appendix B.1.
Although the relation operations of Definition 5 were formulated to satisfy each of the four fundamental properties, we can formalize these guarantees rigorously, proving them directly from Theorem 9. The following lemma establishes this result.
Lemma 10 (Fundamental properties in Relational Least-Squares). For every linear relation , the following statements hold:
is surjective,
is total and
is injective,
is deterministic.
Proof. Appendix B.1.
3.1.1. Compositions of Least-Squares Operators
By composing the relation operations of Theorem 9, it is possible to obtain new linear relations with specific properties. For example, the four possible compositions of the Tot operation take the form:
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 14 of 47
The properties of these linear relations obtained through the composition of the relation operations of Theorem 9 are described in Lemma 11.
Lemma 11 (Idempotency and Commutativity). For every linear relation — —, the following statements hold:
Idempotency
| 1. | — Sur (Sur(R)) — = — Sur(R) — , |
|---|---|
| 2. | — Inj (Inj(R)) — = — Inj(R) — , |
| 3. | — Tot (Tot(R)) — = — Tot(R) — , |
| 4. | — Det (Det(R)) — = — Det(R) — . |
Commutativity
| 6. | — Sur (Inj(R)) — = — Inj (Sur(R)) — , |
|---|---|
| 7. | — Sur (Tot(R)) — = — Tot (Sur(R)) — , |
| 8. | — Det (Inj(R)) — = — Inj (Det(R)) — , |
| 9. | — Tot (Det(R)) — = — Det (Tot(R)) — . |
Proof. Appendix B.1.1.
□
With the results of idempotency and commutativity established, we are now ready to state Theorem 12, which synthesizes the fundamental properties of all compositions between pairs of the relational operations Sur, Inj, Tot and Det.
Theorem 12 (Linear Compositional Relations: Fundamental Properties). For every linear relation — — and for any pair of relational operations
,
the composed — — relation satisfies the fundamental property indicated at the intersection of the row labeled and the column labeled in the following table:
| Sur | Inj | Tot | Det | |
|---|---|---|---|---|
| Sur | surjective | surjective and injective | surjective and total | surjective |
| Inj | surjective and injective | injective | injective | injective and deterministic |
| Tot | surjective and total | total | total | total and deterministic |
| Det | deterministic | injective and deterministic | total and deterministic | deterministic |
Proof. Direct application of Lemmas 10 and 11.
□
The commutative compositions established in Lemma 11 exhibit, by Theorem 12, particularly relevant properties. In particular, the opposite of the composition — Sur (Inj(R)) — coincides with the well-known pseudoinverse of relations, as defined in [1], which will be further explored in Section 3.3. The remaining compositions, although still requiring a more in-depth investigation of their properties, also present themselves as mathematically promising operations, which we have not yet found in the literature. The composition — Sur (Tot(R)) — defines a surjective and total relation, that is, it ensures that all elements are related; — Det (Inj(R)) — , being deterministic and total, results in a one-to-one relation; and — Tot (Det(R)) — produces a linear relation that is also a function, providing a functional approximation of the original linear relation.
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 15 of 47
3.2. Relational Least-Squares via GSVD
Besides the optimization and projection formulations presented above, the operations Sur, Inj, Tot, and Det admit an additional description in terms of the GSVD, in which case, perhaps surprisingly, they correspond to just swapping the colors of the black and white dots.
Theorem 13 (GSVD for Relational Least Squares). Let be a linear relation whose GSVD is

Then,

Proof. We will prove item 1. The remaining items are proved analogously.

[Thm.9]
[Def. 3]
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 16 of 47

Fig.9 + Fig.12.
This completes the proof.
It may be useful to think of the theorem above as the following: calculating the relational least-squares of a linear relation is equivalent to “switching on or off” the wire associated with that property in the GSVD, if we wish the relation to be surjective, we simply change the color of the node corresponding to the wire .
Corollary 14. Theorem 13 coincides, except for two orthogonal linear transformations, with the application of the operations Sur, Inj, Tot, and Det to the GSVD of a diagonal linear relation. In other words, if we write for the relation in the middle of the GSVD of , we get
-
,
-
,
-
,
-
.
3.3. Pseudoinverse
Definition 6 (Pseudoinverse of Linear Relation). For every linear relation , its pseudoinverse is
Remark 4. By Theorem 13, is a cofunction, so we henceforth denote it as .
As a cofunction, can be interpreted as a relation that associates elements of the target set to elements of the starting set, and not the reverse. This can be interpreted geometrically through Definition 5, as illustrated in Figure 6. Moreover, it corresponds precisely to the pseudoinverse, originally formalized by Alvarez [1], which generalizes the classic Moore-Penrose pseudoinverse [27] to the broader context of linear relations.

Figure 6: Geometric visualization of the pseudoinverse. Given a linear relation and a vector , we project onto to obtain the nearest point . The vector is then associated with the set of infinitely many least squares solutions of the relational equation . Among these solutions, the projection with the smallest norm (obtained in ) is selected, characterizing the pseudoinverse such that .
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 17 of 47
By opening the orthogonal projections in Definition 6, we arrive at the following characterization of the pseudoinverse in terms of the fundamental spaces of .
Lemma 15. For every linear relation , its pseudoinverse can be written as

Proof. Appendix B.2.
□
Furthermore, for linear maps, Lemma 15 simplifies to an expression in terms of it and its transpose.
Corollary 16 (Pseudoinverse of linear transformation). For every linear transformation —A—, its pseudoinverse can be written as

Proof. Appendix B.2.
□
According to Ben-Israel and Greville [3], the classic formulation of the Moore-Penrose pseudoinverse is traditionally presented in terms of the Penrose equations, introduced by Penrose [27]. The following theorem says that the relational definition of the pseudoinverse presented in Definition 6, when applied to the particular case where is a linear transformation , satisfies the four Penrose equations.
Theorem 17 (Moore-Penrose pseudoinverse). For every linear transformation —A—, its pseudoinverse —A+— is the unique cofunction satisfying the following system of equations:

Proof. Appendix B.2.
□
3.3.1. Pseudoinverse via GSVD
The composition of the injectivity and surjectivity operations, which defines the pseudoinverse , not only extends the classical Moore–Penrose theory to the context of linear relations but also enables the derivation of algorithms. We now present a formulation of the pseudoinverse of relations in terms of the GSVD.
In the graphical syntax, the procedure essentially consists of turning on and off the “wires” corresponding to the injectivity and surjectivity properties in the GSVD of .
Theorem 18. Let be a linear relation with GSVD as in Theorem 13. Then its pseudoinverse is

(14)
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 18 of 47
Proof. Theorem 13 for Inj and Sur.
For a diagonal linear relation, Theorem 18 maintains the central structure, without the orthogonal linear transformations.
Corollary 19 (Pseudoinverse of a Diagonal Linear Relation). The pseudoinverse of a diagonal linear relation
Remark 5. By Corollary 19, we can rewrite Theorem 18 in the simplified form
In the particular case in which the linear relation is a linear transformation , it is still possible to employ the GSVD as in Theorem 6. To this end, it suffices to consider the linear transformation in the representation of the linear relation in span form (Proposition 4), in which case the GSVD coincides with the SVD [18, 34]. In this way, we recover the classical solution of the Moore–Penrose pseudoinverse, introduced by [28], as established in Theorem 20.
Theorem 20 (SVD for Pseudoinverse). For every linear transformation , there exist orthogonal linear transformations and and a linear transformation with nonnegative diagonal entries such that, if
where .
Proof. Appendix B.2.1
3.3.2. Optimization problems
Now, we show how two optimization problems presented in the article The Restricted Singular Value Decomposition: Properties and Applications [10] can be reformulated and reinterpreted when expressed in the semantics of linear relations.
The original paper uses the Restricted Singular Value Decomposition (RSVD) to analyze a series of applications involving the decomposition of a linear transformation A relative to two other linear transformations B and C, exploring how restrictions on column and row spaces influence decompositions and geometric relations between kernels and images. The results obtained in the context of the RSVD generally depend on the complete structure of the triple and the interaction between the generated subspaces. From the perspective of linear relations, we can view the triple of linear transformations as a decomposition of linear relations . This is similar to the span and cospan forms in Proposition 4. A proof that every linear relation may by decomposed this way is left to Proposition 43.
As proven in [10], by setting or , the RSVD reduces to the QSVD — a decomposition equivalent to the GSVD. In this paper, we revisit some of the problems presented by the authors for the case .
Remark 6. To provide context for the reader and facilitate comparison between version, Appendix B.2.2 contains all relevant theorems of [10] “as-is”, i.e., in terms of triplet of matrices. Throughout this section we prove equivalent results using linear relations instead.
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 19 of 47
We begin by [10, Thm. 4], transcribed as Theorem 47. In that theorem, the authors describe the conditions for the linear transformation that minimizes rank to be unique. We present the same result in Theorem 22, but first prove a useful lemma.
Lemma 21 (Image of ). For every linear relation and every cofunction ,

Proof.

Fig.10 + Fig.19
Theorem 22 (Uniqueness of that minimizes rank ). For every linear relation ,
if and only if is injective and surjective.
Proof. Let .
—R— is injective and surjective
[Cor.48]
[Lem.21]
[Thm.18: Pseudoinverse]
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 20 of 47
In [10, Thm. 7], transcribed as Theorem 49, the authors seek to characterize the minimum norm solution of the matrix equation with respect to the unknown linear transformation . They also note that this equation has particular historical relevance, as it led Penrose to the formulation of the pseudoinverse that now bears his name. We reformulate these statements into Theorems 25 and 26, both in terms of linear relations. Lemmas 23 and 24 provide the necessary tools for that.
Lemma 23 (Conditions for the existence of an upper limit for a linear relation). Let be a linear relation. The following statements are equivalent:
-
is injective;
-
such that ;
-
;

Proof.
is injective

[Lem.7]
[Fig.18]

[Fig. 19]
[Lem.40-item 1]
[Lem.38]
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 21 of 47

[Algebra]
[Fig.18]
Lemma 24 (Conditions for the existence of a lower limit for a linear relation). Let be a linear relation. The following statements are equivalent:
-
is surjective;
-
such that ;
-
;

Proof. Analogous to the proof of Lemma 23.
Theorem 25 (Upper limit with least norm of a linear relation). For every injective linear relation ,
Proof. Let .
is injective
[Cor.50]
[Lem.23]
[Thm.18: Pseudoinverse]
Theorem 26 (Lower limit with least norm of a linear relation). For every surjective linear relation ,
Proof. Analogous to the proof of Theorem 25.
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 22 of 47
The results of this section establish an interesting connection between the pseudoinverse of linear relations and optimization problems. In particular, Theorems 22, 25 and 26 characterize solutions according to two distinct criteria: minimizing the rank of the difference between relations and minimizing the Frobenius norm of a cofunction that approximates a given linear relation.
In the next section, we revisit these criteria by exploring a relational version of the low-rank approximation problem. This formulation brings together the rank constraint and the minimization of the Frobenius norm within a unified optimization framework, extending classical results, such as the Eckart–Young theorem, to the context of linear relations.
4. Relational Low-Rank Approximation
In Linear Algebra, low-rank approximation consists of an optimization problem that seeks to represent a linear transformation in the best possible way by another of lower rank. This approach has numerous applications, as it enables compact representations with controlled information loss. Applications include image processing and compression, data mining and analysis, noise reduction, regularization of ill-posed problems, and statistical modeling, among many others [37, 21, 24, 30, 15]. This chapter presents a generalization of low-rank approximation to linear relations.
Throughout this work we generalize the notion of “rank” to linear relations according to the following definition.
Definition 7 (Rank of a Linear Relation). For every linear relation , we define its rank as
4.1. Generalizing Low-Rank Approximation for Linear Relations
We begin by using the GSVD to define a low-rank cofunction that approximates a linear relation.
Definition 8 (Relational Low-Rank Approximation). For every linear relation with rank and for any , we define the cofunctions
where
-
is the cofunction containing the smallest elements of the diagonal of ;
-
as the cofunction containing the largest elements of the diagonal of .
Remark 7. For any linear relation with rank r,
Theorem 27 states that, for every linear relation of rank , , as defined in Definition 8, is the minimum norm cofunction with rank that approximates . A similar result was proved in [10, Thm. 6] (stated in Theorem 51), although in a different context: given three linear transformations , , and , the authors characterize the minimum norm function that satisfies a given value for rank .
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 23 of 47
Theorem 27 (Relational Low-Rank Approximation with Least Norm). Let be defined as in Definition 8. For every linear relation of rank and for every linear transformation satisfying
we have:
Proof.
[Cor.52]
[Lem.21]
Variable change:
Def.8: Relational
Low-Rank
4.2. Instances
From the formulation presented in Theorem 27, it is possible to retrieve a series of results from the literature through instances of the linear relation and the number . We begin with a more familiar instance, namely, when the linear relation reduces to a linear transformation. This case serves as a consistency check for the relational formulation and provides a direct bridge to classical theory, since the result obtained corresponds to the Eckart-Young theorem [12, 38].
Theorem 28 (Eckart-Young Theorem via Relational Low-Rank Approximation). Let be a linear transformation with rank . Then, for every we have
Proof. Let . We instantiate Theorem 27 with .
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 24 of 47
⟺ 𝐴𝑟−𝑘 ∈ argmin 𝑆 [ ‖ ‖ ‖ 𝑆 ‖ ‖ ‖𝐹 ∶ rank ( 𝐴 −𝑆 ) = 𝑘 ] [ 𝑘𝐼 = 𝑘𝑆 = 0] ⟺ 𝐴 −𝐴𝑘 ∈ argmin 𝐴 −𝑆 [ ‖ ‖ ‖ ‖ ‖ 𝐴 −𝑆 ‖ ‖ ‖ ‖ ‖𝐹 ∶ rank ( 𝑆 ) = 𝑘 ] ⎡ ⎢ ⎢ ⎣ Variable change: 𝑆 ∶= 𝐴 −𝑆 ⎤ ⎥ ⎥ ⎦ ⟺ 𝐴𝑘 ∈ argmin 𝑆 [‖ ‖ ‖ ‖ ‖ ‖ 𝐴 −𝑆 ‖ ‖ ‖ ‖ ‖ ‖𝐹 ∶ rank ( 𝑆 ) = 𝑘 ] [ Simplify] Lemma 29 shows that Theorem 27 recovers Theorem 25 when 𝓁 = 𝑟, that is, it finds the smallest upper limit of a linear relation. Lemma 29 (Upper limit with least norm of a linear relation via Relational Low-Rank Approximation). Let 𝑚 𝑅 𝑛 be an injective linear relation and 𝑚 𝑅+ 𝑛 its pseudoinverse defined as in Definition 6. Then 𝑚 𝑅+ 𝑛 ∈ argmin 𝑚 𝑆 𝑛 [ ‖ ‖ ‖ 𝑆 ‖ ‖ ‖𝐹 ∶ 𝑅 ⊆ 𝑆 ] , Proof. We instantiate Theorem 27 with 𝑟 = 𝓁. 𝑅 + 𝑟 ∈ argmin 𝑆 ⎡ ⎢ ⎢ ⎣ ‖ ‖ ‖ 𝑆 ‖ ‖ ‖𝐹 ∶ rank ⎛ ⎜ ⎜ ⎝ 𝑅 −𝑆 ⎞ ⎟ ⎟ ⎠ = 0 ⎤ ⎥ ⎥ ⎦ ⇔ 𝑅+ ∈ argmin 𝑆 [ ‖ ‖ ‖ 𝑆 ‖ ‖ ‖𝐹 ∶ 𝑅 ⊆ 𝑆 ] [ 𝑅 + ̄𝑟 = 𝑅+ and Lem.23] By instantiating 𝓁 = 𝑟, we obtain another classic result when considering the linear relation 𝑅 as a linear transformation 𝐴 : the pseudoinverse is the left-inverse of least norm of a linear transformation. Lemma 30 shows this result. Lemma 30 (Left-inverse with Least Norm). The pseudoinverse of an injective linear transformation 𝑚 𝐴 𝑛 satisfies 𝑚 𝐴+ 𝑛 ∈ argmin 𝑚 𝑆 𝑛 [ ‖ ‖ ‖ 𝑆 ‖ ‖ ‖𝐹 ∶ 𝐴 𝑆 = ] , Proof. We instantiate Theorem 27 with 𝑟 = 𝓁 and 𝑅 = 𝐴 . 𝐴 + 𝑟 ∈ argmin 𝑆 ⎡ ⎢ ⎢ ⎣ ‖ ‖ ‖ 𝑆 ‖ ‖ ‖𝐹 ∶ rank ⎛ ⎜ ⎜ ⎝ 𝐴 −𝑆 ⎞ ⎟ ⎟ ⎠ = 0 ⎤ ⎥ ⎥ ⎦ ⇔ 𝐴 + 𝑟 ∈ argmin 𝑆 ⎡ ⎢ ⎢ ⎣ ‖ ‖ ‖ 𝑆 ‖ ‖ ‖𝐹 ∶ 𝐴 −𝑆
⎤ ⎥ ⎥ ⎦ [ Def. 7 ] ⇔ 𝐴+ ∈ argmin 𝑆 [ ‖ ‖ ‖ 𝑆 ‖ ‖ ‖𝐹 ∶ 𝐴 𝑆 = ] [ Lem.23] J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier Page 25 of 47
Instances of Theorem 27 also allow us to recover some of the optimization problems proposed in [10], already cited throughout this work. To do this, it suffices to consider the linear relation in its cospan form (Proposition 4).
Lemma 31 ([10, Thm. 6] via Relational Low-Rank Approximation). For every linear relation , there exist orthogonal linear transformations and , and a diagonal linear relation , defined as in Definition 4, such that
Proof. Apply Theorem 27 with .
Lemma 32 ([10, Thm. 7] via Relational Low-Rank Approximation). For every linear relation , we have that:
Proof. By substituting in Lemma 29 we obtain
[Algebra + Lem.23]
One can also recover the main result from [17], which describes a solution to the problem of low-rank approximation with a specified number of fixed columns.
Lemma 33 ([17] via Relational Low-Rank Approximation). Let be a linear relation. Then there exist and such that and
Proof. We instantiate Theorem 27 with .
[Lem.41]
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 26 of 47
[Algebra]
Finally, Theorem 27 can also be instantiated using subspaces, arriving at all of the results shown in Table 1. Below, as an example, we prove two of them.
Lemma 34. Let be a linear relation where is a subspace and is a linear transformation. Then

Proof. We instantiate Theorem 27 with
[Fig. 9]
Variable change
[Algebra]
Lemma 35. Let be a linear relation where is a subspace and is a linear transformation. Then

J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 27 of 47
Proof. We instantiate Theorem 27 with , and the proof proceeds analogously to the proof of Lemma 34.
Lemma 36. Let be a linear relation where and

Proof. We instantiate Theorem 27 with , and the proof proceeds analogously to the proof of Lemma 34.
A. Axioms and Theorems in Graphical Notation
Most of the proofs in this text consist of sequences of diagram manipulations. This subsection contains all the necessary rules in their diagrammatic form. We present the theorems of linear relations in graphical syntax, which will be used later. Only the theorems necessary for the presented proofs are recorded here. A complete presentation can be found at [26]. In order to maintain the focus of this work, most of the proofs in this section will be omitted, as they can be found in the same reference.
Raw terms are quotiented with respect to the laws of symmetric strict monoidal (SSM) categories, summarized in Fig.7. We omit the (well-known) details [29] here and mention only that this amounts to eschewing the need for “dotted line boxes” and ensuring that diagrams with the same topological connectivity are equated. For the purposes of this work, a detailed knowledge of strict symmetric monoidal categories is not required, since we use this structure only as a convenient tool for graphical reasoning.
In graphical notation, the diagrams are closed under two symmetries: Mirror-Image and Color-Swap. The theorems and their corresponding symmetries are summarized in Figures 9 to 18. Finally, Figure 19 outlines statements determining whether a relation is classified as total (TOT), deterministic (DET), surjective (SUR), or injective (INJ).
Lemmas 37 to 40 show how compositions of linear relations and linear transformations behave in equalities and inequalities.
Lemma 37 (Opposite is Weak Inverse). For every linear transformation ,
Lemma 38. Let and be two linear transformations, then
Proof.
Fig.19-TOT:
Fig.19-DET:
□
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 28 of 47

Figure 7: Laws of Symmetric Strict Monoidal (SSM) Categories.
Lemma 39. For every linear relations , and linear transformations , ,

Proof.


□
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 29 of 47
Lemma 40. For every linear transformations , , , ,
Proof. We first prove item (i). By Lemma 39, . The equality follows by Lemma 38. The remaining items are instances of the first one.
Lemma 41. For every linear relation and every cofunction , there exist linear transformations and such that

Proof.

[Fig.9]
A.1. Translating graphical notation to classical notation
In the graphical syntax, each diagram semantically corresponds to a linear relation. The translation of diagrams to classical notation is compositional and translates their semantic meaning; that is, the meaning of a compound diagram is calculated from the meanings of its sub-diagrams. Here there is a connection with relational algebra, the two operations
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 30 of 47
𝑅 ⊆ 𝑆 ⟺ 𝑅 ⊇ 𝑆 𝑅 ⊆ 𝑆 ⟺ 𝑅 ⊆ 𝑆 Figure 8: The Symmetry Theorems = = = = = = Figure 9: Commutative Comonoid 𝑅 ⊆ 𝑅 ⊇ ⊆ ⟺ 𝑘 = 0 𝑘 𝑘 𝑅 ⊆ 𝑅 ⊇ 𝑅 𝑅 𝑅 ⊇ ⊆ 𝑅 𝑅 𝑅 𝑅 𝑅 𝑅 ⊆ ⊇ 𝑅 𝑅 𝑅 Figure 10: The Inequality Theorems of diagram composition are mapped to the standard ways of composing relations: relational composition and cartesian product. ⟼ {(𝑥, [ 𝑦1 𝑦2 ]) ∣ 𝑥, 𝑦1 , 𝑦2 ∈ ℝ and 𝑦1 = 𝑦2 = 𝑥 } ⟼ {(𝑥, ∗) | 𝑥 ∈ ℝ} ⟼ {([𝑥1 𝑥2 ] , 𝑦) ∣ 𝑥1 , 𝑥2 , 𝑦 ∈ ℝ and 𝑦 = 𝑥1 + 𝑥2 } ⟼ {(∗, 𝑦) | 𝑦 ∈ ℝ and 𝑦 = 0} The generators , , and are, respectively, the opposite of the relations above, as hinted by the symmetric graphical syntax. Its interpretation in classical notation is therefore trivial. Example 5. Here’s an example of how to translate a more complicated diagram. The intuitive way to think about diagrams is like a series of logical gates, where the input starts on the left and flows to the right via the wires. In the J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier Page 31 of 47

Figure 11: Frobenius Algebra

Figure 12: Bialgebra

Figure 13: Flip

Figure 14: Snake
image below we include some variable names (which are not wire numberings) to aid comprehension.

By visualizing the 's flowing to the right, we can see is discarded and is copied. One of the copies is passed to while the other is added with to form . So and . Thus, written in classical notation this
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 32 of 47

Figure 15: Connect sum

Figure 16: Split

Figure 17: Compare

Figure 18: Minimum and maximum relations
Types of Relations
| is TOT | is DET | is SUR | is INJ |
|---|---|---|---|
Figure 19: Each column of the table is a series of equivalent statements. Furthermore, the opposite inequalities for the second and third row hold for any relation (See Figure 10). We are, thus, allowed to treat these characterizations as equalities.
diagram corresponds to the relation
For the purpose of simplifying the notation, sometimes in this paper, the inclusion “” will be omitted and diagrams such as the one presented above will be written in classical notation as follows.
In our case, string diagrams also implicitly handle some non-trivial rules in the usual syntax, just as is commonly done with associativity of functions by ignoring parentheses. Table 3 exemplifies how some rules are handled implicitly in the diagrammatic language, with the dotted lines simulating parentheses. It is worth noting that the dashed lines are represented here for illustrative purposes only and are not part of the notation.
Table 4 showcases how classical constructions are formulated on either graphical or usual notation.
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 33 of 47
| Usual syntax | Graphical syntax |
|---|---|
|  | |
Table 3 Implicit rules. The dotted lines represent parenthesization.
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 34 of 47
| Graphical Syntax | Name | Classical Notation |
|---|---|---|
| Relation | ||
| Opposite | ||
| Orthogonal complement [32] | ||
| Composition | ||
| Cartesian product | ||
| ____ | Identity | |
| Linear transformation | ||
| Linear transformation known to have an inverse | ||
| Orthogonal linear transformation | ||
| Linear Subspace | ||
| Linear transformation composition | ||
| Image | ||
| Kernel | ||
|  | Two-by-one block linear transformation | |
| One-by-two block linear transformation | ||
| Two-by-two linear transformation | ||
| Two-by-two block linear transformation |
Table 4
Dictionary of Notations. denote relations; represent linear transformations; and are real numbers.
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 35 of 47
B. Auxiliary results and omitted proofs
B.1. Relational Least-Squares
Lemma 42 (Properties of the orthogonal projection). Let be a finite-dimensional subspace of , and . Then
-
-
-
and the inequality is an equality iff .
Proof. 1. If with then
[Pythagorean Theorem]
-
If with then .
[Item 2 + Pythagorean Theorem]
[Algebra]
Furthermore, inequality is an equality if and only if .
Proof of Theorem 9 (Relational Least-Squares). We prove items 1 and 2. The proofs of the other items are analogous.
[Def.5]
[Def. argmin]
[Lem.42 - item 3]
[Def.1 - items 1 and 2].
- By definition, and . Since the linear relation is a subspace of , it follows that
Consequently, . Thus, any such that can be expressed as , for some .
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 36 of 47
Pythagorean Theorem
Therefore
So
[Def.5]
[Eq.(15)]
[Def.1 – items 1 and 3]
Proof of Lemma 10 (Fundamental properties). We prove item 1 The remaining items are proved analogously.

[Thm.9]
[Def. 3]
[Def.2: Fundamental subspace]
[Fig.10]
[Fig.9]
□
B.1.1. Compositions of Least-Squares Operators
Proof of Lemma 11 (Idempotency). We prove item 1. The remaining items are proved analogously.
Sur (Sur(R))
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 37 of 47
[Thm.9]
[Thm.9]
[ Lem.3 ]
[Thm.9]
Proof of Lemma 11. (Commutativity) We prove item 6. The remaining items are proved analogously.
[Thm.9]
[Thm.9]
[Thm.9]
[Thm.9]
B.2. Pseudoinverse
Proof of Lemma 15.
[Def.6]
[Thm.9]
[Def. 3]
[Def.2: Fundamental subspace]
Proof of Corollary 16.

[ Lem.15 ]
[Fig.13]
[Fig.9]
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 38 of 47

Lem.37:
Proof of Theorem 17 (Moore-Penrose pseudoinverse). We provide proofs for equations (10) and (12), since the other two are analogous, following equivalent reasoning.
(10)

So,

Lem.16
[Fig.13]
[Fig.9]
[Fig.9 + Fig.13]
[Def 1: ]
[Fig 19- DET: ——]
[Lem.37: ]
Lem.38
[Fig.13]
Lem.15
[Fig.13]
[Lem.15]
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 39 of 47
It only remains to prove that is unique. To do this, assume that there exist linear transformations and that satisfy the four equations.
\begin{aligned}&\begin{bmatrix} \\{{{X_{1}}}} \\\end{bmatrix}\\ &=\begin{bmatrix} \\{{{X_{1}}}}&{{{A}}}&{{{X_{1}}}} \\\end{bmatrix}\\ &=\begin{bmatrix} \\{{{A}}}&{{{X_{1}}}}&{{{X_{1}}}} \\\end{bmatrix}\\ &=\begin{bmatrix} \\{{{A}}}&{{{X_{2}}}}&{{{A}}}&{{{X_{1}}}}&{{{X_{1}}}} \\\end{bmatrix}\\ &=\begin{bmatrix} \\{{{X_{2}}}}&{{{A}}}&{{{X_{1}}}}&{{{A}}}&{{{X_{1}}}} \\\end{bmatrix}\\ &=\begin{bmatrix} \\{{{X_{2}}}}&{{{A}}}&{{{X_{1}}}} \\\end{bmatrix}\\ &=\begin{bmatrix} \\{{{X_{2}}}}&{{{A}}}&{{{X_{2}}}}&{{{A}}}&{{{X_{1}}}} \\\end{bmatrix}\\ &=\begin{bmatrix} \\{{{X_{2}}}}&{{{X_{2}}}}&{{{A}}}&{{{X_{1}}}}&{{{A}} \\\end{bmatrix}\\ &=\begin{bmatrix} \\{{{X_{2}}}}&{{{X_{2}}}}&{{{A}} \\\end{bmatrix}\\ &=\begin{bmatrix} \\{{{X_{2}}}}&{{{A}}}&{{{X_{2}}}} \\\end{bmatrix}\\ &=\begin{bmatrix} \\{{{X_{2}}}} \\\end{bmatrix}\\ \end{aligned}B.2.1. GSVD Algorithm for Pseudoinverse
Proof of Theorem 18 (GSVD for Pseudoinverse).

Proof of Theorem 20 (SVD for Pseudoinverse).

J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 40 of 47

[SVD]
[Lem.8]
[Fig.13]
[U and V are orthogonal]
[Fig.9]
□
B.2.2. Optimization problems
Proposition 43 (Triple of linear transformations for a linear relation). For every linear relation , there exist and linear transformations , and such that:
Proof.
[Prop.4]
[Prop.4: is also a linear relation]
For the theorem below, consider the following notations presented in [10]:
Theorem 44 (Theorem 1 of [10]: The RSVD Theorem). Every triplet of linear transformations , and can be factorized as
where and are invertible linear transformations, and and are orthogonal linear transformations. , , and are real quasi-diagonal linear transformations with nonnegative elements.
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 41 of 47
Corollary 45 (RSVD of a linear relation). For every linear relation there exist orthogonal linear transformations and , and a diagonal linear relation such that:
Proof.
[Prop.43]
[Thm.44]
and are invertible
Remark 8. According to Theorem 2 of [10], for every linear transformations , and , we have
-
If then RSVD ;
-
If then RSVD .
In these cases, the orthogonal linear transformations — — and — — coincide with the orthogonal linear transformations — — and — — from the GSVD (Theorem 6), while the diagonal linear relation satisfies — — = — —, where — — is the diagonal linear relation defined in Definition 4.
De Moor and Golub [10] use rank specifications as conditions of uniqueness and existence in some of their theorems. Here we interpret these conditions in terms of the fundamental properties (injectivity, surjectivity, determinism, and totality), since we can associate them with the threads of the GSVD (Theorem 6). For comparison purposes, we write the wire dimensions and d in terms of the ranks of :
Proposition 46 (Rank conditions for injectivity and surjectivity). A linear relation is injective and surjective if and only if
Proof. Since then .
( ) Let R be an injective and surjective linear relation.
R is injective
\Leftrightarrow
[Lem.7]
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 42 of 47
On the other hand,
R is surjective
Therefore, .
(⇔) Direct application of the hypothesis to Equations (16) and (17).
Theorem 47 (Theorem 4 of [10]). Let , , and be linear transformations such that and assume that . Then

if and only if:
Corollary 48. Let be a linear relation. Then
if and only if is injective and surjective.
Proof.
is injective and surjective
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 43 of 47
Opposite: Def.1
- Remark 8
Theorem 49 (Theorem 7 of [10]). The matrix equation —B—S—C— = —A— in the unknown linear transformation —S— is consistent if and only if . The minimum norm solution corresponds to
where be any unitarily invariant norm.
Corollary 50. Let be a linear relation. The matrix equation in the unknown linear transformation is consistent if and only if is injective. The minimum norm solution corresponds to
Proof.
—R— is injective
\Leftrightarrow and
[Prop.46]
\Leftrightarrow
\Leftrightarrow
[Opposite: Def.1
- Remark 8]
□
B.3. Generalizing Low-Rank Approximation to Linear Relations
Table 5 contains all the characterizations involving the diagonal relation presented in this work.
Theorem 51 (Theorem 6 of [10]). Consider all linear transformations —S— satisfying
where k is a given integer and let be any unitarily invariant norm. A linear transformation of minimal norm is given by
where be any unitarily invariant norm.
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 44 of 47
| Name | Graphical Syntax | Matrix notation |
|---|---|---|
| Sur() | ||
| Inj() | ||
| Tot() | ||
| Det() | ||
Table 5 Equivalent notations for the diagonal linear relation with its relational operations, pseudoinverse and low-rank approximation.
Corollary 52. Let be a linear relation with rank . Consider all linear transformations satisfying
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 45 of 47 where k is a given integer and let be any unitarily invariant norm. A linear transformation of minimal norm is given by
Proof.
[Lem.21]
□
Acknowledgements
This study was financed in part by the Coordenação de Aperfeiçoamento de Pessoal de Nível Superior - Brasil (CAPES) - Finance Code 001.
References
[1] Alvarez, T., 2014. On the moore-penrose inverse of a closed linear relation. Publ. Math. Debrecen 85, 59–72.
[2] Baez, J., Erbele, J., 2015. Categories in control. Theory and Application of Categories 30, 836–881.
[3] Ben-Israel, A., Greville, T.N., 2003. Generalized Inverses: Theory and Applications. volume 15 of CMS Books in Mathematics. Springer Science & Business Media. URL: https://books.google.com.br/books?id=o_zXUXaqGU8C.
[4] Berger, T., Trunk, C., Winkler, H., 2015. Linear relations and the kronecker canonical form. Technische Universität Ilmenau, Institut für Mathematik 15-05.
[5] Betcke, T., 2008. The generalized singular value decomposition and the method of particular solutions. SIAM J. Sci. Comput. 30, 1278–1295.
[6] Bonchi, F., Holland, J., Pavlovic, D., Sobociński, P., 2017. Refinement for Signal Flow Graphs, in: Meyer, R., Nestmann, U. (Eds.), 28th International Conference on Concurrency Theory (CONCUR 2017), Schloss Dagstuhl – Leibniz-Zentrum für Informatik, Dagstuhl, Germany. pp. 24:1–24:16. URL: https://drops.dagstuhl.de/entities/document/10.4230/LIPIcs.CONCUR.2017.24, doi:10.4230/LIPIcs.CONCUR.2017.24.
[7] Bonchi, F., Piedeleu, R., Sobociński, P., Zanasi, F., 2019. Graphical affine algebra, in: 2019 34th Annual ACM/IEEE Symposium on Logic in Computer Science (LICS), pp. 1–12. doi:10.1109/LICS.2019.8785877.
[8] Bonchi, F., Sobociński, P., Zanasi, F., 2014. A categorical semantics of signal flow graphs, in: International Conference on Concurrency Theory, Springer. pp. 435–450.
[9] Bonchi, F., Sobociński, P., Zanasi, F., 2015. Full abstraction for signal flow graphs, in: POPL 2015, ACM. pp. 515–526.
[10] De Moor, B.L.R., Golub, G.H., 1991. The restricted singular value decomposition: Properties and applications. SIAM Journal on Matrix Analysis and Applications 12, 401–425. URL: https://doi.org/10.1137/0612029, doi:10.1137/0612029.
[11] Dijkstra, E.W., Scholten, C.S., 1989. Predicate Calculus and Program Semantics. Monographs in Theoretical Computer Science, Springer.
[12] Eckart, C., Young, G., 1936. The approximation of one matrix by another of lower rank. Psychometrika 1, 211–218. doi:10.1007/BF02288367.
[13] Edelman, A., Wang, Y., 2020. The gsvd: Where are the ellipses?, matrix trigonometry, and more. SIAM Journal on Matrix Analysis and Applications 41, 1826–1856. URL: http://dx.doi.org/10.1137/18M1234412, doi:10.1137/18m1234412.
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 46 of 47
[14] de Freitas, I.L., Mota, J., Paixão, J., Rufino, L., 2025. Generalizing the invertible matrix theorem with linear relations using graphical linear algebra. arXiv preprint arXiv:2502.16783 URL: https://arxiv.org/abs/2502.16783.
[15] Friedland, S., Mehrmann, V., Miedler, A., Nkengla, M., 2011. Fast low rank approximation of matrices and tensors. Electronic Journal of Linear Algebra 22, 1031–1048.
[16] Gockenbach, M.S., 2016. Generalizing the gsvd. SIAM Journal on Numerical Analysis 54, 2517–2540. URL: https://doi.org/10.1137/15M1019453, doi:10.1137/15M1019453, arXiv:https://doi.org/10.1137/15M1019453.
[17] Golub, G., Hoffman, A., Stewart, G., 1987. A generalization of the eckart-young-mirsky matrix approximation theorem. Linear Algebra and its Applications 88-89, 317–327. URL: https://www.sciencedirect.com/science/article/pii/0024379587901145, doi:https://doi.org/10.1016/0024-3795(87)90114-5.
[18] Golub, G.H., Van Loan, C.F., 2013. Matrix Computations. 4 ed., Johns Hopkins University Press, Baltimore, MD.
[19] Hassi, S., Sebestyén, Z., de Snoo, H.S.V., Szafraniec, F.H., 2006. A canonical decomposition for linear operators and linear relations. arXiv:math/0611045.
[20] Hinze, R., Marsden, D., 2023. Introducing String Diagrams: The Art of Category Theory. Cambridge University Press.
[21] Lee, J., Kim, S., Lebanon, G., Singer, Y., 2013. Matrix approximation under local low rank assumption. arXiv:1301.3192.
[22] Legendre, A.M., 1805. Nouvelles méthodes pour la détermination des orbites des comètes. Firmin Didot, Paris.
[23] Mota, J.d., Paixão, J., Rufino, L., 2025. Point-free calculational proofs and program derivation in linear algebra using a graphical syntax. Journal of Functional Programming 35, e13. doi:10.1017/S0956796825000085.
[24] Murphy, K.P., 2012. Machine Learning: A Probabilistic Perspective. MIT Press.
[25] Paige, C.C., Saunders, M.A., 1981. Towards a generalized singular value decomposition. SIAM Journal on Numerical Analysis 18, 398–405. URL: https://doi.org/10.1137/0718026, doi:10.1137/0718026, arXiv:https://doi.org/10.1137/0718026.
[26] Paixão, J., Rufino, L., Sobociński, P., 2022. High-level axioms for graphical linear algebra. Science of Computer Programming 218, 102791. URL: https://www.sciencedirect.com/science/article/pii/S0167642322000247, doi:https://doi.org/10.1016/j.scico.2022.102791.
[27] Penrose, R., 1955. A generalized inverse for matrices. Mathematical Proceedings of the Cambridge Philosophical Society 51, 406–413. URL: http://dx.doi.org/10.1017/s0305004100030401, doi:10.1017/s0305004100030401.
[28] Penrose, R., 1956. On best approximate solutions of linear matrix equations. Mathematical Proceedings of the Cambridge Philosophical Society 52, 17–19. doi:10.1017/S0305004100030929.
[29] Selinger, P., 2010. A survey of graphical languages for monoidal categories, in: New structures for physics. Springer, pp. 289–355.
[30] Skillicorn, D.B., 2007. Understanding Complex Datasets: Data Mining with Matrix Decompositions. Chapman & Hall/CRC.
[31] Sobociński, P., 2015. Graphical linear algebra, “maths with diagrams”, episode 17. https://graphicallinearalgebra.net/2015/06/16/maths-with-diagrams/. Accessed: 03-08-2023.
[32] Stein, D., Samuelson, R., 2024. Towards a compositional framework for convex analysis (with applications to probability theory), in: Kobayashi, N., Worrell, J. (Eds.), Foundations of Software Science and Computation Structures, Springer Nature Switzerland, Cham. pp. 166–187.
[33] Sun, J.G., 1983. Perturbation analysis for the generalized singular value problem. SIAM Journal on Numerical Analysis 20, 611–625. URL: https://doi.org/10.1137/0720041, doi:10.1137/0720041.
[34] Trefethen, L.N., Bau, D., 1997. Numerical Linear Algebra. SIAM.
[35] Van Loan, C., 1985. Computing the cs and the generalized singular value decompositions. Numerische Mathematik 46, 479–492. URL: http://eudml.org/doc/133008.
[36] Van Loan, C.F., 1976. Generalizing the singular value decomposition. SIAM Journal on Numerical Analysis 13, 76–83. URL: https://doi.org/10.1137/0713009, doi:10.1137/0713009, arXiv:https://doi.org/10.1137/0713009.
[37] Ye, J., 2005. Generalized low rank approximation of matrices. Machine Learning 61, 167–191.
[38] Young, G., Householder, A.S., 1936. Discussion of a set of points in terms of their mutual distances. Psychometrika 1, 229–239. doi:10.1007/BF02288370.
[39] Zanasi, F., 2015. Interacting Hopf Algebras: the theory of linear systems. Ph.D. thesis. Ecole Normale Supérieure de Lyon.
J A Mota; I Leal de Freitas; L Rufino; J Paixão: Preprint submitted to Elsevier
Page 47 of 47