Let
$$LHS = \dfrac{\sin\theta - \cos\theta + 1}{\sin\theta + \cos\theta - 1} \quad\text{and}\quad RHS = \dfrac{1}{\sec\theta - \tan\theta}.$$
Step 1 Simplify the right-hand side
Rationalise the denominator of $$RHS$$:
$$\dfrac{1}{\sec\theta-\tan\theta}\;=\;\dfrac{1}{\sec\theta-\tan\theta}\,\cdot\,\dfrac{\sec\theta+\tan\theta}{\sec\theta+\tan\theta}\;=
\;\dfrac{\sec\theta+\tan\theta}{\sec^{2}\theta-\tan^{2}\theta}.$$
Using $$\sec^{2}\theta = 1+\tan^{2}\theta$$, we get
$$\sec^{2}\theta-\tan^{2}\theta=(1+\tan^{2}\theta)-\tan^{2}\theta=1.$$
Therefore
$$RHS = \sec\theta+\tan\theta.$$
Express each term in sine and cosine:
$$\sec\theta+\tan\theta=\dfrac{1}{\cos\theta}+\dfrac{\sin\theta}{\cos\theta}=\dfrac{1+\sin\theta}{\cos\theta}.$$
Hence
$$RHS = \dfrac{1+\sin\theta}{\cos\theta}. \quad(1)$$
Step 2 Show that the left-hand side equals $$(1)$$
Let $$s=\sin\theta$$ and $$c=\cos\theta$$ (to lighten notation).
We need to prove
$$\dfrac{s-c+1}{s+c-1}=\dfrac{1+s}{c}. \quad(2)$$
Cross-multiply the two fractions in (2):
$$c\,(s-c+1)=(1+s)(s+c-1).$$
Compute each side separately.
- Left side:
$$c\,(s-c+1)=cs-c^{2}+c.$$
- Right side:
$$(1+s)(s+c-1)=1\cdot(s+c-1)+s\cdot(s+c-1) \\
\qquad = (s+c-1)+(s^{2}+sc-s) \\
\qquad = s^{2}+sc+c-1.$$
Take the difference “right − left”:
$$\bigl(s^{2}+sc+c-1\bigr)-\bigl(cs-c^{2}+c\bigr)=s^{2}+sc+c-1-cs+c^{2}-c=s^{2}+c^{2}-1.$$
But for every angle $$\theta$$, $$s^{2}+c^{2}=\sin^{2}\theta+\cos^{2}\theta=1.$$
Hence the difference is $$0$$, so the two sides are equal. Therefore equation (2) is true, i.e.
$$\dfrac{\sin\theta-\cos\theta+1}{\sin\theta+\cos\theta-1}=\dfrac{1+\sin\theta}{\cos\theta}. \quad(3)$$
Step 3 Conclude the proof
From (1) and (3) we have
$$LHS=\dfrac{1+\sin\theta}{\cos\theta}=RHS.$$
Hence the required identity is proved:
$$\boxed{\dfrac{\sin\theta-\cos\theta+1}{\sin\theta+\cos\theta-1}=\dfrac{1}{\sec\theta-\tan\theta}}.$$