$$\frac{\sin x - \cos x +1}{\sin x + \cos x -1}=\frac{\sin x +1}{\cos x}$$
I tried substituting $\sin^2x+\cos^2x = 1$ but I cannot solve it.
$$\frac{\sin x - \cos x +1}{\sin x + \cos x -1}=\frac{\sin x +1}{\cos x}$$
I tried substituting $\sin^2x+\cos^2x = 1$ but I cannot solve it.
The above method is really verifying and always quick. Another method to arrive at the answer is by rationalising denominator (mainly when the answer [or RHS] is not known or one is asked to work out only from LHS to RHS):
$$\frac{\sin x - \cos x + 1 }{\sin x + \cos x - 1 }\cdot \frac{\sin x + \cos x + 1}{\sin x + \cos x + 1}$$
$$\frac{ (\sin x + 1)^2 - \cos^2 x }{ 2 \sin x \cos x } $$
$$ \frac{ \sin^2 x + 2 \sin x + 1 - \cos^2 x }{ 2 \sin x \cos x } $$
$$ \frac{ \sin^2 x + 2 \sin x + \sin^2 x + \cos^2 x - \cos^2 x } {2 \sin x \cos x } $$
and the answer follows i.e. $$ \frac{\sin x + 1}{\cos x}. $$
Hope it was helpful.
Hint
$$\frac{a}{b}=\frac c d\iff ad=bc$$
$(\sin x- \cos x+1)\cos x = \sin x \cos x -\cos^2 x +\cos x$
$(\sin x+ \cos x-1)(\sin x +1) = \sin^2 x + \sin x \cos x +\cos x -1 = \sin x \cos x +\cos x +(\sin^2 x -1)= \sin x \cos x -\cos^2 x +\cos x$
As always, the method that "always" (never say "never" OR "always"...) work is the substitution $ t = \tan \frac{x}{2},$ which makes $\sin(x) = \frac{2x}{1+x^2}, \cos(x)= \frac{1-x^2}{1+x^2},$ which makes an identity like this a mechanical verification.
Observe that the Right Hand side $\displaystyle\frac{\sin x+1}{\cos x}=\tan x+\sec x$
So, I want to utilize $\displaystyle\sec^2x-\tan^2x=1$
Dividing the numerator & the denominator by $\cos x,$
$$\frac{\sin x - \cos x +1}{\sin x + \cos x -1}=\frac{\tan x-1+\sec x}{\tan x+1-\sec x}$$
$$=\frac{\tan x+\sec x-(\sec^2x-\tan^2x)}{\tan x+1-\sec x}(\text{ Replacing }1\text{ with } \sec^2x-\tan^2x)$$
$$=\frac{(\sec x+\tan x)-(\sec x+\tan x)(\sec x-\tan x)}{\tan x+1-\sec x}$$
$$=\frac{(\sec x+\tan x)(1-\sec x+\tan x)}{\tan x+1-\sec x}$$
$$=\sec x+\tan x$$
I will start like Timotej, but finish differently.
$$\cos x(\sin x-\cos x+1)=\cos x(1+\sin x)-\cos^2x=\cos x(1+\sin x)-(1-\sin^2x)$$ $$=(1+\sin x)\{\cos x-(1-\sin x)\}$$
$$\implies \cos x(\sin x-\cos x+1)=(1+\sin x)(\sin x+\cos x-1)$$
Now change the sides of $\displaystyle \cos x, \sin x+\cos x-1$
Let me derive some other identities
$(1)\displaystyle\sin x(\sin x-\cos x+1)=\sin^2x+\sin x(1-\cos x)=1-\cos^2x+\sin x(1-\cos x)$
$\displaystyle\implies\sin x(\sin x-\cos x+1)=(1-\cos x)(\sin x+\cos x+1)$
$(2)\displaystyle\sin x(\sin x+\cos x-1)=\sin^2x-\sin x(1-\cos x)=(1-\cos x)(1+\cos x-\sin x)$
$(3)\displaystyle\cos x(\sin x+\cos x-1)=\cos^2x-\cos x(1-\sin x)=(1-\sin x)(1+\sin x-\cos x)$
and so on