With a view to expressing the primitive in the form: :$\displaystyle \int u \frac {\d v} {\d x} \rd x = u v - \int v \frac {\d u} {\d x} \rd x$ let: {{begin-eqn}} {{eqn | l = u       | r = \frac {\sin^{m - 1} a x} {\cos^n a x}       | c =  }} {{eqn | ll= \leadsto       | l = \frac {\d u} {\d x}       | r = \frac {\cos^n a x \dfrac {\d} {\d x} \sin^{m - 1} a x - \sin^{m - 1} a x \dfrac {\d} {\d x} \cos^n a x} {\cos^{2 n} a x}       | c = Quotient Rule for Derivatives }} {{end-eqn}} Thus: {{begin-eqn}} {{eqn | l = \frac \d {\d x} \sin^{m - 1} a x       | r = a \paren {m - 1} \sin^{m - 2} a x \cos a x       | c = Derivative of $\sin a x$, Derivative of Power, Chain Rule for Derivatives }} {{eqn | l = \frac \d {\d x} \cos^n a x       | r = a n \cos^{n - 1} a x \paren {-\sin a x}       | c = Derivative of $\cos a x$, Derivative of Power, Chain Rule for Derivatives }} {{eqn | r = -a n \cos^{n - 1} a x \sin a x       | c =  }} {{end-eqn}} and so: {{begin-eqn}} {{eqn | l = \frac {\d u} {\d x}       | r = \frac {\cos^n a x \paren {a \paren {m - 1} \sin^{m - 2} a x \cos a x} + \sin^{m - 1} a x \paren {a n \cos^{n - 1} a x \sin a x} } {\cos^{2 n} a x}       | c =  }} {{eqn | r = \frac {a \paren {m - 1} \sin^{m - 2} a x \cos^2 a x + a n \sin^m a x} {\cos^{n + 1} a x}       | c = simplifying and cancelling $\cos^{n - 1}$ }} {{eqn | r = \frac {a \sin^{m - 2} a x \paren {\paren {m - 1} \cos^2 a x + n \sin^2 a x} } {\cos^{n + 1} a x}       | c = factorising }} {{eqn | r = \frac {a \sin^{m - 2} a x \paren {\paren {m - 1} \paren {1 - \sin^2 a x} + n \sin^2 a x} } {\cos^{n + 1} a x}       | c = Sum of Squares of Sine and Cosine }} {{eqn | r = \frac {a \sin^{m - 2} a x \paren {\paren {n - m + 1} \sin^2 a x + \paren {m - 1} } } {\cos^{n + 1} a x}       | c = simplifying }} {{eqn | r = \frac {a \paren {n - m + 1} \sin^m a x} {\cos^{n + 1} a x} + \frac {a \paren {m - 1} \sin^{m - 2} a x} {\cos^{n + 1} a x}       | c = separating }} {{end-eqn}} Then let: {{begin-eqn}} {{eqn | l = \frac {\d v} {\d x}       | r = \sin a x       | c =  }} {{eqn | ll= \leadsto       | l = v       | r = \frac {-\cos a x} a       | c = Primitive of $\sin a x$ }} {{end-eqn}} Then: {{begin-eqn}} {{eqn | l = \int \frac {\sin^m a x} {\cos^n a x} \rd x       | r = \int \frac {\sin^{m - 1} a x} {\cos^n a x} \sin^a x \rd x        | c =  }} {{eqn | r = \paren {\frac {\sin^{m - 1} a x} {\cos^n a x} } \paren {\frac {-\cos a x} a}       | c = Integration by Parts }} {{eqn | o =        | ro= -       | r = \int \paren {\frac {-\cos a x} a} \paren {\frac {a \paren {n - m + 1} \sin^m a x} {\cos^{n + 1} a x} + \frac {a \paren {m - 1} \sin^{m - 2} a x} {\cos^{n + 1} a x} } \rd x + C       | c =  }} {{eqn | r = \frac {-\sin^{m - 1} a x} {a \cos^{n - 1} a x}       | c =  }} {{eqn | o =        | ro= +       | r = \paren {n - m + 1} \int \frac {\sin^m a x} {\cos^n a x} \rd x       | c = Linear Combination of Integrals }} {{eqn | o =        | ro= +       | r = \paren {m - 1} \int \frac {\sin^{m - 2} a x} {\cos^n a x} \rd x + C       | c =  }} {{end-eqn}} {{begin-eqn}} {{eqn | ll= \leadsto       | l = \paren {1 - \paren {n - m + 1} } \int \frac {\sin^m a x} {\cos^n a x} \rd x       | r = \frac {-\sin^{m - 1} a x} {a \cos^{n - 1} a x} + \paren {m - 1} \int \frac {\sin^{m - 2} a x} {\cos^n a x} \rd x + C       | c =  }} {{eqn | ll= \leadsto       | l = \paren {m - n} \int \frac {\sin^m a x} {\cos^n a x} \rd x       | r = \frac {-\sin^{m - 1} a x} {a \cos^{n - 1} a x} + \paren {m - 1} \int \frac {\sin^{m - 2} a x} {\cos^n a x} \rd x + C       | c =  }} {{eqn | ll= \leadsto       | l = \int \frac {\sin^m a x} {\cos^n a x} \rd x       | r = \frac {-\sin^{m - 1} a x} {a \paren {m - n} \cos^{n - 1} a x} + \frac {m - 1} {m - n} \int \frac {\sin^{m - 2} a x} {\cos^n a x} \rd x + C       | c =  }} {{end-eqn}} {{qed}}