<s>[INST] Calculate $\Delta J$ for a functional $J(y)=\int_{0}^{1} (x^2-y^2+(y')^2)dx$
$y(x)=x, h(x)=x^2$
I need to calculate $\Delta J$ and I am given this from the answer key: 
$\Delta J = J(y + \epsilon h)-J(y) = J(x + \epsilon x^2) - J(x)$
I just need to verify that this comes out to:
$\Delta J = (\frac{17}{15}\epsilon ^2+\frac{3}{2}\epsilon +1) -(1)= \frac{17}{15}\epsilon ^2+\frac{3}{2}\epsilon$ ?
The reason I ask is that our book never gives an example of this, so I want to verify that this is correct.
 [/INST] It's just a matter of substition: For a given function $h$ and value $\epsilon$, $\Delta J = J(y + \epsilon h) - J(y)$ by definition. So, given that $y(x) = x, h(x) = x^2$, we see that $y'(x) = 1, h'(x) = 2x$. So:
$$\begin{align}\Delta J &= J(y + \epsilon h)-J(y) \\
&= \int_{0}^{1} (x^2-(y + \epsilon h)^2+(y'+\epsilon h')^2)dx - \int_{0}^{1} (x^2-y^2+(y')^2)dx\\
&= \int_{0}^{1} (x^2-(x + \epsilon x^2)^2+(1+2\epsilon x)^2)dx - \int_{0}^{1} (x^2-x^2+(1)^2)dx\\
&= \int_{0}^{1} -\epsilon^2 x^4 - 2\epsilon x^3 + 1+4\epsilon x + 4\epsilon^2 x^2)dx - \int_{0}^{1} 1\ dx\\
&= -\frac{\epsilon^2}{5} - \frac{2\epsilon}{4} + \frac{4\epsilon}{2} + \frac{4\epsilon^2}{3}\\
&=\frac{17}{15}\epsilon ^2+\frac{3}{2}\epsilon\end{align}$$
</s>