# Coordinate Rotation in a Cartesian 3-Space

## Main Question or Discussion Point

I have been trying to derive a set of equations for a new Cartesian coordinate system after a rotation of an original coordinate system. This is what I did:

1) I transformed the Cartesian coordinates (x,y,z) into spherical coordinates (r,p,q):
x= r cos(q) cos(p)
y= r cos(q) sin(p)
z= r sin (q)

2) The coordinates are to be rotated by angles of p0 and q0 so that:

p'= p-p0
q'= q-q0
r'= r

3) Substitution:

x'= r cos(q-q0) cos (p-p0)
y'= r cos(q-q0) sin (p-p0)
z'= r sin(q-q0)

4) Simplifying and substituting the original values of x, y, and z:

x'= (r cos(q) cos(q0) + r sin(q) sin(q0)) (cos(p) cos(p0) + sin(p) sin(p0))
= r cos(q) cos(q0) cos(p) cos(p0) + r cos(q) cos(q0) sin(p) sin(p0) + r sin(q) sin(q0)cos(p) cos(p0) + r sin(q) sin(q0) sin(p) sin(p0)
= x cos(q0) cos(p0) + y cos(q0) sin(p0) + z sin(p0)cos(p) cos(p0) + z sin(q0) sin(p)
sin(p0)

y'=(r cos(q) cos(q0) + r sin(q) sin(q0)) (sin(p) cos(p0) - cos(p) sin(p0))
=r cos(q) cos(q0) sin(p) cos(p0) - r cos(q) cos(q0) cos(p) sin(p0) + r sin(q) sin(q0)
sin(p) cos(p0) - r sin(q) sin(q0) cos(p) sin(p0)
=y cos(q0) cos(p0) - x cos(q0) sin(p0) + z sin(q0) sin(p) cos(p0) - z sin(q0) cos(p)
sin(p0)

z'= r sin(q) cos(q0) - r cos(q) sin(q0)
= z cos(q0) - r cos(q) sin(q0)

This is as far as I got, but in the equations for x and y, there are still some sin(p)'s and
cos(p)'s left in there which cannot be evaluated without the original coordinates and I want to find a coordinate-independent set of equations so that the same equations can be used for every point in the original coordinate system.

My question is: Is there any way to get rid of these sine's and cosine's? Or do you see anything that I could have done wrong or different?

If you know any simpler equations, please send them to me.

Thanks.