# How to solve for extremal of a functional with one boundary condition?

The extremal of the functional $$J[y]=\int_{0}^{\log 3}[e^{-x}y'^2+2e^x(y'+y)]dx$$ where $y(\log 3)=1$ and $y(0)$ is free is
1. $4-e^x$
2. $10-e^{2x}$
3.$e^x-2$
4. $e^{2x}-8$

Now, I used the Euler-Lagrange equation to come up with the following extremal

$$y(x)=ae^x+b ~~~~~~~~~~(1)$$ where $a$ and $b$ are constants. Then by using the condition $y(\log 3)=1$, I got $1=3a+b$.

Now by looking at $(1)$, I can conclude that option 2 and 4 are not correct. Again by choosing $a=-1$ we get $b=4$, which satisfied option 1, and by choosing $a=1$ we get $b=-2$, which satisfied option 3.

But the answer given is only option 1. What is the problem with option 3? Since one boundary is given to be free, we can use $a$ and $b$ freely right? Or am I wrong somewhere? Please help me in this. Thanks.

The "freeness" of $y(0)$ induces a second boundary condition, called a natural boundary condition. Some intuition:
1. How can we expect a unique minimizer to our minimization problem if $y(0)$ can be chosen at will? Somehow, some combination of $y(0)$ or $y'(0)$ needs to be fixed.
2. A more serious problem:How does the critical point condition $\delta J[y](\eta)=0$ even make sense if it depends on an arbitrary constant $\eta(0)$? The only way is for the coefficient of $\eta(0)$ to vanish.
As an example, consider $J[y]=\int_0^1 \frac{1}{2}y'(x)^2dx$ with boundary condition $y(1)=1$. To derive the natural boundary condition, let us find critical points $y$ of $J$: $$0=\delta J[y](\eta)=\frac{d}{d\epsilon}\Big|_{\epsilon=0}J[y+\epsilon \,\eta]=\int_0^1 y'(x)\eta'(x)dx.$$ Since $y(1)=1$, the perturbation $\eta$ must satisfy $\eta(1)=0$, so integrating by parts gives: $$0=-\int_0^1y''(x)\eta(x)dx-y'(0)\eta(0).$$ Obviously, the first term is the Euler-Lagrange equation, hence zero, so we conclude: $$y'(0)\eta(0)=0.$$ Since $\eta(0)$ is free, we conclude $y'(0)=0$ is the natural BC.