Talk:Quaternions and spatial rotation/Archive 1

Original article basis
This article is marked:

Author: M. Romero Schmidtke. Translator: August Pieres.

Please can the authors confirm that this is original work, donated under the GFDL?


 * The article appears to be a translation from this Enciclopedia Libre article; M.Romero Schmidtke is a regular contributor there. AxelBoldt 01:26 Apr 7, 2003 (UTC)

Thank you, August Piers, for this translation of my article. I would surely not have done better. And yes, it is an original work, writen specifically for enciclopedia libre and the spanish wikipedia.

M. Romero Schmidtke, April 26, 2003.

The following text was cut from the main page. -- Fropuff 03:48, 2004 Aug 2 (UTC)

Versors
Versors are described in Earliest Known Uses of Some of the Words of Mathematics (under Tensor) and in this tutorial, but I found neither clear or relevant enough to be included in the References. -- Jitse Niesen (talk) 11:29, 10 September 2005 (UTC)

a thought
One can specify a rotation in n dimensions by specifying two unit vectors A and B. The specified rotation is that which maps A onto B. The axis of rotation in n dmensions is a surface of (n-2) dimensions. Only in three dimensions is this axis itself one-dimensional.
 * If you want to generalize rotations to higher dimensions, it's often much easier to think of rotations "over" a plane, instead of around a "hyper" axis. In 3D, we happen to have a vector as axis, which is the normal of the plane we are rotating over. In higher dimensions this "axis" wouldn't be a simple vector any more, but the thing that axis is normal to will still be a 2D subspace (plane).

I would guess, then, that a quaternion of rotation is equivalent to the cross product of the two unit vectors A and B, which is also a vector only in three-space, and whose magnitude also varies as the sin of the angle.

I'm not sure what you mean by "The specified rotation is that which maps A onto B." In 3 dimensions, there can be many rotations that map A onto B, not just the ones with the cross product as axis. Jwwalker

29 November 2005

I think perhaps the original suggestion is well defined, but the contributor is confusing the point with incorrect vocabulary and muddled concepts. What is probably meant is as follows:

One can specify a rotation in n dimensions by specifying two reflections. Indeed, this is the definition of a rotation. Each reflection can then in turn be specified by a corresponding unit vector, orthogonal to the (n-1) dimensional subspace which is invariant under the reflection. There are two such vectors: A and -A. If we choose positive notation by convention, A is mapped to -A under the reflection represented by A.

Composing with a second reflection B moves -A to its final desination = 2[A|B] B - A, where [x|y] specifies the finite dimensional inner product, following the notation of quantum mechanics for infinite dimensional inner products (). [A|B] is of course the cosine of the angle between A and B, call it t, and defines this angle unambiguously. Therefore, A is rotated by an angle 2t through B, in the two dimensional subspace containing both A and B. The 'axis' of rotation is the n-2 dimensional subspace fixed by the composition of the two reflections A and B and is orthogonal to the plane containing A and B. I say 'axis' because its use in this context is an unforgivable corruption of terminology.

Returning to the topic at hand, namely quaternions, one may form the rotation which takes the three dimensional vector A to B in the plane of A and B by calculating sqrt(AB). As the second contributor correctly notes, there are infinitely many other rotations which move A to B. Of course, if A and B are not of unit magnitude, the resulting square root needs to be normalized.

The square root of a quaternion rotation operator is the quaternion operator which, when applied twice to all vectors in three space, yields the same movement as the orginal operator applied once. The square root rotates about the same axis, but by only half the angle. So given q=-cos(t )+usin(t ), which rotates 3-vectors about the axis u by an angle 2t, sqrt(q)=-cos(t /2)+usin(t /2). u is of course a unit pure quaternion specifying the axis of rotation (i.e. a three dimensional vector), and the resulting operator moves vectors by an angle t about u.

An interesting alternative axis of rotation for moving A to B is the unit vector bisecting the angle between them. In this case, the rotation operator is a pure quaternion (t = 90 degrees) formed by computing (A/|A|+B/|B|)/|(A/|A|)+(B/|B|)|, where |x| denotes the norm or magnitude of x.

P.S. As an after thought, the main article on quaternions and spatial rotation needs to be completely rewritten. It is confusing and misleading in places and was clearly authored by individuals who rarely use quaternions in practice, and therefore lack intuitive understanding.

14 December 2005

Well, it seems either no one is tracking this article's discussion, or no one is critically reading it, since the egregious error in my equation for the final destination of A above went unnoticed and uncorrected by others. It is now correct. It seems I muddled the forms for orthogonal bases and self referential bases in my head, which just goes to show extemporaneous online mathematical discourse is error prone. The correct equation is completely self referential.

Ironically, I had the presence of mind to correct the omission of the sqrt in [A|B] B - sqrt(1-[A|B]^2)A the first time I revisited the page, but didn't notice the orthogonal basis adjustment factor was unnecessary, and incorrect in this context.

In spite of these foibles, per wiki etiquette, I am announcing here in the discussion that I have decided to rewrite this article in stages over the next few months, whenever I have a few hours to kill. This is a heads up, in case someone else has adopted this article, or may wish to collaborate on the revision. While I am evidently not the most competent person for the job, apparently no one in the current time frame has greater competence.

When I am finished, the article will be completely new, and I will therefore delete the copyright issue noted above, as it will become irrelevent.


 * Hi. Just a note that you are being watched :) . I don't know much about quaternions though and I never used them, so don't expect any help on the maths from me. Please go ahead and improve the article as you see fit. I hope you'll create an account first; that makes it easier to communicate and it enables you to tell us your background; alternatively, if that's what you want, it gives you more anonymity because it hides your IP address. Oh, and don't use this [ | ] notation for inner products unless it really is standard in this context; it most certainly is not standard in the general area of mathematics. I use x &middot; y or xTy or &lang;x,y&rang;; you may also use the physicists' &lang;x|y&rang; notation if you like it; it certainly is not restricted to infinite dimensions. Good luck! -- Jitse Niesen (talk) 23:02, 14 December 2005 (UTC)

3 January 2006

Well, it is good to know some discussion takes place before revisions. Regarding anonymity, I have no personal online access and use public terminals exclusively. For the purposes of this effort, I've been making a point of using the same public terminal so that the URL in the history consistently identifies me. Therefore, contributing without an account gives me the greatest anonymity, for I can change terminals in a trice.

Regarding notation, I will stick with what I've used above for reasons which will become apparent. I've nearly completed the revision in my head, and will begin data entry later this week. As far as unconventional notation goes, it is worth noting that Conway, in his recent book on octonians, implicitly defines the norm of a vector as the square of what is usually considered to be a norm, as a contradistinction to the magnitude. It is a good idea, and it sets a useful precedent, something which someone of Conway's stature can easily get away with.

14 Jan 2006

A word of encouragement: The author of the article is doing a better job of explaining a somewhat tricky subject than is usual - rather than simply displaying erudition, as some authors do, he/she seems to be genuinely aware of the pitfalls that can trap (and even dishearten) the interested but non-expert reader; if the Wikipedia is to be useful, it is to this level that I believe it should be targetted. Thanks. PGE.

17 January 2006

Since I'm still quite a wiki-neophyte, there are some editing details that need attention
 * The citation mechanism I'm using is ad hoc, created merely to enter the data. What is needed is a footnote placing the data at the end of the article, with a numbered link in situ.  I don't know how to do this.
 * As things progress, the addition of several figures would be illuminating. I don't know how to  make or insert such graphics.
 * The math mode creates very awkward font size changes. My predisposition thus far is to make it look right in an ad hoc way.  This will become increasingly burdensome as things progress.  On the other hand, the formatting choices of the math system are usually positively repulsive aesthetically.

I trust there are more experienced individuals who can help with this. Thus far, I've mostly simply imitated notation existing in the page, and gleaned a few techniques from the "cheat" link on the edit help page. Therefore, if someone would fix a citation, I can figure out what needs to be done with the rest of them.


 * Adding an image to this wikipedia is a simple matter - I did the images on the Mobius Transformation page. Creating them is quite a bit trickier. I did the 3d images with a tool called "PovRay", but that is not an interactive graphical tool: you have to greate a description file and tell your machine to render it. Pmurray bigpond.com 23:56, 20 February 2006 (UTC)

In Summary
The "Quaternion rotation" has a summary where it gives the cookbook formula for making a quaternion given an angle and a unit vector.

Could someone add the converse - the formula for getting the vector and the angle from an arbitrary quaternion? Yes, I suppose the reader can work it out from what's given but it would be nice and encyclopedic to include it.

Actually - why not make this summary a separate section? Name it "this is how you actually do it", or something.

Oh - and why use  (rather than the dot operator) for the dot product when the cross operator is used for the cross product?

As an afterthought: please don't remove these equations. There's an annoying trend on the math pages for hard-core math guys to remove the cookbook ("analytic") stuff. I imagine they feel that people should make the effort to understand the deeper beauties and derive the equations themselves, because the actual resulting equations are uninteresting: but it really imposes a learning curve and makes it difficult for people like me who just want to write code.

Too technical
This article certainly needs many cleanup, accessibility change, tone and style change, and even an rewrite. Personally, I think this article should be moved to wikibooks, but it is also true that wikipedia could use an article that explain how to do spatial rotation using quaternion in detail, through not excessively(translation: not too long that scare away all people).

I suggest that it be moved to wikibooks, and either rewrite this article here, or take the following measures to take it up to encyclopedia article standard:
 * The introduction on certain special properties of quaternion can be summarized and moved to the main quaternion article.(And yes, the non-commutativity of rotation can be better explained by using a diagram)
 * While useful for an indepth understanding, I don't think doing rotation would need understanding projective space, operator space, and all the like. The concepts section cannot stay, I'm afraid
 * Historical terminology(!) can be moved to their respective article.(PS: does this section imply that sometimes historical terms will be used?!)
 * Modern terminology can be moved to the last part of this article, sort of like an appendix, until we know what to do with them.
 * I know there is difference in notation in computer science and mathematics, even for the same concepts, but I think for the part that shows the mathematics, derive how to do rotation, prove that it is correct, etc, they should use standard mathematics notation(We have LaTeX, sir), so that it is accessible to mathematician.
 * And then, if there's even an algorithm section, that can use the computer science group's notation, if there's a difference.
 * Instead, the algebraic rules section should be moved to the beginning, as a summary/revision.
 * The rest is ok as it stands. Through the derivation of quaternion for rotation(That is, the main point of this article, afterall) need quite some expansion.
 * And as a sidenote, the citation can be done in a footnote style, rather than brackets everywhere(check any featured article and notice some small number that occassionally appear at the end of a sentence.)

That's all for now, thanks. --Lemontea 02:34, 23 April 2006 (UTC)


 * Agree. The article is not too technical; its too verbose. The mathematics behind this is actually quite easy, but you would never guess that from this article. The sheer heft of this article is daunting. This whole thing should be moved to wikibooks, and re-written from scratch. linas 14:56, 18 August 2006 (UTC)


 * Yes. FAR too technical. The person talking about rotating vectors makes much more sense to me than talking about reflections. The person saying reflections are the basis of the definition of rotation may be right for 4 or higher dimensions, but I really don't think this needs to be mentioned in the article at all, it only confuses me.

Copied?
Has this article been copied from some other site? For one thing, there's this:

''...which will not equal the absolute position implied by the sum produced in another representation. This problem arises when simply translating the origin some small distance from the original representation. (illustrative figure here) The positions are unique absolute physical positions, whereas the n-tuple is merely a symbolic abstraction....''

Which looks as if a hyperlink was lost in the conversion to text, and nobody noticed.

For another thing, this is not Wikipedia style at all. It reads like a very, very boring book. Worse still, it doesn't actually make sense to anyone who doesn't already know what the article is about. I'm trying to make sense of it, but it's just frustrating the hell out of me.

My brother once said, "I've looked on Wikipedia, but I didn't understand it." This is my first go at that experience. 86.136.82.105 15:31, 9 May 2006 (UTC)


 * The source is mentioned at the top of this talk page. Actually this is a small corner of wikipedia that I'm afraid are rarely visited, as shown by how my comment and suggestions(see above) recieve no reply, not even acknowledgement or objection. And it's true that this topic is a quite specific and difficult one. Anyway, I tried to understand quaternion by starting from the matrix representation of complex number. Why rotation was done that way is still unknown to me. --Lemontea 11:25, 10 May 2006 (UTC)

no pictures
That's pretty extreme to discuss that whole article without a single picture.

Re. ^^^^: People's heads probably started aching before they got up to there.


 * Here are pictures. I'm a bad graphist, as you will notice. But that's better than nothing and helps understand the maths. MathsPoetry (talk) 14:45, 19 April 2009 (UTC)

Could we have something a bit more to the specific topic?
Could we have something a bit more to the specific topic? The topic is not quaternions, which already exists (elsewhere), it is quaternions and spatial rotation. I would be expecting something to tell me
 * 1) how to represent rotation in terms of quaternions
 * 2) why quaternions are better than matrixes.

It seems that Blender uses quaternions to represent rotations; perhaps that would provide some assistance from the Blender documentation. m.e. 05:38, 16 October 2006 (UTC)

Ya, *unfortuneately* (from a user standpoint), Blender does use Quats for "bone" rotation representation in the "IPO" (graph) editor.

I think that this article attempts to address the issue of the pros and cons of using different rotations representations in software systems. However, the issue is more complicated then just adding up the size and number of calculation for each representation. For instance rotations matrices are and out, up, and right vector that allow for easy strafing in a game. Also if you intend to use hardware acceleration using rotation matrices can be faster. I think that discussing the pros and cons of using different rotation schemes should be an article onto itself. —Preceding unsigned comment added by Jfischoff (talk • contribs) 20:19, 11 February 2008 (UTC)

Book Description and zy rotation
I changed some of the description for the initial "book" example, it appeared to me that the "spine direction" description was incorrect. If I have changed it incorrectly, please advise .. (and I'll be confused :) if so).

Also in the description of "In fact, the composition zy represents a single rotation of 180 degrees about the [-1 1 0] axis", does that imply from  [0 0 0] to [-1 1 0] ? I assume so, as otherwise I don't understand how an axis can be defined by a single point:) .. Unless it's more "understood" math terminology that I'm not familiar with :) Mike Stramba 17:19, 2 December 2006 (UTC)


 * Conventionally, an axis is represented by a unit vector (magnitude 1), such as the above mentioned [-1 1 0], so your assumption is correct. Btw, in two-dimensional space, a rotation axis is actually defined by a point. – Adrian Lozano 08:02, 4 December 2006 (UTC)
 * [-1,1,0] isn't a unit vector; it has norm \sqrt{2}.
 * In linear algebra, vectors are typically concieved as going from the origin to some other point in space. This leads to a common notational ambiguity; does a n-tuple represent the coordinates of a point in space, or a vector from the origin to the point? It could be either; the context helps if you really need to know. But often you don't, which only encourages the laziness. Endomorphic 02:43, 5 December 2006 (UTC)
 * My mistake, I don't know where my mind was – but an excellent example of laziness :-) – Adrian Lozano 23:37, 5 December 2006 (UTC)

Large edits planned
Is anyone actively editing this page at the moment? I would hack out the obfuscation in this article but for fears that someone else already has designs on it. Previous comments recommend an overhaul, and I concur. We have definitions from dictionaries a century old. We have vast notation and concepts sections which are at best redundant, at worst counterproductive. What should be the meat of the article doesn't arrive until three quarters of the way through. The article should *start* with 1.) q = cos(α/2) + u sin(α/2) and 2.) f_{q}(x) = q x q* and expand from there. Unless someone can provide a *really good* reason why so much history and handwaving needs to included in a practical article such as this, it's all going to get removed. Endomorphic 02:24, 5 December 2006 (UTC)


 * As a rank amateur researching quaternions, I would be delighted to see you perform the aforementioned surgery as soon as possible.


 * I've edited a technical magazine for six years and know irrelevancy when I see it. I followed this link sincerely hoping to see something such as, well... "1.) q = cos(α/2) + u sin(α/2) and 2.) f_{q}(x) = q x q* and expand from there". Over time, perhaps folks could even add in a few diagrams; the topic is, after all, rotations and spins.


 * The main issue is the obliviousness of the article to the link-intensive style of Wikipedia. That excellent style allows both amateurs (me) and experts (Endomorphic for example) to use the same articles with nearly equal ease. I follow nearly every link as a sort of guided study program. An expert looking at the same text skips over all the links and goes right to what they need. By replicating the contents of an old-style, stand-alone study book, this article instead creates an overly lengthy, out-of-context, and necessarily out-of-date tome that is equally frustrating for both amateurs and experts.


 * As a consolation for the sincerely directed efforts of the translator, perhaps some of the early materials could be used to create small, new, properly linked entries for topics not already covered. I seriously doubt the resulting small articles would even be referenced by the final version of this one, though.


 * Finally: Since fools go where angels fear to tread, and since I am, ah, very much in the former category, I hereby give fair warning that I will shortly undertake to do a major chop on this critter if Endomorphic or someone else does not do so fairly soon. I can't add anything, but as an editor I know what irrelevancy looks like, and I can be a terror with the editing knife when the circumstances merit it.


 * Terry Bollinger 18:34, 30 December 2006 (UTC)


 * Good grief, what are you waiting for? This bizarre article is in dire need of cleaning up.  Nearly all of it is irrelevant, rambling, incoherent, confusing and frustrating. —The preceding unsigned comment was added by 134.174.9.30 (talk) 17:22, 17 January 2007 (UTC).


 * I couldn't state it better Jtico 22:50, 31 January 2007 (UTC)


 * Done. What this (severely) reduced version now needs are more specifics about applications, e.g., orbital mechanics. I don't have the details, but I know NASA has done a lot along those lines. I'll try to find someone to ask, or maybe a public domain report.


 * Incidentally, parts of the excised version tracked closely in content and order to Roger Penrose's section on visualizing quaternions in The Road to Reality. In particular, Penrose goes through much the same discussion of flipping a book around. Such visualization topics may have enough meat to merit a separate Wikipedia article (not here!). Frankly, though, I'd rather add in a reference at an appropriate spot to the chapter in Penrose's book, which does a pretty decent job of describing the visualization aspects of quaternions. (That said, all such attempts that I've seen, including Penrose's, are not for the visually faint of heart...)


 * Terry Bollinger 04:02, 1 February 2007 (UTC)


 * Excellent work. More is required; in particular, sometime I'd like to be motivated enough to detail:
 * The advantages over matrices mentioned in the intro. I (Bjones410 21:04, 30 May 2007 (UTC)) added some performance comparisons between quaternions and other rotation methods, though I'm not sure that's what you mean by "advantages."
 * Distinction between quaternions representing points in 3D space and quaternions representing rotations.
 * The double-cover issue
 * The good news is it's more like pruning a hedge into the shape of a fish, rather than chainsawing a path through the Amazon. Endomorphic 21:30, 1 February 2007 (UTC)


 * Thanks, and all three of those possible additions sound very useful. Good use-the-main-ref trim of the basic operations section too -- brings the important material up to the start, where they should be.


 * Interestingly, the double cover section is one of the few early parts I thought about trying to preserve. It's and important and fascinating aspect of how quaternions relate to symmetry groups, and could be helpful for anyone coming here to gain insights on particle spin. A fresh start seemed better, though. Terry Bollinger 02:47, 2 February 2007 (UTC)

Discussion of non-commutativity insertion
Janek Kozicki: Your description of the book analogy in 3D space looks correct, and its an interesting point related to rotations of quaternions. However, you might want to think about where you have positioned it versus the kinds of readers most likely to link to this article. I suspect most such readers will not understanding how quaternions are used to represent rotations in the first place -- and until they can fully understand that, an immediate discussion of non-commutativity will not be what they expect, nor something they will easily be able to follow. They may understand the analogy fine, but not why it is being told to them.

I think a paragraph like the one your wrote might fit nicely somewhere within the overall group of quaternion articles, but I would suggesting thinking about location a bit more.

Terry Bollinger 05:40, 5 February 2007 (UTC)


 * Sure, you might be right. If you find a better place please feel free to move it there :) Maybe I'll find something too, I dunno. I was just writing an appendix about quaternions in my thesis, and I thought that this paragraph from my thesis might be interesting for the people. Janek Kozicki 20:12, 6 February 2007 (UTC)

It is interesting, readable, and relevant to quaternions, so placement is the question... I'll think on it a bit, and meanwhile, if you find a good spot, by all means feel free to take the initiative.

There may even be a potential for a new article of some sort, something about visualization in general of quaternions (Quaternion visualizations? Hmm. Not title that leaps to mind, is it?) The rotation focus of this Quaternions and spatial rotation can be done almost purely mathematically, making it less critical to have the visualization here...

Actually, one place I think material like this would be very relevant is in explaining the concept of non-commutativity in general to intro math folks. This concept is often presented so mysteriously that people can't see any connection to ordinary circumstances; your book example shows that there are quite ordinary operations on real objects that are non-commutative (or non-Abelian). The Commutativity article itself might be a plausible location, for example, with a proper intro...


 * I think the example of non-commutative rotations is good to have in the article, but I don't think the current explanation is clear enough. For someone who is good at thinking in spatial terms, it's easy to follow, but many people will not be, especially people who are new to quaternions. A diagram would really help here, maybe an animated GIF? Does anyone have the ability to make a good one? - Rainwarrior 20:09, 10 February 2007 (UTC)

I disagree with a lot of the intent in the above posts. Representing rotations with quaternions is a specific technical idea. I'm not saying that the article should be filled with jargon; merely that handwaving descriptions of rotating books won't be useful to someone who arrives at Wikipedia wanting to know how to rotate with quarternions. That being said, the book analogy is good, but perhaps it should go at "Non-commutativity" itself, which currently redirects to commutativity. Add a little For a technical discussion of non-commutativity, see Commutativity. line, and you have the perfect place to explain why Rubics Cube's are so difficult. Endomorphic 20:27, 11 February 2007 (UTC)

Application to 3D animation
This article is too technical for me. How are Quarternions used in 3D graphics? --24.249.108.133 22:59, 11 April 2007 (UTC)

Great reference
A wonderful article on all this, which provides a historical picture and, at the same time, shows very clearly how to do calculations with quaternions in a way that will make sense to people with only a background in vector analysis, is "Hamilton, Rodrigues, and the Quaternion Scandal" by Simon L. Altmann, Mathematics Magazine, Vol. 62, No. 5. (Dec., 1989), pp. 291-308.

R. Wilsker

Rwilsker 15:36, 17 August 2007 (UTC)

Disambiguation page needed for "versor"
Etimology: VERSOR (from Latin versus = toward (or turned), from past participle of vertere = to turn)

Please remove the redirection from "versor" to "quaternion". The word refers to different concepts. For instance,
 * 1) For some authors a versor is a unit vector describing the orientation of a Cartesian axis, i.e. any one of the vectors forming a standard basis, or, more generally,
 * 2) the normalized vector of a non-zero vector (see unit vector).
 * 3) From Earliest Known Uses of Some of the Words of Mathematics: "VERSOR. The term VERSOR was introduced by William Rowan Hamilton (1805-1865). It appears in his Elements of Quaternions ii. i. (1866) 133: “We shall now say that every Radial Quotient is a Versor. A Versor has thus, in general, a plane, an axis, and an angle.” (OED and Julio González Cabillón.) Unlike VECTOR and SCALAR, two of Hamilton's other QUATERNION terms, versor did not enter general currency."
 * 4) In 1901, Wilson (a pupil of Josiah Willard Gibbs), defined the versor as a particular kind of dyadic representing a rotation (i.e. something similar to an orientation vector or rotation matrix, as far as I can understand) [See, page 335].

I conclude that "versor" is a generic word used to indicate different mathematical objects which represent the orientation of a vector (directed line segment), or directed axis, or system of directed axes, or rigid body, although the etimology of the word (see above) makes it more appropriate to indicate an object representing direction (i.e. the orientation of a single axis or vector, as in points 1 and 2), rather than all kinds of orientation (as in points 3 and 4).

Notice that, according to Earliest Known Uses of Some of the Words of Mathematics (see point 3 above), the word versor, as defined by Hamilton with reference to quaternions, "did not enter general currency".

The word "versor" should point to a disambiguation page, containing at least links to these articles:
 * Unit vector (where I added the specific definition of the word "versor").
 * Cartesian coordinate system (where I added the specific definition of the word "versor", and a reference to standard basis).
 * And if you like, to Quaternions and spatial rotation (but in this case somebody should add the relevant definition of the word "versor", which is missing).

I don't know how to build a disambiguation page. Would you mind to do it, and (if you believe it is needed), insert in this article Hamilton's definition of the word? Thanks, Paolo.dL 21:29, 22 August 2007 (UTC)

Derivation of Rotation Matrix from Quaternions
The derivation section does not derive anything actually, it just proves that the double sided multiplication could be a rotation operation. But there is no clue why this should really be a calculation. And it simply says "it turns out that a=cos(alpha/2)". Isn't there any complete derivation of double sided quaternion multiplication as 3D rotation? One can't simply say that complex multiplication is rotation so that quaternion multiplication should also be a rotation... —Preceding unsigned comment added by 130.225.73.232 (talk) 14:54, 19 December 2007 (UTC)


 * Section being discussed: Quaternions_and_spatial_rotation. If anyone can provide a reference to an actual derivation of a rotation matrix from a quaternion transformation, please do so in the section. WinterSpw (talk) 15:12, 5 July 2016 (UTC)

Matrix to Quaternion Conversion
Is there a simple formula for converting a (special) orthogonal matrix to the corresponding rotation quaternion? The best I can figure out is to solve the axis and angle from the matrix and go from there, but I thought there might be an easy formula. 198.99.123.63 (talk) 16:32, 24 April 2008 (UTC)


 * The problem is to find a, b, c, d given a2 + b2 + c2 + d2 = 1 and the matrix
 * $$M = \begin{pmatrix}

a^2+b^2-c^2-d^2&2bc-2ad       &2ac+2bd        \\ 2ad+2bc       &a^2-b^2+c^2-d^2&2cd-2ab        \\ 2bd-2ac       &2ab+2cd        &a^2-b^2-c^2+d^2\\ \end{pmatrix}$$.
 * That's ten equations in four variables, so there are lots of ways to solve it. The only hard part is finding an approach that's numerically well behaved for every possible rotation. I don't know anything about numerical analysis, but I think the following will work fairly well. From the matrix diagonals and a2 + b2 + c2 + d2 = 1 you get
 * a2 = (1 + Mxx + Myy + Mzz) / 4
 * b2 = (1 + Mxx − Myy − Mzz) / 4
 * c2 = (1 − Mxx + Myy − Mzz) / 4
 * d2 = (1 − Mxx − Myy + Mzz) / 4
 * Pick the largest of these and resolve the quaternion sign ambiguity by taking the positive square root. Then compute the other three coefficients (with sign) from the off-diagonal entries. For example if a2 is the largest then compute b = (Mzy − Myz) / 4a and so on. -- BenRG (talk) 12:16, 27 April 2008 (UTC)
 * I just noticed that you can find this exact algorithm in Rotation matrix, as well as a few variations. It's not really the simple formula you were looking for, but I think any simple formula will fail on some rotation matrices. -- BenRG (talk) 12:43, 27 April 2008 (UTC)
 * I just noticed that the transform from quaternion to matrix is different from that from the following website: http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToMatrix/index.htm, I think the formular in Wikipedia have switched the sign on off diagonal components.-- Bamboo77 (talk) 1:02, 10 November 2009 (CSU)

simple example
I think something like that would fit better for the explanation of non commutativ of rotations.

A simple example, take a die, rotate so that you see the 1 in front of you. Rotate it around the y-axis for 180 degrees. You can now see the 6. Rotate about the y axis for 90 degree. You will see now the "4". Another Rotation about 180 degrees about x axis will show you an 2. If you change the rotations, like first 180 degree about x axis, and then again 180 degree about x axis (total of 360 degree) and then 90 degrees around the y axis. All you get is a rotation around the y- axis for 90 degrees. —Preceding unsigned comment added by 213.61.226.6 (talk) 12:00, 28 March 2008 (UTC)

Comparison with Rotation operator (vector space)
Duplicate thread deleted, see Talk:Quaternion. -- BenRG (talk) 01:43, 14 August 2008 (UTC)

Quaternion "handedness"
Note that quaternions, like any other rotation or linear transform, are not "handed" (as in left-handed vs right-handed). Handedness of a coordinate system comes from the interpretation of the numbers in physical space. No matter what the handedness convention, rotating the X vector 90 degrees around the Z vector will yield the Y vector -- the math and numbers are the same. I think this paragraph is confusing at best, since "rotating the X vector 90 degrees around Z" is subject to convention too (clockwise or ccw?). Moreover, the last sentence seems false to me (not always true at least), since in a left-handed coord. system, rotating the X axis 90 degs. around the Z axis, does actually yield -Y axis, provided we use the right hand rule for rotations. Any comments on this? Should this paragraph be changed to be clearer? 87.220.148.171 (talk) 16:39, 29 September 2008 (UTC)

Another thing I've noticed: the previous paragraph states that "The above matrix assumes row vectors on the left". This is plain wrong. It's exactly the other way around (I'm assuming right-handedness here). You can check yourself by trying to rotate every axis over every other axis using the given matrix. For example, acoording to the given matrix, rotating Y axis over X (remember it's supposed to be for row vectors) yields the -Z axis, when in a right-handed system it should yield the Z axis. Comments? 82.144.14.242 (talk) 11:33, 20 October 2008 (UTC)

I've deleted the section. I'm not the user posting the previous paragraphs but the section is indeed confusing and may be wrong unless the creator of that section assumed very unusual conventions for rotations. — Preceding unsigned comment added by 190.230.143.36 (talk) 22:21, 19 September 2012 (UTC)


 * I've reversed the deletion because the lack of handedness is important (the cross product is oriented). I concur that the section is confusing, and will look at restating it in a clearer way. — Quondum 10:21, 20 September 2012 (UTC)

Sample code
OK, so this is a shameless piece of self promotion, but I have created a short set of C routines that perform rotations using quaternions. The code is available here under the GPL, and the site has no advertising nor any kind of commercial activity. I have refrained from adding it as an external link, as stated in the external link guideline, but provide it here for interested parties. If someone else wants to add it as an external link, that is fine by me! 129.78.64.102 (talk) 05:49, 30 January 2009 (UTC)

Vectors and components
(Moved from my talk page. -- BenRG (talk) 14:43, 28 April 2009 (UTC))

Hi Ben,

Thank you for having reviewed and corrected my changes on that page.

Ouch...it looks rather strange to me to read $$\vec{v} = (x, y, z)$$, or in words that a vector $$\vec{v}$$ is *equal* to its coordinates (x, y, z)... For me, a vector *has* coordinates, but does not equal them.

But I suppose this is only the effect of (mathematical) cultural differences. I am French and in France, we write either $$\vec{v}(x, y, z)$$ or $$\vec{v}\begin{pmatrix}x\\y\\z\end{pmatrix}$$ or $$\vec{v}\begin{vmatrix}x\\y\\z\end{vmatrix}$$ (no right bar), the most common being perharps the second one. What makes me think it is a matter of different languages is that you said in your comments that mathematicians "don't use it", which is obviously wrong when speaking of math books published in my country.

I just check the Euclidean vector English page and it is full of things like $$\vec{v} = (x, y, z)$$, which I would cross in red and give a bad mark if it were in a pupil's essay ;-).

We do write too $$\vec{v} \wedge \vec{w}$$ when the English write $$\vec{v} \times \vec{w}$$ for the cross product. This example is often cited to illustrate that the mathematical language is not a completly universal language.


 * Sorry, my mistake about the notation, I'd never seen it before (I was educated mostly in the US). When you wrote $$\vec{v}(x, y, z)$$ and later $$\vec{v}\begin{bmatrix}x\\y\\z\end{bmatrix}$$, I initially thought $$\vec{v}$$ was meant to be a function which constructed a vector from its three components. It didn't seem like the best choice of name since $$\vec{v}$$ looks like a vector, not a function, and is a vector elsewhere in the article. But then in a later section you wrote $$\vec{u}\begin{bmatrix}x\\y\\z\end{bmatrix}$$ and then referred back to $$\vec{u}$$, so apparently this notation actually introduces a name for the vector. To me that's like writing "x 3" in place of "x = 3". With an equals sign between $$\vec{u}$$ and the column vector it would make sense. But most of the vectors that were named $$\vec{v}$$ in this way were never referred to by name, so it would be better to drop the names to cut down on the reuse of that particular symbol. That leaves $$\begin{bmatrix}x\\y\\z\end{bmatrix}$$, which brings us full circle. In short, I don't understand why you think that $$\vec{v} = \begin{bmatrix}x\\y\\z\end{bmatrix}$$ incorrectly identifies a vector with its components while $$\vec{v} \begin{bmatrix}x\\y\\z\end{bmatrix}$$ is okay; they both seem to identify a vector with its components to the same extent, and the second doesn't agree with any notation I'd seen before. I don't think it's ever used in English-language texts.


 * Would you be okay with $$\vec{v} = a\hat{x} + b\hat{y} + c\hat{z}$$ instead of $$\vec{v} = (a,b,c)$$? I think it's a bit hard to read but I could accept it as a compromise.


 * I don't think $$\vec{v} = (x,y,z)$$ confuses anyone. One can argue against it on formalist or aesthetic grounds, but I don't think it actually in practice confuses anybody; it's clear what it's supposed to mean. I'd rather avoid mentioning components entirely in the article, but that seems difficult.


 * As you have guessed, $$\vec{v}\begin{pmatrix}x\\y\\z\end{pmatrix}$$ (with parenthesis and not brackets, my bad), is a notation that says "vector v has coordinates x, y, and z". $$\vec{v} = (x,y,z)$$ completly puzzled me, just like $$\vec{v}\begin{pmatrix}x\\y\\z\end{pmatrix}$$ puzzled you. That's just the effect of having learned maths in different places, I guess ;-).


 * Here is my answer to why $$\vec{v} = (0, 1, 2)$$ is incorrect from the point of view of someone who has learned maths in France. $$\vec{v}$$ is an element of a vectorial space, i.e. a mathematical structure just like groups or manifolds. A vectorial space is a set V with two operations : the addition between two vectors and the "external" multiplication by a scalar, and a set of properties, like commutativity, or "mixed associativity". This definition is completly independant of any coordinates system : vectors preexist their coordinates.


 * Here is a classical example of vectorial space V. Let's assume you have an euclidean space E, and you have four points P, Q, R, S in E. You define a relation ~ between two couples (P, Q) and (R, S) of E² as follows : (P, Q) ~ (R, S) if PQSR is a parallelogram. It can be proved that ~ is a relation of equivalence, hence you can define V as the quotient of E² by relation ~. You can define an addition and an external multiplication on V, and prove that this is a vectorial space. You are now entitled to call $$\overrightarrow{PQ}$$ a vector and to write $$\overrightarrow{PQ} = \overrightarrow{RS}$$. So far we have worked in a purely geometrical manner (with parallelograms) and not spoken about coordinates. By the way, this construction works the same on a line, a plane, a 3D space or a 4D hyperspace: we don't even know if we were in dimension 1, 2, 3, or 4 (or more)! To add the notion of coordinates, you need a number of special vectors that will act as a basis to measure coordinates. So you see that V (i.e. E²/~) and R² (or R³ or whatever) are very different mathematical beings. Vectors are not their coordinates, and you can even have vectors without coordinates. That's why, from my point of view, $$\vec{v} = (0, 1, 2)$$ is a monster, as it equates an element of V with an element of R³.


 * If V of dimension 3 uses R for its scalars, it can be shown that V is isomorphic to R³, but isomorphic sets are not equal sets. And if V uses elements of Q (rationals) or of C (complex numbers) for its scalars, that's not even true anymore! In such a case V would be isomorphic to Q³ or C³.


 * Having explained that, I understand it is probably a matter of cultural differences and historical considerations. If English speaking mathematicians are used to writing $$\vec{v} = (0, 1, 2)$$, fine. I will stick to writing $$\vec{v}\begin{pmatrix}0\\1\\2\end{pmatrix}$$ or "$$\vec{v}$$ has the coordinates $$(0, 1, 2)$$" in the French Wikipedia pages, and conform to $$\vec{v} = (0, 1, 2)$$ in the English pages. We can live together with cultural differences. MathsPoetry (talk) 07:06, 30 April 2009 (UTC)


 * I agree—vectors are not tuples of coordinates and shouldn't be confused with their components in some basis. It's funny that I wrote a response below talking about algebras modulo equivalence relations and then read your response here, which is about... pairs of points modulo an equivalence relation. It's clear we speak the same language; we shouldn't be having so much trouble communicating. I hope I can at least convert you to the view that ai + bj + ck is an unnecessary componentwise representation of a vector that can better be treated in a coordinate-free way, even when it's part of a quaternion. You dislike coordinates even more than I do, so it should be easy...


 * I don't really want to write $$\vec{v} = (x,y,z)$$, I just can't see a good alternative. $$\vec{v}(x,y,z)$$ is unfamiliar to me and presumably many readers. I would somewhat prefer $$\vec{v} = \begin{pmatrix}x\\y\\z\end{pmatrix}$$ if it weren't for the layout problems it causes. $$\vec{v} = x\hat{x} + y\hat{y} + z\hat{z}$$ is harder to read and I'm worried it might confuse people more than $$\vec{v} = (x,y,z)$$. $$\vec{v} = x\mathbf{i} + y\mathbf{j} + z\mathbf{k}$$ would be jumping the gun. -- BenRG (talk) 15:24, 30 April 2009 (UTC)


 * Yes, maths are basically a common language, despite some surface differences, and we have no trouble communicating once we identified the small changes in the notations.


 * I have nothing against coordinates. They are a powerful tool for a large number of problems, and, as you pointed out, they are an inefficient tool for other problems. What I have is a strong tendancy to put emphasis on the nature of the objects that we manipulate, hence my reluctancy to assimilate a vector to its coordinates, or (see next section) a vector to a quaternion. But, as I said, if people who have learned maths in English-speaking countries are familiar with $$\vec{v} = (x,y,z)$$, it's fine with me, as long as we realize that it is a standard abuse (your own words). So I think this topic is closed ;-). MathsPoetry (talk) 20:16, 30 April 2009 (UTC)

Proof that quaternions rotate vectors
Another remark. We could completly have avoided this historical a quaternion is a scalar plus a number historical approach and sticked to a purely algebrical approach. The proof that quaternions "rotate" vectors works with imaginary numbers i, j, and k too and I think it is more rigorous because it makes obvious that you have to add a zero fourth coordinate to your 3D vector to make it a quaternion. I think it would have been less confusing for the non-specialist readers: a lot of people are familiar to complex numbers, much less people are comfortable with vector algebra. Also, they would have only needed to learn one new notion (the three imaginary numbers), not two (that and the vector notation of quaternions). MathsPoetry (talk) 05:49, 28 April 2009 (UTC)


 * I think it would be a big mistake to write the proof out in components. It would be much longer and much harder to follow; the basic steps would be lost in the detail of having to repeat everything 3 or 3×3 times. Instead of
 * $$(\mathbf{v} - \mathbf{u} (\mathbf{u} \cdot \mathbf{v})) \cos \alpha + (\mathbf{u} \times \mathbf{v}) \sin \alpha + \mathbf{u} (\mathbf{u} \cdot \mathbf{v})$$
 * we would have something like
 * $$(v_x\mathbf{i} + v_y\mathbf{j} + v_z\mathbf{k} - (u_x\mathbf{i} + u_y\mathbf{j} + u_z\mathbf{k}) (u_xv_x + u_yv_y + u_zv_z)) \cos \alpha + ((u_yv_z-u_zv_y)\mathbf{i} + (u_zv_x-u_xv_z)\mathbf{j} + (u_xv_y-u_yv_x)\mathbf{k}) \sin \alpha + (u_x\mathbf{i} + u_y\mathbf{j} + u_z\mathbf{k}) (u_xv_x + u_yv_y + u_zv_z)$$
 * Is that really easier for anyone to understand? How easy is it to spot that the two occurrences of $$(u_x\mathbf{i} + u_y\mathbf{j} + u_z\mathbf{k}) (u_xv_x + u_yv_y + u_zv_z)$$ are the same compared to the two occurrences of $$\mathbf{u} (\mathbf{u} \cdot \mathbf{v})$$? Maybe it's easier to teach ij = k than the vector cross product, but there's no point in it. If you slog through dozens of rearrangement steps and applications of the ij = k rule but overlook the fact that $$(u_yv_z-u_zv_y)\mathbf{i} + (u_zv_x-u_xv_z)\mathbf{j} + (u_xv_y-u_yv_x)\mathbf{k}$$ is a vector perpendicular to the inputs in the direction given by the right-hand rule, you haven't really learned anything worth knowing; you might as well be writing "I won't chew gum in class" 100 times on the blackboard. I'm not saying the current proof is very insightful, but writing it out in components would make things much worse.


 * I don't particularly think that you have to add a 0 to a vector in order to turn it into a quaternion. I think that adding 0 is a no-op. It's like saying that the i in eiπ = −1 is really the formal pair (0+1i); it's certainly a valid way of constructing and thinking about complex numbers, but I don't think it's helpful to beginners. You don't need to construct quaternions as formal pairs or quadruples to work with them; it's sufficient, and a lot easier, to just remember $$\vec{u}\,\vec{v} = \vec{u}\times\vec{v} - \vec{u}\cdot\vec{v}$$. (Or i2 = j2 = k2 = ijk = −1, but that's less convenient in practice.) -- BenRG (talk) 14:43, 28 April 2009 (UTC)


 * First, a vector is *not* a quaternion. In this particular example, vectors are members of three dimensional vector space V, while quaternions are members of four dimensional set H. That's precisely the problem of the a quaternion is a number plus a vector approach: it is basically a convenient notation to put the real part on one side and the imaginary part on the other side, but you see it as if it were a real addition. So your remark I think that adding 0 is a no-op shows that you are being fooled by this notation. It is really much more as adding 0, it is changing a three dimensional being (the vector) into a four dimensional being (the quaternion). If you had to program the rotation of a vector with quaternions in a computer program, you'd perfecly see that you need to convert class vector v(x, y, z); into class quaternion q(0, x, y, z);, adding a zero first component, before calling the multiplication routine -- otherwise: bang! compilation error!


 * Second, yes, it would be a bit longer a demonstration if we dropped the 19th century "a quaternion is a number plus a vector" approach. But not very much longer, and perharps simpler to understand. But before I give demonstration outlines below, let me point out that, in this article, we have never explained the origin of the $$sin(\alpha /2)$$ coefficient. The first paragraph about the intuitive vision of the rotations space gives an idea, but absolutely no demonstration. We say it's an hypersphere, fine, but where does that result come from? Silence... We did not prove either the relation that binds quaternion multiplication to cross product and scalar product. Finally, we are using the fact that the inverse of a unit quaternion is the same as its conjugate, but did not prove it. So, in the proof that quaternions rotate vectors, we are currently building results upon moving sand ;-).


 * Also, current demonstration skips a lot of intermediate lines, its calculations are not obvious at all.


 * Here is the outline of a first demonstration (almost without computations):
 * when does conjugation preserves a vector? u V u* = V if and only if u V = V u, i.e. when u and V commute
 * u and V commute only if they are collinear
 * conjugation is linear (i.e. the conjugate of the sum is the sum of the conjugates)
 * the length of the vector part of a quaternion is preserved under conjugation
 * a linear application that conserves the length and that preserves a vector only when its axis coincides with the vector is a rotation


 * Another demonstration is to do directly the computations with all symbols and end up with the rotation's formulas. As this leads to endless formulas in the general case (and as you remark above, it's not easy to spot the identities in the transformations), we could do it in a simplified case, for example when rotating i around k of an angle alpha.


 * Finally, let me point out that I did not really intend to remove the "vectors approach". It was merely an intellectual side remark. I have enough work with translating this article to French already ;-). I am even wondering if a demonstration is really needed at all in a wikipedia article. MathsPoetry (talk) 09:49, 29 April 2009 (UTC)


 * I'm not being fooled by notation, I'm taking a different view of quaternions than you are. Saying that a vector is a quaternion is like saying that a real number is a complex number or a rational number is a real number. In a strictly formal approach those are false statements. Chances are that you constructed the rationals as equivalence classes of ordered pair of integers, while real numbers are equivalence classes of Cauchy sequences of rationals and complex numbers are ordered pairs of reals. Integers, in turn, are signed natural numbers, while natural numbers are finite ordinals and ordinals are certain sets. You can't say, in this system, that 2 is an integer, at least not if you also want to say that 2 is a natural number; that would be an abuse of notation. You need to write an explicit injection into the integers if you want to use 2 as an integer. If you want to use it as a real number, so you can multiply it by π for example, then you have to inject the integer 2 into the rationals and from there into the reals. If you really want to take a principled strongly-typed approach to mathematics then it's not enough to demand that vectors be explicitly constructed from their components and then explicitly injected into quaternion space. You'll also have to write things like $$2_{\mathbb{R}} \times_{\mathbb{R}} \pi$$, where for "convenience" I've defined $$2_{\mathbb{R}} \equiv \mathfrak{i}_{\mathbb{R}}(\mathfrak{i}_{\mathbb{Q}}(\mathfrak{i}_{\mathbb{Z}}(2)))$$. Take a look at 2p2e4 at MetaMath to see what it's really like to write mathematics like software (see also the trivia).


 * Also, there's nothing informal or weakly typed about the s + v approach to quaternions. The reason numbers are usually constructed as formal n-tuples is just that ordered tuples are easy to define in set theory. That's also why $$\mathbb{C}$$ and $$\mathbb{H}$$ are constructed that way in software, because programming languages have primitive ordered tuples. But it's equally rigorous, just less foundational, to write down the axioms of an algebra with formal symbols i, j, k and equivalences i² = j² = k² = ijk = −1. In that system it's a theorem that every value has a representative of the form a + bi + cj + dk where a, b, c, d are reals. It's equally rigorous to write down the axioms of an algebra of mixed scalars and vectors and the equivalence uv = u×v − u·v. In that system it's a theorem that every value has a representative of the form s + v. How do you add a vector and a scalar? Well, I just did. Expecting it to collapse to a "single value" is no more reasonable than expecting a+bi to collapse to a single value. If complex numbers are pairs then that really means (a,0) + (b,0) × (0,1), which collapses to (a,b). That's the computer-software approach. But people don't think of complex numbers as pairs satisfying the rule (a,b)×(c,d) = (ac−bd, ad+bc), they think of a+bi and i² = −1, and they are fully justified in doing so, mathematically speaking.


 * I'm completely in favor of your largely calculation-free proof that quaternion rotation works, if you can pull it off. I don't like the current proof very much. All I'm opposed to is a proof that's like the current one but with an even larger lump of unexplained calculation in the middle. -- BenRG (talk) 14:50, 30 April 2009 (UTC)


 * I am happy you have taken the example that rationals are not real numbers, and that real numbers are not complex numbers. If you remind well your work with Cauchy sequences, you should remind that your teacher proved at some point that the constant sequence (q) where q is the same rational number (for every N) is a Cauchy sequence and the associated real number could be considered "equal" to this rational number, even though they are objects of very different natures, making Q a mere subset of R. This is by no means a straightforward consideration and needed a proof, even though this proof is obvious. The same applies to complex numbers, that you have probably constructed as pairs (x, y) of reals (exhibiting a "number" i with funny properties was fine in the 16th century, but it is not rigourous). Your teacher probably proved that the subset of C of the form (x, 0) was equivalent to the reals, making R a mere subset of C. Again, there's nothing "straightforward" in such facts and it deserved a demonstration, albeit very simple. Introducing i as a notation for (0, 1) is practical and can be thought of "the number whose square is -1", but it's only a shortcut of the mind. I have added a sentence to state that, in conjugation $$q V q^{-1}$$, the vector V was turned into a quaternion and I think this sentence was very necessary. But I think that we basically agree on that. Sorry if I hurted your feelings with the word "fooled", I should have used some other word. I just wanted to say that this "addition" hides changes in the dimensions.


 * About "my" proof without computations that conjugation by a unit quaternion is a rotation. First, it's not "my" demonstration, I remembered it from some mathematical reading (which one??? mistery... I'm afraid I have forgotten where I have read it). Second, yes it's very elegant, but somehow it is "cheating"... It uses a very powerful result: "if f is a linear map that keeps lengths unchanged and that keeps an axis invariant, then f is a rotation". Somehow this is too powerful, it's like drawing a rabbit from a magician's hat. So I am not 100% sure it would be better than current demonstration from a pedagogical point of view. Also, current demonstration has an advantage over "mine" : it shows why $$\alpha$$ had to be divided by 2 ;-).


 * Again, do we really need a demonstration at all of the quaternion-rotation equivalence in an encyclopedic article? I have currently mixed feelings towards all three demonstrations (vector oriented, linear maps oriented or analytical computations oriented), each of them has qualities and drawbacks, perharps I need time to give some more thinking on that topic. MathsPoetry (talk) 21:01, 30 April 2009 (UTC)


 * Of course there's a Cauchy sequence converging to every rational. That doesn't make Q a subset of R. Rather, it gives a natural injection of Q into R, which I called $$\mathfrak{i}_{\mathbb{R}}$$. I can't see any evidence that you understood anything that I wrote above. You complained that in the sum s + v a vector was being implicitly converted into a quaternion. I responded by saying that that's not true in the system I'm advocating (second paragraph) and also not true in the system you're advocating (first paragraph). In your followup not only do you repeat what you said before, you don't even seem to realize that I disagree with you! Do you see the problem with claiming that a real number is a complex number while also claiming that a three-vector is not a quaternion because the spaces have different dimension? When I wrote "How do you add a vector and a scalar? Well, I just did", do you understand what I meant by that? Do you understand that in my approach i is not a shorthand for (0,1)? Does it help if I mention that I'm constructing the complex numbers as $$\mathbb{R}[\mathbf{i}]/(\mathbf{i}^2+1)$$, a quotient ring of a polynomial ring?


 * I don't know whether we need a proof, but I don't think it's doing any harm. It isn't very long, and it's not something people would necessarily see how to do on their own. The article already says things like "any rotation in three dimensions is a rotation by some angle about some axis" (which is far from obvious), so I don't think there would be anything wrong with "a linear map that keeps lengths unchanged and that keeps [just one] axis invariant is a rotation". -- BenRG (talk) 11:58, 4 May 2009 (UTC)


 * Exactly, strictly speaking, Q is not a subset of R, but there is a natural injection. Saying that Q is a subset of R is, again, a common abuse. So is saying that a real is a complex. Or that a vector is the imaginary part of a quaternion. We only do such shortcuts because a) we have complex constructions that JUSTIFY our notation shortcuts (like the Cauchy sequences, and the abovementioned natural injection), and b) because these shortcuts are so PRACTICAL - every 13 years old pupil considers Q as a "subset" of R, and it is written in many math books, though some persons with more math knowledge like you and me know that it is not exactly true.


 * Now returning to the quaternions, in this wikipedia page we have NO justifications. We have vague sentences like "the imaginary part of a quaternion behaves like a vector", and that's all. Basically, that's "believe me, that's how it works". Later on, taking an usual, geometrical, vector, and using it in quaternion multiplications is left unjustified, just the same. I agree this vector notation is practical. I also agree wikipedia is no maths manual, and that's not the place to do such constructions and justifications. But we need to at least WARN the reader that, when we take V and conjugate it, it becomes suddenly a quaternion (we aggregate a first zero coordinate). Hence my sentence let also $$\vec{v}$$ be an ordinary vector of the 3 dimensional space, considered as a quaternion with a real coordinate equal to zero which I consider as very important. But I am wondering what we are arguing about, as you did not seem to oppose that sentence.


 * Let me also say that you have absolutely no reason to be so harsh in your tone. I am trying to be polite and I am expecting the same from you. Don't say that I don't understand what you say, that is very offending.


 * Yes, you're right, the current proof does not do any harm. Let's leave it alone. Switching to the so-called "my demonstration" would not really be any better. Or would it? I'm not really sure of anything in this affair. MathsPoetry (talk) 18:23, 4 May 2009 (UTC)

(restarting the indentation at 0). Regarding "my demonstration" (we need a better name for it), I have been giving some thought at it and I am wondering if it is even correct. I have been searching a property similar to "if f is a linear map that keeps lengths unchanged and that keeps an axis invariant, then f is a rotation", and have not found it. First, it is not true in other dimensions than 3 (in a plane, a linear map that is an isometry and that keeps an axis unchanged is a reflection). Second, I am wondering it it is even true in dimension 3. Perharps it should be proven that f keeps handedness too. The closest property I have found was "if f is a linear map that keeps scalar product and determinant unchanged, then f is a rotation". I still think that this demonstration is valid, but it probably needs some more work and additional verifications. MathsPoetry (talk) 07:40, 6 May 2009 (UTC)


 * It is true in dimension 3. An antirotation for example does not keep the vectors of the axis unchanged, it converts them to their opposite. This demonstration is valid in dimension 3, it's only that I would like to see a book where the final property "a linear application that conserves the length and that preserves a vector only when they pertain to a given axis is a rotation" is stated, or better, established. I am feeling uncomfortable to use a tool that no one else mentions. Or perharps I just did not search well. MathsPoetry (talk) 10:03, 7 May 2009 (UTC)

(restarting the indentation at 0). The article Quaternions and spatial rotation was translated by MathsPoetry, and we have a discussion in french on that translation. I advise you to read it (if you can understand french).


 * Let f be an isometry (= linear map preserving the distance) of R3. Assume 1 to be an eigenvalue of f. Say, there exists a vector V such that f(V)=V. Then the line generated by V is stable under f. As f is an isometry, it preserves the orthogonality. Thus, f preserves the plane orthogonal to V. In particular, f restricts to an isometry of V. You probably know that isometries in dimension 2 are rotations or orthogonal symetries with respect to a line generated by W. Thus f is a rotation of axis RV (first case) or a symetry with respect to the generated by V and W.


 * has partially right. There exists a beautiful geometric argument (beautiful for anyone who loves geometry). The field of quaternions H is equipped with an Euclidean metric |.|, and we have $$|ab|=|a|\times |b|$$. In particular, the action A(q) of a unitary quarternion q by conjugation preserves this Euclidean metric. Then, A(q) is an isometry of the Euclidean vector space H, which preserves 1, then the line of reals and its orthogonal, which is the vector space E of the pure quaternions. Here E is a vector space of dimension 3, and can be naturally identified with R3 because i, j and k is an orthonormal basis. The linear map A(q) restricts to an isometry of E, still denoted by A(q). Now, the set of unitary quaternions is simply the unit sphere of H. So you can pass continuously from 1 to q. There is a continuous path of isometries from the identity to A(q). Hence, the determinant of A(q) is 1. In other words, A(q) is a rotation. This prrof is well-known, and it is not hard to find references, if necessary. I hope no.


 * The explicit computation ("your proof") is also very nice, but appears to me as a sort of trick. But it is useful to understand really how a unitary quaternion represents a rotation, with its axis and its angle.


 * ) Neifbor Udofix (talk) 19:01, 2 June 2009 (UTC)


 * f can't be a symetry with respect to a plane, because such symetries preserve the whole plane. In the case of conjugation, a vector V is preserved if and only if it pertains to a given axis. Re-read my demonstration, please (which btw is not mine).


 * Yes, the demonstration you give above is a beautiful demonstration, indeed. Probably the most beautiful among all the "conjugation<=>rotation equivalence" demonstrations that we have exhibited so far. However, I would not call it a "geometrical" demonstration, because it makes use of continuity, which is typically a topological notion. MathsPoetry (talk) 20:55, 3 June 2009 (UTC)
 * Sorry you were right. The set of fixed vectors of your isometry is exactly a line so that the isometry must be a rotation.
 * General topology can be viewed as a part of geometry, even though this point of view is debatable. Note that the definitions of topological manifolds or varieties require the notion of continuity. Continuity is necessary to define interessant geometric objects. Neifbor Udofix (talk) 23:29, 3 June 2009 (UTC)

Example
Currently, the text of the example says:


 * This can be simplified, using the ordinary rules for quaternion arithmetic, to
 * $$f(a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) = c\mathbf{i} + a\mathbf{j} + b\mathbf{k}$$

I think it is a bad idea to omit all the computations, because a reader who is not familiar with "quaternion arithmetics" may wonder where this comes from and feel disappointed. I suggest to replace this paragraph with:


 * If we develop the previous expression, and if we apply
 * $$\begin{alignat}{2}

\mathbf{ij} & = \mathbf{k}, & \mathbf{ji} & = \mathbf{-k}, \\ \mathbf{jk} & = \mathbf{i}, & \mathbf{kj} & = \mathbf{-i}, \\ \mathbf{ki} & = \mathbf{j}, & \mathbf{ik} & = \mathbf{-j} \end{alignat}$$
 * we obtain:
 * $$\begin{array}{lll}

f(a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) &=& \frac{1 + \mathbf{i} + \mathbf{j} + \mathbf{k}}{2} (a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) \frac{1 - \mathbf{i} - \mathbf{j} - \mathbf{k}}{2} \\ &=& \frac{1}{4} ( (a\mathbf{i} + b\mathbf{j} +c\mathbf{k}) + (a\mathbf{i}^{2} + b\mathbf{ij} + c\mathbf{ik}) + (a\mathbf{ji} + b\mathbf{j^{2}} + c\mathbf{jk}) + (a\mathbf{ki} +b\mathbf{kj} + c\mathbf{k}^{2}))\\ &&                         (1 - \mathbf{i} - \mathbf{j} - \mathbf{k})\\ &=& \frac{1}{4} ( (a\mathbf{i} + b\mathbf{j} + c\mathbf{k}) +(- a + b\mathbf{k} - c\mathbf{j}) + (-a\mathbf{k} - b +c\mathbf{i}) + (a\mathbf{j} - b\mathbf{i} - c))\\ &&                         (1 - \mathbf{i} - \mathbf{j} - \mathbf{k})\\ &=& \frac{1}{4} ( (-a - b - c) + (a - b+ c) \mathbf{i} + (a + b - c) \mathbf{j} + (-a + b + c) \mathbf{k})\\ &&                         (1 - \mathbf{i} - \mathbf{j} - \mathbf{k})\\ &=& \frac{1}{4} ( ( (-a - b - c) + (a - b+ c ) \mathbf{i} + (a + b - c) \mathbf{j} + (-a + b + c) \mathbf{k})\\ &&+                      ( (a + b + c) \mathbf{i} - (a - b + c) \mathbf{i}^{2} - (a + b - c) \mathbf{ji} - (-a + b + c) \mathbf{ki})\\ &&+                       ( (a + b + c) \mathbf{j} - (a - b + c) \mathbf{ij} - (a + b - c) \mathbf{j}^{2} - (-a + b + c) \mathbf{kj})\\ &&+                       ( (a + b + c) \mathbf{k} - (a - b + c) \mathbf{ik} - (a + b - c) \mathbf{jk} - (-a + b + c) \mathbf{k}^{2}))\\ &=& \frac{1}{4} ( ( (-a - b - c) + (a - b + c) \mathbf{i} + (a + b - c) \mathbf{j} + (-a + b + c) \mathbf{k})\\ &&+                      ( (a + b + c) \mathbf{i} + (a - b + c) + (a + b - c) \mathbf{k} + (a - b - c) \mathbf{j})\\ &&+                       ( (a + b + c) \mathbf{j} + (-a + b - c) \mathbf{k} + (a + b - c) + (-a + b + c) \mathbf{i})\\ &&+                       ( (a + b + c) \mathbf{k} + (a - b + c) \mathbf{j} + (-a - b + c) \mathbf{i} + (-a + b + c))\\ &=& \frac{1}{4} ( ( (-a - b - c) + (a - b + c) + (a + b - c) + (-a + b + c) )\\ &&+                      ( (a - b + c) + (a + b + c) + (-a + b + c) + (-a - b + c) ) \mathbf{i}\\ &&+                      ( (a + b - c) + (a - b - c) + (a + b + c) + (a - b + c) ) \mathbf{j}\\ &&+                      ( (-a + b + c) + (a + b - c) + (-a + b - c) + (a + b + c) ) \mathbf{k})\\ &=& \frac{1}{4} (0 + 4c \mathbf{i} + 4a \mathbf{j} + 4b \mathbf{k})\\ &=&c\mathbf{i} + a\mathbf{j} + b\mathbf{k} \end{array}$$

I know these computations are long and boring. But without them, we give the impression that we are illusionists drawing a rabbit from a magician's hat. Also, it is informational to show that quaternion arithmetics are long and tedious.

Perharps we could skip a few lines to keep its length reasonable.

Criticism and opposition are welcome. If no one disagrees, I'll proceed with the change. MathsPoetry (talk) 09:24, 4 May 2009 (UTC)


 * No reaction after three days; I'll go on with that change. MathsPoetry (talk) 08:42, 7 May 2009 (UTC)

Conversion from an orthogonal matrix to a quaternion
Hi everyone

This article says :


 * The value of
 * $$r=\sqrt{1+Q_{uu}-Q_{vv}-Q_{ww}}$$
 * will certainly be a real number

That might be true, but I don't understand why. Can someone enlighten this point? Perharps we could add a reference in the article to some place where this point is explained? References in Wikipedia are a good thing ;-). MathsPoetry (talk) 09:46, 10 May 2009 (UTC)
 * This whole conversion formula is obviously wrong and should be removed or corrected. Let us assume that Q is the identity matrix. The current version of the conversion formula then returns the quaternion (undefined, 0, undefined, undefined) (lots of divisions by zero), when in fact it should trivially return (1, 0, 0, 0). Sebsch (talk) —Preceding undated comment added 14:16, 16 April 2010 (UTC).
 * I don't have the time to correct the article but the correct formulas can for example be found in A8 of this paper, which is often cited in the computer vision literature.Sebsch (talk) 14:32, 16 April 2010 (UTC)
 * I've just had a go at fixing it, before reading your last comment. I'm not convinced it's the best approach as it would be numerically unstable very close to the identity but it at least deals with the divide by zero.-- JohnBlackburne wordsdeeds 14:36, 16 April 2010 (UTC)
 * I believe, the square root will still yield complex values in a number of situations. I see no guarantee, that $$Q_{uu}-Q_{vv}-Q_{ww} \geq -1$$ just because $$|Q_{uu}| > |Q_{vv}|,|Q_{uu}| > |Q_{ww}|$$.131.246.191.249 (talk) 09:49, 11 June 2010 (UTC)

From an orthogonal matrix to a quaternion: The naming conventions are not kept consistent: q0 + qxi + qyj + qzk is used to define the quaternion but u,v and w are used as indices for the formula. Despite that the conversion formulas appear to be wrong (i.e. mixed up) —Preceding unsigned comment added by 131.246.194.27 (talk) 08:43, 6 August 2010 (UTC)

The conversion from a matrix to a quaternion is the same one provided by Berthold Horn (1987). If the input matrix is not exactly orthogonal, its columns can be used as 3 independent vectors that are to be registered to the 3 elementary vectors in the least-squares sense. Horn's formula finds the least-squares spherical displacement as a quaternion, which is what the conversion returns. Incidentally, the quaternion can then be used to create an orthogonal matrix that is, in the registration least-squares sense, a "correction" of the input matrix. (This correction matrix is not optimal in the sense of being the orthogonal matrix closest under the Frobenius norm but it is nearby if the input matrix is "nearly" orthogonal.) —Preceding unsigned comment added by RandyEllis (talk • contribs) 19:21, 8 October 2010 (UTC)

The given method was unstable if the matrix approached the identity matrix. I replaced it with a link to [Rotation_matrix#Quaternion], which gives a correct and stable method. Note that this 'bug' in the article has already leaped into several libraries, showing the influence (good and bad) of wikipedia. 62.245.183.130 (talk) 09:24, 11 January 2012 (UTC)

Parameterizing the space of rotations
In the example of 2D rotations (rotations about an axis on the xy-plane) - "A point (w,x,y) on the sphere represents a rotation around the axis directed by the vector (x,y,0)..." shouldn't it be (0,x,y)?

pvazteixeira (talk) 10:37, 15 October 2009 (UTC)

Double cover
The reference to double cover is mentioned only lightly at one point. It is actually a serious drawback of quaternions when comparing them to 3x3 matrices and should be mentioned in this comparison section. It means that users either have to accept two different values for each orientation or their representation has a discontinuity. —Preceding unsigned comment added by 203.214.118.60 (talk)
 * I don't think it's ever a problem in practice; can you give an example? -- BenRG (talk) 20:23, 23 October 2009 (UTC)

OK,
 * how do you average three orientations? a simple solution is to add up the components then normalise the result, but there are two quaternions for each orientation, so the choice affects the average. If you make all of the quaternions have +ve w you get a different result to if you make them all have a +ve x, so this shows that choice of how deal with the double cover affects the resulting orientation. With 3x3 matrices you could add them together and orthonormalise and get a good approximate average.
 * if you want to lerp (linear interpolate then normalise) from one orientation to another the result depends on which of the two quats are being used at each end. If the 2 quats both are known to have +ve w then you still need to check the 4d dot betweeen them to avoid the lerp interpolating the long way around. With 3x3 matrices you can interpolate then orthonormalise without these concerns.
 * the above show how it can be a good idea to keep quats with a +ve w at all times, however, this means the data jumps when going from +180 degrees to -180 degrees, which for example complicates interpolated table lookups based on orientations, and it complicates any code that tries to measure the change in orientation based on the similarity of the data. With 3x3 matrices you can take one from the other and the square sum of the components is a reliable measure for how different the orientations are.
 * When interpolating between quaternions you do have to check the dot product and negate one input when it's negative. However, that has the side effect of ensuring that the angle between the inputs is no more than 90°, so they're guaranteed to be well conditioned as inputs to the lerp. The test and negation are a tiny inconvenience compared to the problems you run into with matrices when one of the axes is rotated by an angle near 180°. I'm not completely sure what it means to take the average of three orientations, but I suppose that with quaternions I would compute the four sums a±b±c and take the longest of them. It's easy to show that its length will be at least √3, so this gives sane results for all inputs. Again, the matrix equivalent will break in the general case unless you make heroic efforts to identify and handle the special cases. We could add to the article a statement to the effect that it's easier with matrices to write some functions that work in simple cases (but break in the general case), while with quaternions you're basically forced to handle the general case. But I see that as an advantage of quaternions.


 * I don't think it ever makes sense to demand a canonical form for the quaternions because, as you say, there will always be discontinuities that you'll have to check for anyway. All functions on the quaternions should be sign-agnostic on their inputs. -- BenRG (talk) 19:09, 27 October 2009 (UTC)


 * OK, maybe just something reminding people that there are two values for each orientation, which needs to be remembered when comparing two orientations. I just think this double cover needs to be mentioned as a (minor) complication, since I've been bitten by it once or twice myself. Tom. —Preceding unsigned comment added by 124.171.141.46 (talk) 01:00, 28 October 2009 (UTC)


 * These issues with the double cover are dealt with easily. See Michael Johnson's MIT PhD thesis, "Exploiting quaternions to support expressive interactive character motion" for all the details. Briefly, a bundle of quaternions should be confined to one hemisphere by making sure they all have a positive dot product with the quaternion representing the average of the bundle. This way, there is no "jumping" when going from +180 to -180. The average is the 1st Eigenvector of the 4x4 Hermitian matrix given by the Einstein sum $$A_{jk} = q_{ij}q_{ik}$$. Notably, this is the only correct method for computing mean rotation. Really, his PhD thesis has the best explanation and diagrams for understanding quaternions that I've found. Reve etrange (talk) 14:53, 3 March 2019 (UTC)