When using Orthogonalize[] one can specify which definition of "inner product" is to be used. For example, Orthogonalize[vectors,Dot] presupposes that all values are real.

When dealing with non-hermitian matrices, the "inner product" definition (apparently) needs to be $|z|^2 = zz$, just like with real numbers.

Consider this matrix:

mat = {{0. + 1.002 I, -1}, {-1, -I}}

The following code does not orthonormalize the eigenvectors of my matrix, as can be seen:


-2.90378*10^-15 + 0.999 I

The Dot option does not work, it presents me with an error

Orthogonalize::ornfa: The second argument Dot is not an inner product function, which always should return a number or symbol. If its two numeric arguments are the same, it should return a non-negative real number.

which is not surprising, since I have complex entries.

How can I force Orthogonalize[] to use the real number inner product definition, without Dot?

I'm using the words "inner product", but feel free to correct me as it seems they're not appropriate. Maybe I should say "involution"?


As there's a bounty on this question, I'm leaving it open until the last day it's effective. Thanks for the answers.

After talking with my supervisor, turns out we'll have to "manually" orthonormalize eigenvectors that share the same eigenvalue, since the eigenvectors are otherwise already orthonormal, as in this case:

Mathematica graphics

  • $\begingroup$ Could you please be more specific? A Hamiltonian is an operator, so what does it have to do with your list? Or are you talking about matrices? $\endgroup$
    – F'x
    Commented Mar 28, 2012 at 20:12
  • 1
    $\begingroup$ I fear this question may be easy to misinterpret. Generally, an hermitian operator on a vector space is a linear operator for which $A^{\*}=A$ where $\*$ is an involution. When the vector space is real, $*$ is usually the transpose. When the space is complex, $*$ can be taken either as the transpose or the complex conjugate transpose. This gives rise to orthogonal and hermitian operators, respectively. I believe (but am not sure) that the question asks how to specify which involution is intended when undertaking certain operations (but it's not entirely clear). $\endgroup$
    – whuber
    Commented Mar 28, 2012 at 20:15
  • 1
    $\begingroup$ F'x, a matrix merely is one way (out of many) to specify an operator. $\endgroup$
    – whuber
    Commented Mar 28, 2012 at 20:16
  • 1
    $\begingroup$ If you are talking about the inner product for your vectors, then zz does not satisfy the inner product axioms, regardless of the properties of the operator you are considering. So, the orthogonalization procedure with such inner product does not make much sense to me. Perhaps, I mis-interpreted your problem? $\endgroup$ Commented Mar 28, 2012 at 20:41
  • 2
    $\begingroup$ You probably did not get my point: regardless of the type of an operator, zz is not an inner product, in particular because it violates axioms #1 (conjugation) and #3 (positive-definiteness) on inner products. Technically, you can still use it to orthogonalize with it, but your vectors won't have a real length, meaning for example that you can not intepret the wave function squared as a probability density. AFAIK, the standard approach for expressing things like decays (non-unitary w.f. evolution) is to use the density matrix formalism, where at least you don't have this problem. $\endgroup$ Commented Mar 28, 2012 at 21:05

3 Answers 3


The way I am interpreting this question, it has nothing to do with the vectors in question being eigenvectors of any particular matrix. If this interpretation is wrong, the question needs to be clarified.

The next point is that orthogonality requires an actual scalar product, and for a complex vector space this rules out the Dot product because Dot[{I,0},{I,0}] == -1 which is obviously not positive.

Therefore, the only way that it could make sense to speak of orthogonalization with respect to the Dot product for complex vectors is that you might wish for some reason to apply the orthogonalization algorithm (e.g., Gram-Schmidt) to a set of vectors with complex entries.

Doing this is completely legitimate, but it will not lead to vectors that are orthogonal with respect to the Dot product because the Dot product is not a scalar product. It just doesn't make sense to use the term "orthogonality" in this case.

Here is a function that performs the algorithm as described:

orthoDotize[vecs_] := Module[{s, a, e, ortho},
  s = Array[a, Dimensions[vecs]];
  ortho = Orthogonalize[s];
  ortho /. Thread[Flatten[s] -> Flatten[vecs]]

This function has the property that its output satisfies the expected Euclidean orthogonality relations when the vectors in the list vecs are real. If they are not real, then the dot product after "pseudo-orthogonalization" can have imaginary parts:

mat = {{0. + 1.002 I, -1}, {-1, -I}};
evecs = N[Eigenvectors[mat]];
ovecs = orthoDotize[evecs]

{{0.722734 + 0. I, -2.69948*10^-16 + 0.691127 I}, {3.67452*10^-15 + 0.691127 I, 0.722734 - 3.56028*10^-15 I}}


0. + 0.999001 I

Edit: a possible cause of confusion

However, as I mentioned in my comment to the question (March 28), it could also be that there is a mathematical misunderstanding of a different kind here: equating orthogonality with biorthogonality.

As explained on this MathWorld page, we can define left and right eigenvectors of the matrix mat, which in this case are transposes of each other because mat is symmetric. To get these (generally different) sets of eigenvectors, you can do

eR = Eigenvectors[mat];
eL = Transpose[Eigenvectors[Transpose[mat]]];

The last line follows from

$\begin{eqnarray*}\vec{x}_{L}^{\top}M & = & \lambda \vec{x}_{L}^{\top}\\\Leftrightarrow\,\,\,M^{\top}\vec{x}_{L} & = & \lambda \vec{x}_{L}\end{eqnarray*}$

Then the following holds:

eL.eR // Chop

$\begin{pmatrix}0.0446879 & 0\\0 & 0.0446879\end{pmatrix}$

The appearance of the diagonal matrix here means that the rows of the matrix eL (the left eigenvectors) are orthogonal to the columns of eR (the right eigenvectors) in the sense of the matrix product. This is automatically true, and there is no need to do any further orthogonalization.

Edit 2

In case it needs further clarification: for any symmetric matrix mat we have that Transpose[eR] == eL. This implies that Transpose[eR].eR is diagonal (see above) and therefore eR[[1]].eR[[2]] == 0. That's why there is no need for any further orthogonalization in the example given in the question.

Edit 3

If mat is not symmetric, then its (right) eigenvectors are not orthogonal in the dot multiplication sense. Forming any kind of linear combination of those eigenvectors with the intention of orthogonalizing them will lead to new vectors which in general are no longer eigenvectors (unless the vectors in question share the same eigenvalue). So the orthogonalization idea is either trivial (for symmetric matrices) or violates the eigenvector property (for general non-symmetric matrices with non-degenerate spectrum).

  • $\begingroup$ Thanks for your comment on my answer Jens, I see what you mean now. I've deleted my "solution" as it doesn't actually do anything. $\endgroup$ Commented Apr 17, 2012 at 15:05
  • $\begingroup$ There is (or was) a mathematical misunderstanding. Thanks a bunch. $\endgroup$
    – CHM
    Commented Apr 18, 2012 at 1:13

You can indeed check the difference between Orthogonalize as it applies to real and complex vectors:

Orthogonalize[{{1, 1}, {1, -1}}]
Orthogonalize[{{1, 1}, {1, -1}}, Dot]

enter image description here


While if you use Orthogonalize on complex vectors, by default the inner produt is indeed $u.v = \sum u_i \bar{v}_i$:

Orthogonalize[{{1, 1}, {1, I}}]
Orthogonalize[{{1, 1}, {1, I}}, Dot[Conjugate[#1], #2] &]
Simplify@Orthogonalize[{{1, 1}, {1, I}}, Dot]

enter image description here

So, I think you can use Dot as second argument to Orthodonalize to achieve your aim. I don't know why it doesn't work for you, though…

  • $\begingroup$ sevecMol = Orthogonalize[N[Eigenvectors[hamiltMol]], Dot]; returns "The second argument Dot is not an inner product function, which always should return a number or symbol. If its two numeric arguments are the same, it should return a non-negative real number." I think the problem is in the N[] evaluation. I'm using on OSX 10.6.8 $\endgroup$
    – CHM
    Commented Mar 28, 2012 at 20:37
  • $\begingroup$ @CHM could you give an example of hamiltMol (eg how you produce your hamiltonian matrix)? This is probably happening because of the form of the eigenvectors (try evaluating Orthogonalize[N[Eigenvectors[RandomReal[{-1, 1}, {3, 3}]]], Dot] a few times to see that it sometimes works and sometimes not). $\endgroup$
    – acl
    Commented Mar 28, 2012 at 20:40
  • $\begingroup$ @CHM check the output of Dot[{0., 1. + 0.1 I}, {0., 1. + 0.1 I}] :) $\endgroup$
    – F'x
    Commented Mar 28, 2012 at 20:41
  • $\begingroup$ @acl I've added an image of my matrix in my question. Thanks, that surprises me. Do you know why it doesn't work all the time? $\endgroup$
    – CHM
    Commented Mar 28, 2012 at 20:49
  • $\begingroup$ your matrix isn't hermitean so it may in general have complex eigenvalues and eigenvectors (and not all with the same phase). the dot product of two complex vectors is complex (in general). $\endgroup$
    – acl
    Commented Mar 28, 2012 at 20:51

Apparently this can be made to work for exact input.

mat = {{1002/1000 I, -1}, {-1, -I}};
evecs = Eigenvectors[mat];

ovecs = Simplify[Orthogonalize[evecs, Dot]]

Out[122]= {{0, 
  0}, {(I*(-1001 + Sqrt[2001]))/Sqrt[-4002 + 2002*Sqrt[2001]], 
     500*Sqrt[2/(-2001 + 1001*Sqrt[2001])]}}
    mat = {{1002/1000 I, -1}, {-1, -I}};
    evecs = Eigenvectors[mat];

The problem is that their dot product is zero, so we cannot get a full set in this way. Stated differently, according to this "inner product" they are actually parallel.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.