Take the 2-minute tour ×
Physics Stack Exchange is a question and answer site for active researchers, academics and students of physics. It's 100% free, no registration required.

Assume you have a vector $\vec{x}=(\sin(\vartheta)\cos(\varphi),\sin(\vartheta)\sin(\varphi),\cos(\vartheta))$ given in spherical coordinates in a reference System "R". I want to rotate the reference system so that it's z-direction points along $\vec{x}$. All I have to do is a first rotation about the z-axis with the angle $\varphi$ and afterwards a rotation about the new y-axis with the angle $\vartheta$. Eulers angles could do the job (look here, german). So I define my transformation matrix like that, except that in the basic rotation matrices every $\sin$ has to be changed to $-\sin$ (since I am rotating the reference system and not the vector). The resulting matrix is (since I do not rotate again about the new z-axis, I can set the last angle to zero):

$M=\left( \begin{array}{ccc} \cos(\vartheta)\cos(\varphi) & -\sin(\varphi) & -\sin(\vartheta)\cos(\varphi) \\ -\cos(\vartheta)\sin(\varphi) & \cos(\varphi) & \sin(\vartheta)\sin(\varphi) \\ -\sin(\vartheta) & 0 & \cos(\vartheta) \end{array} \right)$

So if I want to know the coordinates of a vector $\vec{y}$ in the new coordniate system R' I need to compute $\vec{y}'=M\vec{y}$. Now I want to do some tests. First, what is $\vec{e}_z'$ the old unit vector in the new coordinate system.

$\vec{e}_z'=(-\sin(\vartheta)\cos(\varphi),\sin(\vartheta)\sin(\varphi),\cos(\vartheta))=\vec{x}(x,-\vartheta,-\varphi)/x$

which is correct. But if I compute $M\vec{x}$ it should yield $(0,0,1)$, which it doesn't. What am I doing wrong?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Here's how I'd set it up, in 3 steps: First step, rotate the coordinate system about the z-axis (as you suggested) by $\phi$, so that it lies in the x-z plane (ie, its y-component is 0). You do this by rotating the coordinates by

$M_1 = \left( \begin {array} {ccc} cos(\phi) & sin(\phi) & 0 \\ -sin(\phi) & cos(\phi) & 0 \\ 0 & 0 & 1 \end {array} \right) $

How did I know that the minus sign goes there? Well, $\hat {i}$ maps to $-\hat{j}$, and $\hat {j}$ maps to $+ \hat{i}$ (try to think about it conceptually, if $\phi$ were $\frac {\pi} {2}$).

Verify that $(M_1 \vec x)$ (which I'll call $\vec x'$) has a $\hat j$ component of 0.

I get $\vec x'$ = $sin(\theta) \hat {i} + cos(\theta) \hat {k}$

Now, let's rotate our coordinates about the y-axis so that the z-axis aligns with $\vec x'$. Again, $\hat {k}$ maps to $-\hat {i}$, and $\hat {i}$ maps to $+\hat {k}$.

$M_2 = \left( \begin {array} {ccc} cos(\theta) & 0 & -sin(\theta) \\ 0 & 1 & 0 \\ sin(\theta) & 0 & cos(\theta) \end {array} \right) $

Now in order to do our rotations, we need $\hat {k} =\vec x'' = M_2 \vec x' = M_2(M_1 \vec x) = (M_2 M_1) \vec x = M \vec x$

so $M = M_2 M_1 = \left( \begin {array} {ccc} cos(\theta)cos(\phi) & cos(\theta)sin(\phi) & -sin(\theta) \\ -sin(\phi) & cos(\phi) & 0 \\ sin(\theta)cos(\phi) & sin(\theta)sin(\phi) & cos(\theta) \end {array} \right) $

Plugging this in to our original $\vec x$, it looks like this works.

share|improve this answer
    
Thanks a lot! I did try that exact same thing (same matrices) but I just realized that I had them in reversed order (because I read that's what you have to do when you using that Euler formalism). –  DaPhil Jan 22 '13 at 17:52
    
Ouch! Yeah, been there, back when I was learning this stuff. –  Will Cross Jan 22 '13 at 20:27

You wrote down a matrix that maps $(0, 0, 1)$ to $\vec x$. That is the inverse of the matrix that maps $\vec x$ to $(0, 0, 1)$.

Edit: it's possible I misunderstood, so let's go through it.

You want to define a set of cartesian axes $e_i$ such that $\vec x = e_z$. You know $\vec x = {x'}^i {e'}_i$ in an old basis that you're rotating from. The bases are related by a rotation operator $\underline R({e'_i}) = e_i$.

So, let's look at the components of ${e'}_z$ in the new basis. We want to evaluate ${e'}_z \cdot e_j = {e'}_z \cdot \underline R({e'}_j) = \underline R^{-1}({e'}_z) \cdot {e'}_j$. This means that to find the components of ${e'}_z$ on the new basis, you can equivalently inverse rotate it and find the components on the old basis. But $\underline R^{-1}({e'}_z) \neq \vec x$--picture this if you don't follow. That you got the erroneous result that they were the same tells me your matrix is not correct. It is not what you thought it was; it's probably assuming you want to rotate vectors and not the axes or some other similar, subtle disconnect.

Edit edit: actually, I'm not sure I understand what you're saying you found ${e_z}'$ to be in the new basis. The notation does not make sense.

3rd edit: let's walk through a whole cloth calculation of the rotation operator. Doing this with two rotations chained is somewhat onerous, if straightforward. I'll use quaternions (spinors, rotors) in a geometric (clifford) algebra.

The idea here is simple: any rotation can be broken down into a double-sided action of a spinor.

$$\underline R(a) = \psi a \psi^{-1}$$

where the products here are clifford products. The spinor $\psi$ is formed as an exponential of a bivector. Given two orthonormal vectors $u, v$ that span the rotation plane, the spinor that rotates through an angle $\theta$ is $\psi = \exp(-u \wedge v \, \theta/2)$.

First, we find the vector that lies in the plane $\vec x \wedge e_z$ that is orthonormal to $e_z$. The expression is rather simple:

$$\rho = (\vec x \wedge e_z) \cdot e^z = (\sin \theta \cos \phi e_{xz} + \sin \theta \sin \phi e_{yz}) \cdot e^z = (\sin \theta \cos \phi e_x + \sin \theta \sin \phi e_y)$$

Exactly as you'd expect. This vector has magnitude $\sin \theta$, so the normalized vector is

$$\hat \rho = e_x \cos \phi + e_y \sin \phi$$

Because we've decomposed the problem into spherical coordinates, we know the angle between $\vec x$ and $e_z$ is $\theta$. We can then write the spinor as

$$\psi = \exp(-\hat \rho e_z \theta/2) = \cos \frac{\theta}{2} - \hat \rho e_z \sin \frac{\theta}{2}$$

With $\hat \rho e_z = e_{xz} \cos \phi + e_{yz} \sin \phi$. Now let's get down to evaluating the operator's components.

$$\begin{align*}\underline R(e_x) &= \Big ( \cos \frac{\theta}{2} - \hat \rho e_z \sin \frac{\theta}{2} \Big) e_x \Big ( \cos \frac{\theta}{2} + \hat \rho e_z \sin \frac{\theta}{2} \Big) \\ &= e_x \cos^2 \frac{\theta}{2} + e_z \sin \theta \cos \phi - \sin^2 \frac{\theta}{2} (e_x \cos 2\phi + e_y \sin 2\phi) \end{align*}$$

The other basis vectors are mapped to

$$\begin{align*} \underline R(e_y) &= e_y \cos^2 \frac{\theta}{2} + e_z \sin \theta \sin \phi + \sin^2 \frac{\theta}{2} (e_y \cos 2\phi - e_x \sin 2\phi) \\ \underline R(e_z) &= e_z \cos \theta - (e_x \cos \phi + e_y \sin \phi) \sin \theta \end{align*}$$

Checking that this is correct for the full vector is a bit involved, but I've checked a few important limits ($\phi = 0, \pi/2$) and the behavior seems to check out.

share|improve this answer
    
I'm not sure you're correct. The inverse should map (0, 0, 1) to his original vector; it maps it to x⃗ =(-sin(ϑ)cos(φ),sin(ϑ)sin(φ),cos(ϑ)) (note the minus sine in the $\textbf {i}$ direction) –  Will Cross Jan 22 '13 at 16:26
    
Hm, that's possible. I originally read it as an active transformation, but it's possible he meant a passive transformation. I guess that's likely, actually. If that's the case, though, then the old z-vector $e_z'$ should not evaluate to $x^a e_a$ ($e_a$ being the new basis). –  Muphrid Jan 22 '13 at 16:34
    
I am not sure what an active or passive transformation is, but neither M nor it's inverse maps $\vec{x}$ to $(0,0,1)$. –  DaPhil Jan 22 '13 at 16:40
    
Can you clarify what you found ${e'}_z$ to be in the new basis? Honestly, you could also probably perform the rotation such that, instead of moving the axes, $\vec x$ is moved to the z-axis instead. This might allow you to use references assuming that kind of rotation. –  Muphrid Jan 22 '13 at 16:50
    
@thatnerd: Then how do I rotate my reference system correctly? The description of the matrix I use is exactly what I want to do - so I thought it's the right one. Why do we evaluate $\vec{e}_z' \cdot \vec{e}_j$? I also noticed that rotating only one axis works perfect. Rotating both gives errors. –  DaPhil Jan 22 '13 at 16:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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