You also need to remember that the sine and cosine functions are 2-Pi-periodic-- which means you can safely remove 2*Pi from any argument to a sine or cosine function without changing its value...
In other words:
sin(5*Pi / 2 - x) = sin( [5*Pi / 2 - x] - 2*Pi) = sin(Pi/2 - x), and similiarly
cos(5*Pi/ 2 - x) = cos(Pi/2 - x)