Chapter3-Least Squares Approximation-3
Chapter3-Least Squares Approximation-3
Chapter3-Least Squares Approximation-3
Numerical analysis 1
R. Z
𝜑1
ℎ1 =
∥ 𝜑1 ∥
𝑘−1
𝑢𝑘
ℎ𝑘 = , 𝑘 = 2, 3, … , 𝑛 𝑜ù 𝑢𝑘 = 𝜑𝑘 − ∑ < 𝜑𝑘 , ℎ𝑖 > ℎ𝑖 .
{ ∥ 𝑢𝑘 ∥
𝑖=1
𝑏
2 2
∀ 𝑓 ∈ 𝐸 ∶ ∥ 𝑓 ∥ = ∫ 𝜔(𝑥)𝑓 (𝑥)𝑑𝑥
𝑎
Where 𝜔(𝑥) ≥ 0, ∀𝑥 ∈ [𝑎, 𝑏], the function 𝜔 is called “Weight function”. In practice,
we take 𝜔 ≡ 1.
𝑏 𝑛
Remark 3.3
𝑏 𝑛 2
9
Department of Mathematics, Faculty of Science, Ferhat Abbas-Sétif University 1
Numerical analysis 1
R. Z
= min Ψ(𝑎1 , 𝑎2 , … , 𝑎𝑛 )
𝑎𝑖
Let 𝑃𝑛∗ (𝑥) = ∑𝑛𝑖=0 𝑎𝑖∗ 𝑥 𝑖 , 𝑥 ∈ [𝑎, 𝑏]. If we take 𝜔 ≡ 1 into the relationship (𝟏) then,
𝑏 𝑏 𝑏 𝑏 𝑏
∫𝑎 1𝑑𝑥 ∫𝑎 𝑥𝑑𝑥 ∫𝑎 𝑥 2 𝑑𝑥 ∫𝑎 𝑥 𝑛 𝑑𝑥 𝑎0∗ ∫𝑎 𝑓(𝑥)𝑑𝑥
𝑏 𝑏 𝑏 𝑏 𝑏
∫𝑎 𝑥𝑑𝑥 ∫𝑎 𝑥 2 𝑑𝑥 ∫𝑎 𝑥 3 𝑑𝑥 ⋯ ∫𝑎 𝑥 𝑛+1 𝑑𝑥 𝑎∗
( 1) = ∫𝑎 𝑥𝑓(𝑥)𝑑𝑥
⋮ ⋮ ⋮ ⋮ ⋮ ⋮
𝑏 𝑛 𝑏 𝑛+1 𝑏 𝑛+2 𝑏 2𝑛 𝑎𝑛∗ 𝑏 𝑛
∫
(𝑎 𝑥 𝑑𝑥 ∫𝑎
𝑥 𝑑𝑥 ∫𝑎
𝑥 𝑑𝑥 ∫𝑎
𝑥 𝑑𝑥 ) (∫𝑎 𝑥 𝑓(𝑥)𝑑𝑥)
Example 3.1
Determine the best polynomial approximation of degree 1 in the least squares sense of
10
Department of Mathematics, Faculty of Science, Ferhat Abbas-Sétif University 1
Numerical analysis 1
R. Z
Method 1:
Let us take 𝑃1 (𝑥) = 𝑎𝑥 + 𝑏, we have {𝜑1 = 1, 𝜑2 = 𝑥} the canonical basis of the space
of polynomials of degree1.
< √𝑥 − 𝑎𝑥 − 𝑏, 1 > = 0
⟺{ (∎)
< √𝑥 − 𝑎𝑥 − 𝑏, 𝑥 > = 0
1
∫(√𝑥 − 𝑎𝑥 − 𝑏)(1)𝑑𝑥 = 0
0
⟺ 1
∫(√𝑥 − 𝑎𝑥 − 𝑏)(𝑥)𝑑𝑥 = 0
{0
2 𝑥2
[ 𝑥√𝑥 − 𝑎 − 𝑏𝑥]10 = 0
⟺ 3 2
2 2 𝑥3 𝑥2 1
{[5 𝑥 √𝑥 − 𝑎 3 − 𝑏 2 ]0 = 0
2 𝑎
− −𝑏 =0
⟺{ 3 2
2 𝑎 𝑏
− − =0
5 3 2
3𝑎 + 6𝑏 = 4
⟺{
10𝑎 + 15𝑏 = 12
4
𝑎=
⟺{ 5
4
𝑏=
15
So the best polynomial approximation of degree 1 of 𝑓 in the least squares sense of
4 4
the function 𝑓 defined by 𝑓(𝑥) = √𝑥 in [0,1] is 𝑃1 (𝑥) = 𝑥 + .
5 15
Method 2
1
Let’s pose Ψ(𝑎, 𝑏) =∥ 𝑓 − 𝑃1 ∥2 =∥ √𝑥 − 𝑎𝑥 − 𝑏 ∥2 = ∫0 (√𝑥 − 𝑎𝑥 − 𝑏)2 𝑑𝑥
=< √𝑥 − 𝑎𝑥 − 𝑏, √𝑥 − 𝑎𝑥 − 𝑏 >
11
Department of Mathematics, Faculty of Science, Ferhat Abbas-Sétif University 1
Numerical analysis 1
R. Z
We have
𝜕Ψ
(𝑎, 𝑏) = 0 ⟺ −2 < √𝑥 − 𝑎𝑥 + 𝑏, 𝑥 > = 0
𝜕𝑎
and
𝜕Ψ
(𝑎, 𝑏) = 0 ⟺ −2 < √𝑥 − 𝑎𝑥 + 𝑏, 1 > = 0
𝜕𝑏
𝜕Ψ 𝜕Ψ
i.e., (𝑎, 𝑏) = 0 and (𝑎, 𝑏) = 0 ⟺(∎)
𝜕𝑎 𝜕𝑏
Note: In an interval of the form [−𝒂, 𝒂] (symmetric to the origin), if 𝒇 is an even (odd)
function then the polynomial approximation of 𝒇 is even (odd).
Let 𝐸 be a Pre-Hilbert space of functions defined in [𝑎, 𝑏] and let 𝐹𝑛+1 be a vector
subspace of 𝐸 such that dim 𝐹𝑛+1 = 𝑛 + 1 and {𝜑0 , 𝜑1 , … , 𝜑𝑛 } is a basis of 𝐹𝑛+1 .
Then the element 𝜑 ∗ = ∑𝑛𝑖=0 𝑎𝑖∗ 𝜑𝑖 is the best approximation in 𝐹𝑛+1 of 𝑓 if and
only if < 𝑓 − 𝜑 ∗ , 𝜑ℓ > = 0, ∀ ℓ = 0, 1, … , 𝑛.
Find the element 𝜑 ∗ ∈ 𝐹𝑛+1 which is the best approximation of the vector
𝑢 ∈ ℝ𝑚+1 .
We define the inner (scalar) product and the Euclidean norm in 𝐸 as follows:
𝑚
∀ 𝑓, 𝑔 ∈ 𝐸 ∶ < 𝑓, 𝑔 > = ∑ 𝜔(𝑥𝑖 )𝑓(𝑥𝑖 )𝑔(𝑥𝑖 )
𝑖=0
𝑚
12
Department of Mathematics, Faculty of Science, Ferhat Abbas-Sétif University 1
Numerical analysis 1
R. Z
𝑛 𝑚 𝑛
<𝑓− ∑ 𝑎𝑖∗ 𝜑𝑖 , 𝜑ℓ > = ∑ 𝜔(𝑥𝑘 ) [𝑓(𝑥𝑘 ) − ∑ 𝑎𝑖∗ 𝜑𝑖 (𝑥𝑘 )] 𝜑ℓ (𝑥𝑘 ) = 0, ∀ ℓ = 0,1, … , 𝑛. (𝟐)
𝑖=1 𝑘=0 𝑖=0
Remark 3.4
The condition (𝟐) can be found using the following equivalent condition
𝜕Ψ
(𝑎 , 𝑎 , … , 𝑎𝑛 ) = 0, ∀ 𝑖 = 0, 1, … , 𝑛
𝜕𝑎𝑖 0 1
Such as Ψ(𝑎0 , 𝑎1 , … , 𝑎𝑛 ) =∥ 𝑓 − 𝜑 ∥2 , 𝜑 ∈ 𝐹𝑛+1
𝑚 𝑛 2
𝑛 𝑛 2
= min Ψ(𝑎0 , 𝑎1 , … , 𝑎𝑛 )
𝑎𝑖
13
Department of Mathematics, Faculty of Science, Ferhat Abbas-Sétif University 1
Numerical analysis 1
R. Z
∑𝑚
𝑘=0 1
∑𝑚
𝑘=0 𝑥𝑘 ∑𝑚𝑘=0 𝑥𝑘
2 ∑𝑚𝑘=0 𝑥𝑘
𝑛
𝑎0∗ ∑𝑚𝑘=0 𝑓(𝑥𝑘 )
𝑚
∑𝑘=0 𝑥𝑘 ∑𝑘=0 𝑥𝑘2
𝑚 𝑚 3 𝑚
∑𝑘=0 𝑥𝑘 ⋯ ∑𝑘=0 𝑥𝑘𝑛+1
𝑎 ∗ ∑ 𝑚
𝑥 𝑓(𝑥𝑘 )
( 1 ) = ( 𝑘=0 𝑘 )
⋮ ⋮ ⋮ ⋮ ⋮ ⋮
𝑚 𝑛
(∑𝑘=0 𝑥𝑘 ∑𝑘=0 𝑥𝑘𝑛+1
𝑚
∑𝑚
𝑘=0 𝑥𝑘
𝑛+2 ∑𝑚 2𝑛
𝑘=0 𝑥𝑘 )
𝑎𝑛∗ ∑𝑚 𝑛
𝑘=0 𝑥𝑘 𝑓(𝑥𝑘 )
This system admits also a unique solution: (𝑎0∗ , 𝑎1∗ , … , 𝑎𝑛∗ )𝑇 ∈ ℝ𝑛+1 .
Example 3.2
Determine the best least squares polynomial approximation of degree 1 of the function
𝑓 defined by:
𝑘 0 1 2
𝑥𝑘 −1 0 2
𝑓(𝑥𝑘 ) 1 2 4
Method 1:
We have 𝑃1 is the Best approximation of 𝑓 ⟺ < 𝑓 − 𝑃1 , 𝜑𝑙 > = 0, ∀ 𝑙 = 0, 1.
< 𝑓(𝑥) − 𝑃1 (𝑥), 1 > = 0
⟺{
< 𝑓(𝑥) − 𝑃1 (𝑥), 𝑥 > = 0
2
𝑎 + 3𝑏 = 7
⟺{
3𝑎 + 𝑏 = 7
7
⟺𝑎 =𝑏=
4
14
Department of Mathematics, Faculty of Science, Ferhat Abbas-Sétif University 1
Numerical analysis 1
R. Z
7 7
Then 𝑃1 (𝑥) = 𝑥 + is the best least squares approximation of degree 1 of the
4 4
function 𝑓.
15