How to simplify $\frac{(\sec\theta -\tan\theta)^2+1}{\sec\theta \csc\theta -\tan\theta \csc \theta}$

How to simplify the following expression :

$$\frac{(\sec\theta -\tan\theta)^2+1}{\sec\theta \csc\theta -\tan\theta \csc \theta}$$

Write $1$ in the numerator as : $$\sec^2(\theta) - \tan^2(\theta)$$

$$\frac{(\sec\theta -\tan\theta)^2+\sec^2\theta - \tan^2\theta}{\sec\theta \csc\theta -\tan\theta \csc \theta}$$

$$\frac{(\sec\theta -\tan\theta)^2+(\sec\theta - \tan\theta)(\sec\theta + \tan\theta)}{\sec\theta \csc\theta -\tan\theta \csc \theta}$$

$$\frac{(\sec\theta - \tan\theta)(\sec\theta - \tan\theta + \sec\theta + \tan\theta)}{\sec\theta \csc\theta -\tan\theta \csc \theta}$$

$$\frac{(\sec\theta - \tan\theta)(2 \sec\theta)}{\csc\theta(\sec\theta - \tan\theta)}$$

$$2 \tan\theta$$

Hence the simplified result is: $$2 \tan\theta$$

Hope the answer is clear !

The numerator becomes $(\sec\theta -\tan\theta)^2+1=\sec^2\theta+\tan^2\theta-2\sec\theta\tan\theta+1=2\sec\theta(\sec\theta -\tan\theta)$

So, $$\frac{(\sec\theta -\tan\theta)^2+1}{\sec\theta \csc\theta -\tan\theta \csc \theta}$$ $$=\frac{2\sec\theta(\sec\theta -\tan\theta)}{\csc\theta(\sec\theta -\tan\theta)}=2\frac{\sec\theta}{\csc\theta}(\text{ assuming } \sec\theta -\tan\theta\ne0)$$

$$=2\frac{\sin\theta}{\cos\theta}=2\tan\theta$$