# Approximate Solutions of Differential Equations by Using the Bernstein Polynomials

Authors: Y. Ordokhani; S. Davaei far
Journal: ISRN Applied Mathematics
 (2011)

---

## Abstract

A numerical method for solving differential equations by approximating the solution in the Bernstein polynomial basis is proposed. At first, we demonstrate the relation between the Bernstein and Legendre polynomials. By using this relation, we derive the operational matrices of integration and product of the Bernstein polynomials. Then, we employ them for solving differential equations. The method converts the differential equation to a system of linear algebraic equations. Finally
some examples and their numerical solutions are given; comparing the results with the numerical results
obtained from the other methods, we show the high accuracy and efficiency of the proposed method.


---

## Body

## 1. Introduction

In recent years, the Bernstein polynomials (B-polynomials) have attracted the attention of many researchers. These polynomials have been utilized for solving different equations by using various approximate methods.  For instance, B-polynomials have been used for solving Fredholm integral equations [1, 2], Volterra integral equations [3], differential equations [4–7], and integro-differential equations [8].  Singh et al. [6] and Yousefi and Behroozifar [7] have proposed an operational matrix in different ways for solving differential equations. In [6], the B-polynomials have been first orthonormalized by using Gram-schmidt orthonormalization process, and then the operational matrix of integration has been obtained. By the expansion of B-polynomials in terms of Taylor basis, Yousefi and Behroozifar have found the operational matrices of integration and product of B-polynomials. In this paper, firstly, we present operational matrices of integration Pb and product Ĉ for the B-polynomials, by the expansion of B-polynomials in terms of Legendre polynomials. Then, we use them for solving differential equation(1.1)∑j=0sρj(x)y(j)(x)=g(x),0≤x≤1,with the initial conditions(1.2)y(k)(0)=bk,0≤k≤s-1,whereg(x) and ρj(x), j=0,…,s are given functions and y(x) is the unknown function to be determined. The main characteristic of this technique is that it reduces these equations to those of an easily soluble algebraic equation, thus greatly simplifying the equations. Special attention has been given to the applications of Legendre wavelets method [9–11], Homotopy perturbation method (HPM) [12], modified decomposition method (MDM) [13], Taylor matrix method [14], and Chebyshev wavelets method [15]. The organization of this paper is as follows: in Section 2, we introduce the B-polynomials and their properties. Section 3 is devoted to the function approximation by using B-polynomials basis. Section 4 introduces the expansion of B-polynomial in terms of Legendre basis, and vice versa. The operational matrices of integration and product will be derived in Section 5. Section 6 is devoted to the solution method of differential equations. In section 7, we present some numerical examples. Numerical solution of each equation based on the exact and approximate solutions are compared. And Section 8 offers our conclusion.


## 2. B-Polynomials and Their Properties

The B-polynomials ofmth degree are defined on the interval [0,1] as [4](2.1)Bi,m(x)=(mi)xi(1-x)m-i,0≤i≤m,where(2.2)(mi)=m!i!(m-i)!.There arem+1,mth degree B-polynomials. For mathematical convenience, we usually set Bi,m(x)=0, if i<0 or i>m.  These polynomials are quite easy to write down: the coefficients can be obtained from Pascal’s triangle. It can easily be shown that each of the B-polynomials is positive and also the sum of all the B-polynomials is unity for all real x∈[0,1], that is,(2.3)∑i=0mBi,m(x)=1,x∈[0,1].See [16] for complete details.


## 3. Function Approximation

B-polynomials defined above form a complete basis [1] over the interval [0,1]. It is easy to show that any given polynomial of degree m can be expressed in terms of linear combination of the basis functions. A function f(x) defined over [0,1] may be expanded as(3.1)f(x)≃Pm(x)=∑i=0mciBi,m(x),m≥1.Equation (3.1) can be written as(3.2)Pm(x)=CTϕ(x),whereC and ϕ(x) are (m+1)×1 vectors given by(3.3)C=[c0,c1,…,cm]T,(3.4)ϕ(x)=[B0,m(x),B1,m(x),…,Bm,m(x)]T.The use of an orthogonal basis on[0,1] allows us to directly obtain the least-squares coefficients of Pm(x) in that basis, and also ensures permanence of these coefficients with respect to the degree m of the approximant, that is, all the coefficients of Pm+1 agree with those of Pm(x), except for that of the newly introduced term. The B-polynomials are not orthogonal. But, these can be expressed in terms of some orthogonal polynomials, such as the Legendre polynomials. The Legendre polynomials constitute an orthogonal basis that is well suited [17, 18] to least-squares approximation.


## 4. Expansion of B-Polynomials in Terms of Legendre Basis and Vice Versa

To use the Legendre polynomials for our purposes, it is preferable to map this to[0,1]. A set of shifted Legendre polynomials, denoted by {Lk(x)} for k=0,1,…, is orthogonal with respect to the weighting function w(x)=1 over the interval [0,1]. These polynomials satisfy the recurrence relation [19](4.1)(k+1)Lk+1(x)=(2k+1)(2x-1)Lk(x)-kLk-1(x),k=1,2,…,with(4.2)L0(x)=1,L1(x)=2x-1.The orthogonality of these polynomials is expressed by the relation(4.3)∫01Lj(x)Lk(x)dx={12k+1,j=k,0,j≠k,j,k=0,1,2,….When the approximant (3.1) is expressed in the Legendre form(4.4)Pm(x)=∑j=0mljLj(x),by using (4.3), we can obtain the Legendre coefficients as(4.5)lj=(2j+1)∫01Lj(x)f(x)dx,j=0,…,m.Lemma 4.1.
The Legendre polynomialLk(x) can be expressed in the kth degree Bernstein basis B0,k(x),B1,k(x),…,Bk,k(x) as [20]
(4.6)Lk(x)=∑i=0k(-1)k+i(ki)Bi,k(x).Now consider a polynomialPm(x) of degree m,  expressed in the mth degree Bernstein and Legendre bases on x∈[0,1](4.7)Pm(x)=∑j=0mcjBj,m(x)=∑k=0mlkLk(x).We write the transformation of the Legendre polynomials on[0,1] into the mth degree Bernstein basis functions as [21](4.8)Bk,m(x)=∑i=0mwk,iLi(x),k=0,…,m.The elementswk,i, k,i=0,1,…,m, form an (m+1)×(m+1) basis conversion matrix W. To compute them, we multiply (4.8) by Lj(x), integrate over x∈[0,1], and use (4.3) to obtain(4.9)wk,j=(2j+1)∫01Bk,m(x)Lj(x)dx.We now replace (4.6) into (4.9) and obtain(4.10)wk,j=(2j+1)∑i=0j(-1)j+i(ji)∫01Bk,m(x)Bi,j(x)dx.The integrals of the products of Bernstein basis functions can be found using(4.11)∫01(1-x)rxidx=1(r+i+1)(r+ii),i,r∈N∪{0},as follows:(4.12)∫01Bk,m(x)Bi,j(x)dx=(mk)(ji)∫01xk+i(1-x)m+j-k-idx=(mk)(ji)(m+j+1)(m+jk+i).Therefore, we have the elements ofW as(4.13)wk,j=(2j+1)m+j+1(mk)∑i=0j(-1)j+i(ji)(ji)(m+jk+i),k,j=0,…,m.Now, we write the transformation of the B-polynomials on[0,1] into mth degree Legendre basis functions as [21](4.14)Lk(x)=∑j=0mΛk,jBj,m(x),k=0,…,m.The elementsΛk,j form an (m+1)×(m+1) basis conversion matrix Λ. Replacing (4.14) into (4.7) and rearranging the order of summation, we obtain(4.15)cj=∑k=0mlkΛk,j,j=0,…,m.Since we can express eachkth degree Bernstein basis function in the mth degree Bernstein basis as [21](4.16)Bi,k(x)=∑j=im-k+i(ki)(m-kj-i)(mj)Bj,m(x),i=0,…,k,replacing (4.16) into (4.6) and rearranging the order of summation, we find that the basis transformation (4.14) is defined by the elements(4.17)Λk,j=1(mj)∑i=rmin⁡{j,k}(-1)k+i(ki)(ki)(m-kj-i),r=max{0,j+k-m},of the matrixΛ for k,j=0,…,m. If we denote the Legendre basis vector as(4.18)L(x)=[L0(x),L1(x),…,Lm(x)]T,using (3.4), (4.8), (4.14), and (4.18), we have(4.19)ϕ(x)=WL(x),(4.20)L(x)=Λϕ(x).


## 5. Operational Matrices of Integration and Product of B-Polynomials

### 5.1. B-Polynomials Operational Matrix of Integration

LetPb be an (m+1)×(m+1) operational matrix of integration, then(5.1)∫0xϕ(t)dt⋍Pbϕ(x),0≤x≤1.By using (4.19), we have(5.2)∫0xϕ(t)dt=W∫0xŁ(t)dt=WPL(x),where the(m+1)×(m+1) matrix P is the operational matrix of integration of the shifted Legendre polynomials on the interval [0,1] and can be obtained as [22](5.3)P=12[1100⋯000-130130⋯0000-15015⋯000⋮⋮⋮⋮⋱⋮⋮⋮0000⋯-12m-1012m-10000⋯0-12m+10],and, therefore, by using (4.20)–(5.2), we have the operational matrix of integration as(5.4)Pb=WPΛ.


### 5.2. B-Polynomials Operational Matrix of Product

In this subsection, we present a general formula for finding the operational matrix of product ofmth degree B-polynomials. Suppose that C is an arbitrary (m+1)×1 vector, then Ĉ is an (m+1)×(m+1) operational matrix of product whenever(5.5)CTϕ(x)ϕT(x)⋍ϕT(x)Ĉ.Using (4.19) and since CTϕ(x)=∑i=0mciBi,m, we have(5.6)CTϕ(x)ϕT(x)=(CTϕ(x))(LT(x)WT)=[L0(x)(CTϕ(x)),L1(x)(CTϕ(x)),…,Lm(x)(CTϕ(x))]WT=[∑i=0mci(L0(x)Bi,m(x)),∑i=0mci(L1(x)Bi,m(x)),…,∑i=0mci(Lm(x)Bi,m(x))]WT.Now, we approximate all functionsLk(x)Bi,m(x) in terms of {Bi,m(x)}i=0m for i,k=0,1,…,m. Let(5.7)ηk,i=[η0k,iη1k,i⋮ηmk,i],by (3.2), we have(5.8)Lk(x)Bi,m(x)≃ηk,iTϕ(x),i,k=0,1,…,m.Using (4.15), we can obtain the elements of vector ηk,i, for i,k=0,1,…,m. Therefore,(5.9)∑i=0mci(Lk(x)Bi,m(x))≃∑i=0mci(∑j=0mηjk,iBj,m(x))=∑j=0mBj,m(x)(∑i=0mciηjk,i)=ϕT(x)[∑i=0mciη0k,i∑i=0mciη1k,i⋮∑i=0mciηmk,i]=ϕT(x)[ηk,0,ηk,1,…,ηk,m]C=ϕT(x)C̃k,where(5.10)C̃k=[ηk,0,ηk,1,…,ηk,m]C,k=0,1,…,m.If we define a(m+1)×(m+1) matrix C̃=[C̃0,C̃1,…,C̃m], then by using (5.6) and (5.9), we have(5.11)CTϕ(x)ϕT(x)≃ϕT(x)[C̃0,C̃1,…,C̃m]WT=ϕT(x)C̃WT,and, therefore, we have the operational matrix of product as(5.12)Ĉ=C̃WT.


## 5.1. B-Polynomials Operational Matrix of Integration

LetPb be an (m+1)×(m+1) operational matrix of integration, then(5.1)∫0xϕ(t)dt⋍Pbϕ(x),0≤x≤1.By using (4.19), we have(5.2)∫0xϕ(t)dt=W∫0xŁ(t)dt=WPL(x),where the(m+1)×(m+1) matrix P is the operational matrix of integration of the shifted Legendre polynomials on the interval [0,1] and can be obtained as [22](5.3)P=12[1100⋯000-130130⋯0000-15015⋯000⋮⋮⋮⋮⋱⋮⋮⋮0000⋯-12m-1012m-10000⋯0-12m+10],and, therefore, by using (4.20)–(5.2), we have the operational matrix of integration as(5.4)Pb=WPΛ.


## 5.2. B-Polynomials Operational Matrix of Product

In this subsection, we present a general formula for finding the operational matrix of product ofmth degree B-polynomials. Suppose that C is an arbitrary (m+1)×1 vector, then Ĉ is an (m+1)×(m+1) operational matrix of product whenever(5.5)CTϕ(x)ϕT(x)⋍ϕT(x)Ĉ.Using (4.19) and since CTϕ(x)=∑i=0mciBi,m, we have(5.6)CTϕ(x)ϕT(x)=(CTϕ(x))(LT(x)WT)=[L0(x)(CTϕ(x)),L1(x)(CTϕ(x)),…,Lm(x)(CTϕ(x))]WT=[∑i=0mci(L0(x)Bi,m(x)),∑i=0mci(L1(x)Bi,m(x)),…,∑i=0mci(Lm(x)Bi,m(x))]WT.Now, we approximate all functionsLk(x)Bi,m(x) in terms of {Bi,m(x)}i=0m for i,k=0,1,…,m. Let(5.7)ηk,i=[η0k,iη1k,i⋮ηmk,i],by (3.2), we have(5.8)Lk(x)Bi,m(x)≃ηk,iTϕ(x),i,k=0,1,…,m.Using (4.15), we can obtain the elements of vector ηk,i, for i,k=0,1,…,m. Therefore,(5.9)∑i=0mci(Lk(x)Bi,m(x))≃∑i=0mci(∑j=0mηjk,iBj,m(x))=∑j=0mBj,m(x)(∑i=0mciηjk,i)=ϕT(x)[∑i=0mciη0k,i∑i=0mciη1k,i⋮∑i=0mciηmk,i]=ϕT(x)[ηk,0,ηk,1,…,ηk,m]C=ϕT(x)C̃k,where(5.10)C̃k=[ηk,0,ηk,1,…,ηk,m]C,k=0,1,…,m.If we define a(m+1)×(m+1) matrix C̃=[C̃0,C̃1,…,C̃m], then by using (5.6) and (5.9), we have(5.11)CTϕ(x)ϕT(x)≃ϕT(x)[C̃0,C̃1,…,C̃m]WT=ϕT(x)C̃WT,and, therefore, we have the operational matrix of product as(5.12)Ĉ=C̃WT.


## 6. Solution of the Linear Differential Equation

Consider the linear differential equation (1.1) with the initial conditions (1.2). If we approximate g(x), ρj(x), j=0,…,s and y(s)(x) as follows:(6.1)g(x)=GTϕ(x),ρj(x)=PjTϕ(x),j=0,…,s,(6.2)y(s)(x)=CTϕ(x),whereG, Pj, j=0,…,s, and C are the coefficients which are defined similarly to (3.3). With s-times integrating from (6.2) with respect to x between x=0 to x=x, using (5.1) and the initial conditions (1.2), we will have(6.3)y(s-1)(x)=bs-1+CTPbϕ(x),y(s-2)(x)=bs-2+bs-1x+CTPb2ϕ(x),⋮y′(x)=b1+b2x+b32!x2+⋯+bs-1(s-2)!x(s-2)+CTPbs-1ϕ(x),y(x)=b0+b1x+b22!x2+⋯+bs-1(s-1)!x(s-1)+CTPbsϕ(x).Let(6.4)xi=diTϕ(x),i=1,2,…,s-1,bs-i=bs-iETϕ(x),i=1,2,…,s,where(6.5)1=ETϕ(x).Substituting (6.4) into (6.3), we have(6.6)y(s)(x)=CTϕ(x)=QsTϕ(x),y(s-1)(x)=(bs-1ET+CTPb)ϕ(x)=Qs-1Tϕ(x),y(s-2)(x)=(bs-2ET+bs-1d1T+CTPb2)ϕ(x)=Qs-2Tϕ(x),⋮y′(x)=(b1ET+b2d1T+b32!d2T+⋯+bs-1(s-2)!ds-2T+CTPbs-1)ϕ(x)=Q1Tϕ(x),(6.7)y(x)=(b0ET+b1d1T+b22!d2T+⋯+bs-1(s-1)!ds-1T+CTPbs)ϕ(x)=Q0Tϕ(x).Replacing (6.6) and (6.7) into (1.1), we obtain(6.8)∑j=0sPjTϕ(x)ϕT(x)Qj=GTϕ(x).Using (5.5), we have(6.9)∑j=0sϕT(x)P̂jQj=ϕT(x)G.Therefore, we get(6.10)∑j=0sP̂jQj=G.The unknown vectorC can be obtained by solving (6.10). Once C is known, y(x) can be calculated from (6.7).


## 7. Illustrative Examples

Example 7.1.
Consider the eighth-order linear differential equation given in [14] by
(7.1)y(viii)(x)-y(x)=-8ex,0≤x≤1,with the initial conditions
(7.2)y(0)=1,y′(0)=0,y′′(0)=-1,y′′′(0)=-2,y(iv)(0)=-3,y(v)(0)=-4,y(vi)(0)=-5,y(vii)(0)=-6.The exact solution for this example is y(x)=(1-x)ex. Using the method described in Section 6, we assume that y(viii)(x) is approximated by
(7.3)y(viii)(x)=CTϕ(x).
By using (5.1) and the initial conditions (7.2), we have
(7.4)y(x)=Q0ϕ(x),
where
(7.5)Q0=ET-12!d2T-23!d3T-34!d4T-45!d5T-56!d6T-67!d7T+CTPb8=AT+CTPb8.
We can express function -8ex as
(7.6)-8ex=GTϕ(x).
Substituting (7.3)–(7.6) into (7.1), we obtain
(7.7)CTϕ(x)-(AT+DTPb8)ϕ(x)=GTϕ(x).
Therefore, we get
(7.8)C=(I-(Pb8)T)-1(A+G),
where I is the (m+1)×(m+1) identity matrix and Equation (7.8) is a set of algebraic equations which can be solved for C. Now, we apply the method presented in this paper with m=8 to solve (7.1) with the initial conditions (7.2).  In Table 1, the numerical results obtained by the present method are compared with the results of the HPM [12] and MDM [13] and method in [14]. As we see from this table, it is clear that the result obtained by the present method is very superior to that by HPM, MDM methods, and method in [14]. The absolute difference between exact and approximate solutions is plotted in Figure 1. It is observed in this figure that the accuracy is of the order of 10-10.Table 1
Numerical results for Example7.1.
xExact solutionMethod of [12]Method of [13]Method of [14]Presented methodforN=8forN=8forN=8form=8011110.99999999920.10.99465382630.99465382630.99465382620.99465382660.99465382610.20.97712220650.97712220650.97712220140.97712220930.97712220650.30.94490116530.94490116530.94490107690.94490117520.94490116550.40.89509481860.89509481860.89509415220.89509484870.89509481840.50.82436063540.82436063560.82435743860.82436073280.82436063530.60.72884752020.7288475220.72883599690.72884786040.72884752040.70.60412581220.60412582110.60409171110.60412696620.60412581210.80.44510818570.44510822010.44502083870.44511176690.44510818570.90.24596031110.24596042490.24575994820.24597036180.2459603113103.326×10-7-4.213×10-42.57×10-58×10-10Figure 1
Absolute difference between exact and approximate solutions of Example7.1.Example 7.2.
Consider the Lane-Emden equation given in [10] by
(7.9)y′′(x)+2xy′(x)=2(2x2+3)y(x),0≤x≤1,
with the initial conditions
(7.10)y(0)=1,y′(0)=0.
The exact solution of this example is ex2. We solve (7.9) with the initial conditions (7.10) by using the method in Section 6 with m=11. The comparison among the present method, Legendre wavelets solution [10], and analytic solution for m=11 is shown in Table 2. As we see from this Table, it is clear that the result obtained by the present method is very superior to that by Legendre wavelets method. It is noted that the mean square error for this example, obtained in Legendre wavelets method, is 2.07×10-5; but in the present method, the mean square error is 2.3174×10-18. We display a plot of the approximate and exact solution of this example for m=11 in Figure 2.Table 2
Numerical results for Example7.2.
xExact solutionMethod  of [10]Presented methodform=11form=110.011.000100010.99581.000100010.31.094174281.09421.094174280.51.284025421.28431.284025420.751.755054661.75511.755054660.92.247907992.24802.247907990.952.465759812.46582.4657598112.718281832.71842.71828183Figure 2
Approximate and exact solution of Example7.2 for m=11.Example 7.3.
Consider the Bessel differential equation of order zero given in [15] by
(7.11)xy′′+y′+xy=0,
with the initial conditions
(7.12)y(0)=1,y′(0)=0.
The exact solution of this example is
(7.13)J0(x)=∑q=0∞(-1)q(q!)2(x2)2q.
Now, we solve (7.11) with the initial conditions (7.12) by using the method in Section 6 with m=5. Table 3 shows the absolute difference between exact and approximate solutions of the present method and the methods in [11, 15] for equality basis functions. The results of [11] have been given in [15]. As we see from this table, the maximum error for this example, for the methods in [11, 15], is 10-4; but in the present method, the maximum error is 10-7. We display a plot of the approximate and exact solution of this example for m=5 in Figure 3.Table 3
Numerical results for Example7.3.
xMethod of [11]Method of [15]Presented methodforM=3, k=2forM=3, k=2form=50.09.36E-056.01E-054.1506E-070.12.78E-056.15E-051.6138E-070.23.60E-055.99E-057.5736E-080.31.83E-059.00E-061.2007E-070.44.12E-055.24E-053.8093E-080.52.695E-041.695E-041.3032E-070.69.22E-051.602E-042.8912E-080.78.26E-051.140E-041.2445E-070.86.88E-057.84E-056.8492E-080.91.026E-041.577E-041.6395E-071.02.689E-041.636E-044.1524E-07Figure 3
Approximate and exact solution of Example7.3 for m=5.


## 8. Conclusion

In this article, at first, we demonstrate the relation between the Bernstein and Legendre polynomials. By using this relation, we derived the operational matrix of integration and product of B-polynomials. They are applied to solve ordinary differential equations. The present method reduces an ordinary differential equations into a set of algebraic equations. We applied the presented method on three test problems and compared the results with their exact solutions and the other methods, revealing that the present method is very effective and convenient.



---

*Source: 787694-2011-06-20.xml*