Partial fractions and trig functions A long time ago I wrote down a silly problem. It starts with

Attempt to write $$\frac{1}{\sin(x)\cos(x)}$$ using partial fractions.

and then goes on to prove a trig identity.
I was wondering if there is actually a way to do this? Is there a way to write a "trig rational function" as a partial fraction? I would assume that the form (in general) is simply as follows, as if $\sin(x)=:y$ and $\cos(x)=:z$ and following your nose?
$$\frac{1}{\sin(x)\cos(x)}=\frac{A\sin(x)+B\cos(x)+C}{\sin(x)}+\frac{D\sin(x)+E\cos(x)+F}{\cos(x)}$$

OK, let's try the tangent half-angle substitution:
\begin{align}
\tan\frac\theta 2 & = t \\[8pt]
\theta & = 2\arctan t \\[8pt]
\sin\theta & = \sin(2\arctan t) = 2\sin(\arctan t)\cos(\arctan t) \\
& = 2\frac{t}{\sqrt{t^2+1}} \cdot \frac{1}{\sqrt{t^2+1}} \\[6pt]
& = \frac{2t}{t^2+1} \\[8pt]
\cos\theta & = \cos(2\arctan t) = \cos^2\arctan t - \sin^2\arctan t \\
& = \left(\frac{1}{\sqrt{t^2+1}}\right)^2 - \left(\frac{t}{\sqrt{t^2+1}}\right)^2 \\[6pt]
& = \frac{1-t^2}{1+t^2}
\end{align}
Then:
$$
\frac 1 {\sin\theta\cos\theta} = \frac{(t^2+1)^2}{2t(1-t^2)} = \frac{t^4+2t^2+1}{2t(1-t)(1+t)}
$$
Long division of polynomials gives us a first-degree polynomial in $t$ plus $\dfrac{\cdots}{2t(1-t)(1+t)}$, where the numerator is at most a second-degree polynomial, and the fraction becomes $\dfrac A t+ \dfrac B{1-t} + \dfrac C{1+t}$.
