Primitive of x by Tangent of a x

Theorem

 * $\ds \int x \tan a x \rd x = \frac 1 {a^2} \paren {\frac {\paren {a x} ^ 3} 3 + \frac {\paren {a x}^5} {15} + \frac {2 \paren {a x}^7} {105} + \cdots + \frac {\paren {-1}^{n - 1} 2^{2 n} \paren {2^{2 n} - 1} B_{2 n} \paren {a x}^{2 n + 1} } {\paren {2 n + 1}!} + \cdots} + C$

where $B_{2 n}$ denotes the $2 n$th Bernoulli number.

Proof
From Power Series Expansion for Tangent Function:

Also see

 * Primitive of $x \sin a x$
 * Primitive of $x \cos a x$
 * Primitive of $x \cot a x$
 * Primitive of $x \sec a x$
 * Primitive of $x \csc a x$