# Composition of Quaternions as rotations

1. Oct 31, 2011

### tomelwood

1. The problem statement, all variables and given/known data
Hi, I am having problems in showing that in practise the composition of two rotations represented by quaternions is still a rotation.
The example I have constructed is:
Rotate (1,1,0) by 45 degrees about the z axis.
The quaternion to use is thus q = cos(22.5)+ksin(22.5)
This gives the vector (0,√2,0), as one would expect.
Then, rotate this new vector by 45 degrees about the x acis.
The quaternion to use is thus p = cos(22.5)+isin(22.5)
This gives the vector (0,1,1), as expected.
However, trying to find the single quaternion rotation to get from (1,1,0) to (0,1,1) is proving problematic..

2. Relevant equations
I know that composition of rotations is done in reverse order, ie to find the single quaternion that I need to use, I need to do pq and then apply this to (1,1,0) to give me (0,1,1)

3. The attempt at a solution
Now, I know that the answer is a rotation of 90 degrees about the y-axis, ie about (0,1,0), which is, in quaternion form, r = cos45+jsin45

But when I multiply p with q, I do not get this.
In fact, pq= cos^2(22.5) + isin(22.5)cos(22.5) + ksin(22.5)cos(22.5) - jsin^2(22.5)
which I cannot get to equal what I want!

By adding and subtracting another sin^2 , I can get the cos45, but then I am left with
sin(22.5)(icos(22.5)+kcos(22.5)-jsin(22.5)) which is no closer!

Could somebody please explain where I have gone wrong/what identities I have missed, as this should work, and I don't understand why it isn't!

Many thanks.

2. Oct 31, 2011

### tomelwood

Having investigated further, I have found that multiplying (1,1,0) by that quaternion that I didn't like does actually give (0,1,1) , but I don't understand how I can interpret that geometrically - ie about what axis and by what angle is the rotation being performed?
Because the usual way of writing that is in the form
cos(θ/2)+Asin(θ/2) , where θ is the angle of rotation and A is the unit vector which is the axis of rotation...
Unless, I write it out numerically:
0.85355+0.35355i-0.14644j+0.35355k
Therefore the angle of rotation is 2arccos(0.85355) = 62.8 degrees
And the axis of rotation is the vector (0.35355, -0.14644, 0.35355) But this isn't a unit vector...

Am I any closer?