The variational derivative I'm reading about variational derivative from the following pdf-file:
http://www.cs.iastate.edu/~cs577/handouts/variational-problems.pdf
On the very first page, the author takes the partial derivative of $J(y_1, ..., y_n)$ w.r.t $y_k$ on formula $(1)$ and gets the formula $(2)$ from it. Could someone explain how did he get the result? What I get if I take the partial derivative is (Note that $y_i = y_i(x_i)$): 
$$\frac{\partial}{\partial y_k} [J(y_1, ..., y_n)] = \frac{\partial}{\partial y_k} \left[ \sum_{i=0}^{n} F\left( x_i, y_i, \frac{y_{i+1}-y_i}{\Delta x}\right)\Delta x\right] = \frac{\partial}{\partial y_k} \left[ \cdots + F\left( x_{k-2}, y_{k-2}, \frac{y_{k-1}-y_{k-2}}{\Delta x}\right)\Delta x + F\left( x_{k-1}, 
y_{k-1}, \frac{y_{k}-y_{k-1}}{\Delta x}\right)\Delta x + F\left( x_k, y_k, \frac{y_{k+1}-y_k}{\Delta x}\right)\Delta x + F\left( x_{k+1}, y_{k+1}, \frac{y_{k+2}-y_{k+1}}{\Delta x}\right)\Delta x + \cdots\right] = \frac{\partial}{\partial y_k} \left[ F\left( x_{k-1}, 
y_{k-1}, \frac{y_{k}-y_{k-1}}{\Delta x}\right)\Delta x + F\left( x_k, y_k, \frac{y_{k+1}-y_k}{\Delta x}\right)\Delta x \right] = F_{y_k}\left( x_{k-1}, 
y_{k-1}, \frac{y_{k}-y_{k-1}}{\Delta x}\right)\Delta x + F_{y_k}\left( x_k, y_k, \frac{y_{k+1}-y_k}{\Delta x}\right)\Delta x$$
Did I forget to use chain rule or something?...Thank you for your help :) 
 A: For each $k$, $y_k$ appears in $J(y_1,\dots,y_n)$ only twice, i.e. in the terms
$$F_{k-1}:=F(x_{k-1},y_{k-1},\frac{y_k-y_{k-1}}{\Delta x})\Delta x ~~(*)$$
and
$$F_{k}=F(x_{k},y_{k},\frac{y_{k+1}-y_{k}}{\Delta x})\Delta x.~~(**)$$
I think there is a typo in formula $(2)$ in your reference: the last term should have the variables
$$(x_{k},y_{k},\frac{y_{k+1}-y_{k}}{\Delta x}) $$
as it corresponds to the choice $i=k$ in $J(y_1,\dots,y_n)$. Let us introduce the notation 
$$F=F(x,y,g(y)),$$
where $x$ is any of the $x_k$'s, $y$ any of the $y_k$'s and $g(y_k):=\frac{y_{k+1}-y_{k}}{\Delta x}$. In the paper you are reading the author uses the notation
$$g(y)=y'.$$
in formula $(2)$.
Note that $g(y_{k-1})=\frac{y_k-y_{k-1}}{\Delta x}$, by definition.
Le us compute the partial derivative $\frac{\partial J}{\partial y_k}$ using the chain rule on the terms $(*)$ and $(**)$. We arrive at
$$\frac{\partial J}{\partial y_k}=\frac{\partial F_{k-1}}{\partial g(y_{k-1})}\frac{\partial  g(y_{k-1})}{\partial y_k}\Delta x+\left(
\frac{\partial F_{k}}{\partial y_{k}}\frac{d y_{k}}{d y_k}\Delta x+
\frac{\partial F_{k}}{\partial g(y_{k})}\frac{\partial  g(y_{k})}{\partial y_k}\Delta x\right).$$
($F_{k-1}$ does not depend on $y_k$). Now
$$\frac{d y_{k}}{d y_k}=1, $$
$$  \frac{\partial F_{k-1}}{\partial g(y_{k-1})}\frac{\partial g(y_{k-1})}{\partial y_k}\Delta x=\frac{\partial F_{k-1}}{\partial g(y_{k-1})} \frac{1}{\Delta x}\Delta x=\frac{\partial F_{k-1}}{\partial g(y_{k-1})},$$
$$\frac{\partial F_{k}}{\partial g(y_{k})}\frac{\partial g(y_{k})}{\partial y_k}\Delta x=
-\frac{\partial F_{k}}{\partial g(y_{k})} \frac{1}{\Delta x}\Delta x=-\frac{\partial F_{k}}{\partial g(y_{k})}. $$
In summary
$$\frac{\partial J}{\partial y_k}=\frac{\partial F_{k-1}}{\partial g(y_{k-1})}+\left(
\frac{\partial F_{k}}{\partial y_{k}}\Delta x-
\frac{\partial F_{k}}{\partial g(y_{k})}\right)=(\text{replicating the order of the factors in formula (2) contained in your reference})=\frac{\partial F_{k}}{\partial y_{k}}\Delta x+\frac{\partial F_{k-1}}{\partial g(y_{k-1})}-\frac{\partial F_{k}}{\partial g(y_{k})}.  $$
In the (a bit confusing) notation of the paper
$$\frac{\partial J}{\partial y_k}=F_{y}(x_{k},y_{k},\frac{y_{k+1}-y_{k}}{\Delta x}) \Delta x+
F_{y'}(x_{k-1},y_{k-1},\frac{y_k-y_{k-1}}{\Delta x})-
F_{y'}(x_{k},y_{k},\frac{y_{k+1}-y_{k}}{\Delta x}) $$
