If you wanted to do it the long way, you would do it as follows:
d/dx(tanx)(cosx)
=(tanx)'(cosx) + (cosx)'(tanx)
=(sinx/cosx)'(cosx) + (-sinx)(tanx)
=((cos^2x-(sin^2x))/cos^2x)(cosx) - (sinx)(tanx)
=((cos^2x/cos^2x)+(sin^2x/cos^2x))(cosx) - (sinx)(tanx)
=((cos^3x/cos^2x)+((sin^2x)(cosx)/cos^2x))) - (sinx)(sinx/cosx)
=(cosx+(sin^2x/cosx)) - (sin^2x/cosx)
=cosx
As you can see, that's rather long winded and you can see why everyone prefers to just simplify (tanx)(cosx) to sinx in the first step.