Rotation About the Origin

To rotate a line or polygon, we must rotate each of its vertices

To rotate point (x1,y1) to point (x2,y2) we observe:

From the illustration we know that
sin(A+B) = y2/r
cos(A+B) = x2/r
sin(A) = y1/r
cos(A) = x2/r

From the Double angle formulas
sin(A+B) = sin(A)*cos(B) + cos(A)*sin(B)

Substituting
y2/r = (y1/r)*cos(B) + (x1/r)*sin(B)

Therefore: y2 = y1*cos(B) + x1*sin(B)

We have
x2 = x1*cos(B) - y1*sin(B)
y2 = x1*sin(B) + y1*cos(B)

Elaborate