I was just solving a question of integration which though I know how to solve but just thought of approaching it in a different way which includes use of complex numbers.
Question:- $\displaystyle\int{\dfrac{e^x}{\sqrt{e^{2x}-a^2}}dx}$
Standard Approach:- Let $z=e^x\implies dz=e^xdx$
So, the integral becomes $\displaystyle\int{\dfrac{dz}{\sqrt{z^2-a^2}}}=\ln\left|z+\sqrt{z^2-a^2}\right|+c=\ln\left|e^x+\sqrt{e^{2x}-a^2}\right|+c$
The approach through which I am trying to solve the question:-
Let $z=e^x\implies dz=e^xdx$
$\therefore \displaystyle\int{\dfrac{e^x}{\sqrt{e^{2x}-a^2}}dx}=\displaystyle\int{\dfrac{dz}{\sqrt{z^2-a^2}}}=\displaystyle\int{\dfrac{\sqrt{-1}dz}{\sqrt{-1}\sqrt{z^2-a^2}}}=\displaystyle\int{\dfrac{idz}{\sqrt{a^2-z^2}}}$
Now form this point I thought that there can be two routes which can be followed to arrive at an answer but none being the answer.
First Route:- Let $y=iz\implies dy=idz$
Then $\displaystyle\int{\dfrac{idz}{\sqrt{a^2-z^2}}}=\displaystyle\int{\dfrac{dy}{\sqrt{a^2+y^2}}}=\ln\left|y+\sqrt{y^2+a^2}\right|=\ln\left|iz+\sqrt{a^2-z^2}\right|+c$
Second Route:-$\displaystyle\int{\dfrac{idz}{\sqrt{a^2-z^2}}}=i\displaystyle\int{\dfrac{dz}{\sqrt{a^2-z^2}}}=i\sin^{-1}{\dfrac{x}{a}}+c$
So, what am I doing wrong here, and also I do not have much knowledge of complex integration so is it a basic conceptual mistake that I am making because of treating $i$ as a constant.