Special Functions of Mathematical Physics: A Uniﬁed Lagrangian Formalism

: Lagrangian formalism is established for differential equations with special functions of mathematical physics as solutions. Formalism is based on either standard or non-standard Lagrangians. This work shows that the procedure of deriving the standard Lagrangians leads to Lagrangians for which the Euler–Lagrange equation vanishes identically, and that only some of these Lagrangians become the null Lagrangians with the well-deﬁned gauge functions. It is also demonstrated that the non-standard Lagrangians require that the Euler–Lagrange equations are amended by the auxiliary conditions, which is a new phenomenon in the calculus of variations. The existence of the auxiliary conditions has profound implications on the validity of the Helmholtz conditions. The obtained results are used to derive the Lagrangians for the Airy, Bessel, Legendre and Hermite equations. The presented examples clearly demonstrate that the developed Lagrangian formalism is applicable to all considered differential equations, including the Airy (and other similar) equations, and that the regular and modiﬁed Bessel equations are the only ones with the gauge functions. Possible implications of the existence of the gauge functions for these equations are discussed.


Introduction
There are numerous applications of linear, second-order ordinary differential equations (ODEs) in applied mathematics and physics [1,2]. The most commonly used are the ODEs whose solutions are given by the special functions (SFs) of mathematical physics defined in [3][4][5]. In this paper, we concentrate on these ODEs and introduce Q s f to be a set of such equations. LetD = d 2 /dx 2 + B(x)d/dx + C(x) be a linear operator with B(x) and C(x) being ordinary (with the maps B : R → R and C : R → R, with R denoting the real numbers) and smooth with at least two continuous derivatives (C 2 ) functions defined either over a restricted interval (a, b) or an infinite interval (−∞, ∞) depending on the ODE of Q s f (see Section 3), and letDy(x) = 0 be a linear second-order ODE with non-constant coefficients. The form of functions B(x) and C(x) can be selected so that the resulting equations represent all the members of Q s f . For a special case of B(x) = 0, we defineD o = d 2 /dx 2 + C(x), and thereby we haveD o y(x) = 0 with a different family the SF solutions. In general, the solutions of the ODEs of Q s f can be written in the following form y(x) = c 1 y 1 (x) + c 2 y 2 (x), where c 1 and c 2 are integration constants [1][2][3], and y 1 (x) and y 2 (x) are given in terms of the SFs; the solutions written in this form are used in Section 2 of this paper.
Typically, the ODEs of Q s f are obtained by separation of variables in hyperbolic, parabolic and elliptic partial differential equations (PDEs) [1][2][3]. Another (less known) method is based on Lie groups, whose irreducible representations (irreps) are used to find the SF and their corresponding ODEs [1,6]. There have also been some attempts to establish the Lagrangian formalism for the ODEs of paper, we investigate the phenomenon in detail and present the auxiliary conditions for the ODEs of Q s f . The outline of the paper is as follows: in Section 2, the Lagrangian formalism for the ODEs of Q s f is established using both standard and non-standard Lagrangians, and validity of the Helmholtz conditions is also explored; in Section 3, applications of the obtained results to some selected ODEs of Q s f are given and discussed; and our concluding remarks and open problems are presented in Section 4.

Hamilton's Principle and the Existence of Lagrangians
From a mathematical point of view, in the Lagrange formalism we are provided with a functional S[y(x)], which depends on an ordinary and smooth function y(x) that must be determined. The functional is a map S : C ∞ (R) → R, with C ∞ (R) being a space of smooth functions. Typically S[y(x)] is defined by an integral over a smooth function L that depends on y (x) = dy/dx, y and on x, and the function L(y , y, x) is called the Lagrangian function or simply Lagrangian. The functional S[y(x)] defined in this way is known as the functional action, or simple action, and the principle of least action, or Hamilton's principle [14], requires that δS = 0, where δ is the variation defined as the functional (Fréchet) derivative of S[y(x)] with respect to y(x). Using δS = 0, the Euler-Lagrange (E-L) equation is obtained and this equation becomes a necessary condition for the action to be stationary (to have either a minimum or maximum or saddle point).
In general, the E-L equation leads to a second-order ODE that can be further solved to obtain y(x) that makes the action stationary. The described procedure is the basis of the classical calculus of variations, and it works well when the Lagrangian L(y , y, x) is already given. Deriving the second-order ODE from the E-L equation is known as the Lagrangian formalism, and in this paper we deal exclusively with this formalism. Our main goal is to establish the Lagrangian formalism for the ODEs of Q s f and find new Lagrangians.
To fully establish the Lagrangian formalism for the ODEs of Q s f , we must know how to construct the SLs, NLs and NSLs for these equations. In the following, we describe new families of Lagrangians and show that the existence of some of these Lagrangians has profound implications on the validity of the Helmholtz conditions and on the calculus of variations.

Standard and Mixed Lagrangians
In the previous work [8], a very effective method of finding some SLs forDy(x) = 0, which includes the ODEs of Q s f , was proposed. The constructed SLs, denoted here as L s are of the following form: where and is only a function of one independent variable x, the lower limit must be an arbitrary constant, which can be omitted because such constant has no effect on the Lagrangian formulation. Note that in a special case of B(x) = constant, L s [y (x), y(x), x] becomes the Caldirola-Kanai Lagrangian [32,33].
As shown in [9], the equationDy(x) = 0 can also be derived from the following Lagrangian where and Since in L m [y (x), y(x), x] the variables y (x) and y(x) are mixed when compared to L s [y (x), y(x), x], we call L m [y (x), y(x), x] the mixed Lagrangian to distinguish it from the standard Lagrangian.
Having defined the Lagrangians L sm , L s and L m , we now state our main result concerning these Lagrangians in the following proposition. Proposition 1. Let L s and L sm be the Lagrangians given respectively by Equations (2) and (4), and let L m be defined by Equation (5). Both L s or L sm give the sameDy(x) = 0 if, and only if, L m makes the E-L equation vanish identically.
Proof. The proof is straightforward, as substitution of and ∂L m ∂y are exactly equal, which means that they make the E-L equation (see Equation (1)) vanish identically.
As a result, L m makes null contributions to the Lagrange formalism, and therefore has no influence on derivation of the original equationDy(x) = 0. This concludes the proof. Important results that are consequences of Proposition 1 are now presented in the following three corollaries, which require the following definition: a Lagrangian is called the simplest if, and only if, this Lagrangian does not contain L m [y (x), y(x), x]. Corollary 1. The Lagrangian L s [y (x), y(x), x] given by Equation (2)

Null Lagrangian and Gauge Functions
Our results presented above show that for L m [y (x), y(x), x], the E-L equation vanishes identically, which means that the mixed Lagrangians have null effects on the Lagrangian formalism. The mixed Lagrangian may or may not become the null Lagrangian L n [y (x), y(x), x] that is defined [22] as where φ(x) is a gauge function [25]. It is easy to verify that for the ODEs of Q s f , such a function cannot be uniquely defined, except some special cases considered below and also in Section 3. Thus, in general L m [y (x), y(x), x] = L n [y (x), y(x), x] for most ODEs of Q s f ; however, there are a few special cases when the MLs are the NLs. Here is one interesting example. The ODEs of Q s f reduce toD o y(x) = 0 if B(x) = 0. In this case, L m [y (x), y(x), x] = 0 but we may consider L mo [y (x), y(x)] = qy (x)y(x)/2, with q = const, and show that this is the mixed Lagrangian for D o y(x) = 0. In addition, it is easy to demonstrate the existence of the gauge function because which means that for these ODEs the derived mixed Lagrangians are the null Lagrangians and that the gauge function can be derived. The resulting gauge function is given by Since q is arbitrary, our results show that φ(x) is the gauge function for the ODEs of the form D o y(x) = 0 (see Section 3 for applications).
Let us now assume that q = const and that q(x) = B(x). By making this assumption, we want to show that this does not cause φ(x) to be the gauge function for the ODEs given byDy(x) = 0 because one extra term must be added, and this term cannot be included into the total derivative. Therefore, for most ODEs of Q s f , their L m [y (x), y(x), x] are not the same as L n [y (x), y(x), x] .
Another important point is that the obtained NLs can be easily eliminated (e.g., [25]). Nevertheless, our purpose of deriving the NLs is motivated by some previous work [22][23][24] in which it was clearly shown that the NLs are very useful for identifying symmetries in physical systems, and that they also play a significant role in Carathéodory's theory of fields of extremals and integral invariants [23]. Moreover, the gauge functions resulting from the derived NLs may have some effects on the behaviours of quantum systems whose solutions are known to be given by the SFs of mathematical physics.
The procedure of eliminating the NLs from the Lagrangians is based on the fact that these NLs are expressed as the total derivative of an arbitrary scalar function [25]. Therefore, the same elimination procedure cannot be applied to the MLs, whose presence may actually give a different view of symmetries in physical systems.

Non-Standard Lagrangians
Having established the Lagrangian formalism based on the SLs and deriving the corresponding NLs, we now develop the Lagrangian formalism based on the NSLs. Our new results are presented by the following two propositions.
] be a non-standard Lagrangian with f (x) and g(x) being ordinary and smooth functions. The Lagrangian formalism can be used to determine these functions for any ODE of Q s f , and expressing L ns [y (x), y(x), x] in the following form where (14) and E ns (x) = exp [−2 x B(x)dx], with the necessary auxiliary conditionDv(x) = 0.
and ∂L ns ∂y which gives By comparing this equation toDy(x) = 0, the following two conditions that allow finding f (x) and g(x) are obtained 1 2 and with f (x) = 0. From Equation (18), we get and Substituting Equations (20) and (21) into Equation (19), we find Introducing With which satisfies the Ricatti equation, allows us to determine the functions f (x) and g(x).

We now transform Equation (23) by introducing a new variable
where if, and only if, χ(x) = −2B(x)/3. This allows writing the solution for u(x) in the following form It is easy to verify that Equation (27) is the solution of the Riccati equation given by Equation (23), if Equation (26) is taken into account. Having obtained u(x), the functions f (x) and g(x) can be calculated and and the resulting non-standard Lagrangian is given by where which is the same as that given by Equations (17) and (18). Since the derived non-standard Lagrangian depends explicitly onv(x), the auxiliary conditionDv(x) = 0 (see Equation (26)) must supplement L ns [y (x), y(x), x]. This concludes the proof.
Having derived the NSLs for the ODEs of Q s f , we must now verify that the original ODEs can be obtained from the non-standard Lagrangian and its auxiliary condition. The following proposition and corollaries present our results. Proof. Substituting the definition of L ns [y (x), y(x), x] given by Equations (13) and (14) into the E-L equation, we obtain which can also be written as This is the result of substituting L ns [y (x), y(x), x] obtained in Proposition 1 into the E-L equation, and it is seen that Equation (33) is not the same as the original equationDy(x) = 0. In order to derive the original equation, we must now use the auxiliary condition (see Equation (26) This shows that by applying the the auxiliary conditionDv(x) = 0, the E-L equation gives the original equationDy(x) = 0, which concludes the proof. (13) is the non-standard Lagrangian for the ODEs of Q s f .

Corollary 5.
All non-standard Lagrangians L ns [y (x), y(x), x] given by Equation (13) form a new and separate family among all known non-standard Lagrangians.
Since the solutions of the ODEs of Q s f are given by the SFs, the same functions are the solutions for the auxiliary conditionDv(x) = 0. Nevertheless, the dependent variables for which the solutions are known are not the same, and therefore the integration constants must be different to obey different boundary conditions the two variables satisfy. The implications of this are shown by the following corollary.
is the non-zero Wronskian; and the term [c 1 y 1 (x) + c 2 y 2 (x)] 2 is also non-zero for both oscillatory and non-oscillatory solutions.
Let us point out that the solutions y 1 (x) and y 2 (x) are the same for both y(x) andv(x), which means that their dependence on x is identical. However, the integration constants are different because y(x) andv(x) are not the same variables, and therefore they must obey different boundary conditions.
The requirement of Corollary 6 that [c 1 y 1 (x) +c 2 y 2 (x)] 2 = 0 needs additional explanation. Clearly, the requirement is non-zero when both y 1 (x) and y 2 (x) are non-oscillatory. Moreover, if both y 1 (x) and y 2 (x) are oscillatory, then the requirement still remains non-zero because the locations of the zeros of the two linearly independent solutions given by the SFs are never the same. The exception could be the point x = 0; thus, we consider x ∈ (0, ∞) in our applications (see Section 3).
A novel result is that the original ODEs have only one dependent variable and that the procedure of deriving the NSLs introduces a new dependent variablev(x), which explicitly appears in the NSLs. Let us point out that these NSLs do give the original ODEs but only with the auxiliary condition that allows eliminating the additional dependent variable [31].
To show that the auxiliary condition is necessary, we substitute the NSLs given by Equation (30) into the E-L equation written for the variablev(x), and obtain Comparing this result to Equation (32), it is seen that there are two extra terms on the right-hand-side (RHS) of Equation (36), which can be written as which shows that the additional term on the RHS of this equation can only be eliminated when However, this violates the main result of Corollary 6 that the Wronskian must be non-zero. Thus, our results clearly demonstrate that the auxiliary condition cannot be derived from the E-L equation, but instead it must be obtained independently (see Proposition 3). Only with this independently derived auxiliary condition, can the original ODEs be obtained from the NSLs; this is a new phenomenon in the calculus of variations, as we already pointed out in [31].

Helmholtz Conditions and Their Validity
The existence of Lagrangians is guaranteed by the Helmholtz conditions (HCs), which are necessary and sufficient conditions [10,27]. Let F i (y j , y j , y j , x) = 0 be a set of n ODEs, with i = 1, 2, ..., n and j = 1, 2, ..., n; then, the Helmholtz conditions are and Since for the ODEs of Q s f , i = j = 1, the first and second conditions are trivially satisfied; however, the third HC is not satisfied. The reason is that the LHS = B(x) but the RHS = 0; thus, the third HC fails to be valid, and this implies that no Lagrangian can be constructed for any ODEs of Q s f with B(x) = 0. Despite this strong negative statement, the Lagrangians obtained in this paper (as well as in some previous papers, notable in [5]) seem to contradict the third HC.
Let us explain the contradiction by substituting L s given by Equation (2) into the E-L equation. The result is and it is easy to verify that this equation does satisfy the third HC and also the first and second HCs; therefore, the existence of L s is justified by the HCs. However, the problem is that Equation (41) is not the same as the original equation (Dy(x) = 0), and it does not even belong to Q s f . In other words, the Lagrangian L s is consistent with the HCs but it gives the equation that differs from the original one by the factor E s (x). Since E s (x) > 0, [Dy(x)]E s (x) = 0 can be divided by E s (x) in order to obtain the original equation. This shows that the contradiction arises because the HCs do not account for the required division by E s (x). The credit for discovering and explaining this phenomenon goes back to Bateman [5]. Surprisingly, for the non-standard Lagrangians, the results are different than those obtained above for the standard Lagrangians. This can be shown by substituting L ns given by Equations (13) and (14) into the E-L equation, and finding  (41). This is important because Equation (41) already satisfies the third HC. The only problem that remains to be resolved is whether the imposed solution onv(x) is also a solution of the auxiliary condition. In general, this will not be the case; however, the ODEs whose coefficients B(x) and C(x) are related by B (x) + 4B 2 (x) = −C(x)/3 will be the exception. Thus, the presented results show that there is only a small subset of Q s f for which the existence of the NSLs can be justified by the HCs. A new phenomenon is that the remaining ODEs have their non-standard Lagrangians despite the fact that the resulting ODEs violate the HCs.
Let us point out that the problems described above forDy(x) = 0 do not exist forD o y(x) = 0, since for the latter the coefficient B(x) = 0, and as a result, the Helmholtz conditions are satisfied. It is also important to emphasise that the existence of the MLs and NLs is independent from the Helmholtz conditions, because these Lagrangians have no effects on the derivation of the original ODEs. In other words, once the mixed or null Lagrangian are found, they can be added to any standard or non-standard Lagrangian without changing the original equation or affecting the HCs.

Implications of Our Results on Calculus of Variations
We formally established the Lagrangian formalism for the ODEs of Q s f , and demonstrated that this can be achieved by using either standard or non-standard Lagrangians. We also derived the mixed Lagrangians and identified the ODEs for which these Lagrangians become the null Lagrangians. Knowing the NLs, we obtained their corresponding gauge functions and discussed their role in the Lagrangian formalism. Our results have profound implications on the calculus of variations.
First, we showed that the standard Lagrangians, previously derived for the ODEs of Q s f , may have their corresponding mixed Lagrangians, which cannot be used to obtain the original ODEs. We demonstrated that the mixed Lagrangians can be determined for all considered ODEs but the null Lagrangians exist only for some special cases (including the ODEs of the formD o y(x) = 0), and that only in these cases the corresponding gauge functions can be derived. The role of the null Lagrangians in studies of symmetries of physical systems and other phenomena was also briefly discussed. It was pointed out that the MLs may also contribute to these studies.
Second, in order to obtain the NSLs for the ODEs of Q s f , we had to solve the non-linear Riccati equation (see Equation (26)) whose solutions introduced a new dependent variable. Thus, despite the fact that the original ODEs have only one dependent variable, another one naturally appeared only in the NSLs and not in the SLs .
Third, we demonstrated that this additional dependent variable can only be removed by an auxiliary condition, which becomes the amendment to the E-L equation. The existence of the auxiliary condition in the Lagrangian formalism based on the NSLs is a new phenomenon in the calculus of variations and it has a profound implications on the Helmholtz conditions and their validity.
Fourth, the dependence of the SLs (L s ) and the NSLs (L ns ) on B(x) and C(x) is significantly different. Moreover, the form of SLs changes for different ODEs; however, the basic form NSLs remains practically the same for the ODEs of Q s f . This is a novel property of the NSLs derived here, which has not yet been observed in other NSLs previously obtained.
Finally, let us point out that our results clearly showed that for the derived NLs there is only a small subset of ODEs of Q s f with B(x) = 0 for which the Helmholtz conditions are satisfied. However, other ODEs of Q s f have their non-standard Lagrangians but do not obey the Helmholtz conditions. The effects of this novel discovery may become important in establishing the Lagrangian formalism based on the NLs.

Airy Equation
The general form of the ODEs of Q s f can be reduced toD o y(x) = 0 by taking B(x) = 0. Then, by specifying C(x) = −x, we obtain the following Airy equation y (x) − xy(x) = 0. Since B(x) = 0, the standard Lagrangian (see Proposition 1) is and the non-standard Lagrangian (see Proposition 3) can be written as whereH nso [y (x), y(x), x] is given by Equation (14) and it requires B(x) = 0. The auxiliary condition becomesv (x) = xv(x), and by using it, the original Airy equation is obtained from L nso [y (x), y(x), x]. We may also include the following mixed Lagrangian where q is an arbitrary constant. The resulting gauge function is This is the gauge function for the Airy equation, and it is also the gauge function for the ODEs of the formD o y(x) = 0 (see Equation (12)).

Bessel Equations
Let us consider a general form of Bessel equations and writeDy(x) = 0 as where B(x) = α/x and C(x) = β(1 + γµ 2 /x 2 ). In addition, α, β, γ and µ are constants, and their specific values determine the four different types of Bessel equations (see Table 1). Based on the above definitions of B(x) and C(x), these functions have singularities at x = 0 (regular) and x = ∞ (irregular); thus, x (0, ∞); thus, the functions are only smooth in this interval, and this is consistent with our definition given in Section 1. In other words, the results presented in this section are only valid inside this interval.
The solutions to the Bessel equations are given as the power series expansions around the regular singular point x = 0. The obtained solutions to different Bessel equations are summarised in Table 2. All solutions are converging when x → ∞; however, only some are finite in the entire range x (0, ∞) but others become infinite when x → 0 [3].
Using the results of Propositions 1, 2 and 3, we find the standard and non-standard Lagrangians for the Bessel equations are and where H ns [y (x), y(x), x] is given by Equation (14), and that the mixed Lagrangian L m is defined as with α being either 1 or 2. According to Table 1, α = 1 corresponds to regular and modified Bessel equations for which L m [y (x), y(x), x] = y(x)y (x)/2; however, for spherical and modified spherical Bessel equations α = 2 and L m [y (x), y(x), x] = y(x)y (x)x + y 2 (x)/2. An interesting result is that L m [y (x), y(x), x] = y(x)y (x)/2 is also the null Lagrangian because being the gauge function for the regular and modified Bessel equations; it is also the gauge function for the Euler equations because its b(x) = 1/x. The main reason is that for these equations B(x) = 1/x, which gives B + B 2 (x) = 0 and reduces significantly the derived MLs that are the NLs. As a result, only in theses cases, can the gauge functions be defined. It is interesting that Equation (52) can be obtained from Equation (12) by taking q = 1. The auxiliary condition that must supplement L ns [y (x), y(x), x] is given bȳ and this condition is required in order to derive the original Bessel equations from the E-L equation (see Proposition 3). The solutions presented in Table 2 are the two linearly independent solutions for the Bessel equations given as the special functions of mathematical physics. The notation used for these solutions is standard (e.g., [1][2][3]), which means that J µ (x) is the Bessel function of the first kind, J −µ (x) is the independent second solution, Y µ (x) is the Bessel function of the second kind or the Neumann function, I µ (x) is the modified Bessel function of the first kind, I −µ (x) is the independent second solution and K µ (x) is the modified Bessel function of the second kind or the modified Neumann function. In addition, j l (x) and y l (x) are the spherical Bessel functions, and i l (x) and k l (x) are the modified spherical Bessel functions. According to the results of Corollary 6, the derived NSLs can be expressed in terms of the pairs of these solutions, and such explicit dependence of the NSLs on the solutions of the original ODEs is a new phenomenon in the calculus of variations. Table 2. The linearly independent solutions of the four Bessel equations (see Table 1). The standard notation commonly adopted in textbooks and monographs of mathematical physics is used for these solutions.

Bessel Equations
Solutions µ or l Among the solutions listed in Table 2, the SFs I µ (x), I −µ (x), K µ (x), i l (x) and k l (x) are non-oscillatory; however, all other special functions listed above are oscillatory. The superpositions of the solutions y(x) andv(x) for each Bessel equation do not lead to any discontinuity in the above SLs and NSLs. However, it must be noted that some of the solutions given in Table 2 become zero at x = 0 but this also does not result in discontinuities for the derived NSL because x ∈ (0, ∞).

Legendre Equations
There are the regular and associated Legendre equations, and the latter can be written as where l and m are constants, and when m = 0 the above equation becomes the regular Legendre equation (see Table 3). Comparing the above Legendre equation toDy(x) = 0, we obtain B(x) = −2x/(1 − x 2 ) and C(x) = l(l + 1)/(1 − x 2 ) − m 2 /(1 − x 2 ) 2 , which show that the solutions presented below are only valid within the range x (−1, +1) as only this interval the functions are smooth. For the regular Legendre equation, the power series solutions are calculated either at one of the regular singular points x = ±1 [1][2][3]. The two linearly independent solutions are the Legendre functions of the first kind or the Legendre polynomials P l (x), which are oscillatory within x (−1, +1), and the Legendre functions of the second kind Q l (x) that are singular at x = ±1 (see Table 3); note that Q l (x) can be expressed in terms of P l (x); nevertheless, the solutions remain linearly independent 1 . The power series solutions calculated at one of the regular singular points diverge at x = ±1 unless l is chosen to be an integer, which terminates the series, and finite Legendre polynomials of order l are obtained [3]; therefore, in physical applications l is a positive integer.
Because of the above constraints on the solutions, the original definitions of B(x) and C(x) given in Section 1 are not valid, and as a result, the Legendre equations formally do not belong to Q s f . However, since the equations are of the form of the ODEs of Q s f , let us make adjustments to the definitions of B(x) and C(x), so that our procedure of deriving the Lagrangians applies to the Legendre equations as well. It must be noted that the adjustments are only valid for the equations considered in this subsection.
We now present the SL only for the associated Legendre equations because the SL corresponding to the regular Legendre equation is obtained by taking m = 0. However, the NSL and L m have the same forms for both regular and associated Legendre equations. Following Propositions 1 and 2, we find the following Lagrangians where H ns [y (x), y(x), x] is given by Equation (14), and the mixed Lagrangian is given by which shows that the gauge function cannot be defined for this mixed Lagrangian. It is also interesting to note that the mixed Lagrangians for the spherical Bessel and Legendre equations have is taken into account. Table 3. The linearly independent solutions of the regular and associated Legendre equations. The standard notation commonly adopted in textbooks and monographs of mathematical physics is used for these solutions.

Legendre Equations Solutions m
Regular There are two linearly independent solutions of the associated Legendre equation, the associated Legendre functions of the first kind P m l (x), which are related to P l (x), and the associated Legendre functions of the second kind Q m l (x), which are related to Q l (x); in the case in which l is an integer, P m l (x) is called the associated Legendre polynomials. The well-known property of the Legendre functions is the fact that all P m l (x) with m > 0 can be generated from P l (x), which can be built recursively from P 0 (x) = 1 and P 1 (x) = x; the same is true for Q m l (x). It must be pointed out that P m l (x) are oscillatory within x (−1, +1) and Q m l (x) are non-oscillatory. These properties of the solutions are important for expressing the SL, NSL and L m in terms of the superpositions of linearly independent solutions y 1 (x) and y 2 (x), as shown by Corollary 6.

Hermite Equation
The Hermite equation can be written as where H ns [y (x), y(x), x] is given by Equation (14), and mixed Lagrangian is defined as and the gauge function cannot be defined, which means that L m [y (x), y(x), x] is not the null Lagrangian and that the gauge function cannot be determined. It is also seen that the terms xy(x)y (x) + y 2 (x)/2 that appeared in the mixed Lagrangians for the spherical Bessel and Legendre equations are also present in the mixed Lagrangians for the Hermite equation. To obtain the original Hermite equation, the Lagrangian must be substituted into the E-L equation, and according to Proposition 3 the following auxiliary condition must be used.

Discussion of Applications
Having obtained the standard and non-standard Lagrangians for the Airy, Bessel, Legendre and Hermite equations is equivalent to showing that the equations can be derived from the Lagrangian formalism based on these Lagrangians [24,34]. Similarly, we may find the SLs and NSLs for all other ODEs of Q s f , and establish the Lagrangian formalism for all considered ODEs. The obtained results are important in theoretical physics, since their main equations are typically derived from given Lagrangians. Our results may also be useful in applied mathematics and engineering where the ODEs Q s f are commonly used.
There are advantages of having the Lagrangian formalism for the ODEs of Q s f , and they include using the derived Lagrangians to study the group structure underlying the SLs and NSLs, and their symmetries (possibly some new ones), as well as finding relationships between the Lagrange formalism and the Lie group approach (e.g., [1,6]), which introduces the special functions by using irreducible representations of some Lie groups; these topics are out the scope of this paper but they will be investigated in the future.
We also derived the mixed Lagrangians forD o y(x) = 0 and forDy(x) = 0. For the former, we demonstrated that the mixed Lagrangians depend on an arbitrary constant and that the gauge functions can be defined for all these MLs since they are equivalent to the NLs. For the latter, we showed that the MLs depend on the function B(x) but they are independent of C(x). Because of this dependence on B(x), the MLs become zero when B(x) = 0. Other special cases of L m [y (x), y(x), x] = 0 are also possible, and we now list the required conditions: (i) y(x) = 0 and B(x) = 0; (ii) y(x) = 0 but B(x) = 0; (iii) y(x) = 0 but B(x) = 0; and G m [y (x), y(x), x] = 0, which is only satisfied when y(x) and B(x) are related by y( , and with C 0 being the integration constant.
The existence of the MLs for the ODEs of Q s f is an interesting result, which shows that there is a family of Lagrangians that gives null contributions to calculus of variations by fully solving the E-L equation. Specific applications of the MLs and NLs are to study symmetries of physical systems described by the Lagrangians, and their other effects will be the subject of future explorations. An important result is that the only MLs obtained for the Airy equation, and regular and modified Bessel equations become the NLs, and that only for these two equations can the gauge functions be properly defined.

Conclusions
We considered linear second-order ODEs with non-constant coefficients that are commonly used in applied mathematics, physics and engineering. We selected the ODEs with non-constant coefficients whose solutions are the special functions of mathematical physics, and denoted them as Q s f . We established the Lagrange formalism for these equations. Since the original ODEs were known, our main objective was to derive the Lagrangians corresponding to these equations. This required solving the inverse calculus of the variations problem, and we developed novel methods for solving it. These methods allowed for the derivation of standard and non-standard Lagrangians, and also the mixed Lagrangians that make null contributions to the Lagrangian formalism but become full solutions of the Euler-Lagrange equation. We identified the equations for which the mixed Lagrangians are the null Lagrangians with the properly defined gauge functions. An interesting result is that for most ODEs of Q s f , the gauge functions cannot be defined. We also showed that the derived non-standard Lagrangians form a new family of Lagrangians.
The dependence of non-standard Lagrangians on an additional dependent variable requires that the E-L equation is amended by the auxiliary condition, which is again, a new phenomenon in calculus of variations. To present the effects of these new phenomena, we considered the Helmholtz conditions and investigated their validity. The obtained results clearly showed that there are ODEs in the set Q s f for which the non-standard Lagrangians can be found, despite the fact that the Helmholtz conditions are violated. This result may have profound implications on the development of the Lagrangian formalism based on non-standard Lagrangians.
We considered specific applications of our results to the Airy, Bessel, Legendre and Hermite equations. In these applications, we constructed the standard, non-standard and mixed Lagrangians for each one of these equations, and discussed the similarities and differences between the resulting Lagrangians. The presented results demonstrate that the Lagrangian formalism is well-established for the ODEs of Q s f , which means that there is a powerful and robust method of obtaining the ODEs whose solutions are given in terms of the special functions of mathematical physics. Moreover, our results show that the derived mixed Lagrangians become the null Lagrangians only for the Airy (and other similar) equations, and also for the regular and modified Bessel equations.
Finally, let us briefly summarise important open problems resulting from this paper.
(1) The presented methods of finding standard and non-standard can be extended to other ODEs both homogeneous and inhomogeneous. (2) The obtained mixed (null) Lagrangians can be used to investigate symmetries of physical systems described by such Lagrangians. (3) Since only one family of non-standard Lagrangians was explored, other families known from the literature [17,20,25] should also be investigated to determine whether all these Lagrangians require the auxiliary conditions. (4) The fact that the Euler-Lagrange equation does not give directly the original equation is a new phenomenon that needs additional studies. (5) Some non-standard Lagrangians violate the Helmholtz conditions; therefore, a generalisation of these conditions, so they apply to all Lagrangians, is required.
These open problems will be explored in separate papers.