Introduction

Consider the general eighth-order linear differential equation of the form

$$\begin{aligned} Lu(x)=u^{(8)}(x)+\sum _{i=0}^{7}a_{i}(x)u^{(i)}(x)=f(x),\quad x\in [-1, 1], \end{aligned}$$
(1)

subject to the following boundary conditions

$$\begin{aligned} u^{(j)}(-1)=u^{(j)}(1)=0,\quad j=0,1,2,3, \end{aligned}$$
(2)

where u(x), f(x) are continuous functions in the space \(\ell ^{2}]-1, 1[\) and \(a_{i}(x)= x^{i}\).

The boundary value problems of higher order have been investigated due to their mathematical importance and the potential for the applications in hydrodynamic and hydro-magnetic stability [1, 2]. Higher-order boundary value problems arise in many fields. For instance, sixth- and eighth-order differential equations are modelled by thermal instability as ordinary convection and overstability in horizontal layer of fluid heated from below subject to the action of rotation [2, 3]. Generally, such problems are known to arise in astrophysics. The narrow convecting layers bounded by stable layers which are believed to surround A-type stars may be modelled by sixth-order boundary value problems [4]. Dynamo actions in some stars may be modelled by such equations [5]. Shen [6] derived an eighth-order differential equation by governing bending and axial vibrations. Equations for the equilibrium in terms of components for an orthotropic thin circular cylindrical shell subjected to a load that is symmetric about the shell result in an eighth-order differential equations as shown by Paliwal and Pande [7]. Bishop et al. [8] showed that an eighth-order differential equation arises in torsional vibration of uniform beams. Existence and uniqueness of solutions of 2n-th order boundary value problems are discussed by Agarwal [9, 10]. The analytical solutions of such problems cannot be found easily. Therefore, the authors suggested different approximate algorithms using Legendre, Hermite and Laguerre [11, 12] polynomials. Among them, Legendre polynomials have extensively been particularly used in the area of physics and engineering. For instance, Legendre and assocaited Legendre polynomials are also widely used in [1315], to solve the fractional problems. Spectral methods also have gained a good reputation among numerical analysts as a robust numerical tool for a wide variety of problems in applied mathematics and scientific computing. Many researchers used the spectral approach [16, 17] to solve the ordinary and partial differential equations, respectively. A selective review for getting the numerical solution of the eighth-order boundary value problems is presented here. Boutayeb and Twizell [18] used finite difference methods, Akram and Siddiqi [19, 20] used nonic and non-polynomial spline functions, respectively, Akram and Rehman [21] developed reproducing kernel space, Viswanadham and Ballem [22] used Galerkin method with quintic B-spline, Inc and Evans [23] constructed Adomian decomposition method, Wazwaz [24] developed modified Adomian decomposition method, Siddiqi and Iftikhar [25] used homotopy analysis method, and Ballem and Viswanadham [26] presented the Galerkin method with septic B-splines, whereas Abbasbandy and Shirzadi [27] developed variational iteration method.

In this paper, the Legendre Galerkin method has been elaborated for the solution of linear eighth-order boundary value problem with two-point boundary conditions defined in Eq. (1) with Eq. (2).

In "Preliminaries", some important definitions, lemmas and theorems regarding Legendre polynomials are discussed. Legendre Galerkin method is explained in "Description of the method". Convergence and error analysis of the method are discussed in "Convergence and error analysis". The transformation of nonhomogeneous boundary conditions and change of interval are discussed in "Handling of boundary conditions and solution domain". The practical usefulness and applicability of the method have been discussed via examples in "Numerical examples".

Preliminaries

Legendre polynomials are widely used as a mathematical tool in applied sciences as well as in engineering field. These polynomials are defined precisely and easily differentiated and integrated as well.

Legendre polynomials of degree n over the interval \([-1,1]\) is defined as

$$\begin{aligned} L_{n}(x)= \frac{1}{2^{n}}\sum _{k=0}^{N}(-1)^k\frac{(2n-2k)!}{k!(n-k)!(n-2k)!}x^{n-2k}, \end{aligned}$$

where

$$\begin{aligned} N=\left\{ \begin{array}{ll} \frac{n}{2}, &{} \hbox {if} \ n = 0, 2, 4,\ldots \\ \frac{(n-1)}{2}, &{} \hbox {if} \ n = 1, 3, 5,\ldots \end{array} \right. \end{aligned}$$

and satisfy the following recurrence relations

$$\begin{aligned} (2n+1)L_{n}(x)= L'_{n+1}(x)-L'_{n-1}(x), \end{aligned}$$
(3)
$$\begin{aligned} nL_{n}(x) &= x L'_{n}(x)-L'_{n-1}(x). \end{aligned}$$
(4)

Legendre polynomials are orthogonal on \([-1,1]\) with respect to the weight function 1, i.e.

$$\begin{aligned} \int _{-1}^{1}L_{m}(x)L_{n}(x){\rm d}x=\left\{ \begin{array}{ll} \frac{2}{2n+1}, &{} \hbox {if} \ m = n \\ 0, &{} \hbox {if} \ m\ne n \end{array} \right. \end{aligned}$$
(5)

and

$$\begin{aligned} \int _{-1}^{1}L_{n}(x){\rm d}x=\left\{ \begin{array}{ll} 2, &{} \hbox {if} \ n = 0 \\ 0, &{} \hbox {if} \ n > 0. \end{array} \right. \end{aligned}$$
(6)

Lemma 2.1

Let n and m be any two integers such that \(n-m\le N\) and \(m>0\), then

$$\begin{aligned} \int _{-1}^{1}L_{n}(x)L''_{n-m}(x){\rm d}x= 0. \end{aligned}$$

Proof

Integrating the left hand side by parts and using Eq. (6) yield the result.

Lemma 2.2

Let n and m be any two integers such that \(n\ge m\), then

$$\begin{aligned} \int _{-1}^{1}L_{n}(x)L'_{m}(x){\rm d}x= 0. \end{aligned}$$

Proof

The proof is divided into two parts.

Case I

For \(n=m\), we have

$$\begin{aligned} \int _{-1}^{1}L_{n}(x)L'_{n}(x){\rm d}x &= \left[ \frac{1}{2}\{L_{n}(x)\}^{2}\right] ^{1}_{-1}=0. \end{aligned}$$

Case II

For \(n>m\), the integral on the left, using Eqs. (3) and (6), can be written as

$$\begin{aligned} \int _{-1}^{1}L_{n}(x)L'_{m}(x){\rm d}x &= \int _{-1}^{1}\left[ (2m-1)L_{m-1}(x)+L'_{m-2}(x)\right] L_{n}(x){\rm d}x\\&= \int _{-1}^{1}L_{n}(x)L'_{m-2}(x){\rm d}x\\&= \int _{-1}^{1}L_{n}(x)L'_{m-4}(x){\rm d}x\\&\cdot&\\&\cdot&\\&\cdot&\\&= \left\{ \begin{array}{ll} \int _{-1}^{1}L_{n}(x)L'_{0}(x){\rm d}x, &{} {\text {if}} \ m=even\\ \int _{-1}^{1}L_{n}(x)L'_{1}(x){\rm d}x, &{} {\text {if}} \ m=odd\\ \end{array} \right. \\&= 0. \end{aligned}$$

Theorem 2.1

Let n and m be any two integers such that \(n,m \le N\) , then

$$\begin{aligned}&(1) \ \int _{-1}^{1}L'_{n}(x)L_{m}(x){\rm d}x=\left\{ \begin{array}{ll} 2, &{} {\rm if} \ n=m+i\\ 0, &{} {\rm if} \ n\ne m+i \ {\rm or} \ n\le m,\\ \end{array} \right. \\&{\rm (2)} \ \int _{-1}^{1}L''_{n}(x)L_{m}(x){\rm d}x=\left\{ \begin{array}{ll} n(n+1)-m(m+1),&{}{\rm if} \ n\ne m+i \\ 0,&{} {\rm if} \ n=m+i \ {\rm or} \ n\le m,\\ \end{array} \right. \end{aligned}$$

where \(i=1,3,5,\ldots ,2k+1\le N-m\).

Proof

  1. (1)

    Integrating \(\int _{-1}^{1}L'_{n}(x)L_{m}(x){\rm d}x\) by parts gives

    $$\begin{aligned} \int _{-1}^{1}L'_{n}(x)L_{m}(x){\rm d}x&= \left[ L_{n}(x)L_{m}(x)\right] _{-1}^{1}-\int _{-1}^{1}L_{n}(x)L'_{m}(x){\rm d}x \nonumber \\ &= \left[ 1+(-1)^{n+m+1}\right] -\int _{-1}^{1}L_{n}(x)L'_{m}(x){\rm d}x. \end{aligned}$$
    (7)

    For \(n=m+i, i=1,3,5,\ldots ,2k+1\le N-m\) and using Lemma 2.2 lead to

    $$\begin{aligned} \int _{-1}^{1}L'_{n}(x)L_{m}(x){\rm d}x &= 2. \end{aligned}$$

    For \(n=m+i, i=0,2,4,\ldots ,2k\le N-m\), Eq. (7) yields

    $$\begin{aligned} \int _{-1}^{1}L'_{n}(x)L_{m}(x){\rm d}x &= 0. \end{aligned}$$

    For \(n\le m\) and considering the previous cases with Lemma 2.2 yield \(\int _{-1}^{1}L'_{n}(x)L_{m}(x){\rm d}x=0.\)

  2. (2)

    The proof is divided into four parts.

  1. (a)

    For \(n=m+i, \quad i=2,4,6,\ldots ,2k\le N-m\).

    $$\begin{aligned} \int _{-1}^{1}L''_{n}(x)L_{m}(x){\rm d}x &= \left[ L'_{n}(x)L_{n-i}(x)\right] _{-1}^{1}-\int _{-1}^{1}L'_{n}(x)L'_{n-i}(x){\rm d}x\\ &= n(n+1)-\left[ L_{n}(x)L'_{n-i}(x)\right] _{-1}^{1}\\&\quad +\int _{-1}^{1}L_{n}(x)L''_{n-i}(x){\rm d}x\\ &= n(n+1)-\left[ L_{n}(x)L'_{n-i}(x)\right] _{-1}^{1},\\ & \quad \left[ {\text{using Lemma 2.1}}\right] \\ &= n(n+1)-m(m+1). \end{aligned}$$
  2. (b)

    For \(n=m+i, i=1,3,5,\ldots ,2k+1\le N-m\), then \(\int _{-1}^{1}L''_{n}(x)L_{m}(x){\rm d}x=0\).

  3. (c)

    For \(n=m\), then

    $$\begin{aligned} \int _{-1}^{1}L''_{n}(x)L_{m}(x){\rm d}x &= \left[ L'_{n}(x)L_{n-i}(x)\right] _{-1}^{1}-\int _{-1}^{1}L'_{n}(x)L'_{n-i}(x){\rm d}x\\ &= n(n+1)-m(m+1)\\ &= 0. \end{aligned}$$
  4. (d)

    For \(n<m\), then integrating \(\int _{-1}^{1}L''_{n}(x)L_{m}(x) {\rm d}x\) by parts and using Eq. (6) leads to \(\int _{-1}^{1}L''_{n}(x)L_{m}(x) {\rm d}x=0\).

Description of the method

To solve the linear eighth-order boundary value problem (1) by the Galerkin method along with Legendre basis, u(x) is approximated as

$$\begin{aligned} u(x) &= \sum _{j=0}^{n}\alpha _{j} L_{j}(x), \end{aligned}$$
(8)

where \(\alpha _{j}'s\), \(j=0,1,2,\ldots ,n\) are the Legendre coefficients. To determine these coefficients \(\alpha _{j}\), orthogonalizing the residual with respect to the basis functions, i.e.

$$\begin{aligned} \langle u^{(8)}(x),L_{r}(x)\rangle +\sum _{i=0}^{7}\langle a_{i}(x)u^{(i)}(x),L_{r}(x)\rangle -\langle f(x), L_{r}(x)\rangle =0, \end{aligned}$$
(9)

where

$$\begin{aligned} \langle \phi , \psi \rangle &= \int _{-1}^{1}\phi (x) \psi (x) {\rm d}x. \end{aligned}$$

We approximate the integrals in Eq. (9) by integrating by parts such that all derivatives transfer from u to \(L_{r}\). For convenience, few of the inner products of Eq. (9) can be calculated, as

$$\begin{aligned} \langle a_{3}(x)u^{(3)}(x),L_{r}(x)\rangle &= -\int _{-1}^{1}u(x)\left[ a_{3}(x)L_{r}(x)\right] ^{(3)}{\rm d}x,\end{aligned}$$
(10)
$$\begin{aligned} \langle a_{2}(x)u^{(2)}(x),L_{r}(x)\rangle &= \int _{-1}^{1}u(x)\left[ a_{2}(x)L_{r}(x)\right] ^{(2)}{\rm d}x,\end{aligned}$$
(11)
$$\begin{aligned} \langle a_{1}(x)u'(x),L_{r}(x)\rangle &= -\int _{-1}^{1}u(x)\left[ a_{1}(x)L_{r}(x)\right] '{\rm d}x,\end{aligned}$$
(12)
$$\begin{aligned} \langle a_{0}(x)u(x),L_{r}(x)\rangle &= \int _{-1}^{1}a_{0}(x)u(x)L_{r}(x){\rm d}x,\end{aligned}$$
(13)
$$\begin{aligned} {\rm and} \ \langle f(x),L_{r}(x)\rangle\simeq & {} \sum _{k=0}^{m}\frac{2f(x_{k}) L_{r}(x_{k})}{\left[ (1-x_{k}^{2}) (L'_{m}(x_{k}))^{2}\right] }. \end{aligned}$$
(14)

Lemma 3.1

The following relations hold:

$$\begin{aligned} 1. \ \langle u^{(8)}(x),L_{r}(x)\rangle &= \sum _{k=4}^{7}(-1)^{k+1}\left[ u^{(k)}(x)L_{r}^{(7-k)}(x)\right] _{-1}^{1}\nonumber \\&\quad +\int _{-1}^{1}u(x)L_{r}^{(8)}(x){\rm d}x,\end{aligned}$$
(15)
$$\begin{aligned} 2. \ \langle a_{7}(x)u^{(7)}(x),L_{r}(x)\rangle &= \sum _{k=4}^{6}(-1)^{k}\left[ u^{(k)}(x)\{a_{7}(x)L_{r}(x)\}^{(6-k)}\right] _{-1}^{1} \nonumber \\&\quad-\int _{-1}^{1}u(x)\{a_{7}(x)L_{r}(x)\}^{(7)}{\rm d}x, \end{aligned}$$
(16)
$$\begin{aligned} 3. \ \langle a_{6}(x)u^{(6)}(x),L_{r}(x)\rangle &= \sum _{k=4}^{5}(-1)^{k+1}\left[ u^{(k)}(x)\{a_{6}(x)L_{r}(x)\}^{(5-k)}\right] _{-1}^{1} \nonumber \\&\quad+\int _{-1}^{1}u(x)\{a_{6}(x)L_{r}(x)\}^{(6)}{\rm d}x,\end{aligned}$$
(17)
$$\begin{aligned} 4.\ \langle a_{5}(x)u^{(5)}(x),L_{r}(x)\rangle &= \left[ u^{(4)}(x)a_{5}(x)L_{r}(x)\right] _{-1}^{1}\nonumber \\&\quad-\int _{-1}^{1}u(x)\{a_{5}(x)L_{r}(x)\}^{(5)}{\rm d}x,\end{aligned}$$
(18)
$$\begin{aligned} 5. \ \langle a_{4}(x)u^{(4)}(x),L_{r}(x)\rangle &= \int _{-1}^{1}u(x)\{a_{4}(x)L_{r}(x)\}^{(4)}{\rm d}x. \end{aligned}$$
(19)

Proof

  1. 1.

    As

    $$\begin{aligned} \langle u^{(8)}(x),L_{r}(x)\rangle &= \int _{-1}^{1}u^{(8)}(x)L_{r}(x){\rm d}x. \end{aligned}$$

    Integrating the right hand terms of the above equation by parts leads to

    $$\begin{aligned} \langle u^{(8)}(x),L_{r}(x)\rangle &= B_{T,8}+\sum _{k=4}^{7}(-1)^{k+1}\left[ u^{(k)}(x)L_{r}^{(7-k)}(x)\right] _{-1}^{1}\\&\quad+\int _{-1}^{1}u(x)L_{r}^{(8)}(x){\rm d}x, \end{aligned}$$

    where the boundary term

    $$\begin{aligned} B_{T,8} &= \sum _{k=0}^{3}(-1)^{k+1}\left[ u^{(k)}(x)L_{r}^{(7-k)}(x)\right] _{-1}^{1} \end{aligned}$$

    is zero using the boundary conditions defined in Eq. (2) yielding the relation.

  2. 2.

    The inner product of \(\{a_{7}(x)u^{(7)}(x)\}\) with \(L_{r}(x)\) is obtained, as

    $$\begin{aligned} \langle a_{7}(x)u^{(7)}(x),L_{r}(x)\rangle &= B_{T,7}+\sum _{k=4}^{6}(-1)^{k}\left[ u^{(k)}(x)\{a_{7}(x)L_{r}(x)\}^{(6-k)}\right] _{-1}^{1}\\&\quad-\int _{-1}^{1}u(x)\{a_{7}(x)L_{r}(x)\}^{(7)}{\rm d}x, \end{aligned}$$

    where the boundary term

    $$\begin{aligned} B_{T,7} &= \sum _{k=0}^{3}(-1)^{k}\left[ u^{(k)}(x)\{a_{7}(x)L_{r}(x)\}^{(6-k)}\right] _{-1}^{1}=0 \end{aligned}$$

gives the relation. The other relations can be obtained similarly.

Theorem 3.1

If Eq. (8) is the assumed approximate solution of the boundary value problem (1)–(2), then the discrete system for determining the coefficients \(\{\alpha _{j}\}_{j=0}^{n}\) is given by

$$\begin{aligned}&\sum _{j=0}^{n}\left[ \sum _{k=4}^{7}(-1)^{k+1}\left[ L_{j}^{(k)}(x)L_{r}^{(7-k)}(x)\right] _{-1}^{1}\right. \nonumber \\&\qquad +\sum _{k=4}^{6}(-1)^{k}\left[ L_{j}^{(k)}(x)\{a_{7}(x)L_{r}(x)\}^{(6-k)}\right] _{-1}^{1}\nonumber \\&\qquad +\sum _{k=4}^{5}(-1)^{k+1}\left[ L_{j}^{(k)}(x)\{a_{6}(x)L_{r}(x)\}^{(5-k)}\right] _{-1}^{1}\nonumber \\&\qquad +\left[ L_{j}^{(4)}(x)a_{5}(x)L_{r}(x)\right] _{-1}^{1}\nonumber \\&\qquad +\left. \sum _{q=0}^{8}(-1)^{q}\int _{-1}^{1}L_{j}(x) \{a_{q}(x)L_{r}(x)\}^{(q)} {\rm d}x\right] \alpha _{j}\nonumber \\&\quad =\sum _{k=0}^{m}\frac{2f(x_{k}) L_{r}(x_{k})}{\left[ (1-x_{k}^{2}) (L'_{m}(x_{k}))^{2}\right] },\quad 0\le r\le n. \end{aligned}$$
(20)

It can be written, in matrix form, as

$$\begin{aligned} A X &= B, \end{aligned}$$
(21)

where

$$\begin{aligned} A=\left( \begin{array}{ccccccc} \mu _{0,0}+\nu _{0,0} &{} \mu _{1,0}+\nu _{1,0} &{} \mu _{2,0}+\nu _{2,0} &{} . &{} . &{} . &{} \mu _{n,0}+\nu _{n,0} \\ \mu _{0,1}+\nu _{0,1} &{} \mu _{1,1}+\nu _{1,1} &{} \mu _{2,1}+\nu _{2,1} &{} . &{} . &{} . &{} \mu _{n,1}+\nu _{n,1} \\ \mu _{0,2}+\nu _{0,2} &{} \mu _{1,2}+\nu _{1,2} &{} \mu _{2,2}+\nu _{2,2} &{} . &{} . &{} . &{} \mu _{n,2}+\nu _{n,2} \\ \cdot &{} \cdot &{} \cdot &{} \cdot &{} &{} &{} \cdot \\ \cdot &{} \cdot &{} \cdot &{} &{} \cdot &{} &{} \cdot \\ \cdot &{} \cdot &{} \cdot &{} &{} &{} \cdot &{} \cdot \\ \mu _{0,n}+\nu _{0,n} &{} \mu _{1,n}+\nu _{1,n} &{} \mu _{2,n}+\nu _{2,n} &{} \cdot &{} \cdot &{} \cdot &{} \mu _{n,n}+\nu _{n,n} \\ \end{array} \right) \end{aligned}$$

and

$$\begin{aligned} \mu _{j,r} &= \sum _{q=0}^{8}(-1)^{q}\int _{-1}^{1}L_{j}(x) \{a_{q}(x)L_{r}(x)\}^{(q)} {\rm d}x,\quad a_{8}(x)=1, \end{aligned}$$
$$\begin{aligned} \nu _{j,r} &= \left[ \sum _{k=4}^{7}(-1)^{k+1}L_{j}^{(k)}(x)L_{r}^{(7-k)}(x) \right. \\&\quad +\sum _{k=4}^{6}(-1)^{k}L_{j}^{(k)}(x)\{a_{7}(x)L_{r}(x)\}^{(6-k)} \\&\quad + \sum _{k=4}^{5}(-1)^{k+1}L_{j}^{(k)}(x)\{a_{6}(x)L_{r}(x)\}^{(5-k)}\\ &\quad \left. +L_{j}^{(4)}(x)a_{5}(x)L_{r}(x)\right] _{-1}^{1}. \end{aligned}$$

The term \(\mu _{j,r}\) can be calculated using the results given in Preliminaries, while the boundary term \(\nu _{j,r}\) can be calculated as

$$\begin{aligned} \left[ L_{j}^{(4)}(x)a_{5}(x)L_{r}(x)\right] _{-1}^{1}=\frac{1}{384}\left\{ 1-(-1)^{n+r+j}\right\} \prod _{i=0}^{7}(j-i+4), \end{aligned}$$
$$\begin{aligned} & \sum _{k=4}^{5}(-1)^{k+1}\left[ L_{j}^{(k)}(x)\{a_{6}(x)L_{r}(x)\}^{(5-k)}\right] _{-1}^{1} = \frac{1}{3840}\left\{ 1-(-1)^{n+r+j-1}\right\} \prod _{i=0}^{9}(j-i+5)\\&\quad -\frac{1}{768}\left\{ 2n+r(r+1)\right\} \left\{ 1+(-1)^{n+r+j}\right\} \\&\quad \times \prod _{i=0}^{7}(j-i+4), \end{aligned}$$
$$\begin{aligned} & \sum _{k=4}^{6}(-1)^{k}\left[ L_{j}^{(k)}(x)\{a_{7}(x)L_{r}(x)\}^{(6-k)}\right] _{-1}^{1} = \frac{1}{46{,}080}\left\{ 1-(-1)^{n+r+j}\right\} \prod _{i=0}^{11}(j-i+6)\\&\quad -\frac{1}{7680}\left\{ 2n+r(r+1)\right\} \left\{ 1+(-1)^{n+r+j-1}\right\} \\&\quad \times \prod _{i=0}^{9}(j-i+5)+\frac{1}{3072}\left\{ 8n(n-1)+8nr(r+1)\right. \\&\quad \left. +(r+2)(r+1)(r)(r-1)\right\} \left\{ 1-(-1)^{n+r+j}\right\} \\&\quad \times \prod _{i=0}^{7}(j-i+4), \end{aligned}$$
$$\begin{aligned} & \sum _{k=4}^{7}(-1)^{k+1}\left[ L_{j}^{(k)}(x)L_{r}^{(7-k)}(x)\right] _{-1}^{1} = \frac{1}{645{,}120}\left\{ 1+(-1)^{r+j}\right\} \prod _{i=0}^{13}(j-i+7)\\&\quad -\frac{1}{92{,}160}(r(r+1))\left\{ 1-(-1)^{r+j-1}\right\} \prod _{i=0}^{11}(j-i+6)\\&\quad +\frac{1}{30{,}720}\left\{ 1-(-1)^{r+j-1}\right\} \prod _{i=0}^{3}(r-i+2)\prod _{i=0}^{9}(j-i+5)\\&\quad -\frac{1}{18{,}432}\left\{ 1-(-1)^{r+j-1}\right\} \prod _{i=0}^{5}(r-i+3)\prod _{i=0}^{7}(j-i+4). \end{aligned}$$

After solving the linear system (21) having \((n+1)\) equations with \((n+1)\) unknowns yield, the column vector \(X=\left( \alpha _{0}, \alpha _{1}, \alpha _{2},\ldots , \alpha _{n}\right) ^{\rm T}\). Thus, u(x) can now be approximated by Eq. (8).

Convergence and error analysis

In this section, the convergence and error analysis of the Legendre Galerkin method have been studied in detail.

Convergence of the method

Lemma 4.1

Let \(x(t)\in H^{k}]-1, 1[\) (a Sobolev space) and let \(x_{n}(t)=\sum _{i=0}^{n}c_{i}L_{n}(t)\) be the best approximation polynomial of x(t) in the \(\ell ^{2}\) -norm, then

$$\begin{aligned} \|x(t)-x_{n}(t)\|_{\ell ^{2}[-1,1]}\le c_{0}n^{-k}\|x(t)\|_{H^{k}]-1, 1[}, \end{aligned}$$

and \(c_{0}\) is a non-negative constant which depends on the selected norm and is free from x(t) and n.

Proof

[2830].

Theorem 4.1

Assume \(\kappa :X\rightarrow X\) is bounded, with X a Banach space, and \(\lambda -\kappa :X\rightarrow X\) is bijective. Further, assume

$$\begin{aligned} \|\kappa -\kappa L_{n}\|\rightarrow 0\quad {\rm as} \ n\rightarrow \infty , \end{aligned}$$

then for all sufficiently large n , say \(n\ge N\), the operator \((\lambda -\kappa L_{n})^{-1}\) exists as a bounded operator from X to X. Moreover, it is uniformly bounded such that

$$\begin{aligned} \sup _{n\ge N}\|(\lambda -\kappa L_{n})^{-1}\|<\infty . \end{aligned}$$

For the solution of \((\lambda -\kappa L_{n})x_{m}=L_{n}y\), \(x_{m}\in X\) and \((\lambda -\kappa )x=y\),

$$\begin{aligned} x-x_{m}=\lambda (\lambda -L_{n}\kappa )^{-1}(x-L_{n}(x)), \end{aligned}$$
$$\begin{aligned} \frac{|\lambda |}{\|\lambda -\kappa L_{n}\|} \|x-L_{n}(x)\| \le \|x-x_{n}\|\le |\lambda | \|(\lambda -\kappa L_{n})^{-1}\| \|x-L_{n}(x)\|. \end{aligned}$$

Proof

[31].

Consequently, the approximation rate of Legendre polynomials is \(n^{-k}\) with respect to Lemma 4.1, and also from Theorem 4.1, \(\|x-x_{n}\|\) converge to zero as soon as \(\|x-L_{n}\|\).

Error analysis of the method

In this subsection, an error estimator for eighth-order boundary value problems using Legendre Galerkin approximation has been discussed.

Consider \(e_{n}(x)=u(x)-u_{n}(x)\) as the error function of Legendre approximation \(u_{n}(x)\) to u(x), where u(x) is the exact solution of Eq. (1) with boundary conditions defined in Eq. (2). So, \(u_{n}(x)\) satisfies the following problem:

$$\begin{aligned} u_{n}^{(8)}(x)+\sum _{i=0}^{7} a_{i}(x)u_{n}^{(i)}(x)=f(x)+P_{n}(x),\quad x\in [-1, 1], \end{aligned}$$
(22)

with boundary conditions

$$\begin{aligned} u_{n}^{(i)}(-1)=u_{n}^{(i)}(1)=0,\quad i=0,1,2,3, \end{aligned}$$
(23)

where \(P_{n}(x)\) is a perturbation term linked with \(u_{n}(x)\) obtained as follows

$$\begin{aligned} P_{n}(x) &= u_{n}^{(8)}(x)+\sum _{i=0}^{7} a_{i}(x)u_{n}^{(i)}(x)-f(x),\quad i=0,1,2,3. \end{aligned}$$
(24)

We find an approximation \(e_{n,N}(x)\) to \(e_{n}(x)\) in the same way as in description of the method, for the solution of Eq. (1) with Eq. (2). Subtracting Eqs. (22) and (23) from Eqs. (1) and (2), respectively, yields the error function of the form

$$\begin{aligned} P_{n}(x) &= -e_{n}^{(8)}(x)-\sum _{i=0}^{7} a_{i}(x)e_{n}^{(i)}(x) \end{aligned}$$
(25)

and

$$\begin{aligned} e_{n}^{(i)}(-1)=e_{n}^{(i)}(1)=0,\quad i=0,1,2,3. \end{aligned}$$
(26)

We solve this problem using the Legendre Galerkin method to get the approximation \(e_{n,N}(x)\).

Handling of boundary conditions and solution domain

If the boundary conditions are nonhomogeneous or the solution domain is [ab], then these conditions are converted to homogeneous conditions and the domain of the solution must be converted to \([-1,1]\). Consider

$$\begin{aligned} Lu(t)=u^{(8)}(t)+\sum _{i=0}^{7}a_{i}(t)u^{(i)}(t) &= f(t),\quad t\in [a, b], \end{aligned}$$
(27)

subject to the following boundary conditions

$$\begin{aligned} u^{(j)}(a)& =\theta _{j},\quad u^{(j)}(b)=\phi _{j}, \\ &\quad j=0,1,2,3. \end{aligned}$$
(28)

Using the linear transformation \(t=\frac{b-a}{2}x+\frac{b+a}{2}\), then Eq. (27) takes the form

$$\begin{aligned} Lu(x)=\left( \frac{2}{b-a}\right) ^{8}u^{(8)}(x)+\sum _{i=0}^{7}a_{i}(\chi )\left( \frac{2}{b-a}\right) ^{i}u^{(i)}(x) &= f(\chi ),\quad x\in [-1,1], \end{aligned}$$
(29)

where

$$\begin{aligned} \chi =\frac{b-a}{2}x+\frac{b+a}{2}, \end{aligned}$$

subject to the following boundary conditions

$$\begin{aligned} u^{(j)}(-1)=\left( \frac{2}{b-a}\right) ^{j}\theta _{j}=\Theta _{j},\quad u^{(j)}(1)=\left( \frac{2}{b-a}\right) ^{j}\phi _{j}=\Phi _{j},\quad j=0,1,2,3. \end{aligned}$$
(30)

To transform the nonhomogeneous boundary conditions in Eq. (30) to homogeneous boundary conditions, we replace

$$\begin{aligned} u(x) &= \Psi (x)+\Omega (x), \end{aligned}$$
(31)

where \(\Psi (x)\) is the interpolating polynomial such that \(\Psi ^{(j)}(-1)=\Theta _{j}\) and \(\Psi ^{(j)}(1)=\Phi _{j}\), \(j=0,1,2,3\). Also,

$$\begin{aligned} \Omega (x) &= \sum _{j=0}^{7}\eta _{j} x^{j} \end{aligned}$$

and

$$\begin{aligned} \eta _{0} &= \,\frac{1}{96}\left( 48\Theta _{0}+33\Theta _{1}+9\Theta _{2}+\Theta _{3}+48\Phi _{0}-33\Phi _{1}+9\Phi _{2}-\Phi _{3}\right) ,\\ \eta _{1} &=\, \frac{1}{96}\left( -105\Theta _{0}-57\Theta _{1}-12\Theta _{2}-\Theta _{3}+105\Phi _{0}-57\Phi _{1}+12\Phi _{2}-\Phi _{3}\right) ,\\ \eta _{2} &=\, \frac{1}{32}\left( -15\Theta _{1}-7\Theta _{2}-\Theta _{3}+15\Phi _{1}-7\Phi _{2}+\Phi _{3}\right) ,\\ \eta _{3} &= \, \frac{1}{32}\left( 35\Theta _{0}+35\Theta _{1}+10\Theta _{2}+\Theta _{3}-35\Phi _{0}+35\Phi _{1}-10\Phi _{2}+\Phi _{3}\right) ,\\ \eta _{4} &=\, \frac{1}{32}\left( 5\Theta _{1}+5\Theta _{2}+\Theta _{3}-5\Phi _{1}+5\Phi _{2}-\Phi _{3}\right) ,\\ \eta _{5} &= \, \frac{1}{32}\left( -21\Theta _{0}-21\Theta _{1}-8\Theta _{2}-\Theta _{3}+21\Phi _{0}-21\Phi _{1}+8\Phi _{2}-\Phi _{3}\right) ,\\ \eta _{6} &=\, \frac{1}{96}\left( -3\Theta _{1}-3\Theta _{2}-\Theta _{3}+3\Phi _{1}-3\Phi _{2}+\Phi _{3}\right) ,\\ \eta _{7} &= \,\frac{1}{96}\left( 15\Theta _{0}+15\Theta _{1}+6\Theta _{2}+\Theta _{3}-15\Phi _{0}+15\Phi _{1}-6\Phi _{2}+\Phi _{3}\right) . \end{aligned}$$

The problem takes the form:

$$\begin{aligned} L\Psi (x)=\Psi ^{(8)}(x)+\sum _{i=0}^{7}a_{i}(x)\Psi ^{(i)}(x) &= f^{*}(x),\quad x\in [-1, 1], \end{aligned}$$
(32)

subject to the following boundary conditions

$$\begin{aligned} \Psi ^{(j)}(-1)=0,\quad \Psi ^{(j)}(1)=0,\quad j=0,1,2,3, \end{aligned}$$
(33)

where

$$\begin{aligned} f^{*}(x) &= f(x)-L\Omega (x)\\ &= f(x)-\sum _{i=0}^{7}a_{i}(x) \Omega ^{(i)}(x). \end{aligned}$$

Let

$$\begin{aligned} \Psi (x) &= \sum _{j=0}^{n}\alpha _{j} L_{j}(x) \end{aligned}$$
(34)

be an approximate solution of Eq. (32). Then,

$$\begin{aligned} u(x) &= \sum _{j=0}^{n}\alpha _{j} L_{j}(x)+\Omega (x) \end{aligned}$$
(35)

be the approximate solution of Eq. (31). Using the inverse linear transformation \(x=\frac{2}{b-a}t-\frac{b+a}{b-a}\) in Eq. (35) yields the approximate solution u(t) of Eq. (27).

Numerical examples

Some examples have been constructed to measure the accuracy of the proposed method. Numerical results obtained by the method show the betterment of the method also.

Example 1

Consider the following differential equation:

$$\begin{aligned} u^{(8)}(x) + x u(x) &= -(48+15x+x^{3})e^{x},\quad x\in [0, 1], \end{aligned}$$
(36)

subject to the boundary conditions

$$\begin{aligned}&u(0)=0, \quad u(1)=0,\quad u'(0)=1\quad u'(1)=-e,\quad u''(0)=0,\quad u''(1)=-4e,\quad u'''(0)=-3,\nonumber \\&u'''(1)=-9e. \end{aligned}$$
(37)

The exact solution of the problem is \(u(x)=x(1-x)e^{x}\).

The proposed method is implemented to the problem for \(n=10\). The comparison between the absolute errors of the proposed method and that developed by Viswanadham and Ballem [22] is shown in Table 1 and Fig. 1, respectively.

Table 1 Numerical results for Example 1
Fig. 1
figure 1

Absolute errors for Example 1

Example 2

Consider the following differential equation:

$$\begin{aligned}&u^{(8)}(x)+u^{(7)}(x)+2u^{(6)}(x)+2u^{(5)}(x)+2u^{(4)}(x)+2xu^{(3)}(x) \\ &\quad +2u^{(2)}(x)+x^{2}u^{(1)}(x) \nonumber \\&\quad +x u(x)=-(x^{4}-2x^{3}+14x-27)\cos x \\ &\quad -(3x^{3}-13x^{2}+11x+17)\sin x,\quad x\in [0, 1], \end{aligned}$$
(38)

subject to the boundary conditions

$$\begin{aligned}&u(0)=0,\quad u(1)=0,\quad u'(0)=-1,\quad u'(1)=2\sin 1, \\ & u''(0)=0,\quad u''(1)=4\cos 1+2\sin 1,\nonumber \\&u'''(0)=7,\quad u'''(1)=6\cos 1-6\sin 1. \end{aligned}$$
(39)

The exact solution of the problem is \(u(x)=(x^{2}-1)\sin x\).

The proposed method is implemented to the problem for \(n=10\). The comparison between the absolute errors of the proposed method and that developed by Ballem and Viswanadham [26] is shown in Table 2 and Fig. 2, respectively.

Table 2 Comparison of numerical results for Example 2
Fig. 2
figure 2

The absolute errors for Example 2

Example 3

Consider the following differential equation:

$$\begin{aligned}&u^{(8)}(x)+u^{(7)}(x)+2u^{(6)}(x)+2u^{(5)}(x)+2u^{(4)}(x)+2u^{(3)}(x)\\&\quad +2u^{(2)}(x)+u^{(1)}(x) \nonumber \\&\quad +u(x)=14\cos x-16\sin x-4x\sin x, \\ &\quad x\in [0,1], \end{aligned}$$
(40)

subject to the boundary conditions

$$\begin{aligned}&u(0)=0,\quad u(1)=0,\quad u'(0)=-1,\quad u'(1)=2sin1,\quad u''(0)=0,\quad u''(1)=4\cos 1+2\sin 1,\nonumber \\&u'''(0)=7,\quad u'''(1)=6\cos 1-6\sin 1. \end{aligned}$$
(41)

The exact solution of the problem is \(u(x)=(x^{2}-1)\sin x\).

The proposed method is implemented to the problem for \(n=10\). The comparison between the absolute errors of the proposed method and that developed by Viswanadham and Ballem [22] is shown in Table 3 and Fig. 3, respectively.

Table 3 Comparison of numerical results for Example 3
Fig. 3
figure 3

Absolute errors for Example 3

Conclusion

In this paper, Galerkin method using Legendre polynomials as basis function has been developed to approximate the linear eighth-order boundary value problems. In this method, the nonhomogeneous boundary conditions are transformed to the homogeneous boundary conditions and the solution domain is converted to the interval \([-1,1]\). By comparing the results of the proposed method with other existing methods, it is found that the results are improved and become remarkable. Consequently, the solution may converge efficiently to the analytical one by increasing the order of the problem.