Let $a>0, b>0, c>0$ be constants. Show that the stationary path of the functional $$S[y]=\int_{0}^{a}(y'^2+2by)dx, \quad y(a)=0,$$ with a natural boundary condition at $x=0$ and subject to the constraint $$C[y]=\int_{0}^{a}ydx=C,$$ is given by $$y(x)=\frac{3C}{2a^3}(a^2-x^2).$$
Here's my work:
Consider the functional $S[y]=\int_{0}^{a}(y'^2+2by)dx, y(a)=0,$ with a natural boundary condition at $x=0$ where $a>0, b>0, c>0$ are constants.
Then the auxiliary functional is $\bar{S}[y]=\int_{0}^{a}(y'^2+2by+\lambda_{1}y)dx, y(a)=y(c)=0$ where $\lambda_{1}$ is the Lagrange multiplier.
By definition, the Euler-Lagrange equation is $\frac{d}{dx}(\frac{\partial F}{\partial y'})-\frac{\partial F}{\partial y}=0, y(a)=A, y(b)=B$ for the functional $S[y]=\int_{a}^{b}F(x, y, y')dx, y(a)=A, y(b)=B.$
Let $F(x, y, y')=y'^2+2by+\lambda_{1}y.$
Note that $\frac{\partial F}{\partial y'}=2y'$ and $\frac{\partial F}{\partial y}=2b+\lambda_{1}.$
This gives $\frac{d}{dx}(\frac{\partial F}{\partial y'})=2y''.$
Thus, the Euler-Lagrange equation is $\frac{d}{dx}(\frac{\partial F}{\partial y'})-\frac{\partial F}{\partial y}=0\implies 2y''-2b-\lambda_{1}=0.$
Observe that $2y''-2b-\lambda_{1}=0\implies 2y''=2b+\lambda_{1}\implies y''=b+\frac{\lambda_{1}}{2}.$
I know I need to find the general solution first by solving this differential equation but how should I solve this?