<s>
In	O
mathematics	O
,	O
particularly	O
linear	B-Language
algebra	I-Language
and	O
numerical	B-General_Concept
analysis	I-General_Concept
,	O
the	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
is	O
a	O
method	O
for	O
orthonormalizing	O
a	O
set	O
of	O
vectors	O
in	O
an	O
inner	O
product	O
space	O
,	O
most	O
commonly	O
the	O
Euclidean	O
space	O
equipped	O
with	O
the	O
standard	O
inner	O
product	O
.	O
</s>
<s>
The	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
takes	O
a	O
finite	O
,	O
linearly	O
independent	O
set	O
of	O
vectors	O
for	O
and	O
generates	O
an	O
orthogonal	B-Algorithm
set	O
that	O
spans	O
the	O
same	O
k-dimensional	O
subspace	O
of	O
Rn	O
as	O
S	O
.	O
</s>
<s>
The	O
application	O
of	O
the	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
to	O
the	O
column	O
vectors	O
of	O
a	O
full	O
column	O
rank	O
matrix	B-Architecture
yields	O
the	O
QR	O
decomposition	O
(	O
it	O
is	O
decomposed	O
into	O
an	O
orthogonal	B-Algorithm
and	O
a	O
triangular	B-Algorithm
matrix	I-Algorithm
)	O
.	O
</s>
<s>
If	O
u	O
=	O
0	O
,	O
we	O
define	O
,	O
i.e.	O
,	O
the	O
projection	B-Algorithm
map	O
is	O
the	O
zero	O
map	O
,	O
sending	O
every	O
vector	O
to	O
the	O
zero	O
vector	O
.	O
</s>
<s>
The	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
then	O
works	O
as	O
follows	O
:	O
</s>
<s>
The	O
sequence	O
is	O
the	O
required	O
system	O
of	O
orthogonal	B-Algorithm
vectors	O
,	O
and	O
the	O
normalized	O
vectors	O
form	O
an	O
orthonormal	B-Algorithm
set	I-Algorithm
.	O
</s>
<s>
The	O
calculation	O
of	O
the	O
sequence	O
is	O
known	O
as	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
orthogonalization	I-Algorithm
,	O
while	O
the	O
calculation	O
of	O
the	O
sequence	O
is	O
known	O
as	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
orthonormalization	O
as	O
the	O
vectors	O
are	O
normalized	O
.	O
</s>
<s>
To	O
check	O
that	O
these	O
formulas	O
yield	O
an	O
orthogonal	B-Algorithm
sequence	O
,	O
first	O
compute	O
by	O
substituting	O
the	O
above	O
formula	O
for	O
u2	O
:	O
we	O
get	O
zero	O
.	O
</s>
<s>
The	O
general	O
proof	O
proceeds	O
by	O
mathematical	B-Algorithm
induction	I-Algorithm
.	O
</s>
<s>
The	O
vector	O
ui	O
is	O
then	O
defined	O
to	O
be	O
the	O
difference	O
between	O
vi	O
and	O
this	O
projection	B-Algorithm
,	O
guaranteed	O
to	O
be	O
orthogonal	B-Algorithm
to	O
all	O
of	O
the	O
vectors	O
in	O
the	O
subspace	O
U	O
.	O
</s>
<s>
The	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
also	O
applies	O
to	O
a	O
linearly	O
independent	O
countably	O
infinite	O
sequence	O
.	O
</s>
<s>
The	O
result	O
is	O
an	O
orthogonal	B-Algorithm
(	O
or	O
orthonormal	B-Algorithm
)	O
sequence	O
such	O
that	O
for	O
natural	O
number	O
:	O
</s>
<s>
If	O
the	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
is	O
applied	O
to	O
a	O
linearly	O
dependent	O
sequence	O
,	O
it	O
outputs	O
the	O
vector	O
on	O
the	O
ith	O
step	O
,	O
assuming	O
that	O
is	O
a	O
linear	O
combination	O
of	O
.	O
</s>
<s>
If	O
an	O
orthonormal	B-Algorithm
basis	O
is	O
to	O
be	O
produced	O
,	O
then	O
the	O
algorithm	O
should	O
test	O
for	O
zero	O
vectors	O
in	O
the	O
output	O
and	O
discard	O
them	O
because	O
no	O
multiple	O
of	O
a	O
zero	O
vector	O
can	O
have	O
a	O
length	O
of	O
1	O
.	O
</s>
<s>
A	O
variant	O
of	O
the	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
using	O
transfinite	O
recursion	O
applied	O
to	O
a	O
(	O
possibly	O
uncountably	O
)	O
infinite	O
sequence	O
of	O
vectors	O
yields	O
a	O
set	O
of	O
orthonormal	B-Algorithm
vectors	I-Algorithm
with	O
such	O
that	O
for	O
any	O
,	O
the	O
completion	O
of	O
the	O
span	O
of	O
is	O
the	O
same	O
as	O
that	O
of	O
In	O
particular	O
,	O
when	O
applied	O
to	O
a	O
(	O
algebraic	O
)	O
basis	O
of	O
a	O
Hilbert	O
space	O
(	O
or	O
,	O
more	O
generally	O
,	O
a	O
basis	O
of	O
any	O
dense	O
subspace	O
)	O
,	O
it	O
yields	O
a	O
(	O
functional-analytic	O
)	O
orthonormal	B-Algorithm
basis	O
.	O
</s>
<s>
Now	O
,	O
perform	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
,	O
to	O
obtain	O
an	O
orthogonal	B-Algorithm
set	O
of	O
vectors	O
:	O
</s>
<s>
We	O
check	O
that	O
the	O
vectors	O
and	O
are	O
indeed	O
orthogonal	B-Algorithm
:	O
</s>
<s>
noting	O
that	O
if	O
the	O
dot	O
product	O
of	O
two	O
vectors	O
is	O
0	O
then	O
they	O
are	O
orthogonal	B-Algorithm
.	O
</s>
<s>
Denote	O
by	O
the	O
result	O
of	O
applying	O
the	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
to	O
a	O
collection	O
of	O
vectors	O
.	O
</s>
<s>
It	O
commutes	O
with	O
orthogonal	B-Algorithm
maps	O
:	O
</s>
<s>
Let	O
be	O
orthogonal	B-Algorithm
(	O
with	O
respect	O
to	O
the	O
given	O
inner	O
product	O
)	O
.	O
</s>
<s>
Further	O
a	O
parametrized	O
version	O
of	O
the	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
yields	O
a	O
(	O
strong	O
)	O
deformation	O
retraction	O
of	O
the	O
general	O
linear	O
group	O
onto	O
the	O
orthogonal	B-Algorithm
group	O
.	O
</s>
<s>
When	O
this	O
process	O
is	O
implemented	O
on	O
a	O
computer	O
,	O
the	O
vectors	O
are	O
often	O
not	O
quite	O
orthogonal	B-Algorithm
,	O
due	O
to	O
rounding	B-Algorithm
errors	I-Algorithm
.	O
</s>
<s>
For	O
the	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
as	O
described	O
above	O
(	O
sometimes	O
referred	O
to	O
as	O
"	O
classical	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
"	O
)	O
this	O
loss	O
of	O
orthogonality	O
is	O
particularly	O
bad	O
;	O
therefore	O
,	O
it	O
is	O
said	O
that	O
the	O
(	O
classical	O
)	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
is	O
numerically	B-Algorithm
unstable	I-Algorithm
.	O
</s>
<s>
The	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
can	O
be	O
stabilized	O
by	O
a	O
small	O
modification	O
;	O
this	O
version	O
is	O
sometimes	O
referred	O
to	O
as	O
modified	O
Gram-Schmidt	B-Algorithm
or	O
MGS	O
.	O
</s>
<s>
After	O
this	O
step	O
we	O
already	O
have	O
two	O
of	O
our	O
desired	O
orthogonal	B-Algorithm
vectors	O
,	O
namely	O
,	O
but	O
we	O
also	O
made	O
already	O
orthogonal	B-Algorithm
to	O
.	O
</s>
<s>
Now	O
we	O
have	O
stored	O
the	O
vectors	O
where	O
the	O
first	O
three	O
vectors	O
are	O
already	O
and	O
the	O
remaining	O
vectors	O
are	O
already	O
orthogonal	B-Algorithm
to	O
.	O
</s>
<s>
Proceeding	O
in	O
this	O
manner	O
we	O
find	O
the	O
full	O
set	O
of	O
orthogonal	B-Algorithm
vectors	O
.	O
</s>
<s>
If	O
orthonormal	B-Algorithm
vectors	I-Algorithm
are	O
desired	O
,	O
then	O
we	O
normalize	O
as	O
we	O
go	O
,	O
so	O
that	O
the	O
denominators	O
in	O
the	O
subtraction	O
formulas	O
turn	O
into	O
ones	O
.	O
</s>
<s>
The	O
following	O
MATLAB	B-Language
algorithm	O
implements	O
the	O
modified	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
orthonormalization	O
for	O
Euclidean	O
Vectors	O
.	O
</s>
<s>
The	O
vectors	O
(	O
columns	O
of	O
matrix	B-Architecture
V	O
,	O
so	O
that	O
V( 	O
:	O
,	O
j	O
)	O
is	O
the	O
jth	O
vector	O
)	O
are	O
replaced	O
by	O
orthonormal	B-Algorithm
vectors	I-Algorithm
(	O
columns	O
of	O
U	O
)	O
which	O
span	O
the	O
same	O
subspace	O
.	O
</s>
<s>
If	O
the	O
rows	O
are	O
written	O
as	O
a	O
matrix	B-Architecture
,	O
then	O
applying	O
Gaussian	B-Algorithm
elimination	I-Algorithm
to	O
the	O
augmented	O
matrix	B-Architecture
will	O
produce	O
the	O
orthogonalized	O
vectors	O
in	O
place	O
of	O
.	O
</s>
<s>
However	O
the	O
matrix	B-Architecture
must	O
be	O
brought	O
to	O
row	O
echelon	O
form	O
,	O
using	O
only	O
the	O
row	O
operation	O
of	O
adding	O
a	O
scalar	O
multiple	O
of	O
one	O
row	O
to	O
another	O
.	O
</s>
<s>
The	O
result	O
of	O
the	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
may	O
be	O
expressed	O
in	O
a	O
non-recursive	O
formula	O
using	O
determinants	O
.	O
</s>
<s>
The	O
determinant	O
formula	O
for	O
the	O
Gram-Schmidt	B-Algorithm
is	O
computationally	O
slower	O
(	O
exponentially	O
slower	O
)	O
than	O
the	O
recursive	O
algorithms	O
described	O
above	O
;	O
it	O
is	O
mainly	O
of	O
theoretical	O
interest	O
.	O
</s>
<s>
Other	O
orthogonalization	O
algorithms	O
use	O
Householder	B-Algorithm
transformations	I-Algorithm
or	O
Givens	O
rotations	O
.	O
</s>
<s>
The	O
algorithms	O
using	O
Householder	B-Algorithm
transformations	I-Algorithm
are	O
more	O
stable	O
than	O
the	O
stabilized	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
.	O
</s>
<s>
On	O
the	O
other	O
hand	O
,	O
the	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
produces	O
the	O
th	O
orthogonalized	O
vector	O
after	O
the	O
th	O
iteration	O
,	O
while	O
orthogonalization	O
using	O
Householder	B-Algorithm
reflections	I-Algorithm
produces	O
all	O
the	O
vectors	O
only	O
at	O
the	O
end	O
.	O
</s>
<s>
This	O
makes	O
only	O
the	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
process	I-Algorithm
applicable	O
for	O
iterative	B-Algorithm
methods	I-Algorithm
like	O
the	O
Arnoldi	O
iteration	O
.	O
</s>
<s>
Yet	O
another	O
alternative	O
is	O
motivated	O
by	O
the	O
use	O
of	O
Cholesky	O
decomposition	O
for	O
inverting	B-General_Concept
the	I-General_Concept
matrix	I-General_Concept
of	I-General_Concept
the	I-General_Concept
normal	I-General_Concept
equations	I-General_Concept
in	I-General_Concept
linear	I-General_Concept
least	I-General_Concept
squares	I-General_Concept
.	O
</s>
<s>
Let	O
be	O
a	O
full	O
column	O
rank	O
matrix	B-Architecture
,	O
whose	O
columns	O
need	O
to	O
be	O
orthogonalized	O
.	O
</s>
<s>
The	O
matrix	B-Architecture
is	O
Hermitian	B-Algorithm
and	O
positive	B-Algorithm
definite	I-Algorithm
,	O
so	O
it	O
can	O
be	O
written	O
as	O
using	O
the	O
Cholesky	O
decomposition	O
.	O
</s>
<s>
The	O
lower	B-Algorithm
triangular	I-Algorithm
matrix	I-Algorithm
with	O
strictly	O
positive	O
diagonal	O
entries	O
is	O
invertible	O
.	O
</s>
<s>
Then	O
columns	O
of	O
the	O
matrix	B-Architecture
are	O
orthonormal	B-Algorithm
and	O
span	O
the	O
same	O
subspace	O
as	O
the	O
columns	O
of	O
the	O
original	O
matrix	B-Architecture
.	O
</s>
<s>
The	O
explicit	O
use	O
of	O
the	O
product	O
makes	O
the	O
algorithm	O
unstable	O
,	O
especially	O
if	O
the	O
product	O
's	O
condition	B-Algorithm
number	I-Algorithm
is	O
large	O
.	O
</s>
<s>
In	O
quantum	O
mechanics	O
there	O
are	O
several	O
orthogonalization	O
schemes	O
with	O
characteristics	O
better	O
suited	O
for	O
certain	O
applications	O
than	O
original	O
Gram	B-Algorithm
–	I-Algorithm
Schmidt	I-Algorithm
.	O
</s>
