<s>[INST] Contradiction between integration by partial fractions and substitution Integration by substitution:
$$\int \frac {dx}{x^2-1}$$
Let $x=\sec\theta$ and $dx=\sec\theta\tan\theta \,d\theta$
$$\int \frac {dx}{x^2-1} = \int \frac{\sec\theta\tan\theta \,d\theta}{\sec^2\theta-1} = \int \frac {\sec\theta\tan\theta\, d\theta}{\tan^2\theta} = \int \frac {\sec\theta \,d\theta}{\tan\theta} $$
$$\int \frac {\sec\theta \,d\theta}{\tan\theta} = \int \frac {\cos \theta \,d\theta}{\cos\theta \sin \theta} = \int \csc\theta\, d\theta$$
$$=\ln|\csc\theta-\cot\theta|+C$$
$$=\ln| \frac{x}{\sqrt{x^2-1}}-\frac{1}{\sqrt{x^2-1}}|+C=\ln| \frac{x-1}{\sqrt{x^2-1}}|+C$$
Which is $Undefined$ for $|x|<1$

Integration by partial fractions:
$$\int \frac {dx}{x^2-1}$$
$$\int \frac {dx}{x^2-1}= \frac 12\int\frac{dx}{x-1}- \frac12\int \frac{dx}{x+1} =  \frac12 \ln | x-1| - \frac12 \ln|x+1| +C$$
$$ =  \frac12 \ln | \frac{x-1}{x+1}|+C$$
Which is $Defined$ for $|x|<1$ and this is right because the integrand is defined for $|x|<1$
What is the problem in the substitution method ? 
 [/INST] On simplifying
\begin{align}
& \ln \frac{x-1}{\sqrt{x^2-1}}=\ln\frac{\sqrt{x-1}^2}{\sqrt{(x-1)(x+1)}} \\[6pt]
= {} & \ln\frac{\sqrt{x-1}}{\sqrt{x+1}} \\[6pt]
= {} &  \frac 1 2 \ln \frac{x-1}{x+1} 
\end{align}
</s>