Theorem: Primitive of Reciprocal of p squared minus Square of q by Hyperbolic Cosine of a x

:$\ds \int \frac {\d x} {p^2 - q^2 \cosh^2 a x} = \begin {cases}
\dfrac 1 {2 a p \sqrt {p^2 - q^2} } \ln \size {\dfrac {p \tanh a x + \sqrt {p^2 - q^2} } {p \tanh a x - \sqrt {p^2 - q^2} } } + C & : p^2 > q^2 \\
\dfrac 1 {a p \sqrt {q^2 - p^2} } \arctan \dfrac {p \tanh a x} {\sqrt {q^2 - p^2} } + C & : p^2 < q^2 \\
\end {cases}$

Proof:
{{begin-eqn}}
{{eqn | l = \int \frac {\d x} {p^2 - q^2 \cosh^2 a x}
      | r = \int \frac {\csch^2 a x \rd x} {p^2 \csch^2 a x - q^2 \coth^2 a x}
      | c = multiplying numerator and denominator by $\csch^2 a x$
}}
{{eqn | r = \int \frac {\csch^2 a x \rd x} {p^2 \paren {\coth^2 a x - 1} - q^2 \coth^2 a x}
      | c = Difference of Squares of Hyperbolic Cotangent and Cosecant
}}
{{eqn | r = \int \frac {\csch^2 a x \rd x} {\paren {p^2 - q^2} \coth^2 a x - p^2}
      | c = simplifying
}}
{{end-eqn}}
Let:
{{begin-eqn}}
{{eqn | l = u
      | r = \coth a x
      | c = 
}}
{{eqn | ll= \leadsto
      | l = \d u
      | r = -a \csch^2 a x \rd x
      | c = Derivative of Hyperbolic Cotangent Function
}}
{{eqn | ll= \leadsto
      | l = \int \frac {\d x} {p^2 - q^2 \cosh^2 a x}
      | r = \frac 1 a \int \frac {-\d u} {\paren {p^2 - q^2} u^2 - p^2}
      | c = Integration by Substitution: substituting $u = \tanh a x$
}}
{{eqn | n = 1
      | r = \frac 1 {a \paren {p^2 - q^2} } \int \frac {\rd u} {\frac {p^2} {p^2 - q^2} - u^2}
      | c = rearranging into a standard form
}}
{{end-eqn}}
There are two cases to address.
First, suppose $p^2 > q^2$.
Then we have that $p^2 - q^2 > 0$, and so:
{{begin-eqn}}
{{eqn | l = \int \frac {\d x} {p^2 - q^2 \cosh^2 a x}
      | r = \frac 1 {a \paren {p^2 - q^2} } \int \frac {\rd u} {\paren {\frac p {\sqrt {p^2 - q^2} } }^2 - u^2}
      | c = from $(1)$
}}
{{eqn | r = \frac 1 {a \paren {p^2 - q^2} } \frac {\sqrt {p^2 - q^2} } {2 p} \ln \size {\frac {\frac p {\sqrt {p^2 - q^2} } + u} {\frac p {\sqrt {p^2 - q^2} } - u} } + C
      | c = Primitive of $\dfrac 1 {a^2 - x^2}$
}}
{{eqn | r = \frac 1 {2 a p \sqrt {p^2 - q^2} } \ln \size {\frac {\frac p {\sqrt {p^2 - q^2} } + \coth a x} {\frac p {\sqrt {p^2 - q^2} } - \coth a x} } + C
      | c = substituting $u = \coth a x$
}}
{{eqn | r = \frac 1 {2 a p \sqrt {p^2 - q^2} } \ln \size {\frac {\frac p {\sqrt {p^2 - q^2} } + \frac 1 {\tanh a x} } {\frac p {\sqrt {p^2 - q^2} } - \frac 1 {\tanh a x} } } + C
      | c = {{Defof|Real Hyperbolic Cotangent}}
}}
{{eqn | r = \frac 1 {2 a p \sqrt {p^2 - q^2} } \ln \size {\frac {p \tanh a x + \sqrt {p^2 - q^2} } {p \tanh a x - \sqrt {p^2 - q^2} } } + C
      | c = multiplying numerator and denominator of argument of $\ln$ by $\sqrt {p^2 - q^2} \tanh a x$
}}
{{end-eqn}}
Now suppose $p^2 < q^2$.
Then we have that $p^2 - q^2 < 0$, and so:
{{begin-eqn}}
{{eqn | l = \int \frac {\d x} {p^2 - q^2 \cosh^2 a x}
      | r = \frac 1 {a \paren {p^2 - q^2} } \int \frac {\rd u} {\frac {p^2} {p^2 - q^2} - u^2}
      | c = from $(1)$
}}
{{eqn | r = \frac 1 {a \paren {p^2 - q^2} } \int \frac {\rd u} {\frac {-p^2} {q^2 - p^2} - u^2}
      | c = 
}}
{{eqn | r = \frac 1 {a \paren {q^2 - p^2} } \int \frac {\rd u} {u^2 + \paren {\frac p {\sqrt {q^2 - p^2} } }^2}
      | c = 
}}
{{eqn | r = \frac 1 {a \paren {q^2 - p^2} } \frac {\sqrt {q^2 - p^2} } p \arctan \frac u {\frac p {\sqrt {q^2 - p^2} } } + C
      | c = Primitive of $\dfrac 1 {x^2 + a^2}$
}}
{{eqn | r = \frac 1 {a p \sqrt {q^2 - p^2} } \arctan \frac {\sqrt {q^2 - p^2} u} p + C
      | c = 
}}
{{eqn | r = \frac 1 {a p \sqrt {q^2 - p^2} } \arctan \frac {\sqrt {q^2 - p^2} } p \coth a x + C
      | c = substituting $u = \coth a x$
}}
{{eqn | r = \frac 1 {a p \sqrt {q^2 - p^2} } \arctan \frac {\sqrt {q^2 - p^2} {p \tanh a x} } + C
      | c = {{Defof|Real Hyperbolic Cotangent}}
}}
{{eqn | r = \frac 1 {a p \sqrt {q^2 - p^2} } \arccot \frac {p \tanh a x} {\sqrt {q^2 - p^2} } + C
      | c = Arctangent of Reciprocal equals Arccotangent
}}
{{eqn | r = \frac 1 {a p \sqrt {q^2 - p^2} } \map \arctan {\frac {p \tanh a x} {\sqrt {q^2 - p^2} } - \dfrac \pi 2} + C
      | c = Sum of Arctangent and Arccotangent
}}
{{eqn | r = \frac 1 {a p \sqrt {q^2 - p^2} } \arctan \frac {p \tanh a x} {\sqrt {q^2 - p^2} } + C
      | c = subsuming $\dfrac \pi 2$ into constant
}}
{{end-eqn}}
{{qed}}