Derivative of $\int_{x}^{0} \frac{\cos xt}{t} dt$ I am working on the following problem: Find the derivative of $f(x)=\displaystyle \int_{x}^{0}\displaystyle\frac{\cos xt}{t}dt$.
The answer I am supposed to get is $\displaystyle \frac{1}{x}\left[1-2\cos(x^2)\right]$.
To get there, the first thing I did, of course, was switch the limits of integration as such: $f(x) = \displaystyle \int_{x}^{0} \frac{\cos xt}{t} dt = -\int_{0}^{x}\frac{\cos xt}{t} dt$.  
Then, I tried a couple of different avenues: first, I tried straight up integration by parts, with $\displaystyle u = \frac{1}{t}$, $\displaystyle dv=\cos xt$, and end up with $\displaystyle \left[ \frac{-\sin(xt)}{xt}\right]_{0}^{x} + \frac{1}{x}\int_{0}^{x}\frac{\sin(xt)}{t^{2}}dt$, which doesn't get me any closer to a solution.
choosing instead $u = \cos xt$ introduces natural logaritms that cause me to need more integration by parts, and eventually, I get that $\displaystyle \int_{0}^{x}\frac{\cos xt}{t}dt = \left[\ln t \cos (xt)\right]_{0}^{x}$, which is a problem, because $\ln t$ is not defined at $t=0$ (nor does the limit exist there, if I wrote it properly as an improper integral).  So, I'm at an impasse.
If someone could please tell me how in the world they managed to get $\displaystyle \frac{1}{x}\left[1-2\cos(x^2)\right]$ out of this, I'd be most grateful.  I'm sure it is something very simple, yet extremely clever.
Thank you in advance (this was a question on a GRE practice test, fyi).
 A: You are not looking for $f$, but for $f'(x)$. So, we want to know
$$
f'(x)=\frac{d}{dx}\int_{x}^{0}\frac{\cos(xt)}{t}dt
$$
We can differentiate under the sign of the integral, given that the integrand and it's partial derivative in relation to $x$ are continuous (see http://en.wikipedia.org/wiki/Differentiation_under_the_integral_sign). So,
$$
f'(x)=-\frac{\cos(x^2)}{x}+\int_{x}^{0}\frac{\partial}{\partial x}\frac{\cos(xt)}{t}dt =-\frac{\cos(x^2)}{x}+\int_{x}^{0}-\sin(xt)dt = \\
-\frac{\cos(x^2)}{x}+ [\frac{\cos(xt)}{x}]_{x}^{0}=\frac{1}{x}-2\frac{\cos(x^2)}{x}
$$
A: In general we have this formula:
$$\frac d{dx}\int_{\alpha(x)}^{\beta(x)}f(t)dt = \beta'(x)\cdot f(\beta(x)) - \alpha'(x)\cdot f(\alpha(x))$$

Hope this is helpful.
A: $f'(x) = - \frac{\cos{x^2}}{x} + \int_x^0 (-\sin(tx))dt = - \frac{\cos{x^2}}{x} + \frac{-\cos{xt}|_0^x}{x} = \frac{1}{x} (1-2\cos{x^2})$
The point is, if $f(x)=\int_{a(x)}^{b(x)} g(x,t) dt$, $\frac{df}{dx} = \int \frac{\partial g}{\partial x} dt +b'(x) g(x,b) -a'g(x,a)$.
A: $$f(x)=\int_{x}^{0}\frac{\cos xt}{t}dt$$
Define $F(T,x) = \displaystyle\int_T^0 \frac{\cos xt}{t}dt$.
Then $f(x) = F(x,x)$, and $$
f'(x) = \frac{\partial F}{\partial T}(x,x) + \frac{\partial F}{\partial x}(x,x)
$$
Then, compute the partial derivatives:
$$
\frac{\partial F}{\partial T}(T,x) = -\frac{\cos xT}{T}\\
\frac{\partial F}{\partial x}(T,x) = \int_T^0 \frac{-t\sin xt}{t}dt
= -\int_T^0 {\sin xt}\ dt = \left[\frac{\cos xt}{x}\right]_{t=T}^0
= \frac{1}{x} - \frac{\cos xT}x
$$
Then put things together.
