# Frechet derivative of double integral.

### Problem statement

Let $u(t) \in L^{2}(0, 1)$ and $J(u) = \int_0^1 tu(t) \int_0^t u(s)dsdt$

Compute first and second Frechet derivatives.

### Attempted solution

$$\begin{split} J(u + h) - J(u) &= \int_0^1t(u(t) + h(t))\int_0^t u(s) + h(s) dsdt - \int_0^1tu(t)\int_0^t u(s) dsdt \\ &= \int_0^1th(t)\int_0^t u(s) + h(s) dsdt + \int_0^1 tu(t) \int_0^t h(s) dsdt \\ &= \int_0^1th(t)\int_0^t h(s) dsdt + \int_0^1th(t)\int_0^t u(s) dsdt + \int_0^1 tu(t)\int_0^t h(s)dsdt \end{split}$$

Now, in the previous question of mine I was taught a nice trick of "exchange order of integration, rename back the variables", which applies nicely to the last integral:

$$\begin{split} \int_0^1 tu(t)\int_0^t h(s)dsdt &= \int_{t = 0}^1 \int_{s = 0}^t tu(t)h(s)dsdt\\ &= \int_{s = 0}^1 h(s) \int_{t = 0}^s tu(t)dtds \\ &= \int_{t = 0}^1 h(t) \int_{s = 0}^s su(s)dsdt \end{split}$$

After that the derivative computation looks like:

$$J(u + h) - J(u) = \int_0^1th(t)\int_0^t h(s) dsdt + \int_0^1h(t)\int_0^t u(s)(t + s) dsdt$$

I believe the first one to be $o(\|h\|_{L_2})$ and the second one to be $DJ(u)(h)$ but I have no idea of how to prove that. How is that shown?

Since you already know how to deal with functionals of the form $J(u)=\left< Au,u\right>$, it makes sense to put this one in the same form (which is possible, because it's quadratic in $u$). Namely, let $Au(t) = t\int_0^t u(s)\,ds$. To find the adjoint, work as usual (this is similar to what you do above, but simpler): $$\int_0^1 v(t)\, t\,dt \int_0^t u(s)\,ds = \int_0^1 u(s) \,ds \int_s^1 v(t)\, t\,dt \tag{1}$$ from where $A^* v (t) = \int_t^1 v(s)\,s\,ds$. Hence, the first derivative is $$Au+A^*u = t\int_0^t u(s)\,ds + \int_t^1 v(s)\,s\,ds = \int_0^1 u(s)\max(s,t)\,ds \tag{2}$$
This is not what you got, because you exchanged the order of integration incorrectly. From $0\le s\le t$ you should get $s\le t\le 1$.
Sanity check: the kernel $\max(s,t)$ in (2) is symmetric, which means the operator in (2) is self-adjoint, as $A+A^*$ must be.