Why the substitution is not working even though its bijective? The following integral i was trying to evaluate:
$$\int_0^\infty \left( \sin(1/x) - \frac{\sin(\pi/x)}{\pi} \right) \,dx.$$ ,what i did was substituting pi/x = 1/t in the second integral , which converts to first integral which tells integral is zero ,but answer is ln(pi) , whats the fault that i wanted to know .
 A: It sounds like what you did was to write
$$
\int_0^\infty \left( \sin(1/x) - \frac{\sin(\pi/x)}{\pi} \right) \,dx = \int_0^\infty \sin(1/x)\, dx - \int_0^\infty \frac{\sin(\pi/x)}{\pi} \,dx
$$
You then made a $u$-substitution on the second term $u = x/\pi$, in which case the integrals are the same and "should" cancel.
The problem is that both of these improper integrals are divergent.  Technically what we have here is
$$
\lim_{R \to \infty} \left[\int_0^R \sin(1/x)\, dx - \int_0^R \frac{\sin(\pi/x)}{\pi} \,dx \right]
$$
but since both integrals approach $\infty$, this is a limit of the form $\infty - \infty$ and is not necessarily zero.
If we do the $u$-substitution for the proper integrals, it becomes instead
$$
\lim_{R \to \infty} \left[ \int_0^R \sin(1/x)\, dx - \int_0^{R/\pi} \sin(1/u) \,du \right] = \lim_{R \to \infty} \int_{R/\pi}^R \sin(1/x) \, dx
$$
which is more amenable to limit-taking.  (In particular, you might try substituting $w = 1/x$ at this point.)
A: Integrate by parts to get $-x\dfrac{\sin\left(\frac{{\pi}}{x}\right)}{{\pi}}+x\sin\left(\dfrac{1}{x}\right)+\operatorname{Ci}\left(\dfrac{{\pi}}{x}\right)-\operatorname{Ci}\left(\dfrac{1}{x}\right)$
$(1).$ As $x\to \infty,$ the first two terms combine to give $-1+1=0.$ As $x\to 0,$ all four terms tend to $0$. Now,
${\displaystyle \operatorname {Ci} (x)=-\int _x^\infty \frac {\cos t}{t}}dt$ so ${\displaystyle \operatorname {Ci} (\pi/x)=-\int _{\pi/x}^\infty \frac {\cos t}{t}}dt$ and $\displaystyle\operatorname {Ci} (1/x)=-\int _{1/x}^\infty \frac{ \cos t}{t}dt$
and therefore
$(2).\ \operatorname{Ci}\left(\dfrac{{\pi}}{x}\right)-\operatorname{Ci}\left(\dfrac{1}{x}\right) = \displaystyle \int _{1/x}^{\pi/x} \frac {\cos t}{t}dt=\int _{1/x}^{\pi/x}\left(\frac{1}{t}-\frac{t}{2}+O(t³)\right)dt=$
$\ln(\pi/x)-\ln(1/x)+O(1/x^2)=\ln \pi+O(1/x^2)$
To finish, let $x\to \infty$ in $(2)$ and combine the result with $(1).$
