Explanation of a 45-degree 2D rotation matrix

linear algebralinear-transformations

I am trying to understand how 2D matrix transformation works. Let's say I have a point (1, 1). The angle it makes with X axis is $\theta = 45°$ and I want to rotate the point (around origin) by additional 45 degrees, placing it at (0, √2).

Example

I know that 2D rotation matrix is provided by:

$\begin{bmatrix}\cos \theta & -\sin \theta\\\sin \theta & \cos \theta\end{bmatrix} = \begin{bmatrix}\cos 45 & -\sin 45\\\sin 45 & \cos 45\end{bmatrix} = \begin{bmatrix}0.5253 & -0.8509\\0.8509 & 0.5253\end{bmatrix}$

So now all I have to do to get (0, √2) is multiply the two out:

$\begin{bmatrix}0.5253 & -0.8509\\0.8509 & 0.5253\end{bmatrix}\begin{bmatrix}1\\1\end{bmatrix} = \begin{bmatrix}0.5253 – 0.8509\\0.8509 + 0.5253\end{bmatrix} = \begin{bmatrix}-0.3256\\1.3762\end{bmatrix} \neq \begin{bmatrix}0\\1.4142\end{bmatrix}$

What went wrong here?

Best Answer

You were using radians. 45 radians = 8100/pi degrees; 45 degrees = pi/4 radians. Use cos(pi/4) and sin(pi/4), or else change your calculator to degree mode.