Let
V
=
{
v
∈
H
1
[
0
,
1
]
}
{\displaystyle V=\{v\in H^{1}[0,1]\}\!\,}
Find
u
∈
V
{\displaystyle u\in V\!\,}
such that for all
v
∈
V
{\displaystyle v\in V\!\,}
∫
0
1
−
u
″
v
+
α
∫
0
1
u
v
=
∫
0
1
f
v
{\displaystyle \int _{0}^{1}-u''v+\alpha \int _{0}^{1}uv=\int _{0}^{1}fv\!\,}
or after integrating by parts and including initial conditions
∫
0
1
u
′
v
′
+
α
∫
0
1
u
v
=
∫
0
1
f
v
+
B
v
(
1
)
−
A
v
(
0
)
{\displaystyle \int _{0}^{1}u'v'+\alpha \int _{0}^{1}uv=\int _{0}^{1}fv+Bv(1)-Av(0)\!\,}
V
h
=
{
v
∈
H
1
[
0
,
1
]
:
v
=
{\displaystyle V_{h}=\{v\in H^{1}[0,1]:v=\!\,}
piecewise linear
}
{\displaystyle \}\!\,}
{
ϕ
i
}
i
=
0
N
+
1
{\displaystyle \{\phi _{i}\}_{i=0}^{N+1}\!\,}
is basis for
V
h
{\displaystyle V_{h}\!\,}
;
h
=
1
N
+
2
{\displaystyle h={\frac {1}{N+2}}\!\,}
For
i
=
1
,
2
,
…
,
N
{\displaystyle i=1,2,\ldots ,N\!\,}
ϕ
i
=
{
x
−
x
i
−
1
h
for
x
∈
[
x
i
−
1
,
x
i
]
x
i
+
1
−
x
h
for
x
∈
[
x
i
,
x
i
+
1
]
0
otherwise
{\displaystyle \phi _{i}={\begin{cases}{\frac {x-x_{i-1}}{h}}{\mbox{ for }}x\in [x_{i-1},x_{i}]\\{\frac {x_{i+1}-x}{h}}{\mbox{ for }}x\in [x_{i},x_{i+1}]\\0{\mbox{ otherwise}}\end{cases}}\!\,}
ϕ
i
′
=
{
1
h
for
x
∈
[
x
i
−
1
,
x
i
]
−
1
h
for
x
∈
[
x
i
,
x
i
+
1
]
0
otherwise
{\displaystyle \phi _{i}'={\begin{cases}{\frac {1}{h}}{\mbox{ for }}x\in [x_{i-1},x_{i}]\\-{\frac {1}{h}}{\mbox{ for }}x\in [x_{i},x_{i+1}]\\0{\mbox{ otherwise}}\end{cases}}\!\,}
∫
ϕ
i
ϕ
j
=
{
2
3
h
for
i
=
j
1
6
h
for
|
i
−
j
|
=
1
0
otherwise
{\displaystyle \int \phi _{i}\phi _{j}={\begin{cases}{\frac {2}{3}}h{\mbox{ for }}i=j\\{\frac {1}{6}}h{\mbox{ for }}|i-j|=1\\0{\mbox{ otherwise}}\end{cases}}\!\,}
∫
ϕ
i
′
ϕ
j
′
=
{
2
h
for
i
=
j
−
1
h
for
|
i
−
j
|
=
1
0
otherwise
{\displaystyle \int \phi _{i}'\phi _{j}'={\begin{cases}{\frac {2}{h}}{\mbox{ for }}i=j\\-{\frac {1}{h}}{\mbox{ for }}|i-j|=1\\0{\mbox{ otherwise}}\end{cases}}\!\,}
ϕ
0
=
{
x
1
−
x
h
for
x
∈
[
x
0
,
x
1
]
0
otherwise
{\displaystyle \phi _{0}={\begin{cases}{\frac {x_{1}-x}{h}}{\mbox{ for }}x\in [x_{0},x_{1}]\\0{\mbox{ otherwise }}\end{cases}}\!\,}
ϕ
N
+
1
=
{
x
−
x
N
h
for
x
∈
[
x
N
,
x
N
+
1
]
0
otherwise
{\displaystyle \phi _{N+1}={\begin{cases}{\frac {x-x_{N}}{h}}{\mbox{ for }}x\in [x_{N},x_{N+1}]\\0{\mbox{ otherwise }}\end{cases}}\!\,}
Find
u
h
∈
V
h
{\displaystyle u_{h}\in V_{h}\!\,}
such that for all
v
∈
V
h
{\displaystyle v\in V_{h}\!\,}
∫
u
h
′
v
h
′
+
α
∫
0
1
u
h
v
h
=
∫
0
1
f
v
h
+
B
v
(
1
)
−
A
v
(
0
)
{\displaystyle \int u_{h}'v_{h}'+\alpha \int _{0}^{1}u_{h}v_{h}=\int _{0}^{1}fv_{h}+Bv(1)-Av(0)\!\,}
Since
{
ϕ
i
}
i
=
0
N
+
1
{\displaystyle \{\phi _{i}\}_{i=0}^{N+1}\!\,}
forms a basis
u
h
=
∑
i
=
0
N
+
1
u
h
i
ϕ
i
{\displaystyle u_{h}=\sum _{i=0}^{N+1}u_{h_{i}}\phi _{i}\!\,}
Therefore we have system of equations
For
j
=
0
,
1
,
…
,
N
+
1
{\displaystyle j=0,1,\ldots ,N+1\!\,}
∑
i
=
0
N
+
1
u
h
i
∫
0
1
ϕ
i
′
ϕ
j
′
+
α
∑
i
=
0
N
+
1
u
h
i
∫
0
1
ϕ
i
ϕ
j
=
∫
0
1
f
ϕ
j
+
B
ϕ
j
(
1
)
−
A
ϕ
j
(
0
)
{\displaystyle \sum _{i=0}^{N+1}u_{h_{i}}\int _{0}^{1}\phi _{i}'\phi _{j}'+\alpha \sum _{i=0}^{N+1}u_{h_{i}}\int _{0}^{1}\phi _{i}\phi _{j}=\int _{0}^{1}f\phi _{j}+B\phi _{j}(1)-A\phi _{j}(0)\!\,}
[
α
1
3
h
+
1
h
α
6
h
−
1
h
α
6
−
1
h
α
2
3
h
+
2
h
α
6
h
−
1
h
⋱
⋱
⋱
α
6
h
−
1
6
α
2
3
h
+
2
h
α
6
h
−
1
h
α
6
h
−
1
h
α
1
3
h
+
1
h
]
[
u
h
0
u
h
1
⋮
u
h
N
u
h
N
+
1
]
=
[
∫
0
1
f
ϕ
0
−
A
∫
0
1
f
ϕ
1
⋮
∫
0
1
f
ϕ
N
∫
0
1
f
ϕ
N
+
1
+
B
]
{\displaystyle {\begin{bmatrix}\alpha {\frac {1}{3}}h+{\frac {1}{h}}&{\frac {\alpha }{6}}h-{\frac {1}{h}}&&\\{\frac {\alpha }{6}}-{\frac {1}{h}}&\alpha {\frac {2}{3}}h+{\frac {2}{h}}&{\frac {\alpha }{6}}h-{\frac {1}{h}}&\\\ddots &\ddots &\ddots &\\&{\frac {\alpha }{6}}h-{\frac {1}{6}}&\alpha {\frac {2}{3}}h+{\frac {2}{h}}&{\frac {\alpha }{6}}h-{\frac {1}{h}}\\&&{\frac {\alpha }{6}}h-{\frac {1}{h}}&\alpha {\frac {1}{3}}h+{\frac {1}{h}}\end{bmatrix}}{\begin{bmatrix}u_{h_{0}}\\u_{h_{1}}\\\vdots \\u_{h_{N}}\\u_{h_{N+1}}\end{bmatrix}}={\begin{bmatrix}\int _{0}^{1}f\phi _{0}-A\\\int _{0}^{1}f\phi _{1}\\\vdots \\\int _{0}^{1}f\phi _{N}\\\int _{0}^{1}f\phi _{N+1}+B\end{bmatrix}}\!\,}
In general terms, we can use Cea's Lemma to obtain
‖
u
−
u
h
‖
1
≤
C
inf
v
h
∈
V
h
‖
u
−
v
h
‖
1
{\displaystyle \|u-u_{h}\|_{1}\leq C\inf _{v_{h}\in V_{h}}\|u-v_{h}\|_{1}}
In particular, we can consider
v
h
{\displaystyle v_{h}\!\,}
as the Lagrange interpolant, which we denote by
v
I
{\displaystyle v_{I}\!\,}
. Then,
‖
u
−
u
h
‖
1
≤
C
‖
u
−
v
I
‖
1
≤
C
h
‖
u
‖
H
2
(
0
,
1
)
{\displaystyle \|u-u_{h}\|_{1}\leq C\|u-v_{I}\|_{1}\leq Ch\|u\|_{H^{2}(0,1)}}
.
It's easy to prove that the finite element solution is nodally exact. Then it coincides with the Lagrange interpolant, and we have the following punctual estimation:
‖
u
(
x
)
−
u
h
(
x
)
‖
L
∞
(
[
x
i
−
1
,
x
i
]
)
≤
max
x
∈
[
x
i
−
1
,
x
i
]
u
(
2
)
(
x
)
(
2
)
!
(
h
2
)
2
{\displaystyle \|u(x)-u_{h}(x)\|_{L^{\infty }([x_{i-1},x_{i}])}\leq \max _{x\in [x_{i-1},x_{i}]}{\frac {u^{(2)}(x)}{(2)!}}\left({\frac {h}{2}}\right)^{2}}