(Bubnov)-Galerkin Method for Problem 2
The Bubnov-Galerkin method is the most widely used weighted average method. This method is the basis of most finite element methods.
The finite-dimensional Galerkin form of the problem statement of our second order ODE is :

Since the basis functions (
) are known and linearly independent, the approximate solution
is completely determined once the constants (
) are known.
The Galerkin method provides a great way of constructing solutions. But the question is: how do we choose
so that these functions are not only linearly independent but arbitrary? Since the solution is expressed as a sum of these functions, the accuracy of our result depends strongly on the choice of
.
Let the trial solution take the form,

According to the Bubnov-Galerkin approach, the weighting function also takes a similar form

Plug these values into the weak form to get
![{\displaystyle \int _{0}^{1}\left[\left(\sum _{i=1}^{n}a_{i}{\cfrac {dN_{i}}{dx}}\right)\left(\sum _{j=1}^{n}b_{j}{\cfrac {dN_{j}}{dx}}\right)+\left(\sum _{i=1}^{n}a_{i}N_{i}\right)\left(\sum _{j=1}^{n}b_{j}N_{j}\right)-x\left(\sum _{j=1}^{n}b_{j}N_{j}\right)\right]~dx=0}](../45b2cfd0ce79becb728c0381e52c983cf2ff4b1a.svg)
or
![{\displaystyle \int _{0}^{1}\left[\sum _{j=1}^{n}b_{j}\left({\cfrac {dN_{j}}{dx}}\sum _{i=1}^{n}a_{i}{\cfrac {dN_{i}}{dx}}+N_{j}\sum _{i=1}^{n}a_{i}N_{i}-x~N_{j}\right)\right]~dx=0}](../e56a43f8052ccfcccf8a09e6f962ce5d3161938c.svg)
or
![{\displaystyle \int _{0}^{1}\left[\sum _{j=1}^{n}b_{j}\left(\sum _{i=1}^{n}\left(a_{i}{\cfrac {dN_{j}}{dx}}{\cfrac {dN_{i}}{dx}}+a_{i}N_{j}N_{i}\right)-x~N_{j}\right)\right]~dx=0~.}](../785fcfc807948a2115aa1499dc791be17da02a03.svg)
Taking the sums and constants outside the integrals and rearranging, we get
![{\displaystyle \sum _{j=1}^{n}b_{j}\left[\sum _{i=1}^{n}a_{i}\int _{0}^{1}\left({\cfrac {dN_{i}}{dx}}{\cfrac {dN_{j}}{dx}}+N_{i}N_{j}\right)~dx-\int _{0}^{1}x~N_{j}~dx\right]=0~.}](../18717a03b11275700133463305404649b147a646.svg)
Since the
s are arbitrary, the quantity inside the square brackets must be zero. That is

Let us define

Then we get a set of simultaneous linear equations

In matrix form,
