Take next the cosine.
Let y = cos θ {\displaystyle y=\cos \theta } .
Now cos θ = sin ( π 2 − θ ) {\displaystyle \cos \theta =\sin \left({\dfrac {\pi }{2}}-\theta \right)} .
Therefore
d y = d ( sin ( π 2 − θ ) ) = cos ( π 2 − θ ) × d ( − θ ) , = cos ( π 2 − θ ) × ( − d θ ) , d y d θ = − cos ( π 2 − θ ) . {\displaystyle {\begin{aligned}&{\begin{aligned}dy=d\left(\sin \left({\frac {\pi }{2}}-\theta \right)\right)&=\cos \left({\frac {\pi }{2}}-\theta \right)\times d(-\theta ),\\&=\cos \left({\frac {\pi }{2}}-\theta \right)\times (-d\theta ),\end{aligned}}\\&{\frac {dy}{d\theta }}=-\cos \left({\frac {\pi }{2}}-\theta \right).\end{aligned}}}
And it follows that
d y d θ = − sin θ {\displaystyle {\frac {dy}{d\theta }}=-\sin \theta } .
Lastly, take the tangent. Let
y = tan θ , d y = tan ( θ + d θ ) − tan θ . {\displaystyle {\begin{aligned}y&=\tan \theta ,\\dy&=\tan(\theta +d\theta )-\tan \theta .\\\end{aligned}}}
Expanding, as shown in books on trigonometry,
tan ( θ + d θ ) = tan θ + tan d θ 1 − tan θ ⋅ tan d θ ; whence d y = tan θ + tan d θ 1 − tan θ ⋅ tan d θ − tan θ = ( 1 + tan 2 θ ) tan d θ 1 − tan θ ⋅ tan d θ . {\displaystyle {\begin{aligned}\tan(\theta +d\theta )&={\frac {\tan \theta +\tan d\theta }{1-\tan \theta \cdot \tan d\theta }};\\{\text{whence}}\quad \quad \quad dy&={\frac {\tan \theta +\tan d\theta }{1-\tan \theta \cdot \tan d\theta }}-\tan \theta \\&={\frac {(1+\tan ^{2}\theta )\tan d\theta }{1-\tan \theta \cdot \tan d\theta }}.\end{aligned}}}