TITLE: Using Feymann's trick in Advanced Integration
QUESTION [6 upvotes]: Introduction:

$\def\d{\mathrm{d}}$A common integration technique is to employ Feymann's trick. Assume that we have the following function of two variables$$\int_a^bf(x,y)\, \d x$$Then we can differentiate with respect to $y$ provided that $f$ is continuous and has partial continuous derivative on a chosen interval$$F'(y)=\int_{a}^bf_y(x,y)\, \d x$$But using this approach may be difficult because you have to think a lot to get the required answer. Since most integrals are in one variable, you will have to introduce a second variable and assume it is a function with two variables.

Example:

A worked example of integrating $\dfrac{x^2-1}{\ln x}$ with respect to $x$.$$\int_0^1\frac {x^2-1}{\ln x}\, \d x=?\tag1$$Since we can get a natural log when we diffentiate an exponential function $F(a)=2^a\implies F'(a)=\ln a\cdot 2^a$. Applying this to our problem, we have$$F(a)=\int_0^1\frac {x^a-1}{\ln x}\, \d x$$And taking the partial derivative with respect to $a$ gives$$F'(a)=\int_0^1\frac {\partial}{\partial a}\left(\frac {x^a-1}{\ln x}\right)\, \d x=\int_0^1x^a\, \d x=\frac 1{a+1}\tag{2}$$Integrating with respect to $a$ gives us$$F(a)=\ln(a+1)+C$$Set $a=0$ to find the value of the constant and we get $C=0$. Therefore, it implies that$$\int_0^1\frac {x^a-1}{\ln x}\, \d x=\ln(a+1)\implies\int_0^1\frac {x^2-1}{\ln x}\, \d x=\ln 3\tag3$$

Questions:


How do you know what to set $a$ as? In this case, they set the exponent of $x$ as $a$. Why? What was their reasoning?
Isn't the derivative of $2^a=\ln 2\cdot 2^a$, not $\ln a\cdot 2^a$?
Why did they set $a=0$? Why not $a=1$, or $2$?
How do you integrate this using Feymann's trick?$$\int_0^\infty\frac {\sin x}x\, \d x\tag4$$

REPLY [9 votes]: Let the integral of interest, $I$, be given by 
$$I=\int_0^1 \frac{x^2-1}{\log(x)}\,dx \tag 1$$
The challenge in evaluating $I$ as given in $(1)$ is the presence of the logarithm in the denominator.  So, we would like to find a way of eliminating the offending term.
One way to do this is to exploit the fact that $\frac{d\,x^a}{da}=\log(x)x^a$.  Hence, if we had $x^a$ instead of $x^2$ in the numerator of the integrand, we could differentiate under the integral sign and eliminate the logarithm from the denominator.  


It is worthy of mentioning that a second approach to eliminate the logarithm from the denominator is to recognize that $\frac{x-1}{\log(x)}=\int_0^1 x^t\,dt$ and proceed accordingly.


We proceed by forming a new function $F(a)$ given by
$$F(a)=\int_0^1 \frac{x^a-1}{\log(x)}\,dx \tag 2$$
so that upon differentiating $(2)$ under the integral sign reveals that 
$$F'(a)=\int_0^1 x^a\,dx= \frac{1}{a+1} \tag 3$$
It is at this point that we would like to recover $F(a)$ and then $F(2)$.  We can find $F(a)$ to within an integration constant from $(3)$ by integrating over $a$.  Proceeding we obtain
$$F(a)=\log(a+1)+C \tag4$$
where $C$ is yet to be found.  To find $C$, we need to know the value of $F(a)$ at some point.  If $a=1$ or $a=2$, we would need to evaluate $F(1)$ or $F(2)$, respectively.  
Well, if we already knew $F(2)$ we would not have to have gone through this procedure.  And to find $F(1)=\int_0^1 \frac{x-1}{\log(x)}\,dx$ we suffer from the appearance of the offending logarithm in the denominator.  
But $F(0)=\int_0^1 \frac{x^0-1}{\log(x)}\,dx=0$ is trivial to evaluate.  And now that we know that $F(a)=\log(a+1)+C$ and $F(0)=0$, we see that $C=0$.
This leaves us with $F(a)=\log(a+1)$ from which we see that $F(2)=\log(3)$.  And we are done! 
Note that $F(2)=\int_0^1 \frac{x^2-1}{\log(x)}\,dx$ is the integral of interest.

To evaluate $\int_0^\infty \frac{\sin(x)}{x}\,dx$ by use of Feynman's Trick, we introduce the function
$$G(a)=\int_0^\infty \frac{e^{-ax}\sin(x)}{x}\,dx\tag 5$$
Since $\int_0^\infty e^{-ax}\sin(x)\,dx$ converges uniformly for $a\ge \delta>0$, we assert that 
$$G'(a)=-\int_0^\infty e^{-ax}\sin(x)\,dx=-\frac{1}{1+a^2} \tag 6$$
Integrating $(6)$ we find that 
$$G(a)=-\arctan(a)+C$$
Letting $a\to \infty$ in $(5)$ reveals $\lim_{a\to \infty}G(a)=0$ and hence $C=\pi/2$.
Finally, we see that $G(0)=\pi/2$ and we are done!