# why is the square of this matrix with sin and cos equal to the identity matrix?

I have a question about why the square of the matrix Q, below, is equal to the identity matrix.

Q =

   cos X  -sin X
sin X   cos X


My knowledge of trigonometry seems to have rotted away, and I can't figure out what rules are used to justify the statement made by professor Strang at 11:55 of this video > Lec 20 | MIT 18.06 Linear Algebra, Spring 2005 (he says the square of Q is equal to I)

The thing that has me stuck is the following: In order to calculate the first cell of Q * Q we take the dot product of the first row and the first column. That would be

  cos^2 Q  -  sin^2 Q


But how is that equal to the "1" that we want in the upper left most cell of the identity matrix ?

If this were cos^2 Q + sin^2 Q

then it would be equal to 1.. but we have a difference here, not a sum.

epilogue: thanks for the answers ! I don't know how I missed the fact that he was not making this claim for Q^2, but Q-transpose * Q, instead. Appreciate your pointing it out.

• Is mayhaps $X = \pi$? For $$\begin{pmatrix}\cos\varphi & -\sin\varphi\\\sin\varphi&\cos\varphi\end{pmatrix}^2 = \begin{pmatrix}\cos(2\varphi) & -\sin(2\varphi)\\\sin(2\varphi)&\cos(2\varphi)\end{pmatrix}$$ – Daniel Fischer Sep 13 '13 at 22:41
• I took the square and I did not end up with the identity matrix either – imranfat Sep 13 '13 at 22:41
• Are you sure he didn't say $Q^TQ=I$ instead? I can't find the statement in the video; at 11:55 he's talking about a different $4\times4$ matrix. – user856 Sep 13 '13 at 22:44

Look at the video you referenced around 21:30, he is not saying that the square of this matrix is the identity matrix. He is saying that if the columns of $Q$ are orthonormal, then $QQ^T=I$ provided the matrix is square. That is to say the matrix is an $n \! \times \! n$ matrix.

Concisely: If $Q$ is a square ($n \! \times \! n$) matrix with orthonormal column vectors, then the product of $Q$ and its transpose equals the identity.

Also note that the column vectors of your matrix are orthonormal as their dot product is zero.

The square of this matrix is not equal to the identity matrix! We compute:

$Q^2 = \begin{bmatrix} \cos x & -\sin x \\ \sin x & \cos x \end{bmatrix} \begin{bmatrix} \cos x & -\sin x \\ \sin x & \cos x \end{bmatrix} = \begin{bmatrix} \cos^2 x - \sin^2 x & -2\sin x \cos x \\ 2 \sin x \cos x & \cos^2 x - \sin^2 x \end{bmatrix}, \tag{1}$

in fact this is

$Q^2 = \begin{bmatrix} \cos 2x & -\sin 2x \\ \sin 2x & \cos 2x \end{bmatrix}; \tag{2}$

but if we try $Q^TQ$, we get

$Q^TQ = \begin{bmatrix} \cos^2 x + \sin^2 x & -\cos x \sin x + \cos x \sin x \\ -\sin x \cos x + \sin x \cos x & \cos^2 x+ \sin^2 x \end {bmatrix} = I, \tag{3}$

$I$ being the $2 \times 2$ identity matrix.

So someone, somewhere must have gotten $Q^2$ and $Q^TQ$ mixed up!

Hope this helps clear things up!

Cheers!

$$\color{magenta}{ \left(% \begin{array}{cr} \cos\left(X\right) & \sin\left(X\right) \\ \sin\left(X\right) & -\cos\left(X\right) \end{array}\right)}$$

really does square to give the identity.

For an $n$ by $n$ matrix with real entries, call it $A,$ if $A$ is symmetric and $A^2 = I$ and $\operatorname{trace} A = n-2,$ then $A$ is a reflection. This applies to the example above with $n=2.$ The eigenvalues are, indeed, $-1,1.$

If we have real numbers $\alpha, \beta, \gamma$ such that $$\color{blue}{ \alpha^2 + \beta^2 + \gamma^2 = 1 },$$ then $$\color{green}{ \left( \begin{array}{ccc} 1 - 2 \alpha^2 & - 2 \alpha \beta & -2 \alpha \gamma \\ - 2 \alpha \beta & 1 - 2 \beta^2 & - 2 \beta \gamma \\ -2 \alpha \gamma & - 2 \beta \gamma & 1 - 2 \gamma^2 \end{array}\right)}$$ is a reflection. It negates the vector with entries $(\alpha, \beta, \gamma)$ and fixes vectors orthogonal to that, such as $(\beta, -\alpha, 0)$ and $(\alpha \gamma, \beta \gamma, \gamma^2 - 1).$ So the eigenvalues are $-1,1,1$ and the trace is $1 = 3-2.$

Oh, if you simply negate all the entries in the 3 by 3 matrix, what you get fixes $(\alpha, \beta, \gamma)$ and rotates in the orthogonal plane by $180^\circ$

Given a column vector $v$ with transpose $v^T$ a row vector, we know that $v^T v$ is the 1 by 1 matrix whose only entry is $v \cdot v = |v|^2.$ In contrast, $v v^T$ is a symmetric $n$ by $n$ matrix of rank $1.$ If, in addition, $|v| = 1,$ then the matrix of the reflection in $v$ is $$\color{magenta}{ I - 2 v v^T}.$$ So, given any $w$ orthogonal to $v,$ we get $v^T w = ( v \cdot w) = (0);$ so $$(I - 2 v v^T) w = Iw - 2 v (v^T w) = w - 2 v (0) = w.$$ But $$(I - 2 v v^T) v = Iv - 2 v (v^T v) = v - 2 v (1) = -v.$$ Meanwhile, $$(I - 2 v v^T)^2 = I - 4 v v^T + 4 v v^T v v^T = I - 4 v v^T + 4 v (v^T v) v^T = I.$$

If $a^2 + b^2 + c^2 + d^2 + e^2 + f^2 + g^2 + h^2 = 1,$ the reflection that negates $(a,b,c,d,e,f,g,h)$ is $$\color{magenta}{\left( \begin{array}{cccccccc} 1 - 2 a^2 & -2ab & -2ac & -2ad & -2ae & -2af & -2ag & -2ah \\ -2ab & 1-2b^2 & -2bc & -2bd & -2be & -2bf & -2bg & -2bh \\ -2ac & -2bc & 1-2c^2 & -2cd & -2ce & -2cf & -2cg & -2ch \\ -2ad & -2bd & -2cd & 1-2d^2 & -2de & -2df & -2dg & -2dh \\ -2ae & -2be & -2ce & -2de & 1-2e^2 & -2ef & -2eg & -2eh \\ -2af & -2bf & -2cf & -2df & -2ef & 1-2f^2 & -2fg & -2fh \\ -2ag & -2bg & -2cg & -2dg & -2eg & -2fg & 1-2g^2 & -2gh \\ -2ah & -2bh & -2ch & -2dh & -2eh & -2fh & -2gh & 1-2h^2 \end{array}\right)}$$ with trace 6.

Your matrix is the rotation matrix of any vector of length 1 about the origin. Why would that square end up being the identity matrix? It is, however for a selective number of values, as Daniel pointed out.

This matrix $Q$ represents a rotation around origin by $X$. Then $Q^2$ represents two consecutive rotation which means a rotation by $2x$: $$Q^2=\left[ \begin{array} {ll} \cos(2x)&-\sin(2x)\\ \sin(2x)&\cos(2x) \end{array} \right]$$ So $Q^2$ is not identity. However if you rotate back by $-x$ then you expect to go back to your original point. So the true inverse of $Q$ is: $$Q^*=\left[ \begin{array} {ll} \cos(x)&\sin(x)\\ -\sin(x)&\cos(x) \end{array} \right]$$ which is indeed its transpose.
$$\left(% \begin{array}{cr} \cos\left(X\right) & -\sin\left(X\right) \\ \sin\left(X\right) & \cos\left(X\right) \end{array}\right) = \cos\left(X\right) - {\rm i}\sin\left(X\right)\,\sigma_{y}\,, \quad \sigma_{y} \equiv \left(% \begin{array}{cr} 0 & -{\rm i} \\ {\rm i} & 0 \end{array}\right)\,, \quad \left\vert% \begin{array}{l} \mbox{Notice that} \\ \sigma_{x}^{2} = 2\times 2\ \mbox{identity}. \end{array}\right.$$
Then $$\left(% \begin{array}{cr} \cos\left(X\right) & -\sin\left(X\right) \\ \sin\left(X\right) & \cos\left(X\right) \end{array}\right) = \cos\left(X\right) - {\rm i}\sin\left(X\right)\,\sigma_{y} = {\rm e}^{-{\rm i}X\sigma_{y}}$$ So, $$\color{#ff0000}{\large% \left(% \begin{array}{cr} \cos\left(X\right) & -\sin\left(X\right) \\ \sin\left(X\right) & \cos\left(X\right) \end{array}\right)^{n} = {\rm e}^{-{\rm i}nX\sigma_{y}} = \left(% \begin{array}{cr} \cos\left(nX\right) & -\sin\left(nX\right) \\ \sin\left(nX\right) & \cos\left(nX\right) \end{array}\right)}$$