Proving $\int_0^\infty\frac{\sin(x)}x\ dx=\frac{\pi}2$. Why is this step correct?

I came across a different approach on the proof: $$\int_0^\infty \frac{\sin(x)}x\ dx=\frac{\pi}2$$ First, recall the identity: $$\sin(A)-\sin(B)=2\sin\left(\frac{A}2-\frac{B}2\right)\cos\left(\frac{A}2+\frac{B}2\right)$$ Applying the identity for: $$A=kx+\frac{x}2\ \land\ B=kx-\frac{x}2$$ We obtain:$$\sin\left(kx+\frac{x}2\right)-\sin\left(kx-\frac{x}2\right)=2\sin\left(\frac{x}2\right)\cos\left(kx\right)\Rightarrow \\\cos\left(kx\right)=\frac{\sin\left(kx+\frac{x}2\right)-\sin\left(kx-\frac{x}2\right)}{2\sin\left(\frac{x}2\right)}$$ Using the previous result, we can easily show that: $$\frac12+\cos(x)+\cos(2x)+\cdots+\cos(\lambda x)=\frac{\sin\left(\lambda x+\frac{x}2\right)}{2\sin\left(\frac{x}2\right)} \quad \text{where \lambda \in \mathbb{N}}$$ Integrating the last expression: $$\int_0^\pi\frac{\sin\left(\lambda x+\frac{x}2\right)}{\sin\left(\frac{x}2\right)}\ dx=\int_0^\pi\left(1+2\cos(x)+2\cos(2x)+\cdots+2\cos(\lambda x)\right)\ dx=\pi$$ We can also prove (since $f(x)$ is continuous on $[0,\pi]$), using Riemann-Lebesgue Lemma, that: $$\lim_{\lambda\to\infty}\int_0^\pi\underbrace{\left(\frac2t-\frac1{\sin\left(\frac{t}2\right)}\right)}_{f(x)}\sin\left(\lambda t+\frac{t}2\right)dt=\lim_{\lambda\to\infty}\int_0^\pi\left(\frac{2\sin\left(\lambda t+\frac{t}2\right)}t-\frac{\sin\left(\lambda t+\frac{t}2\right)}{\sin\left(\frac{t}2\right)}\right)=0$$ Therefore: $$\left(1\right)\ \lim_{\lambda\to\infty}\int_0^\pi\frac{2\sin\left(\lambda t+\frac{t}2\right)}t=\lim_{\lambda\to\infty}\int_0^\pi\frac{\sin\left(\lambda t+\frac{t}2\right)}{\sin\left(\frac{t}2\right)}=\pi$$ Returning to the initial problem: $$\\$$ Let: $$x=\lambda t+\frac{t}2$$ Thus: $$\int_0^\infty \frac{\sin(x)}x\ dx \stackrel{\eqref{*}}=\frac12\lim_{\lambda\to\infty}\int_0^{\color{teal}{\pi}}\frac{2\sin\left(\lambda t+\frac{t}2\right)}{t}\ dt$$ Using the result obtained from $(1)$:$$\int_0^\infty \frac{\sin(x)}x\ dx=\boxed{\frac{\pi}2}$$  My question comes from $\color{teal}{(???)}$, Why is it correct to have $\pi$ instead of $\infty$ when changing the limits of integration?

Let $x = (\lambda + \frac{1}{2}) t$. Then $$\int_0^T \frac{\sin((\lambda + \frac{1}{2}) t)}{t} \mathrm{d}t = \int_0^{(\lambda + \frac{1}{2}) T} \frac{\sin(x)}{\frac{x}{\lambda + \frac{1}{2}}}\frac{\mathrm{d}x}{(\lambda + \frac{1}{2})}=\int_0^{(\lambda + \frac{1}{2}) T} \frac{\sin(x)}{x} \mathrm{d}x$$ Take the limit: $$\lim_{\lambda\to\infty} \int_0^{(\lambda + \frac{1}{2}) T} \frac{\sin(x)}{x} \mathrm{d}x = \int_0^{\infty} \frac{\sin(x)}{x} \mathrm{d}x$$
• So the last step is correct for any $T\in\mathbb{R}$?
• For any $T>0\in \mathbb{R}$, but yes.
Let $l_n=n/\pi-1/2$ for $n/\pi>1/2$. Then $$\int_0^n t^{-1}\sin t\;dt =\int_0^{\pi} t^{-1}\sin (l_nt+t/2)\;dt.$$ Now let $n\to \infty.$