# Integration - substitution that introduces $i$ into the integrand

This may turn out to be a trivial question, but is it valid to make a change of variables when calculating an indefinite, real integral that introduces the imaginary unit into the integrand? For example, if I'm trying to evaluate $$\int\frac{1}{\sqrt{y^2-1}}dy,$$ is making the substitution $$y=cos(\theta)$$, leading to the integral $$-i\int d\theta,$$ valid? Of course following the calculation of the above $$\theta$$ integral we would replace $$\theta$$ by $$arcos(y)$$.

Yes, you should however be able inter-convert between circular / hyperbolic /inverse hyperbolic functions and log functions.

Continuing from where you left, let $$u = -i \cos^{-1} y$$

$$\cos iu = y = \cosh u$$ $$u = \cosh^{-1}y =\pm \log(y + \sqrt{y^2-1})$$

However, it may be more convenient sticking either to circular or to hyperbolic regimes.

Your calculation seems correct, although I found that if you make the substitution $$y=\cos\theta$$ you should get \begin{align}\int\frac{-\sin\theta }{\sqrt{\cos^2\theta-1}}d\theta&=-\int\frac{\sin\theta}{\sqrt{-\sin^2\theta}}d\theta\\ &=-\frac{1}{i}\int\frac{\sin\theta}{|\sin\theta|}d\theta\\&=i\int\text{sgn}(\sin\theta)d\theta.\end{align} Another way is to notice that $$\int\frac{1}{\sqrt{y^2-1}}dy=\int\frac{\frac{y}{\sqrt{y^2-1}}+1}{\sqrt{y^2-1}+y}dy=\log \left(\sqrt{y^2-1}+y\right)+C\tag{*}$$ using $$\int f'(x)/f(x)dx=\log f(x)+C$$. But anyway, your calculation seems correct. If you plot your answer alongside (*) you get the same result, e.g. in Mathematica here's a plot where I've separated the curves by 0.02 vertically.

Plot[{-I ArcCos[x],Log[Sqrt[x^2-1]+x]+0.02},{x,0,5},AspectRatio->1] 