Let's first draw a triangle to get the trigonometry right.
So we get:
Which is the definition of the sine .
You could have done this another way if you knew that
Then it would be:
# cosx tanx -= sinx #
# cosx tanx -= cosx * sinx/cosx -= sinx #