Let $\Omega \subset \mathbb{R}^2$ be open and bounded, $P:C^1(\Omega) \to L_2(\mathbb{R})$ be a linear and bounded operator. I want to calculate the first variation of $\|Pu - f\|^2_{L_2}$, $u \in C^1(\Omega), f \in L_2(\Omega)$.
${d \over dt}\|P(u+tv) - f\|^2_{L_2} = {d \over dt}\int_{\Omega} |P(u+tv) - f|^2 = {d \over dt}\int_{\Omega} (P(u+tv) - f)^2$.
I thought that the most straightforward way is to use chain rule but I don't see this leading to the result which should be $\langle v,2P^T(P(u)-f)\rangle_{\Omega}$.
Any help appreciated.
First, $P$ is linear so $P(u+tv)=P(u)+tP(v)$ and so
$$ \int_{\Omega} \big(P(u+tv)-f\big)^2=\int_{\Omega} t^2\,P(v)^2+2t\,P(v)(P(u)-f)+(P(u)-f)^2 $$
whose derivative with respect to $t$ at $t=0$ is
$$ 2\int_{\Omega} P(v)(P(u)-f)=2\langle P(v),P(u)-f \rangle_{L^2}=\langle v,2P^T(P(u)-f)\rangle_{\Omega}. $$
I assume this is brunt of what you want.