I cannot make the Gram-Schmidt procedure work

In summary, the statement expresses frustration with the Gram-Schmidt process, a method used to orthogonalize a set of vectors in linear algebra. The speaker is likely struggling with the implementation or understanding of the steps involved in the procedure, which can be complex and requires careful manipulation of vectors to ensure orthogonality.
  • #1
George Keeling
Gold Member
180
41
Homework Statement
I have been asked to use the Gram-Schmidt procedure and it does not produce orthonormal vectors :(
Relevant Equations
Gram-Schmidt procedure, inner product of complex vectors
This is problem A.4 from Quantum Mechanics – by Griffiths & Schroeter.

I cannot make the Gram-Schmidt procedure work. I don't know whether I am just inept with complex vectors or I have made some wrong assumption.

The Gram-Schmidt procedure (modified, I think)
Suppose you start with a basis ##\left(|\left.e_1\right>,|\left.e_2\right>,\ldots,|\left.e_n\right>\right)## that is not orthonormal. The Gram-Schmidt procedure is a systematic ritual for generating from it an orthonormal basis ##\left(|\left.{e^\prime}_1\right>,|\left.\left.{e^\prime}_2\right>\right>,\ldots,|\left.{e^\prime}_n\right>\right)##. It goes like this:
(i) Normalize the first basis (divide it by its norm):
\begin{align}|\left.{e^\prime}_1\right>=\frac{|\left.e_1\right>}{\left|\left.e_1\right.\right|}&\phantom {10000}(1)\nonumber\end{align} (ii) Find the projection of the second vector along the first and subtract it off:
\begin{align}|\left.e_2\right>-\left<{e^\prime}_1|e_2\right>|\left.{e^\prime}_1\right>&\phantom {10000}(2)\nonumber\end{align}This vector is orthogonal to ##|\left.{e^\prime}_1\right>##; normalise it to get ##|\left.{e^\prime}_2\right>##.
(iii) Subtract from ##|\left.e_3\right>## its projections along ##|\left.{e^\prime}_1\right>## and ##|\left.{e^\prime}_2\right>## and get
\begin{align}|\left.e_3\right>-\left<{e^\prime}_1|e_3\right>|\left.{e^\prime}_1\right>-\left<{e^\prime}_2|e_3\right>|\left.{e^\prime}_2\right>&\phantom {10000}(3)\nonumber\end{align}This vector is orthogonal to ##|\left.{e^\prime}_1\right>## and ##|\left.{e^\prime}_2\right>##; normalise it to get ##|\left.{e^\prime}_3\right>##. And so on.

The authors also uses the * sign. For example at A.24 they almost say "with an orthonormal basis the inner product of two vectors can be written very neatly in terms of their components
\begin{align}\left<\beta|\alpha\right>={\beta_1}^\ast\alpha_1+{\beta_2}^\ast\alpha_2+\ldots+{\beta_n}^\ast\alpha_n&\phantom {10000}(4)\nonumber\end{align}". I assumed that ##{\beta_1}^\ast## is the complex conjugate of ##\beta_1##. (Wikipedia agrees that physicists do this). Formula (4) will be very useful for executing the GS procedure.

The Question and my attempted solution
Use the Gram-Schmidt procedure to orthonormalize the 3-space basis
\begin{align}|\left.e_1\right>&=\left(1+i\right)\hat{i}+\hat{j}+i\hat{k}&\phantom {10000}(5)\nonumber\\|\left.e_2\right>&=i\hat{i}+3\hat{j}+\hat{k}&\phantom {10000}(6)\nonumber\\|\left.e_3\right>&=28\hat{j}&\phantom {10000}(7)\nonumber\end{align}The author does not say so but I assumed that ##\hat{i},\hat{j},\hat{k}## are an orthonormal basis. Although this begs the question: Why do we need another orthonormal basis?

It's obviously easiest to start with ##|\left.e_3\right>## and then it turns out that ##|\left.e_2\right>## is next easiest. Here they are:
\begin{align}|\left.{e^\prime}_3\right>=\hat{j}&\phantom {10000}(8)\nonumber\\|\left.{e^\prime}_2\right>=\frac{i\hat{i}+\hat{k}}{\sqrt2}&\phantom {10000}(9)\nonumber\end{align}##|\left.{e^\prime}_2\right>## has norm 1 and is orthogonal to ##|\left.{e^\prime}_3\right>##. Those were quite easy but this is where it all goes wrong: The third step is to find a vector orthogonal to ##|\left.{e^\prime}_3\right>,|\left.{e^\prime}_2\right>## which is
\begin{align}|\left.e_1\right>-\left<{e^\prime}_3|e_1\right>|\left.{e^\prime}_3\right>-\left<{e^\prime}_2|e_1\right>|\left.{e^\prime}_2\right>&\phantom {10000}(10)\nonumber\\=\left(1+i\right)\hat{i}+\hat{j}+i\hat{k}-\left(1\right)\hat{j}-\left(\left(\frac{i\hat{i}+\hat{k}}{\sqrt2}\right)\bullet\left(\left(1+i\right)\hat{i}+\hat{j}+i\hat{k}\right)\right)\frac{i\hat{i}+\hat{k}}{\sqrt2}&\phantom {10000}(11)\nonumber\\=\left(1+i\right)\hat{i}+i\hat{k}-\frac{1}{2}\left(1\right)\left(i\hat{i}+\hat{k}\right)=\left(1-\frac{i}{2}\right)\hat{i}+\left(-\frac{1}{2}+i\right)\hat{k}&\phantom {10000}(12)\nonumber\end{align}I have used ##\bullet## to indicate inner product when the first vector's components still need to be 'complex conjugated'. The vector has no ##\hat{j}## component so it is orthogonal to ##|\left.{e^\prime}_3\right>##. Now normalise that and we have
\begin{align}|\left.{e^\prime}_1\right>=\frac{\frac{1}{2}\left(\left(2-i\right)\hat{i}+\left(-1+2i\right)\hat{k}\right)}{\sqrt{\left(\frac{1}{2}\left(\left(2-i\right)\hat{i}+\left(-1+2i\right)\hat{k}\right)\right)\bullet\left(\frac{1}{2}\left(\left(2-i\right)\hat{i}+\left(-1+2i\right)\hat{k}\right)\right)}}&\phantom {10000}(13)\nonumber\\|\left.{e^\prime}_1\right>=\frac{\left(2-i\right)\hat{i}+\left(-1+2i\right)\hat{k}}{\sqrt{10}}&\phantom {10000}(14)\nonumber\end{align}Now we just need to check that ##|\left.{e^\prime}_1\right>,|\left.{e^\prime}_2\right>## are orthogonal:
\begin{align}\left<{e^\prime}_1|\ {e\prime}_2\right>=\frac{1}{\sqrt{20}}\left(\left(2-i\right)\hat{i}+\left(-1+2i\right)\hat{k}\right)\bullet\left(i\hat{i}+\hat{k}\right)=\frac{-2}{\sqrt{20}}&\phantom {10000}(15)\nonumber\end{align}##|\left.{e^\prime}_1\right>,|\left.{e^\prime}_2\right>## are not orthogonal! Where I have gone wrong?
 
  • Like
Likes FactChecker
Physics news on Phys.org
  • #2
George Keeling said:
Homework Statement: I have been asked to use the Gram-Schmidt procedure and it does not produce orthonormal vectors :(
Relevant Equations: Gram-Schmidt procedure, inner product of complex vectors

". I assumed that β1∗ is the complex conjugate of β1. (Wikipedia agrees that physicists do this). Formula (4) will be very useful for executing the GS procedure.
This is correct. So then $$\langle e'_1|= ???? $$
 
  • #3
The same as ##|\left.{e^\prime}_1\right>## but using the complex conjugate of each component?

Because ##\langle e'_1|e'_1\rangle|## is the norm (squared).
 
  • #4
Did you do that? I don't think so.
 
  • #5
Did I do what? Sorry I dont understand
 
  • #6
  • Skeptical
Likes George Keeling
  • #7
hutchphd said:
Eq 13 is correct but equation 15 is not. bras and kets
I think (13) is wrong as well because of a sign error. The ##\hat i## component should ##(2+i)/\sqrt{10}##.
 
  • Love
Likes George Keeling
  • #8
Very possible but the big error is how to write the ##\langle bra|ket \rangle##
 
  • #9
Thanks everybody. I will return to the fray tomorrow.
 
  • Like
Likes hutchphd
  • #10
I want to comment on how well this question was presented. The equation numbers and good formatting make it a real pleasure to discuss. I have not looked at the details, but the problem with the ## \hat {i}## component of equation (12) is clear.
 
  • Like
Likes PhDeezNutz and George Keeling
  • #11
hutchphd said:
Very possible but the big error is how to write the ##\langle bra|ket \rangle##
I think you missed that the OP wrote:
George Keeling said:
I have used ∙ to indicate inner product when the first vector's components still need to be 'complex conjugated'.
 
  • #12
vela said:
I think you missed that the OP wrote:
Yes I did miss that (very odd) notation. I believe the OP just screws up the final algebra step in line 15. I get zero.....but I do algebra badly. Whew!
 
  • Skeptical
Likes George Keeling
  • #13
I found checking the OP’s working awkward so would like to add this…

Using suitable notation can help minimise errors, improve readability and reduce eye-strain! It’s tempting here to:

- express the vectors in, say, row/column notation (common practice) to eliminate the need for ##\hat i, \hat j## and ##\hat k##; this (IMO) makes things visually cleaner (as well as reducing the risk of getting ##\hat i## and ##i## muddled);

- use, say, ##b_1, b_2## and ##b_3## rather than ##e'_1, e'_2## and ##e'_3## as the new basis vectors to avoid clutter/confusion between "##e##"s and "##e’##"s.

The final answer can be translated back to the original format, if required.

I know many will already be familiar with this, but for the OP's benefit...

We can write:
##|e_1> = [1+i ~~1~~i]^T,~~|e_2> =[i~~3~~1]^T,~~|## and ##|e_3>=[0~~28~~0]^T##

From the OP's working we have:
##|b_3> = [0~~1~~0]^T## and ##|b_2> = \frac 1{\sqrt 2}[i~~0~~1]^T##.

We express ##<b_3|## and ##<b_2|## as row vectors and incorporate complex conjugation:
##<b_3| = [0~~1~~0]## and ##<b_2| = \frac 1{\sqrt 2}[-i~~0~~1]##

Our last basis vector (not normalised) is then:

##|b_{1,unorm }> = |e_1> - <b_3|e_1>|b_3> - <b_2|e_1>|b_2>##

##= [1+i ~~1~~i]^T - ([0~~1~~0][1+i ~~1~~i]^T)[0~~1~~0]^T - (\frac 1{\sqrt 2}[-i~~0~~1][1+i~~1~~i]^T)\frac 1{\sqrt 2}[i~~0~~1]^T##

##= [1+i~~1~~i]^T - (0.(1+i)+1.1+0.i)[0~~1~~0]^T - \frac 1{\sqrt 2}((-i)(1+i) + 0.1+ 1.i)\frac 1{\sqrt 2}[i~~0~~1]^T##

etc.

Even if there are mistakes, the above format should make locating them a bit easier.
 
  • Like
Likes PhDeezNutz and George Keeling
  • #14
I would also point out that one can write down <b3| by inspection after you see the form of the the other two b vectors. The Gram -Schmidt is really cumbersome. So $$\langle b_1 |=\frac 1 {\sqrt 2} [~ i~0~1~ ]$$
George Keeling said:
Homework Statement: I have been asked to use the Gram-Schmidt procedure and it does not produce orthonormal vectors :(
Relevant Equations: Gram-Schmidt procedure, inner product of complex vectors

Why do we need another orthonormal basis?
Bases are chosen typically using symmetries of the problem to male the arithmetic less opaque.
 
  • Like
Likes George Keeling
  • #15
vela said:
I think (13) is wrong as well because of a sign error. The ##\hat i## component should ##(2+i)/\sqrt{10}##.
That has the great benefit of making ##|\left.{e^\prime}_1\right>,|\left.{e^\prime}_2\right>## orthogonal. Going back to (12) and extracting the ##\hat{i}##
component. I wrote
$$\left(1+i\right)\hat{i}-\frac{1}{2}\left(1\right)\left(i\hat{i}\right)=\left(1-\frac{i}{2}\right)\hat{i}$$
and that is wrong.

It should have been
$$\left(1+i\right)\hat{i}-\frac{1}{2}\left(1\right)\left(i\hat{i}\right)=\left(1+i\right)\hat{i}-\frac{1}{2}i\hat{i}=\left(1+\frac{i}{2}\right)\hat{i}$$So it was just my ineptitude at complex vector arithmetic:frown:.
@vela Did you spot that because you knew the vector that would be orthogonal or because you saw my arithmetic error? Or something else?

Thanks again everybody!
 
  • #16
George Keeling said:
Did you spot that because you knew the vector that would be orthogonal or because you saw my arithmetic error?
I had Mathematica do the calculations you did and compared its results to yours. I didn't do the calculations by hand because I knew I'd probably make a mistake somewhere along the way too. :wink:

Sign errors are really easy to make, and it only gets worse when you throw ##i##'s into the mix. It's one of the first things I look for if I'm expecting an answer of 0 but don't get it.
 
  • Like
Likes George Keeling
  • #17
I don't know if it would be over the top to suggest that a specific inner-product be specified. In this case, it's the "standard" one in ## \mathbb R^n ## (n=2) here.
 

FAQ: I cannot make the Gram-Schmidt procedure work

Why does my Gram-Schmidt process fail to produce orthogonal vectors?

One common reason the Gram-Schmidt process fails to produce orthogonal vectors is due to numerical instability or rounding errors, especially when dealing with vectors that are nearly linearly dependent. Ensure your calculations maintain high precision and consider using a more stable algorithm like Modified Gram-Schmidt if necessary.

What should I do if my vectors are linearly dependent?

If your vectors are linearly dependent, the Gram-Schmidt process will fail because it relies on the assumption that each new vector can be orthogonalized with respect to the previous ones. You need to ensure that your input vectors are linearly independent before applying the Gram-Schmidt procedure.

How can I verify that my output vectors are orthogonal?

To verify that your output vectors are orthogonal, you can check that the dot product between each pair of vectors in the resulting set is zero (or very close to zero, allowing for numerical precision limits). If the dot products are not zero, the vectors are not orthogonal.

Why do I get zero or very small vectors during the process?

Zero or very small vectors can result from numerical precision issues or when the input vectors are nearly linearly dependent. To mitigate this, ensure that your input vectors are well-conditioned, and consider using higher precision arithmetic or the Modified Gram-Schmidt procedure.

Can the Gram-Schmidt process be applied to any set of vectors?

The Gram-Schmidt process can be applied to any set of linearly independent vectors in a finite-dimensional vector space. However, it may not work correctly if the vectors are not linearly independent or if numerical issues arise. Always check the linear independence of your vectors before applying the procedure.

Back
Top