Proving a trigonometric identity: $\frac{\cos x}{1-\sin x} -\tan x = \sec x$

For fun, I found a "trigonograph" of this identity (for acute $\theta$).

In the diagram, $\overline{AB}$ is tangent to the unit circle at $P$. The "trig lengths" (except for $|\overline{AQ}|$) should be clear.

enter image description here

We note that $\angle BPR \cong \angle RPP^\prime$, since these inscribed angles subtend congruent arcs $\stackrel{\frown}{PR}$ and $\stackrel{\frown}{RP^\prime}$. Very little angle chasing gives that $\triangle APQ$ is isosceles, with $\overline{AP} \cong \overline{AQ}$ (justifying that last trig length). Then, $$\triangle SPR \sim \triangle OQR \implies \frac{|\overline{SP}|}{|\overline{SR}|} = \frac{|\overline{OQ}|}{|\overline{OR}|} \implies \frac{\cos\theta}{1-\sin\theta} = \frac{\sec\theta+\tan\theta}{1}$$


We have
$$\begin{align}\frac{\cos x}{1-\sin x}-\tan x & = \frac{\cos x}{1-\sin x}-\frac{\sin x}{\cos x} \\[1.5ex] & =\frac{\cos^2 x-\sin x(1-\sin x)}{\cos x(1-\sin x)} \\[1.5ex] & =\frac{\cos^2 x+\sin^2 x-\sin x}{\cos x(1-\sin x)} \\[1.5ex] & =\frac{1-\sin x}{\cos x(1-\sin x)} \\[1.5ex] & =\frac{1}{\cos x} \\[2.8ex] & =\sec x\end{align}$$


Hint

$$\frac{\cos(x)}{1-\sin(x)}-\tan(x)=\frac{\cos(x)}{1-\sin(x)}-\frac{\sin(x)}{\cos(x)}=\frac{\cos^2(x)-\sin(x)+\sin^2(x)}{\cos(x)(1-\sin(x))}$$

Now what is $\cos^2(x)+\sin^2(x)$?