Given a point O and angle θ, a rotation is a transformation in which every point P with position angle α is moved to the point P′ such that OP=OP′ and that P′ has position angle α+θ.
To express rotation as a linear transformation, we must map the origin to itself. Thus, we will assume that the origin is our center of rotation. If this is not the case for your transformation, you should translate so that this holds, and then apply another translation that takes the problem back to the original center of rotation.
For now, we will just work with two dimensions. This is the simplest, and any single rotation may be shifted so that it is in only two dimensions, so this should be good enough.
Let P=(r,α) in polar coordinates. Then P′=(r,α+θ).
For matrix representations, we will have to convert to Cartesian coordinates:
P=(rcosα,rsinα)
P′=(rcos(α+θ),rsin(α+θ))
Using the angle addition formulas for P′,
P′=(rcos(α+θ),rsin(α+θ))
P′=(r(cosαcosθ−sinαsinθ),r(sinαcosθ+cosαsinθ))
Suppose the rotation matrix is as follows:
A=[acbd]
Thus, for AP=P′, we have the following equations:
arcosα+brsinα=r(cosαcosθ−sinαsinθ)
crcosα+drsinα=r(sinαcosθ+cosαsinθ)
Cancelling out the r factors and solving, we have:
a=cosθ
b=−sinθ
c=sinθ
d=cosθ
Thus, here is the matrix for a rotation by an angle θ counterclockwise:
A=[cosθsinθ−sinθcosθ]