A given functional is path independent if k equals to the one of the following: 
The functional
$$\int_0^1 (y^{\prime 2} + (y + 2y')y'' + kxyy' + y^2) ~dx,$$
$$y(0) = 0, ~y(1) = 1, ~y'(0) = 2, ~y'(1) = 3$$
is path independent if $k$ equals
(A) $1$
(B) $2$
(C) $3$
(D) $4$

I have used Euler's formula for extremizing the given functional and get $k=2$. But I am pretty sure that I have done mistake as I could not get to use the given conditions and also I will be grateful if someone explains what path independent really means and the appropriate formula to be used to tackle the problem.
 A: Presumably, "path-dependent" means that the functional doesn't depend on the function $y(x)$.
Integration by parts transforms $yy''$ into $-y'^2$; the boundary term is fixed by the boundary conditions and hence independent of $y(x)$. Also, $2y'y''$ is the derivative of $y'^2$, so its integral is also fixed by the boundary conditions. That leaves only $kxyy'+y^2$, and this is the derivative of $xy^2$ for one of the given values of $k$.
A: Let
$$
F(x,y,y',y'') = \int_0^1 \big(y'^2 + (y + 2y')y'' + kxyy'+y^2\big)dx
$$
Then, if $h$ is a $C^\infty(0,1)$
$$
F\big(x,y+h,(y+h)',(y+h)''\big) - F(x,y,y',y'') = \int_0^1 \left\{(y'' + kxy' +2y)h + (2y' + 2y'' + kxy)h'+(y+2y')h''\right\}dx+O\big(\|h\|^2\big)
$$
where $\|\cdot\|$ is the appropriate norm. Hence, the Frechet derivative is
$$
DF \cdot h = \int_0^1 \left\{y'' + kxy' + 2y - \frac{d}{dx}\left(2y' + 2y'' + kxy\right) + \frac{d^2}{dx^2}(y + 2 y')\right\}hdx + \mbox{ B.C.}
$$
where
$$
\mbox{B.C.} = \big(2y' + 2y'' + kxy - \tfrac{d}{dx}(y + 2 y')\big)h\Big|_0^1 + (y + 2 y')h'\Big|_0^1 = 0
$$
given that
$$
y(0) = y(1) = 0, \qquad y'(0) = y'(1) = 0.
$$
The Euler-Lagrange equation is
$$
y'' + kxy' + 2y - \frac{d}{dx}\left(2y' + 2y'' + kxy\right) + \frac{d^2}{dx^2}(y + 2 y') = 0
$$
and if $k = 2$, it can be written as
\begin{multline}
y'' + 2xy' + 2y - \frac{d}{dx}\left(2y' + 2y'' + 2xy\right) + \frac{d^2}{dx^2}(y + 2 y') = \\
y'' + \frac{d}{dx}\big(2xy\big) - 2y'' - 2y''' - \frac{d}{dx}\big(2xy\big) + y'' +2 y'' = 0
\end{multline}
for all $y$. In terms of the functional
\begin{multline}
y'^2 + (y + 2y')y'' + 2xyy' + y^2 \\
= y'^2 + yy'' + 2y'y'' + \frac{d}{dx}\big(xy^2\big) = y'^2 + yy'' + \frac{d}{dx}\big(y'^2 + xy^2\big) = \frac{d}{dx}\big(yy' + y'^2 +xy^2\big)
\end{multline}
and then
$$
F(x,y,y',y'') = \int_0^1 \frac{d}{dx}\big(yy' + y'^2 +xy^2\big)dx = 0
$$
