I would like to define a 3-D vector as say v={x,y,z}, but I want it to have a fixed norm, say a unit norm |v|=1. How do I impose this condition on v.

  • 1
    $\begingroup$ how about v=Normalize[{1,2,3}]? $\endgroup$ – Pinguin Dirk Mar 14 '13 at 17:14
  • $\begingroup$ Suppose that I write v = Normalize[{x, y, z}]. Then FullSimplify[v.v] gives (x^2 + y^2 + z^2)/(Abs[x]^2 + Abs[y]^2 + Abs[z]^2), but I want to get simply 1 as the answer. I do not want to specify x,y,z as numbers as in this example. $\endgroup$ – seckin Mar 14 '13 at 17:20
  • 1
    $\begingroup$ In order to simplify the way you want, you need to tell Simplify that you are using reals, like so: Simplify[v.v, Element[{x, y, z}, Reals]] $\endgroup$ – Pinguin Dirk Mar 14 '13 at 17:33
  • $\begingroup$ @PinguinDirk Your comments could provide a perfect answer, others might find it useful too. $\endgroup$ – István Zachar Mar 14 '13 at 17:45
  • $\begingroup$ @IstvánZachar: I figured that a short comment is perfect for this kind of a question :) I added an answer just now, see below. Thanks for your feedback $\endgroup$ – Pinguin Dirk Mar 14 '13 at 18:15

To summarize my comments to the question:

In order to get a normalized version of your (real) vector, just use Normalize:


Note that you can also use other norms in Normalize, see the documentation for that. I shall assume you want the Euclidean one.

Assume we consider a general normalized vector

v= Normalize[{x, y, z}]

In order to get the desired result from Simplify of v.v, you need to tell Mathematica that {x,y,z} are real:

Simplify[v.v, Element[{x, y, z}, Reals]]


as Mathematica assumes by default that $x,y,z$, respectively are complex (and obviously, for e.g. a complex $x=i$, we have $Abs[x]^2=Abs[i]^2=1^2\neq-1=i^2=x^2$, so it cannot simplify in general). Telling Mathematic that we use reals, we have $x^2=Abs[x]^2$ and get the desired result.

  • $\begingroup$ thanks for the answer, this helps. Can I also set x,y,z real to start with and get the answer without using this option in Simplify. I suppose, I can. I will try it tommorow morning. $\endgroup$ – seckin Mar 15 '13 at 1:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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