The matrices shown below perform counterclockwise rotations.
For 2D:
For 3D:
For a rotation around the z-axis:
For a rotation around the x-axis:
For a rotation around the y-axis:
Appendix A
The question came up, can the elements of a matrix be functions? As we can see in the examples above, the yes.
Also, our rotations are counterclockwise. If we had wanted clockwise rotation matrices we would take the matrices above and multiply all sine functions by -1.