

It is very important to follow a derivation based on the diagram given. The two references which you are making might be referring to two different diagrams in which the angle θ marked is different. There is no rule like sin component should cancel or cos component should cancel. It actually depends on how you have taken your angle. So follow one derivation with the diagram whichever you understand better.
