# Transformation of Cartesian Coordinates

## Transformations on a Coordinate Plane

Let two rectangular coordinate systems be given on a plane. The first system is defined by the origin O and the basis vectors i and j. The second system is respectively determined by the origin O' and the basis vectors i' and j'.

An arbitrary point M has coordinates x and y in the first coordinate system. In the second coordinate system, the same point M has coordinates x' and y'. Express the coordinates x and y in terms of x' and y'. We have

$\mathbf{OM} = x\mathbf{i} + y\mathbf{j},\;\;\mathbf{O'M} = x'\mathbf{i'} + y'\mathbf{j'}.$

Let point O' have coordinates x0, y0 with respect to the first coordinate system. Then

$\mathbf{OO'} = x_0\mathbf{i} + y_0\mathbf{j}.$

Any vector on the plane can be expanded in terms of the basis i,j. Therefore, there are numbers α11, α12, α21 and α22 such that

$\mathbf{i'} = \alpha_{11}\mathbf{i} + \alpha_{12}\mathbf{j},\;\;\mathbf{j'} = \alpha_{21}\mathbf{i} + \alpha_{22}\mathbf{j}.$

$\mathbf{OM} = \mathbf{OO'} + \mathbf{O'M}.$

Hence

$x\mathbf{i} + y\mathbf{j} = x_0\mathbf{i} + y_0\mathbf{j} + x'\left({\alpha_{11}\mathbf{i} + \alpha_{12}\mathbf{j}}\right) + y'\left({\alpha_{21}\mathbf{i} + \alpha_{22}\mathbf{j}}\right),$

or

$\left\{ {\begin{array}{*{20}{l}} x = x_0 + \alpha_{11}x' + \alpha_{21}y'\\ y = y_0 + \alpha_{12}x' + \alpha_{22}y' \end{array}} \right..$

Assuming that the shortest turn from the unit vector i to the vector i' occurs counterclockwise, let's express the numbers α11, α12, α21, α22 in terms of the angle φ between these vectors. Multiply the equality $$\mathbf{i'} = \alpha_{11}\mathbf{i} + \alpha_{12}\mathbf{j}$$ by vector i:

$\mathbf{i'} = \alpha_{11}\mathbf{i} + \alpha_{12}\mathbf{j}, \Rightarrow \mathbf{i'}\cdot\mathbf{i} = \alpha_{11}\mathbf{i}\cdot\mathbf{i} + \alpha_{12}\mathbf{j}\cdot\mathbf{i}, \Rightarrow \cos\varphi = \alpha_{11} \cdot 1 + \alpha_{12} \cdot 0, \Rightarrow \alpha_{11} = \cos\varphi.$

Now we multiply the same equation by vector j:

$\mathbf{i'} = \alpha_{11}\mathbf{i} + \alpha_{12}\mathbf{j}, \Rightarrow \mathbf{i'}\cdot\mathbf{j} = \alpha_{11}\mathbf{i}\cdot\mathbf{j} + \alpha_{12}\mathbf{j}\cdot\mathbf{j}, \Rightarrow \cos\left({\frac{\pi}{2} - \varphi}\right) = \alpha_{11} \cdot 0 + \alpha_{12} \cdot 1, \Rightarrow \alpha_{12} = \sin\varphi.$

Performing the same operations with the second equation $$\mathbf{j'} = \alpha_{21}\mathbf{i} + \alpha_{22}\mathbf{j}$$, we find

$\alpha_{21} = -\sin\varphi,\;\alpha_{22} = \cos\varphi$

So we get the following coordinate transformation formulas:

$\left\{ {\begin{array}{*{20}{l}} x = x_0 + x'\cos\varphi - y'\sin\varphi\\ y = y_0 + x'\sin\varphi + y'\cos\varphi \end{array}} \right.$

It is convenient to write this system in matrix form:

$\left[ {\begin{array}{*{20}{c}} x\\ y \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} x_0\\ y_0 \end{array}} \right] + \left[ {\begin{array}{*{20}{c}} \cos\varphi & -\sin\varphi\\ \sin\varphi & \cos\varphi \end{array}} \right]\left[ {\begin{array}{*{20}{c}} x'\\ y' \end{array}} \right]$

The general transformation of coordinates consists of two transformations, one of which corresponds only to parallel translation of the system and the other only to the rotation of the system around the origin by an angle φ.

In the special case when $$\varphi = 0,$$ we are dealing only with parallel translation:

$\left[ {\begin{array}{*{20}{c}} x\\ y \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} x_0\\ y_0 \end{array}} \right] + \left[ {\begin{array}{*{20}{c}} x'\\ y' \end{array}} \right]$

In the case of pure rotation, the coordinate transformation is described by the rotation matrix:

$\left[ {\begin{array}{*{20}{c}} x\\ y \end{array}} \right] = \left[ {\begin{array}{*{20}{c}} \cos\varphi & -\sin\varphi\\ \sin\varphi & \cos\varphi \end{array}} \right]\left[ {\begin{array}{*{20}{c}} x'\\ y' \end{array}} \right]$

## Coordinate Transformations in Space. Euler Angles

Let two arbitrary Cartesian coordinate systems be given in space. The first system is determined by the origin O and the basis vectors i, j, k, and the second system is defined by the origin O' and the basis vectors i', j' and k'.

Let a point M have coordinates x, y and z in the first coordinate system. In the second coordinate system, this point has coordinates x', y' and z'. Using the same reasoning as in the case of a plane, we can express the coordinates x, y and z in terms of x', y' and z'. The coordinate transformation formulas are as follows:

$\left\{ {\begin{array}{*{20}{l}} x = x_0 + \alpha_{11}x' + \alpha_{21}y' + \alpha_{31}z'\\ y = y_0 + \alpha_{12}x' + \alpha_{22}y' + \alpha_{32}z'\\ z = z_0 + \alpha_{13}x' + \alpha_{23}y' + \alpha_{33}z' \end{array}} \right..$

In the case of a common origin, we can assume $$x_0 = y_0 = z_0 = 0.$$

The coefficients α11, α12, ..., α33 are expressed in terms of the so-called Euler angles, which completely determine the position of the axes of the second coordinate system relative to the first one.

We denote by $$N$$ the axis coinciding with the line of intersection of the $$xy-$$plane of the $$1\text{st}$$ system with the $$x^\prime y^\prime -$$plane of the $$2\text{nd}$$ system and directed so that the $$z-,$$ $$z'-,$$ and $$N-$$ axes form a right-handed coordinate system.

Let now $$\psi$$ be the angle between the $$x-$$axis and the $$N-$$axis, $$\theta$$ be the angle between the $$z-$$axis and the $$z'-$$axis, and finally $$\varphi$$ be the angle between the $$N-$$axis and the $$x'-$$axis. The three angles $$\psi, \theta$$ and $$\varphi$$ are called Euler angles.

If three Euler angles are given, then the transformation of the first coordinate system into the second one can be represented as a sequence of three rotations:

1. Rotation of the initial $$xyz-$$system about the $$z-$$axis by angle $$\psi$$ ;
2. Rotation about the $$x'-$$axis by angle $$\theta$$;
3. Rotation about the $$z'-$$axis by angle $$\varphi$$.

The numbers α11, α12, ..., α33 are defined in terms of Euler angles as follows:

$\left\{ {\begin{array}{*{20}{l}} \alpha_{11} = \cos\psi\cos\varphi - \sin\psi\cos\theta\sin\varphi\\ \alpha_{12} = \sin\psi\cos\varphi + \cos\psi\cos\theta\sin\varphi\\ \alpha_{13} = \sin\theta\sin\varphi\\ \alpha_{21} = -\cos\psi\sin\varphi - \sin\psi\cos\theta\cos\varphi\\ \alpha_{22} = -\sin\psi\sin\varphi + \cos\psi\cos\theta\cos\varphi\\ \alpha_{23} = \sin\theta\cos\varphi\\ \alpha_{31} = \sin\psi\sin\theta\\ \alpha_{32} = -\cos\psi\sin\theta\\ \alpha_{33} = \cos\theta \end{array}} \right..$

Thus, we get the following coordinate transformation formulas in three-dimensional space:

$\left\{ {\begin{array}{*{20}{l}} x = x_0 + x'\left({\cos\psi\cos\varphi - \sin\psi\cos\theta\sin\varphi}\right) + y'\left({\cos\psi\sin\varphi + \sin\psi\cos\theta\cos\varphi}\right) + z'\sin\psi\sin\theta\\ y = y_0 + x'\left({\sin\psi\cos\varphi + \cos\psi\cos\theta\sin\varphi}\right) + y'\left({\cos\psi\cos\theta\cos\varphi - \sin\psi\sin\varphi}\right) - z'\cos\psi\sin\theta\\ z = z_0 + x'\sin\theta\sin\varphi + y'\sin\theta\cos\varphi + z'\cos\theta \end{array}} \right..$

The rotation matrix (involving the three elementary rotations) has the form:

$R_{\psi\theta\varphi} = \left[ {\begin{array}{*{20}{c}} \cos\psi\cos\varphi - \sin\psi\cos\theta\sin\varphi & \cos\psi\sin\varphi + \sin\psi\cos\theta\cos\varphi & \sin\psi\sin\theta\\ \sin\psi\cos\varphi + \cos\psi\cos\theta\sin\varphi & \cos\psi\cos\theta\cos\varphi - \sin\psi\sin\varphi & -\cos\psi\sin\theta\\ \sin\theta\sin\varphi & \sin\theta\cos\varphi & \cos\theta \end{array}} \right].$

## Solved Problems

Click or tap a problem to see the solution.

### Example 1

Write formulas for the transformation of rectangular coordinates if the origin of the new $$x^\prime y^\prime-$$system is at a point $$O^\prime\left({4,2}\right)$$ and the angle from the positive direction of the $$x-$$axis to the positive direction of the $$x^\prime-$$axis is equal to $$\frac{\pi}{3}.$$ Both systems have right-handed orientation.

### Example 2

Given point $$M\left({5,-1}\right)$$ in the $$xy-$$coordinate system. Find its coordinates in the $$x^\prime y^\prime-$$system obtained from the first system by translating the origin $$O\left({0,0}\right)$$ to point $$O^\prime\left({2,-3}\right)$$ and rotating by the angle $$\varphi = -\arccos\frac{12}{13}.$$

### Example 1.

Write formulas for the transformation of rectangular coordinates if the origin of the new $$x^\prime y^\prime-$$system is at a point $$O^\prime\left({4,2}\right)$$ and the angle from the positive direction of the $$x-$$axis to the positive direction of the $$x^\prime-$$axis is equal to $$\frac{\pi}{3}.$$ Both systems have right-handed orientation.

Solution.

We use the equations

$\left\{ {\begin{array}{*{20}{l}} x = x_0 + x'\cos\varphi - y'\sin\varphi\\ y = y_0 + x'\sin\varphi + y'\cos\varphi \end{array}} \right..$

Substituting $$x_0 = 4,$$ $$y_0 = 2,$$ and $$\varphi = \frac{\pi}{3},$$ we get

$\left\{ {\begin{array}{*{20}{l}} x = 4 + x'\cos\frac{\pi}{3} - y'\sin\frac{\pi}{3}\\ y = 2 + x'\sin\frac{\pi}{3} + y'\cos\frac{\pi}{3} \end{array}} \right., \Rightarrow \left\{ {\begin{array}{*{20}{l}} x = 4 + \frac{1}{2}x' - \frac{\sqrt{3}}{2}y'\\ y = 2 + \frac{\sqrt{3}}{2}x' + \frac{1}{2}y' \end{array}} \right..$

### Example 2.

Given point $$M\left({5,-1}\right)$$ in the $$xy-$$coordinate system. Find its coordinates in the $$x^\prime y^\prime-$$system obtained from the first system by translating the origin $$O\left({0,0}\right)$$ to point $$O^\prime\left({2,-3}\right)$$ and rotating by the angle $$\varphi = -\arccos\frac{12}{13}.$$

Solution.

Calculate the sine and cosine of the angle $$\varphi:$$

$\cos\varphi = \cos\left({-\arccos\frac{12}{13}}\right) = \cos\left({\arccos\frac{12}{13}}\right) = \frac{12}{13};$
$\sin\varphi = \sin\left({-\arccos\frac{12}{13}}\right) = \pm\sqrt{1-\cos^2\left({-\arccos\frac{12}{13}}\right)} = \pm\sqrt{1-\left({\frac{12}{13}}\right)^2} = \pm\frac{5}{13}.$

Since the angle is in the fourth quadrant, we choose the minus sign: $$\sin\varphi = -\frac{5}{13}.$$

Substitute these values into the coordinate transformation equations:

$\left\{ {\begin{array}{*{20}{l}} x = x_0 + x'\cos\varphi - y'\sin\varphi\\ y = y_0 + x'\sin\varphi + y'\cos\varphi \end{array}} \right., \Rightarrow \left\{ {\begin{array}{*{20}{l}} 5 = 2 + \frac{12}{13}x' + \frac{5}{13}y'\\ -1 = -3 - \frac{5}{13}x' + \frac{12}{13}y' \end{array}} \right., \Rightarrow \left\{ {\begin{array}{*{20}{l}} 3 = \frac{12}{13}x' + \frac{5}{13}y'\\ 2 = - \frac{5}{13}x' + \frac{12}{13}y' \end{array}} \right..$

It is more convenient to pass to integer coefficients. This yields:

$\left\{ {\begin{array}{*{20}{l}} 12x' + 5y' = 39\\ - 5x' + 12y' = 26 \end{array}} \right..$

Use Cramer's rule to solve the system:

$\Delta = \left| {\begin{array}{*{20}{c}} 12 & 5\\ -5 & 12 \end{array}} \right| = 144+25 = 169;\;\Delta_{x^\prime} = \left| {\begin{array}{*{20}{c}} 39 & 5\\ 26 & 12 \end{array}} \right| = 468 - 130 = 338;\;\Delta_{y^\prime} = \left| {\begin{array}{*{20}{c}} 12 & 39\\ -5 & 26 \end{array}} \right| = 312 + 195 = 507.$

Hence,

$x^\prime = \frac{\Delta_{x^\prime}}{\Delta} = \frac{338}{169} = 2;\;y^\prime = \frac{\Delta_{y^\prime}}{\Delta} = \frac{507}{169} = 3.$

Thus the coordinates of the point $$M$$ in the new system are $${\left({2,3}\right)}.$$