[Math] Order of operations in rotation matrix notation.

arithmeticlinear algebramatricesnotationtrigonometry

I'm trying to convert this equation to C# but I'm not a mathematician and I find math notation ambiguous:

See the first matrix in this article:

http://mathworld.wolfram.com/RotationMatrix.html

which has:

$$R'_\theta=\begin{bmatrix}\cos\theta & \sin\theta\\ -\sin\theta & \cos\theta \end{bmatrix} $$

That $-\sin\theta$, is that (negate sin) × angle, or negate (sin × angle)?

In math, unlike programming, there's not much use of parentheses in math equations, so what in what order should calculations be done?

Best Answer

$\theta$ is the greek letter theta. In this context, $\theta$ represents the angle of rotation.

$\sin$ and $\cos$ are trigonometric functions. You can read about them here. In your computations, these should be evaluated first.

If you have a point on a plane represented by the tuple $(x,y)$, mathematicians refer to this as a vector in $\mathbb{R}^2$. ($\mathbb{R}^2$ is the plane of real numbers.) Matrices like $R_\theta$ are transformations which we apply to vectors. If we let $$R=\left[\begin{array}{cc}r_{11}&r_{12}\\r_{21}&r_{22}\end{array}\right]$$ and multiply this with the vector $v=\left[\begin{array}{c}v_1\\v_2\end{array}\right]$, we have $$Rv=\left[\begin{array}{cc}r_{11}&r_{12}\\r_{21}&r_{22}\end{array}\right]\left[\begin{array}{c}v_1\\v_2\end{array}\right]=\left[\begin{array}{c}r_{11}v_1+r_{12}v_2\\r_{21}v_1+r_{22}v_2\end{array}\right].$$ So in the case of $R_\theta$, you have $r_{11}=\cos\theta$, $r_{12}=-\sin\theta$, etc. Compute these before you do the matrix multiplication, and you can use the above formula.

Of course, when you get to vectors in $\mathbb{R}_3$ (associated with $3\times 3$ matrices) you will need to use a different formula. $\text{C}\#$ probably has some built in commands to deal with all this. I would recommend reading up on the documentation if you want to avoid doing the math yourself.

Related Question