Theorem: Primitive of x over Power of Hyperbolic Cosine of a x

:$\ds \int \frac {x \rd x} {\cosh^n a x} = \frac {x \sinh a x} {a \paren {n - 1} \cosh^{n - 1} a x} + \frac 1 {a^2 \paren {n - 1} \paren {n - 2} \cosh^{n - 2} a x} + \frac {n - 2} {n - 1} \int \frac {x \rd x} {\cosh^{n - 2} a x} + C$

Proof:
{{begin-eqn}}
{{eqn | l = \int \frac {x \rd x} {\cosh^n a x} 
      | r = \int x \sech^n a x \rd x
      | c = {{Defof|Hyperbolic Secant}}
}}
{{eqn | r = \frac 1 {a^2} \int \theta \sech^n \theta \rd \theta
      | c = Substitution of $a x \to \theta$
}}
{{eqn | ll= \leadsto
      | l = \frac 1 {a^2} \int \theta \sech^n \theta \rd \theta
      | r = \frac 1 {a^2} \int \sech^2 \theta \times \theta \sech^{n - 2} \theta \rd \theta
      | c =  $\rd u = \sech^2 \theta$ and $v = \theta \sech^{n - 2} \theta$
}}
{{eqn | r = \frac 1 {a^2} \paren {\theta \tanh \theta \sech^{n - 2} \theta - \int \tanh \theta \paren {- \paren {n - 2} \theta \tanh \theta + 1} \sech^{n - 2} \theta \rd \theta}
      | c = Integration by Parts
}}
{{eqn | r = \frac 1 {a^2} \paren {\theta \tanh \theta \sech^{n - 2} \theta - \int \tanh \theta  \sech^{n - 2} \theta \rd \theta + \paren {n - 2} \int \theta \tanh^2 \theta \sech^{n - 2} \theta \rd \theta}
      | c = simplifying
}}
{{eqn | r = \frac 1 {a^2} \paren {\theta \tanh \theta \sech^{n - 2} \theta - \int \tanh \theta  \sech^{n - 2} \theta \rd \theta + \paren {n - 2} \int \theta \paren {1 - \sech^2 \theta} \sech^{n - 2} \theta \rd \theta}
      | c = Sum of Squares of Hyperbolic Secant and Tangent
}}
{{eqn | r = \frac 1 {a^2} \paren {\theta \tanh \theta \sech^{n - 2} \theta - \int \tanh \theta  \sech^{n - 2} \theta \rd \theta + \paren {n - 2} \int \theta \sech^{n - 2} \theta \rd \theta - \paren {n - 2} \int \theta \sech^n \theta \rd \theta}
      | c = simplifying
}}
{{eqn | ll= \leadsto
      | l = \frac {1 + \paren {n - 2} } {a^2} \int \theta \sech^n \theta \rd \theta
      | r = \frac 1 {a^2} \paren {\theta \tanh \theta \sech^{n - 2} \theta - \int \tanh \theta  \sech^{n - 2} \theta \rd \theta + \paren {n - 2} \int \theta \sech^{n - 2} \theta \rd \theta}
      | c = adding end term to both sides
}}
{{eqn | ll= \leadsto
      | l = \frac 1 {a^2} \int \theta \sech^n \theta \rd \theta
      | r = \frac 1 {a^2 \paren {n - 1} } \paren {\theta \tanh \theta \sech^{n - 2} \theta - \int \tanh \theta  \sech^{n - 2} \theta \rd \theta + \paren {n - 2} \int \theta \sech^{n - 2} \theta \rd \theta}
      | c = rearranging for the intended primitive
}}
{{eqn | r = \frac 1 {a^2 \paren {n - 1} } \paren {\theta \tanh \theta \sech^{n - 2} \theta - \paren {- \frac {\sech^{n - 2} \theta } { \paren {n - 2} } } + \paren {n - 2} \int \theta \sech^{n - 2} \theta \rd \theta}
      | c = Primitive of Power of Hyperbolic Secant of a x by Hyperbolic Tangent of a x
}}
{{eqn | r = \frac {\theta \sinh \theta} {a^2 \paren {n - 1} \cosh^{n - 1} \theta } + \frac 1 {a^2 \paren {n - 1} \paren {n - 2} \cosh^{n - 2} \theta } + \frac {n - 2} {a^2 \paren {n - 1} } \int \frac {\theta} {\cosh^{n - 2} \theta} \rd \theta
      | c = simplifying
}}
{{eqn | ll= \leadsto
      | l = \int \frac {x \rd x} {\cosh^n a x} 
      | r = \frac {a x \sinh a x} {a^2 \paren {n - 1} \cosh^{n - 1} a x } + \frac 1 {a^2 \paren {n - 1} \paren {n - 2} \cosh^{n - 2} ax } + \frac {n - 2} {n - 1} \int \frac x {\cosh^{n - 2} ax} \rd x
      | c = Substituting back $\theta \to ax$
}}
{{eqn | r = \frac {x \sinh a x} {a \paren {n - 1} \cosh^{n - 1} a x } + \frac 1 {a^2 \paren {n - 1} \paren {n - 2} \cosh^{n - 2} ax } + \frac {n - 2} {n - 1} \int \frac {x \rd x} {\cosh^{n - 2} ax} + C
      | c = simplifying and adding integration constant
}}
{{end-eqn}}
{{qed}}