Gram-Schmidt

Gram-Schmidt
Lay 6.7.28

Find an orthogonal basis for the subspace of C[0,2π] spanned by  {1, Cos[t], Cos[t]^2, Cos[t]^3}.

In[339]:=

Clear[t, a0, a1, a2, a3, b0, b1, b2, b3, originalBasis, orthogonalBasis, prod] 

a0[t_] = 1 ;

a1[t_] = Cos[t] ;

a2[t_] = Cos[t]^2 ;

a3[t_] = Cos[t]^3 ; 

originalBasis = {a0[t], a1[t], a2[t], a3[t]} ; 

prod[f_, g_] := ∫_0^(2π) f g t

In[346]:=

<<Graphics`Colors`

In[347]:=

Plot[Evaluate[originalBasis], {t, 0, 2π}, PlotLabel->"Original Basis&qu ... 0;}, {-1, 0, 1}}, PlotStyle {Turquoise, DodgerBlue, MediumPurple, DarkViolet}] ;

[Graphics:HTMLFiles/6_gram-schmidt_12.gif]

In[348]:=

b0[t_] = a0[t]

Out[348]=

1

In[349]:=

b1[x_] = a1[t] - prod[a1[t], b0[t]]/prod[b0[t], b0[t]] b0[t]

Out[349]=

Cos[t]

In[350]:=

b2[x_] = a2[t]    - prod[a2[t], b0[t]]/prod[b0[t], b0[t]] b0[t] - prod[a2[t], b1[t]]/prod[b1[t], b1[t]] b1[t]//Simplify

Out[350]=

1/2 Cos[2 t]

In[351]:=

b3[x_] = a3[t]    - prod[a3[t], b0[t]]/prod[b0[t], b0[t]] a0[t] - prod[a3[t], b1[t]]/prod[b1[t], b1[t]] a1[t] - prod[a3[t], b2[t]]/prod[b2[t], b2[t]] b2[t]//Simplify

Out[351]=

1/4 Cos[3 t]

In[352]:=

orthogonalBasis = {b0[x], b1[x], b2[x], b3[x]}

Out[352]=

{1, Cos[t], 1/2 Cos[2 t], 1/4 Cos[3 t]}

In[353]:=

Plot[Evaluate[orthogonalBasis], {t, 0, 2π}, PlotLabel->"Orthogonal Basis", PlotStyle {Turquoise, DodgerBlue, MediumPurple, DarkViolet}] ;

[Graphics:HTMLFiles/6_gram-schmidt_24.gif]


Created by Mathematica  (December 11, 2004) Valid XHTML 1.1!