Consider two vectors v1 = 1/Sqrt[2] {{Exp[I y/2]}, {Exp[-I y/2]}}; and v2 = I/Sqrt[2] {{Exp[-I y/2]}, {-Exp[I y/2]}};, such that u = FullSimplify[n (v1 - v2)], with n a normalization constant. Now, in this case, the dual of u is not simple ConjugateTranspose[u], but is defined as udual = Transpose[A.B.Conjugate[u]]; with A = 1/Cos[y] ( { {I Sin[y], 1}, {1, -I Sin[y]} } ); B = PauliMatrix[1]; where y is real.

Now FullSimplify[udual.u, {Element[y, Reals]}] leads to 2 n Conjugate[n] Cos[y] which immediately tells us that $n=1/\sqrt{2 \cos y}$ is the normalization constant. So let's now define our normalized vector and its dual as

unorm = FullSimplify[1/Sqrt[2 Cos[y]] (v1 - v2)];
udualnorm = Transpose[A.B.Conjugate[unorm]];

Now I expect udualnorm .unorm to be 1, but it is equal to $1/{\rm sign}[\cos y]$. What is going wrong here?

All code in one block for ease of copy/paste:

v1 = 1/Sqrt[2] {{Exp[I y/2]}, {Exp[-I y/2]}};
v2 = I/Sqrt[2] {{Exp[-I y/2]}, {-Exp[I y/2]}};

u = FullSimplify[n (v1 - v2)]

A = 1/Cos[y] ( {{I Sin[y], 1}, {1, -I Sin[y]}});
B = PauliMatrix[1];
udual = Transpose[A.B.Conjugate[u]];

FullSimplify[udual.u, {Element[y, Reals]}]
(* Out: 2 n Conjugate[n] Cos[y] *)

unorm = FullSimplify[1/Sqrt[2 Cos[y]] (v1 - v2)];
udualnorm = Transpose[A.B.Conjugate[unorm]];

udualnorm . unorm
  • $\begingroup$ Although these won't answer your question directly, here are a few comments. Mathematica does not distinguish between column and row vectors, so you can drop one layer of braces in the definitions of v1 and v2: v1 = 1/Sqrt[2] {Exp[I y/2], Exp[-I y/2]}; v2 = I/Sqrt[2] {Exp[-I y/2], -Exp[I y/2]}; and get the same results. Second, you may have forgotten to mention that you must have used Simplify or FullSimplify[udualnorm, Element[y, Reals]] to transform your final result to 1/Sign[Cos[y]]. $\endgroup$
    – MarcoB
    Oct 3, 2022 at 16:12
  • $\begingroup$ @MarcoB, thanks for the comments. You are right, I used FullSimplify to arrive at that expression. If you known someone who can answer, please share the question. $\endgroup$
    – User101
    Oct 3, 2022 at 17:10

2 Answers 2


Try this:

udualnorm = Refine[Transpose[A . B . Conjugate[unorm]], _Symbol ∈ Reals]
PowerExpand@FullSimplify[ComplexExpand[udualnorm . unorm]]
  • 1
    $\begingroup$ thank. What does _Symbol do here? $\endgroup$
    – User101
    Oct 3, 2022 at 19:16
  • $\begingroup$ Match the pattern that the symbols in your expression are real numbers (Note that Head[y]===Symbol). In this case, the symbol is just the letter y, but it's useful to do this when you're working with more symbols. For example, if you calculate Norm[{a, b}] you get Sqrt[Abs[a]^2 + Abs[b]^2], but if you add the assumption Refine[Norm[{a, b}], _Symbol \[Element] Reals] you get Sqrt[a^2 + b^2]. $\endgroup$ Oct 3, 2022 at 21:20

OP makes a calculation (many details of which are not relevant) involving a nonzero complex number n, and a real number y. The result of the calculation is

2 n Conjugate[n] Cos[y]

OP wants to set this expression equal to 1. The problem is that this is not possible when Cos[y] is negative, because n Conjugate[n] > 0 for every nonzero complex n.

With the intention of making the above expression equal to 1, OP then makes the following

choice = n->1/Sqrt[2 Cos[y]]

This will be real for some y and imaginary for some other y (let us assume that Cos[y] is not zero) and we get

2 n Conjugate[n] /. choice // FullSimplify
(* 1/Abs[Cos[y]] *)

Note the Abs, which must be there, because n Conjugate[n] > 0 always. Therefore

2 n Conjugate[n] Cos[y] /. choice //FullSimplify
(* Sign[Cos[y]] *)

meaning the result $+1$ when $\cos y$ is positive, as OP wants, but it is $-1$ when $\cos y$ is negative, which makes perfect sense. See Sign.


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.