Calculate derivative of integral I tried to calculate the derivative of this integral:
$$\int_{2}^{3+\sqrt{r}}  (3 + \sqrt{r}-c) \frac{1}{2}\,{\rm d}c $$
First I took the anti-derivative of the integral:
$$\frac{1}{2}\left(\frac{-c^2}{2}+c\sqrt{r}+3c\right)$$
Then I evaluated the integral:
$$-\frac{1}{2}\left(\frac{3+\sqrt{r})^2}{2} + (3 + \sqrt{r})\sqrt{r}+3(3+\sqrt{r})\right)-\frac{1}{2}\left(-\frac{(2^2)}{2}+2\sqrt{r}+3\cdot 2\right)$$
After I simplified I got:
$$\frac{1 + 2\sqrt{r}+r}{4}$$
I should get:
$$\frac{1 + \sqrt{r}}{4\sqrt{r}}$$
But I cannot get this result.
Can someone help? what am I missing?
 A: As it appears the derivative is taken with respect to $r$. The integral in question is given by, and evaluated as, the following:
\begin{align}
I(r) &= \frac{1}{2} \, \int_{2}^{3+\sqrt{r}} (3 + \sqrt{r} - t) \, dt \\
&= \frac{1}{2} \, \left[ (3 + \sqrt{r}) t - \frac{t^{2}}{2} \right]_{2}^{3 + \sqrt{r}} \\
I(r) &= \frac{(3 + \sqrt{r})^{2}}{4} - (2 + \sqrt{r}).
\end{align}
Now by differentiation 
\begin{align}
\frac{dI}{dr} &=  \frac{2}{4} \cdot (3 + \sqrt{r}) \cdot \frac{1}{2 \sqrt{r}} - \frac{1}{2 \sqrt{r}} \\
&= \frac{3 + \sqrt{r}}{4 \sqrt{r}} - \frac{1}{2 \sqrt{r}} = \frac{1 + \sqrt{r}}{4 \, \sqrt{r}}.
\end{align}
A: I think that the obvious purpose of that problem is to use differentiation under the integral sign. As seen on wikipedia, the theorem states
$$
\frac{\mathrm{d}}{\mathrm{d}x} \left (\int_{a(x)}^{b(x)}f(x,t)\,\mathrm{d}t \right) = f(x,b(x))\cdot b'(x) - f(x,a(x))\cdot a'(x) + \int_{a(x)}^{b(x)} \frac{\partial}{\partial x}f(x,t)\; \mathrm{d}t
$$
(So in your notation $x=r$ and $t=c$). In this case this becomes particularly simple, because $f(x, b(x)) = 3+\sqrt{x}- (3+\sqrt{x})=0$ and $a'(x)=0$ hence we are left with 
$$
\int_{a(x)}^{b(x)} \frac{\partial}{\partial x}f(x,t)\; \mathrm{d}t = \frac{1}{4\sqrt x}\int_{2}^{3+\sqrt{x}} 1\; \mathrm{d}t = \frac{1+\sqrt{x}}{4\sqrt{x}}
$$
A: $$\int_{2}^{3+\sqrt{r}} \left(\frac{1}{2}\left(3+\sqrt{r}-c\right)\right)dc=$$
$$\frac{1}{2}\cdot\int_{2}^{3+\sqrt{r}} \left(3+\sqrt{r}-c\right)dc=$$
$$\frac{1}{2}\left(\int_{2}^{3+\sqrt{r}} (3)dc+\int_{2}^{3+\sqrt{r}} (\sqrt{r}) dc-\int_{2}^{3+\sqrt{r}} (c)dc\right)=$$
$$\frac{1}{2}\left(\left[3c\right]_{2}^{3+\sqrt{r}}+\left[c\sqrt{r}\right]_{2}^{3+\sqrt{r}}-\left[\frac{c^2}{2}\right]_{2}^{3+\sqrt{r}}\right)=$$
$$\frac{1}{2}\left(\left(3\sqrt{r}+3\right)+\left(r+\sqrt{r}\right)-\left(\frac{r}{2}+3\sqrt{r}+\frac{5}{2}\right)\right)=$$
$$\frac{1}{2}\left(\frac{1}{2}\left(\sqrt{r}+1\right)^2\right)=$$
$$\frac{1}{4}\left(\sqrt{r}+1\right)^2=\frac{\left(\sqrt{r}+1\right)^2}{4}$$
