
In this page we will introduce the RayleighRitz Method to
solve boundary value problem of ODE. We will focus on the application of
this method to linear equations of the following form
 
d
dx 
(p(x) 
dy
dx 
) + q(x) y = f(x),
for 0 £ x £
1 

with boundary condition y(0) = y(1) = 0. Here
and
for each x in [0, 1]. Also p(x) Î
C^{1}[0,1], and that q(x), f(x) Î
C[0, 1]. From theory we know this boundary value problem has a unique solution
whihc is a minimizer of the functional:
defined as
I[u] = 
ó
õ 
1
0 
{p(x) [u¢(x)]^{2}+
q(x) [u(x)]^{2}  2f(x)u(x)} dx 

The idea of RayleighRitz approximation is to minimize the
integral over an finite dimensional space that consists of all linear combinations
of the linearly independent base functions
f_{1}(x),
f_{2}(x),
¼,
f_{n}(x) 

with f_{i} (0) = f_{i}
(1) = 0, for each i = 1, 2, ¼, n. Notice
with this condition, the approximate solution u(x) = å_{i
= 1}^{n}c_{i}f_{i}(x)
automatically satisfies the boundary condtions. That is the beautify of
Finite Element method, it facilitates us to treat boundary condition easily
by selecting base functions that satisfy the required boundary condition.
Approximation to the solution of the boundary problem
is then obtained by find constants
c_{1}, c_{2}, c_{3}
, ¼, c_{n} 

to minimize







ó
õ 
1
0 
{p(x)[ 
n
å
i = 1 
c_{i}f_{i}¢(x)]^{2}
+ q(x)[ 
n
å
i = 1 
c_{i}f_{i}(x)]^{2}
2f(x) 
n
å
i = 1 
c_{i}f(x)}dx. 




Notice here f_{1}(x),
f_{2}(x),
¼,
f_{n}(x)
are fixed functions. The only things vary in the above integration are
c_{1}, c_{2}, c_{3} , ¼,
c_{n}. Hence we can consider I as a function of parameters c_{1},
c_{2}, c_{3} , ¼, c_{n}.
Our goal is to find the values of c_{1}, c_{2}, c_{3}
, ¼, c_{n} so that I achieves
its minimum. From Calculus, we know that the necessary condition for I
to have minimum value at c_{1}, c_{2}, c_{3} ,
¼,
c_{n} is that the partial derivatives of I with repect to c_{1},
c_{2}, c_{3},
¼, c_{n}
are zero.
That is

¶I
¶c_{j} 
= 0 for each
j = 1, 2, ·, n 

Now to compute the partial derivative. Let
F(c_{1}, c_{2}, c_{3}
,
¼, c_{n} ) = [ 
n
å
i = 1 
c_{i}q_{i}(x)]^{2} 

with q_{i} fixed. From
chain rule in partial derivative we have,

¶F
¶c_{j} 
= 2q_{j}(x)
[ 
n
å
i = 1 
c_{i}q_{i}(x)]. 

Replacing q(x) with f_{i}¢(x)
and f_{i}(x) in the first and second
terms of I respectively, we can find the partial derivative of I with respect
to c_{j} as Substitute these into the derivative for I we have:

¶I
¶c_{j} 
= 2 
n
å
i = 1 

ó
õ 
1
0 
[{p(x)f_{i}¢(x)f_{j}¢(x)
+ q(x)f_{i}(x)f_{j}(x)}dx]
c_{i} 2 
ó
õ 
1
0 
f(x)f_{j}(x)dx 

This is a linear system of equations for unknown parameters
c_{1}, c_{2}, c_{3}, ¼,
c_{n}, which we can write in a traditional matrix form as Ac =
b. Here A = (a_{ij}) with
a_{ij} = 
ó
õ 
1
0 
[{p(x)f_{i}¢(x)f_{j}¢(x)
+ q(x)f_{i}(x)f_{j}(x)}dx]
for 1 £ i, j £
n. 

And b = (b_{1}, b_{2}, b_{3}, ¼,
b_{n}) with
b_{i} 
ó
õ 
1
0 
f(x)f_{i}(x)dx
for 1 £ i £
n. 

And c = (c_{1}, c_{2}, c_{3}, ¼,
c_{n} ) is the unknown vector.
The simplest choice of the base functions involves piecewise
linear polynomials. The first step is to form a partication of [0, 1] by
choosing points x_{1}, x_{2}, x_{3}, ¼,
x_{n}, x_{n+1} with
0 = x_{1}, x_{2},
x_{3},
¼, x_{n}, x_{n+1}
= 1. 

f_{i}(x)
= 
ì
ï
ï
ï
ï
ï
í
ï
ï
ï
ï
ï
î 
0,
0 £ x £
x_{i1} 

x  x_{i1
}h_{i1} 
, x_{i1}
< x £ x_{i} 


x_{i+1} x
h_{i} 
, x_{i}
< x
£ x_{i+1} 

0,
x_{i+1}£ x £
1 



Notice that f_{i}(x)
has the following properties:
1)
f_{i}(x_{i})
= 1
2)
f_{i}(x)
> 0 for x in x_{i1 }
< x < x_{i+1}
3) f_{i}(x)
= 0 for x out side x_{i1 }
< x < x_{i+1}
4) The graph of f_{i}(x)
is an upside down V.
The derivative of f_{i}(x_{i})
is
f_{i}¢(x)
= 
ì
ï
ï
ï
ï
ï
í
ï
ï
ï
ï
ï
î 
0,
0 £ x £
x_{i1} 

1
h_{i1} 
, x_{i1}
< x £ x_{i} 

 
1
h_{i} 
, x_{i}
< x £ x_{i+1} 

0,
x_{i+1} £ x £
1 



Because f_{i}(x)
and f_{i}'(x)
are not nonzero only on (x_{i 1} , x_{i+1})
, so f_{i}
(x) f_{j}(x)
= 0 and f_{i}'(x)
f_{j}'(x)
= 0 for 0< x £
1 except when j is i  1, i, or i + 1. As a consequence, the
linear system Ac
= b reduces to an n x n tridiagonal linear system. The nonzero
entries in A are

1) For i = 1, 2, . . . , n
a_{ii} = 
ó
õ 
1
0 
{ p(x)[f_{i}¢(x)]^{2}
+ q(x)[f_{i}(x)]^{2} } dx 

= ( 
1
h_{i1} 
)^{2} 
ó
õ 
x_{i}
x_{i1} 
p(x) dx + ( 
1
h_{i} 
)^{2} 
ó
õ 
x_{i+1}
x_{i} 
p(x) dx 

+ ( 
1
h_{i1} 
)^{2} 
ó
õ 
x_{i}
x_{i1} 
(x  x_{i1})^{2} q(x)dx + ( 
1
h_{i} 
)^{2} 
ó
õ 
x_{i+1}
x_{i} 
(x_{i+1}  x)^{2} q(x) dx. 





2) For i = 1, 2, . . . , n1
a_{i,i+1} = 
ó
õ 
1
0 
{p(x)f¢_{i}(x)f¢_{i+1}(x)
+ q(x)f_{i}(x)f_{i+1}(x)
} dx 

= ( 
1
h_{i} 
)^{2} 
ó
õ 
x_{i+1}
x_{i} 
p(x) dx + ( 
1
h_{i} 
)^{2} 
ó
õ 
x_{i+1}
x_{i} 
(x_{i+1}  x)(x  x_{i}) q(x)
dx 





3) For i = 2, 3, . . . , n
a_{i,i1} = 
ó
õ 
1
0 
{p(x)f¢_{i}(x)f¢_{i1}(x)
+ q(x)f_{i}(x)f_{i1}(x)
} dx 

= ( 
1
h_{i1} 
)^{2} 
ó
õ 
x_{i}
x_{i1} 
p(x) dx + ( 
1
h_{i} 
)^{2} 
ó
õ 
x_{i}
x_{i1} 
(x_{i}  x)(x  x_{i1}) q(x)
dx 




The entries in b are:

b_{i} = 
ó
õ 
1
0 
f(x)f_{i}(x)
dx 

= 
1
h_{i1} 

ó
õ 
x_{i}
x_{i1} 
(x  x_{i1})f(x) dx + 
1
h_{i} 

ó
õ 
x_{i+1}
x_{i} 
(x_{i+1}  x)f(x) dx 




