## Change of coordinates by rotation

Let’s look at the transformation that rotates a point by an angle. Let’s take a simple example in ℝ² where we rotate the point 𝑃 by an angle 𝜃 in the XY plane about the origin to get the point 𝑃′ as shown in the below figure:

The coordinates of 𝑃 are (𝑥,𝑦) and the coordinates of 𝑃′ are (𝑥′,𝑦′). We need to find (𝑥′,𝑦′).

From the figure,

sinα = y/r , cosα = x/r − [1]

⟹ xsinα = ycosα − [2]

also, x′ = rcos(θ+α)

⟹ x′ = (x/cosα) ∗ cos(θ+α) (from [1])

but, cos(θ+α) = cosθcosα − sinθsinα

⟹ x′ = (x/cosα) ∗ (cosθcosα − sinθsinα)

⟹ x′ = xcosθ − xsinα ∗ (sinθ / cosα)

⟹ x′ = xcosθ − ycosα ∗ (sinθ / cosα) (from [2])

⟹ x′ = xcosθ − ysinθSimilarly,

y′ = rsin(θ+α)

⟹ y′ = (y/sinα) ∗ sin(θ+α) (from [1])

but, sin(θ+α) = sinθcosα + cosθsinα

⟹ y′ = (y/sinα) ∗ (sinθcosα + cosθsinα)

⟹ y′ = ycosθ + ycosα ∗ (sinθ / sinα)

⟹ y′ = ycosθ + xsinα ∗ (sinθ / sinα) (from [2])

⟹ y′ = ycosθ + xsinθ

⟹ y′ = xsinθ + ycosθHence we have,

x′ = xcosθ − ysinθ

y′ = xsinθ + ycosθ

Rotation is a linear operation, and the above equations can be represented as a matrix multiplication:

This operation is a linear transformation. Here, we are transforming the points keeping the axes or the basis fixed.

## Extending to R3

We can easily extend the rotation transformation to 𝐑³. The transformation matrices for rotation in 𝐑³ about the standard X-axis, Y-axis, and Z-axis are as follows:

## Intrinsic rotation vs extrinsic rotation

The above transformations perform rotation about the standard axes. The axes will be fixed at any time. This is called extrinsic rotation. There is another type of rotation called intrinsic rotation where we rotate the object about its relative axes at each step as shown below:

Intrinsic rotation is hard to perform with Euclidean algebra, and we’ll stick to extrinsic rotation.

## Change of basis by rotation

In a change of basis transformation, the goal is to find the coordinates of a point wrt a new basis. The point will be fixed.

In the below example, the 𝑋𝑌 axes have been rotated by an angle 𝜃 to get 𝑋′𝑌′. Given the coordinates of point 𝑃 wrt the old basis 𝑋𝑌, our goal is to find the coordinates of 𝑃 wrt the new basis 𝑋′𝑌′.

The coordinates of point 𝑃 wrt 𝑋𝑌 are (𝑥, 𝑦), and wrt to 𝑋′𝑌′ are (𝑥′, 𝑦′). Our goal is to find (𝑥′, 𝑦′).

From the figure,

sinα = y′/r , cosα = x′/r − [1]

⟹ x′sinα = y′cosα − [2]

also, x = rcos(θ+α)

⟹ x = (x′/cosα) ∗ cos(θ+α) (from [1])

but, cos(θ+α) = cosθcosα − sinθsinα

⟹ x = (x′ / cosα) ∗ (cosθcosα − sinθsinα)

⟹ x = x′cosθ − xsinα ∗ (sinθ / cosα)

⟹ x = x′cosθ − y′cosα ∗ (sinθ / cosα) (from [2])

⟹ x = x′cosθ − y′sinθSimilarly,

y = rsin(θ+α)

⟹ y = (y′/sinα) ∗ sin(θ+α) (from [1])

but, sin(θ+α) = sinθcosα + cosθsinα

⟹ y = (y′/sinα) ∗ (sinθcosα + cosθsinα)

⟹ y = y′cosθ + y′cosα ∗ (sinθ / sinα)

⟹ y = y′cosθ + x′sinα ∗ (sinθ / sinα) (from [2])

⟹ y = y′cosθ + x′sinθ

⟹ y = x′sinθ + y′cosθHence we have,

x = x′cosθ − y′sinθ

y = x′sinθ + y′cosθ

The above equations can be represented in the matrix form as: