# Converting global to local coordinate systems

I have been given equations for converting from a global to local coordinate system in 2 dimensions, however with no explanation/proof as to how the equation is obtained. I realise that on occasion you just need to learn an equation and use it, but in this case I would really appreciate it if someone could help me understand what's going on. They are as follows:

$$x = X \cos \theta + Y \sin \theta$$ $$y = -X \sin \theta + Y \cos \theta$$

Where (x,y) are the local coordinates of the global point (X,Y) and $\theta$ is the orientation of the local system relative to the global system.

-

This transformation can be described as the multiplication of a vector by a matrix. This matrix is a rotation matrix scaled by $(X, Y)$. Its effect is to rotate $(x,y)$ by $\theta$ (about the origin), then scale by $(X,Y)$.
Out of interest. The rotation matrix given in Wikipedia produces the equations: $x = X \cos \theta - Y \sin \theta$ and $y = X \sin \theta + Y \cos \theta$ is this rotation ccw as opposed to cw? – baseten Jan 11 '12 at 11:16