The rotation matrix

cos(theta) sin(theta)

-sin(theta) cos(theta)

will transform the coordinates x,y to a,b. that is:

a=x*cos(theta) + y*sin(theta)

b=-x*sin(theta) + y*cos(theta)

In the situation where x,y lines on the x axis (y=0), it is clear to me why a=x*cos(theta) and b=-x*sin(theta), since x is the radius, and the values of a and b follow from Pythagoras. What I don't understand is how the extra y*sin(theta) ( for a) and y*cos(theta) (for b) in the above equations compensate for an arbitrary x,y not being on the axis.

Can someone explain this to me, or at least point me in the direction of a thorough proof (easy to follow) of the rotation matrix?

Thanks,

Chris