finding minimizer of a functional using variations 
Find the minimum of the functional
$$I[y(x)]=\int_0^1\bigg(\frac{y'^2}{2}+yy'+y'+y\bigg)dx$$ if the
values at the ends of the interval are not given.

So we have a free boundary condition on both $x=0$ and $x=1$. Taking first variation of the fuctional and equating to zero we have $$\frac{\partial}{\partial\alpha}I(y+\alpha\delta y)\bigg|_{\alpha=0}=0 \\ \implies(y'+y+1)\delta y\bigg|_{x=0}^{x=1}+\int_0^1(-y''+1)\delta ydx=0$$ So the minimizer will be given by $$-y''+1=0$$ and the free boundary conditions $y'(0)+y(0)+1=y'(1)+y(1)+1=0$. So solving the ODE we get the minimizer as $$y(x)=\frac{x^2-3x+1}{2}$$ But the answer is given as $\boxed{\displaystyle y(x)=\frac{x^2-x-1}{2}}$. I don't see where I have done the mistake. Although my suspicion is that the boundary conditions I derived has to do something with it. Any help is appreciated on this one.

$$y(x) = \frac{x^2}{2}+b x+a;\;y'(x)=x+b$$
Initial condition are $$y'(0)+y(0)+1=0,y'(1)+y(1)+1=0$$
That is
$$a+b+1=0;\;a+2 b+\frac{5}{2}=0\to a= \frac{1}{2},b= -\frac{3}{2}$$
Plugging in $y(x)$
$$y(x) = \frac{x^2}{2} - \frac{3}{2}\,x+ \frac{1}{2}\to y(x)=\frac{x^2-3x+1}{2}$$
