Why do these formulas rotate a point $(x,y)$ counterclockwise or clockwise by an angle of $\theta$? I have no idea how to start; I want a step-by-step explanation.

Counterclockwise: $x'=x\cos\theta-y\sin\theta$, $y'=x\sin\theta+y\cos\theta$
Clockwise: $x'=x\cos\theta+y\sin\theta$, $y'=-x\sin\theta+y\cos\theta$

  • 1
    $\begingroup$ This is the set of equations normally represented by a rotation matrix (en.wikipedia.org/wiki/Rotation_matrix). There are a ton explanations online, this one is nice and clear: sunshine2k.de/articles/RotationDerivation.pdf $\endgroup$
    – Carser
    Commented Aug 24, 2016 at 1:57
  • $\begingroup$ Thanks for reposting this. $\endgroup$
    – Deepak
    Commented Aug 24, 2016 at 2:00
  • 2
    $\begingroup$ @Deepak you should not encourage a user to repost (as a new question) the very same question that was closed, nor should you condone the same. By answering the re-post, you reinforced such behavior. $\endgroup$
    – amWhy
    Commented Aug 24, 2016 at 23:46
  • $\begingroup$ @amWhy In the first place, I disagree with the other post having been closed. It was marked "unclear" but I found it perfectly clear what was being asked. There may have been an argument for "off topic" due to no effort, but this had the air of a genuine conceptual question rather than just a homework question. Anyway, the issue was that I had painstakingly created a diagram to help the asker (and others) with the same question, but it was closed before I could post my answer. Which is why I'm grateful to the asker for reposting it, so my effort wasn't wasted. $\endgroup$
    – Deepak
    Commented Aug 25, 2016 at 12:58
  • $\begingroup$ You might also note that my answer was in the vein of "teaching a man to fish" as I didn't do all the work, just part of it to get the idea across. So that's in keeping with the ethos of this site as well. Plus I even linked this thread to another answer I gave so I think I managed to help another group of people there too. Isn't that what this site should ultimately be about, helping answer questions? $\endgroup$
    – Deepak
    Commented Aug 25, 2016 at 13:00

1 Answer 1


enter image description here

See image. This represents a counter-clockwise rotation of an original red segment (terminating at the original point) to a new blue segment (terminating at the new point). The line segment length $r$ is held constant.

The original coordinates $(x,y) = (r\cos\theta, r\sin\theta)$

The new coordinates $(x',y') = (r\cos(\theta + \alpha), r\sin(\theta + \alpha))$

Using angle sum formula, let's re-express the coordinate $x'$:

$r\cos(\theta + \alpha) = r\cos\theta\cos\alpha - r\sin\theta\sin\alpha = x\cos\theta - y\sin\theta$

You can now work out $y'$ and handle the clockwise case yourself.


Not the answer you're looking for? Browse other questions tagged .