The Multivariate Theory of Functional Connections: Theory, Proofs, and Application in Partial Differential Equations

This article presents a reformulation of the Theory of Functional Connections: a general methodology for functional interpolation that can embed a set of user-specified linear constraints. The reformulation presented in this paper exploits the underlying functional structure presented in the seminal paper on the Theory of Functional Connections to ease the derivation of these interpolating functionals--called constrained expressions--and provides rigorous terminology that lends itself to straightforward derivations of mathematical proofs regarding the properties of these constrained expressions. Furthermore, the extension of the technique to and proofs in n-dimensions is immediate through a recursive application of the univariate formulation. In all, the results of this reformulation are compared to prior work to highlight the novelty and mathematical convenience of using this approach. Finally, the methodology presented in this paper is applied to two partial differential equations with different boundary conditions, and, when data is available, the results are compared to state-of-the-art methods.


Introduction
The Theory of Functional Connections (TFC) is a mathematical framework used to construct functionals, functions of functions, that represent the family of all possible functions that satisfy some user-defined constraints; these functionals are referred to as "constrained expressions" in the context of the TFC. In other words, the TFC is a framework for performing functional interpolation. In the seminal paper on TFC [1], a univariate framework was presented that could construct constrained expressions for constraints on the values of points or arbitrary order derivatives at points. Furthermore, Reference [1] showed how to construct constrained expressions for constraints consisting of linear combinations of values and derivatives at points, called linear constraints; for example, y(x 1 ) + 3π y xx (x 2 ) = 2 e, for some points x 1 and x 2 , where y xx symbolizes the second order derivative of y with respect to x. In the current formulation, the univariate constrained expression has been used for a variety of applications, including solving linear and non-linear differential equations [2,3], hybrid systems [4], optimal control problems [5,6], in quadratic and nonlinear programming [7], and other applications [8].
Recently, the TFC method has been extended to n-dimensions [9]. This multivariate framework can provide functionals representing all possible n-dimensional manifolds subject to constraints on the value and arbitrary order derivative of n − 1 dimensional manifolds. However, Reference [9] does not discuss how the multivariate framework can be used to construct constrained expressions for linear constraints. Regardless, these multivariate constrained expressions have been used to embed constraints into machine arXiv:2007.04170v2 [math.NA] 6 Aug 2020 learning frameworks [10][11][12] for use in solving partial differential equations (PDEs). Moreover, it was shown that this framework may be combined with orthogonal basis functions to solve PDEs [13]; this is essentially the n-dimensional equivalent of the ordinary differential equations (ODEs) solved using the univariate formulation [2,3].
The contributions of this article are threefold. First, this article examines the underlying structure of univariate constrained expressions and provides an alternative method for deriving them. This structure is leveraged to derive mathematical proofs regarding the properties of univariate constrained expressions. Second, using the aforementioned structure, this article extends the multivariate formulation presented in Reference [9] to include linear constraints by introducing the recursive application of univariate constrained expressions as a method for generating multivariate constrained expressions. Further, mathematical proofs are provided that prove the resultant constrained expressions indeed represent all possible manifolds subject to the given constraints. Thirdly, this article presents how the multivariate constrained expressions can be combined with a linear expansion of n-dimensional orthogonal basis functions to numerically estimate the solutions of PDEs. While Reference [13] showed that solving PDEs with the multivariate TFC is possible, it merely gave a cursory overview, skipping some rather important details; this article fills in those gaps.
The remainder of this article is structured as follows. Section 2 introduces the univariate constrained expression, examines its underlying structure, and provides an alternative method to derive univariate constrained expressions. Then, in Section 3, this structure is leveraged to rigorously define the univariate TFC constrained expression and provide some related mathematical proofs. In Section 4, this new structure and the mathematical proofs are extended to n-dimensions, and a compact tensor form of the multivariate constrained expression is provided. Section 5 discusses how to combine the multivariate constrained expression with multivariate basis functions to estimate the solutions of PDEs. Then, in Section 6, this method is used to estimate the solution of two PDEs, and the results are compared with state-of-the-art methods when data is available. Finally, Section 7 summarizes the article and provides some potential future directions for follow-on research.

Univariate TFC
Extending the multivariate TFC to include linear constraints requires recursive applications of the univariate TFC. Hence, it is paramount the reader understand univariate TFC before moving to the multivariate case. First, the general form of the univariate constrained expression will be presented, followed by a few examples. These examples serve to solidify the readers understanding of the univariate constrained expression, as well as highlight nuances of deriving constrained expressions. In addition, this section includes mathematical proofs that univariate TFC constrained expressions indeed represent the family of all possible functions that satisfy the constraints.
Given a set of k constraints, the univariate constrained expression takes the following form, where g(x) is a free function, s j (x) are k mutually linearly independent functions called support functions, and η j are k coefficient functionals that are solved by imposing the constraints. The free function g(x) can be chosen to be any function provided that it is defined at the constraints' locations.
The following examples start from Equation (1), the framework proposed in the seminal paper on TFC [1], and highlight a unified structure that underlies the univariate TFC constrained expressions. Following these examples is a section that rigorously defines this structure and provides important mathematical proofs.

Univariate Example # 1: Constraints at a Point
Constraints at a point consist of constraints on the value at a point and constraints on a derivative at a point. Take for example the follow constraints, For this example, the support functions are chosen to be s 1 = 1, s 2 = x 2 , and s 3 = x 3 . Following Equation (1) and imposing the three constraints leads to the simultaneous set of equations Solving this set of equations for the unknowns η j leads to the solution, Substituting the coefficient functionals back into Equation (1) and simplifying yields, (2) It is simple to verify that regardless of how g(x) is chosen, provided g(x) exists at the constraint points, Equation (2) always satisfies the given constraints. The support functions in the previous example were selected as s 1 = 1, s 2 = x 2 , and s 3 = x 3 . However, these support functions could have been any mutually linearly independent set of functions that permits a solution for the coefficient functionals η j : to clarify the latter of these requirements, consider the same constraints with support functions s 1 = 1, s 2 = x, and s 3 = x 2 . Then, the set of equations with unknowns η j is,    Notice that when using these support functions the matrix that multiplies the coefficient functionals is singular. Thus, no solution exists, and therefore, the support functions s 1 = 1, s 2 = x, and s 3 = x 2 are an invalid set for these constraints.
Note that the matrix singularity does not depend on the free function. This means that the singularity arises when a linear combination of the selected support functions cannot be used to interpolate the constraints. Therefore, the singularity of the support function matrix is dependent on both the support functions chosen and the specific constraints to be embedded. This raises another important restriction on the expression of the support functions, not only must they be linearly independent, but they must constitute an interpolation model that is consistent for the specified constraints.
Notice that each term, except the term containing only the free function, in the constrained expression is associated with a specific constraint and has a particular structure. To illustrate, examine the first constraint term from Equation (2), .
The first term in the product, φ 1 (x), is called a switching function-Reference [1] introduced these switching functions as "coefficient" functions, β k -and is a function that is equal to 1 when evaluated at the constraint it is referencing, and equal to 0 when evaluated at all the other constraints. The second term of the product, ρ 1 (x, g(x)), is called a projection functional, and is derived by setting the constraint function equal to zero and replacing y(x) with g(x). In the case of constraints at a point, this is simply the difference between the constraint value and the free function evaluated at that constraint point. It is called the projection functional because it projects the free function to the set of functions that vanish at the constraint. When evaluating the switching function, φ 1 (x), at the constraint it is referencing it is equal to 1 (i.e., φ 1 (0) = 1), and when it is evaluated at the other constraints it is equal to 0 (i.e., ∂φ 1 ∂x (1) = 0 and φ 1 (2) = 0). The projection functional, ρ 1 (x, g(x)), is just the difference between the constraint y(0) = 1 and the free function evaluated at the constraint point, g(0). This structure is important, as it shows up in the other constraint types too. Property 1 follows from the definition of the projection functional. Property 1. The projection functionals for constraints at a point are always equal to zero if the free function, g(x), is selected such that it satisfies the associated constraint.
For example, if g(x) is selected such that g(0) = 1, then the first projection functional in this example becomes ρ 1 (x, g(x)) = 1 − g(0) = 0. Based on this structure, an alternate way to define the constrained expression, shown in Equation (3), can be derived, The projection functionals are simple to derive, but the switching functions require some attention. From their definition, these functions must go to 1 at their associated constraint and 0 at all other constraints. Based on this definition, the following algorithm for deriving the switching functions is proposed: Choose k support functions, s k (x).

2.
Write each switching function as a linear combination of the support functions with unknown coefficients.

3.
Based on the switching function definition, write a system of equations to solve for the unknown coefficients.
To validate that this algorithm works, we will use the same constraints and support functions and rederive the constrained expression shown in Equation (2). Hence, φ 1 (x) = s i (x) α i1 , φ 2 (x) = s i (x) α i2 , and φ 3 (x) = s i (x) α i3 , for some as yet unknown coefficients α ij . Note that in the previous mathematical expressions and throughout the remainder of the paper, the Einstein summation convention is used to improve readability. Now, the definition of the switching function is used to come up with a set of equations. For example, the first switching function has the three equations, These equations are expanded in terms of the support functions, which can be compactly written as, The same is done for the other two switching functions to produce a set of equations that can be solved by matrix inversion. Substituting the constants back into the switching functions and simplifying yields, Substituting the projection functionals and switching functions back into the constrained expression yields, which is identical to Equation (2). This approach to derive constrained expressions using switching functions has, similar to the first approach, the risk of obtaining a singular matrix if the support functions selected are not able to interpolate the constraints. However, as will be demonstrated in the coming sections, this approach can be easily extended to multivariate domains via recursive applications of the univariate theory, and this approach lends itself nicely to mathematical proofs.

Univariate Example # 2: Linear Constraints
Linear constraints consist of linear combinations of the previous types of constraints. Note that by this definition, relative constraints such as y(0) = y(1) are just a special case of linear constraints. Take for example the following two constraints, y(0) = y(1), and 3 = 2y(2) + πy xx (0).
To generate a constrained expression, the projection functionals and switching functions must be found. Similar to the constraints at a point, first the constraints are arranged such that one side of the constraint is equal to zero; for example, Then, the projection functionals can be defined by replacing y(x) with g(x). Thus, The switching functions are again defined such that they are equal to 1 when evaluated with their associated constraint, and equal to 0 when evaluated at all other constraints. The word "evaluation" in the previous sentence requires clarification. Substitution of the constrained expression back into the constraint should result in the expression 0 = 0 (i.e., the constraint is satisfied). When doing so, the switching functions, φ(x), will be evaluated in the same way y(x) is evaluated in the constraint. Thus, the constants within the constraint are not used in the evaluation. Moreover, because the projection functional is designed to exactly cancel the values of the free function in the constraint, the switching function equations should have the opposite sign. Hence, evaluation means to replace the function with the switching function, remove any terms not multiplied by the switching function, and multiply the entire equation by −1. Any reader confused by this linguistic definition of switching function evaluation may refer to Property 4, which defines the switching function evaluation mathematically. For this example, this leads to, 2φ 1 (2) + π ∂ 2 φ 1 ∂x 2 (0) = 0, for the first switching function, and for the second switching function. Note that while this "evaluation" definition may seem convoluted at first, it is in fact exactly what was done for the constraints at a point case. However, in that case, due to the simple nature of the constraints and the way the projection functionals were defined, this was simply the switching function evaluated at the point.
Similar to the constraints at a point case, the switching functions are defined as a linear combination of support functions with unknown coefficients. Again, this can be written compactly in matrix form. For this example, the support functions s 1 (x) = 1 and s 2 (x) = x are chosen. Then, 0 1 2 4 α 11 α 12 α 21 α 22 which results in the switching functions, Substituting the switching and projection functionals back into the constrained expression form given in Equation (3) yields, By substituting this expression for y back into the constraints, one can verify that indeed this constraint expression satisfies the constraints regardless of the choice of free function g(x). Property 2 extends Property 1 to linear constraints.
Property 2. The projection functionals for linear constraints are always equal to zero if the free function is selected such that it satisfies the associated constraint.

General Formulation of the Univariate TFC
This section rigorously defines the TFC constrained expression and provides some relevant proofs. First, a functional is defined and its properties are investigated.

Definition 1.
A functional, e.g., f (x, g(x)), has independent variable(s) and function(s) as inputs, and produces a function as an output.
Note that a function as defined here is coincident with the computer science definition of a functional. One can think of a functional as a map for functions. That is, the functional takes a function, g(x), as its input and produces a function, h(x) = f (x, g(x)) for any specified g(x), as its output. Since this article is focused on constraint embedding, or in other words functional interpolation, we will not concern ourselves with the domain/range of the input and output functions. Rather, we will discuss functionals only in the context of their potential input functions, hereon referred to as the domain of the functional, and potential output functions, hereon referred to as the codomain of the functional.
Next, the definitions of injective, surjective, and bijective are extended from functions to functionals.

Definition 2.
A functional, f (x, g(x)), is said to be injective if every function in its codomain is the image of at most one function in its domain.

Definition 3.
A functional, f (x, g(x)), is said to be surjective if for every function in the codomain, h(x), there exists at least one g(x) such that h(x) = f (x, g(x)).

Definition 4.
A functional, f (x, g(x)), is said to be bijective if it is both injective and surjective.
To elaborate, Figure 1 gives a graphical representation of each of these functionals, and examples of each of these functionals follow. Note that the phrase "smooth functions" is used here to denote continuous, infinitely differentiable, real valued functions. Consider the functional f (x, g(x)) = e −g(x) whose domain is all smooth functions and whose codomain is all smooth functions. The functional is injective because for every h(x) in the codomain there is at most one g(x) that maps f (x, g(x)) to h(x).
However, the functional is not surjective, because the functional does not span the space of the codomain. For example, consider the desired output function h(x) = −2: there is no g(x) that produces this output. Next, consider the functional f (x, g(x)) = g(x) − g(0) whose domain is all smooth functions and whose codomain is the set of all smooth functions h(x) such that h(0) = 0. This functional is surjective because it spans the space of all smooth functions that are 0 when x = 0, but it is not injective. For example, the functions g(x) = x and g( consider the functional f (x, g(x)) = g(x) whose domain is all smooth functions and whose codomain is all smooth functions. This functional is bijective, because it is both injective and surjective.
In addition, the notion of projection is extended to functionals. Consider the typical definition of a projection matrix P n = P for some n ∈ Z + . In other words, when P operates on itself, it produces itself: a projection property for functionals can be defined similarly.

Definition 5.
A functional is said to be a projection functional if it produces itself when operating on itself.
For example, consider a functional operating on itself, f (x, f (x, g(x))). Then, if f (x, f (x, g(x))) = f (x, g(x)), then the functional is a projection functional. Note that proving f (x, f (x, g(x))) = f (x, g(x)) automatically extends to a functional operating on itself n times: for example, )) = f (x, g(x)), and so on. Now that a functional and some properties of a functional have been investigated, the notation used in the prior section can be leveraged to rigorously define TFC related concepts. First, it is useful to define the constraint operator, denoted by the symbol C. Definition 6. The constraint operator, C i , is a linear operator that when operating on a function returns the function evaluated at the i-th specified constraint.
As an example, consider the 2nd linear constraint (i = 2) given in Section 2.2, 3 = 2y(2) + πy xx (0). For this problem, it follows that, The constraint operator is a linear operator, as it satisfies the two properties of a linear operator: ]. For example, again consider the 2 nd linear constraint given in Section 2.2, Naturally, the constraint operator has specific properties when operating on the support functions, switching functions, and projection functionals.

Property 3.
The constraint operator acting on the support functions s j (x) produces the matrix Again, consider the example from Section 2.2 where the support functions were s 1 (x) = 1 and s 2 (x) = x. By applying the constraint operator, which is identical to the matrix derived in Section 2.2. In fact, the matrix S ij is simply the matrix multiplying the α ij matrix in all the previous examples. Therefore, it follows that, S ij α jk = α ij S jk = δ ik , where δ ik is the Kroneker delta, and the solution of the α ij coefficients are precisely the inverse of the constraint operator operating on the support functions.

Property 4.
The constraint operator acting on the switching functions φ j (x) produces the Kronecker delta.
This property is just a mathematical restatement of the linguistic definition of the switching function given earlier. One can intuit this property from the switching function definition, since they evaluate to 1 at their specified constraint condition (i.e., i = j) and to 0 at all other constraint conditions (i.e., i = j).
Using this definition of the constraint operator, one can define the projection functional in a compact and precise manner. Definition 7. Let g(x) be the free function where g : R → R, and let κ i ∈ R be the numerical portion of the i th constraint. Then, Following the example from Section 2.2, the projection functional for the second constraint is, Note that in the univariate case κ i is a scalar value, but in the multivariate case κ i is a function.

Theorem 1.
For any function, f (x), satisfying the constraints, there exists at least one free function, g(x), such that the TFC constrained expression y(x, g(x)) = f (x).
Proof. As highlighted in Properties 1 and 2, the projection functionals are equal to zero whenever g(x) satisfies the constraints. Thus, if g(x) is a function that satisfies the constraints, then the constrained expression becomes y(x, g( . Therefore, for any function satisfying the constraints, f (x), there exists at least one free function g(x) = f (x), such that the constrained expression is equal to the function satisfying the constraints, i.e., y(x, f (x)) = f (x).
Theorem 2. The TFC univariate constrained expression is a projection functional.
Proof. To prove Theorem 2, one must show that y(x, y(x, g(x))) = y(x, g(x)). By definition, the constrained expression returns a function that satisfies the constraints. In other words, for any g(x), y(x, g(x)) is a function that satisfies the constraints. From Theorem 1, if the free function used in the constrained expression satisfies the constraints, then the constrained expression returns that free function exactly. Hence, if the constrained expression functional is given itself as the free function, it will simply return itself.
Theorem 3. For a given function, f (x), satisfying the constraints, the free function, g(x), in the TFC constrained expression y(x, g(x)) = f (x) is not unique. In other words, the TFC constrained expression is a surjective functional.
Proof. Consider the free function choice g(x) = f (x) + β j s j (x) where β j are scalar values on R and s j (x) are the support functions used to construct the switching functions φ i (x).
Substituting the chosen g(x) yields, Now, according to Definition 7 of the projection functional, Since the constraint operator C i is a linear operator, Since f (x) is defined as a function satisfying the constraints, then C i [ f (x)] = κ i , and, Now, according to Property 3 of the constraint operator, and by decomposing the switching functions φ i , Collecting terms results in, However, S ki α ij = δ kj because α ij is the inverse of S ki . Therefore, by the definition of inverse, S ki α ij = α ki S ij = δ kj , and thus, Simplifying yields the result, which is independent of the β j s j (x) terms in the free function. Therefore, the free function is not unique.
Notice that the non-uniqueness of g(x) depends on the support functions used in the constrained expression, which has an immediate consequence when using constrained expressions in optimization. If any terms in g(x) are linearly dependent to the support functions used to construct the constrained expression, their contribution is negated and thus arbitrary. For some optimization techniques it is critical that the linearly dependent terms that do not contribute to the final solution be removed, else, the optimization technique becomes impaired. For example, prior research focused on using this method to solve ODEs [2,3] through a basis expansion of g(x) and least-squares, and the basis terms linearly dependent to the support functions had to be omitted from g(x) in order to maintain full rank matrices in the least-squares.
The previous proofs coupled with the functional and functional property definitions given earlier provide a more rigorous definition for the TFC constrained expression: the TFC constrained expression is a surjective, projection functional whose domain is the space of all real-valued functions that are defined at the constraints and whose codomain is the space of all real-valued functions that satisfy the constraints. It is surjective because it spans the space of all functions that satisfy the constraints, its codomain, based on Theorem 1, but is not injective, because Theorem 3 shows that functions in the codomain are the image of more than one function in the domain: the functional is thus not bijective either because it is not injective. Moreover, the TFC constrained expression is a projection functional as shown in Theorem 2.

Multivariate TFC
Consider the general multivariate function F : R n → R m where F = ( f 1 , f 2 , · · · , f m ). In this definition, F is composed of the real-values functions f i : R n → R such that f i = f i (x 1 , x 2 , · · · , x n ) where x i are the independent variables. In terms of the TFC, the functions f i can be expressed as individual constrained expressions, and therefore the extension to multidimensional functions only involves extending the original method developed in Section 2 for f (x) to f (x 1 , x 2 , · · · , x n ). Once completed, the extension to the original definition of F is immediate: simply write a multivariate constrained expression for every f i in F.
In the following section, the multivariate TFC is developed using a recursive application of the univariate TFC. In this manner, it can be shown that this approach is a generalization of the original theory, and that all mathematical proofs for the univariate constrained expressions can easily be extended to the multivariate constrained expressions. Then, a tensor form of the multivariate constrained expression is introduced by simplifying the recursive method. The tensor formulation provides a succinct way to write multivariate constrained expressions.

Recursive Application of Univariate TFC
As discussed above, our extension to the multivariate case is concerned with deriving the constrained expression for the form f = f (x 1 , x 2 , · · · , x n ). For a set of constraints in the multivariate case, one can first create the constrained expression all constraints on x 1 using the univariate TFC formulation. The resulting univariate constrained expression, which we can denote as, f 1 is then used as the free function in a constrained expression that includes all the constraints on x 2 to produce the expression f 2 . This method carries on until the final independent variable, x n , is reached and the expression f n = f and is the multivariate constrained expression. This concept is best shown through some simple examples. These examples have two spatial dimensions only one dependent variable (i.e., F : R 2 → R) we adopt the following notation:
Then, u 1 (x, y) is used as the free function in the constrained expression involving the constraints on y. Since this problem is two-dimensional, the resultant expression is the multivariate TFC constrained expression.
Substituting u 1 into Equation (4) and simplifying yields, u(x, y, g(x, y)) = g(x, y) + sin(2πy) − g(0, y) − xg x (0, y) + (1 − y) x 2 − g(x, 0) + g(0, 0) Alternatively, one could first write the expression for the constraints on y, u 2 (x, y, g(x, y)) = g(x, y) + (1 − y) x 2 − g(x, 0) + y cos(x) − 1 − g(x, 1) , and use u 2 (x, y) as the free function in a constrained expression for the constraints on x, Substituting u 2 (x, y) into Equation (6) and simplifying yields, the exact same result as in Equation (5). Therefore, it does not matter in what order recursive univariate TFC is applied to produce multivariate constrained expressions, as the final result will be the same. Figure 2 shows the constrained expression evaluated with the free function g(x, y) = x 2 cos(y) + 4. The constraints that can be visualized easily are shown as black lines. As expected, the TFC constrained expression satisfies these constraints exactly.
Then, u 1 (x, y) is used as the free function in the constrained expression for the constraints in y, u(x, y, g(x, y)) = u Substituting in u 1 and simplifying yields, Just as in the previous example, one could first write the constrained expression for the constraints in y, call it u 2 (x, y), and then use u 2 (x, y) as the free function in the constrained expression for the constraints in x: the result, after simplifying, would be identical to Equation (7). Figure 3 shows the constrained expression for the specific g(x, y) = x 2 cos y + sin(2x), where the blue line signifies the constraint on u(0, y), the black lines signify the derivative constraint on u y (x, 0), and the magenta lines signify the relative constraint u(x, 0) = u(x, 1). The linear constraint u(1, y) + u(2, y) = y sin(πy) is not easily visualized, but is nonetheless satisfied by the constrained expression. Multivariate example # 2 constrained expression evaluated using g(x, y) = x 2 cos y + sin(2x). The blue line signifies the constraint on u(0, y), the black lines signify the derivative constraint on u y (x, 0) and the magenta lines signify the relative constraint u(x, 0) = u(x, 1). The linear constraint u(1, y) + u(2, y) = y sin(πy) is not easily visualized, but is nonetheless satisfied by the constrained expression.

Multivariate Constrained Expression Theorems
Theorem 4. For any function, f (x), satisfying the constraints, there exists at least one free function, g(x), such that the multivariate TFC constrained expression u(x, g(x)) = f (x).
Proof. Based on Theorem 1, the univariate constrained expression will return the free function if the free function satisfies the constraints. Let u 1 (x) represent the univariate constrained expression for the independent variable x 1 that uses the free function g(x), u 2 (x) represent the univariate constrained expression for the independent variable x 2 that uses the free function u 1 (x), and so on up to u n (x) which is simply the total constrained expression u(x). If we choose g(x) = f (x), then based on Theorem 1 u 1 (x) = f (x). Applying Theorem 1 recursively leads to u 2 (x) = f (x) and so on until u n (x) = u(x) = f (x). Hence, for any function satisfying the constraints, f (x), there exists a free function, g(x) = f (x), such that the multivariate constrained expression is equal to the function satisfying the constraints, i.e., u(x, f (x)) = f (x).
Theorem 5. The TFC multivariate constrained expression is a projection functional.
Proof. To prove Theorem 5, one must show that u(x, u(x, g(x))) = u(x, g(x)). By definition, the constrained expression returns a function that satisfies the constraints. In other words, for any g(x), u(x, g(x)) is a function that satisfies the constraints. From Theorem 4, if the free function used in the constrained expression satisfies the constraints, then the constrained expression returns that free function exactly. Hence, if the constrained expression function is given itself as the free function, it will simply return itself.
Theorem 6. For a given function, f (x), satisfying the constraints, the free function, g(x), in the TFC constrained expression u(x, g(x)) = f (x) is not unique. In other words, the multivariate TFC constrained expression is a surjective functional.
Proof. Since each expression u i (x) used in deriving the multivariate constrained expression is derived through the univariate formulation, then the results of the proof of Theorem 3 apply for each each u i (x), and therefore the free function g(x) is not unique.
Just like in the univariate case, this proof has immediate implications when using the constrained expression for optimization. Through the recursive application of the univariate TFC approach, any terms in g(x) that are linearly dependent to the the support functions, s i (x 1 ), s j (x 2 ), ... , s k (x n ), will not contribute to the solution. In the multivariate case, this also includes products of the support functions that include one and only one support function from each independent variable, e.g., s i (x 1 )s j (x 2 )...s k (x n ).
In addition, just as in the univariate case, Theorems 4, 5, and 6 allow for a more rigorous definition of the multivariate TFC constrained expression. The multivariate TFC constrained expression is a surjective, projection functional whose domain is the space of all real-valued functions that are defined at the constraints and whose codomain is the space of all real-valued functions that satisfy the constraints.

Tensor Form
Recursive applications of the univariate TFC lead to expressions that lend themselves nicely to mathematical proofs, such as those in the previous section. However, for applications, it is typically more convenient to expression the constrained expression in a more compact form. Conveniently, the multivariate constrained expressions that are formed from recursive applications of the univariate TFC can be succinctly expressed in the following tensor form, where i 1 , i 2 , . . . , i n are n indices associated with the n-dimensions that have constraints, M is an n-dimensional tensor whose elements are based on the projection functionals, ρ(x, g(x)), and the n vectors Φ are vectors whose elements are based on the switching functions for the associated dimension. The M tensor can be constructed using a simple two-step process. Note that the arguments of functionals are dropped in this explanation for clarity.

1.
The elements of the first order sub-tensors of M acquired by setting all but one index equal to one are a zero followed by the projection functionals for the dimension associated with that index. Mathematically, where ρ k j indicates the j-th projection functional of the k-independent variable and k is the number of constraints associated with the k-th independent variable. 2.
The remaining elements of the M tensor, those that have more than one index not equal to one, are the geometric intersection of the associated projection functionals multiplied by a sign (− or +). Mathematically, this can be written as, where i j , i k , . . . , i h are the indices of M i 1 i 2 ...i n that are not equal to one and m is equal to the number of non-one indices. If the constraint functions and free function are differential up to the order of derivatives required to compute Equation (9), then by multiple applications of Clairaut's Theorem the constraint operators can be freely permuted [9]. For example, Equation (9) could be re-written as, The elements of the vectors Φ i k are simply composed of a 1 followed by the switching functions associated with the k-th independent variable. Mathematically, where φ k j denotes the j-th switching function of the k-th independent variable. To solidify the reader's understanding of the tensor form explained above, the constrained expressions for the two multivariate examples are re-derived using the tensor form.

Multivariate Example # 1: Value and Derivative Constraints Using the Tensor Form
The constraints from the first multivariate example are copied below for the reader's convenience.
Then, the first step in constructing the M tensor can be completed.
The remaining elements of the M tensor are found in step 2 by calculating the geometric intersection of the projection functionals. For example, where functional arguments have been dropped for clarity. The remaining elements are computed in a similar fashion to produce, The Φ vectors are assembled by concatenating a 1 with the switching functions for that independent variable. Hence, Now, the tensor form of the constrained expression can be compactly written as, u(x, y, g(x, y)) = g(x, y) + M ij (x, y, g(x, y)))Φ i (x)Φ j (y).
Note that expanding this expression produces the exact same constrained expression as the recursive method.

Multivariate Example # 2: Linear Constraints Using the Tensor Form
The constraints from the second multivariate example are copied below for the reader's convenience.
Now, the tensor form of the constrained expression can be compactly written as, u(x, y) = g(x, y) + M ij (x, y, g(x, y))Φ i (x)Φ j (y).
Note that expanding this expression produces the exact same constrained expression as the recursive method.

Applications to PDEs
In this article, orthogonal bases in n-dimensions, namely Chebyshev orthogonal polynomials of the first kind and Legendre orthogonal polynomials, are leveraged to approximate the solutions of PDEs with the TFC. For completeness, the equations to compute these polynomials are provided in Appendix A.
In general, multivariate basis sets can be created by using all possible products of the functions in the univariate basis sets. The measure that makes up the new multivariate basis set will be the product of measures of the univariate basis sets, and the domain of the multivariate basis set will be the union of the domains that make up the univariate basis sets. More details and insights regarding two-dimensional and n-dimensional orthogonal basis functions can be found in Refs. [14][15][16].
In this article, the free function will be defined as a linear combination of some multivariate basis set with unknown coefficients. The resultant constrained expression and its derivatives are substituted into the PDE. Since the free function consists of known basis functions and unknown coefficients, the PDE is transformed into an algebraic equation. This algebraic equation is discretized over the problem domain, and the unknown coefficients are used to minimize the residual of the PDE over the set of discretized points. The following subsections provide a detailed explanation of each major step, and a summary of the entire process is given in Figure 4.

Defining the Free Function g(x)
Let us define n independent variables in the vector x = {x 1 , · · · , x k , · · · , x n } T . Moreover, let the orthogonal basis set for each of these independent variables be denoted by B m k , where the superscript m denotes the m-th basis function and the subscript k denotes the k-th independent variable. For example, the third basis function for x 2 would be denoted as B 3 2 . The domain of the multivariate basis will be denoted by Ω = Ω 1 × Ω 2 × · · · × Ω n , where the generic Ω k denotes the domain of the k-th basis set. Then, an arbitrary basis function for the multivariate domain can be written as, where m 1 , · · · , m n ∈ Z + . In other words, Equation (10) generates a multivariate basis via a tensor product of univariate basis functions [17]. If one were to use all possible products of the functions in the individual basis sets, i.e., use all possible combinations of m 1 , · · · , m n ∈ Z + , an infinite set, then the resulting multivariate basis would span the union of the individual univariate basis sets' function spaces. However, when creating this expansion, one must pay attention to the results of Theorem 6. Theorem 6 shows that the functions used to constrained the expression must be omitted from the formulation of B. This ensures a full rank system in the later optimization steps. As previously stated, the free function is chosen to be a linear combination of this multivariate basis with unknown coefficients. Mathematically, this can be expressed as, where h ∈ R (∑ n k=1 m k ) whose elements are elements of B, and ξ is a same-sized vector of the unknown coefficients.

Derivatives of the Free Function
In most applications, the domains Ω k of the basis sets do not coincide with the domain of the problem (e.g., for Chebyshev and Legendre polynomials the functions are defined on [−1, +1]). Let the basis functions be defined on z ∈ [z 0 , z f ] and the problem be defined on x k ∈ [x k 0 , x k f ] where k corresponds to the dimension. In order to use the basis functions, a map between the basis function domain and problem domain must be created. The simplest map is a linear one, The subsequent derivatives of the free function can be computed, but by defining, the derivative computations can be simply written as, The immediate result is if the derivative of the function g(x) is taken with respect to the x k variable, then along with taking the derives of the basis functions with respect to this coordinate, the product must also be multiplied by the c k mapping coefficient. From this, it follows that a partial derivative with respect to multiple independent variables (e.g., x 1 and x 2 ) can be written as, This process applies to any derivative of the free function.

Discretization
In order to solve problems numerically, the problem domain (and therefore the basis function domain) must be discretized. Since this article uses Chebyshev and Legendre orthogonal polynomials, an optimal discretization scheme is the Chebyshev-Gauss-Lobatto nodes [18,19]. For, N + 1 points, the discrete points are calculated as, When compared with the uniform distribution, the collocation point distribution results in a much slower increase of the condition number of the matrix to be inverted in the least-squares as the number of basis functions, m, increases. The collocation points can be realized in the problem domain through the relationship provided in Equation (12).

Summary of the Major Steps to Solving PDEs
To summarize, consider a PDE for the function u(x) such that subject to k constraints. In general, the TFC approach to solving differential equations can be broken down into four major steps: (1) derive the constrained expression, (2) define the free function, (3) discretize the domain, and (4) minimize the residual of the differential equation. The flow chart in Figure 4 outlines these steps with all of the relevant equations.
In order to approximate the solution of Equation (15), the constrained expression must be created: this is done using the theory developed in earlier sections. This constrained expression embeds the constraints of the differential equation, and by substituting the constrained expression into Equation (15), transforms the original differential equation into an algebraic equation of the free function subject to no constraints. This transformed expression is denoted by the (∼) symbol. Next, by defining the free function g(x) according to Equation (11), the differential equation becomes an algebraic equation in the unknown coefficient vector ξ. Lastly, this equation is discretized according to Equation (14), leading to a linear system of ξ if the PDE is linear and a nonlinear system of ξ if the PDE is nonlinear, which can be solved by many available optimization techniques. Previous work [2,3] as well as the results provided in the following section utilize a least-squares approach.

Results
This section applies the method to two PDEs. For each problem, the PDE and associated constraints are summarized along with the equations needed to construct the constrained expression. All numerical results were performed in Python, and utilized the autograd package [20] to perform derivatives via automatic differentiation [21]. All computations were performed on a MacBook Pro (2016) macOS Version 10.15.3 with a 3.3 GHz Dual-Core Intel R Core TM i7 and with 16 GB of RAM. All run times were calculated using the default_timer function in the Python timeit package. In all cases, matrix inversion was handled with NumPy's pinv function.
Consequently, two specific computation times are provided (and tabulated in Appendix B), (1) the full run-time of the problem and (2) the computational time associated with the least-squares. In these tables, the full run-time is drastically affected by the computational overhead from autograd, with full run times on the order of 0.5-50 seconds while the computation time for the least squares and nonlinear least squares is on the order of 0.5-185 milliseconds.
For the results in the following sections, the accuracy of the method was determined according to the following process: 1. Training (a) Estimate the solution of the PDE (i.e., determine the coefficients ξ) using the TFC method with n points per independent variable and basis functions up to the to the m-th degree.
Maximum training error: Using the training set discretization, determine the absolute error of the estimated solution compared with the true solution and record the maximum value.

Test
(a) Using converged ξ parameters from the training phase, refine the discretization of domain with n = 100 equally spaced points per dimension and evaluate estimated solution at these points.
Maximum test error: Using the test set discretization, determine the absolute error of the estimated solution compared with the true solution and record the maximum value.
Additionally, for both numerical tests, the method was completed over a varying range of discretization points per independent variable, n, and degree of basis expansion, m. The results in this section and in Appendix B are reported as a function of these two parameters. For example, a value of n = 5 would imply a 5 × 5 grid or 25 points. Likewise, a value of m = 5 would imply that all the univariate basis functions, and combinations thereof, are at most quintic functions. However, the number of coefficients to be solved, and therefore the size of the matrix to be inverted, is dependent on the constrained expression, since some terms need to be removed from the expression of g(x, y) (see Theorem 6). The total number of basis functions associated with each degree for both Problems #1 and #2 are displayed in Table 1.  [24], and Schiassi et al. [12], where x, y ∈ [0, 1] and subject to, which has the true solution u(x, y) = e −x (x + y 3 ). Using the proposed method, the constrained expression can be derived and written in its tensor form as, where g(x, y) is defined according to Equation (11) and for these numerical tests is implemented with either Chebyshev or Legendre polynomials. Furthermore, for this problem, It follows that the expanded constrained expression is, u(x, y) = g(x, y) − (x − 1) y(−g(0, 0) + g(0, 1) − 1) + g(0, 0) + y 3 + (x − 1)g(0, y) + x(yg(1, 1) − (y − 1)g(1, 0)) − xg(1, y) + (y − 1)g(x, 0) − yg(x, 1) + xy y 2 − 1 e + e −x (x + y).  It can be seen that the difference in accuracy of Chebyshev polynomials versus Legendre polynomials is negligible: the solutions that use Legendre polynomials maintain a slightly more accurate estimation than those that use Chebyshev polynomials when using higher order terms.  Finally, the results of the numerical test for Problem #1 are compared to the other approaches in Table  4, where the maximum training and test errors are presented. It can be seen that this method produces an estimate at machine level precision that is at least 3 orders of magnitudes more accurate than the other methods. In fact, the next closest method is a TFC based approach where the free function is expressed using an Extreme Learning Machine [25] in the paper by Schiassi et al. [12].

Problem #2
Problem #2 is a PDE with a linear constraint created by the authors.

Conclusions
This article illustrated that the structure of the univariate TFC constrained expression is composed of a free function and constraint terms, which contain products of projection functionals and switching functions. A method to calculate the projection functionals and switching functions was demonstrated, and their properties were defined. Then, these properties were used as the foundation for mathematical proofs related to the univariate constrained expression.
In addition, the projection/switching perspective of the univariate constrained expression lead directly to a multivariate extension via recursive application of the univariate theory. Since these multivariate constrained expressions where built from univariate constrained expressions, it was fairly simple to extend the mathematical proofs to the multivariate case as well. In the end, it was concluded that the univariate and multivariate TFC constrained expressions are surjective, projection functionals whose domain is the space of all real-valued functions that are defined at the embedded constraints and whose codomain is the space of all real-valued functions that satisfy said constraints. Additionally, a method for compactly writing multivariate constrained expressions via tensors was provided.
After introducing the multivariate TFC in this way, a methodology for solving PDEs via the TFC was presented. This methodology included choosing the free function to be a linear combination of multivariate orthogonal polynomials, discretizing the domain via collocation points, and finally minimizing the residual of the PDE via least-squares. Two example PDEs solved using this methodology were presented, and when available, the TFC solution accuracy was compared with other state-of-the-art methods.
While this article focused on using orthogonal basis functions, namely, Chebyshev and Legendre orthogonal polynomials, as the free function g(x), and ultimately a linear/nonlinear least-square technique to find the unknown parameters ξ, the technique is not limited to this. At its heart, the TFC approach is a way to derive functionals which analytically satisfy the specified constraints. In other words, when solving ODEs or PDEs, these functionals transform a constrained optimization problem into an unconstrained optimization problem, and therefore a myriad valid definitions of g(x) and optimization schemes exist. For example, deep neural networks, support vector machines, and extreme learning machines have been used as free functions in the past. These other free function choices and associated optimization schemes are useful, as for sufficiently complex problems, the number of multivariate basis functions needed to estimate a PDE with sufficient accuracy can become computationally prohibitive.
As defined in this article, the TFC multivariate constrained expressions are capable of embedding value constraints, derivative constraints, and linear combinations thereof. However, other constraint types such as integral, component, and inequality constraints were not discussed. Future work will focus on incorporating these other constraint types. In addition, a more in-depth comparison between TFC and other state-of-the-art methods on a variety of PDEs is likely forthcoming.

Conflicts of Interest:
The authors declare no conflict of interest.
where the orthogonality appears when taking two distinct Chebyshev orthogonal polynomials with indices, i = j.

Appendix A.2. Legendre Orthogonal Polynomials
The Legendre orthogonal polynomials, L k (z), are also defined on the domain z ∈ [−1, +1], with measure dµ(z) = dz. These polynomials can also be generated recursively by, All derivatives of Legendre orthogonal polynomials can be computed in a recursive way, starting from, while the subsequent derivatives of Equation (A1) for k ≥ 1 can be computed in cascade, Additionally, the orthogonality of Legendre polynomials is given by,

Appendix B. Solution Times
Appendix B.1. Problem #1 Solution Times