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)}$$
 A: 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}$.
A: You can easily prove that the set $\{1,\cos x,\cos2x,\ldots,\cos nx,\sin x,\ldots,\sin nx\}$ is linearly indepedent over $\mathbb R$.
That's what you need to make identification $T(x)\equiv 0 \Leftrightarrow a_k(T)=0$ and thus to use this method.
A: Let's imagine a right triangle with angle $x$, hypotenuse $h$, opposite (of $x$) leg $o$ and adjacent leg $a$. Then $\sin(x) = \frac{o}{h}$ and $\cos{x} = \frac{a}{h}$, hence $$\frac{1}{\sin(x)\cos(x)} = \frac{1}{\frac{o}{h}\cdot \frac{a}{h}} \\ = \frac{h^2}{oa}$$ We also know in right triangles that $o^2+a^2 = h^2$, hence $$ \frac{h^2}{oa} =  \frac{o^2+a^2}{oa} \\ = \frac{o^2}{oa}+\frac{a^2}{oa} \\ = \frac{o}{a}+\frac{a}{o} \\ = \tan(x)+\cot(x)$$
