The problem is 3.17 from Calculus of Variations by Gelfand and Fomin. It states
Find the extremals of the functional
$$ J[y]=\int_0^4(y'-1)^2(y'+1)^2dx,\;\;\;\;\;\;y(0)=0,\;y(4)=2$$
which have just one corner. I have the solution, we know that $J[y]\ge 0$ because it's an integral of a non-negative value. Also $(y'-1)^2(y'+1)^2=0$ if $y'(x)=-1$ or $y'(x)=1$. So as long as $y$ is piecewise lines with these slopes then $J[y]=0$. We just need to make the boundary conditions line up and since there's only a single corner we have 2 segments. So the two solutions are
$$y(x)=\left\{\begin{aligned}&x&&0\leq x\leq 3\\&-x+6&&3\leq x\leq 4\end{aligned}\right.$$ and $$y(x)=\left\{\begin{aligned}&-x&&0\leq x\leq 3\\&x-2&&3\leq x\leq 4\end{aligned}\right.$$
In both cases $y$ is continuous, single corner, and $J[y]=0$. QED
This derivation is unsatisfactory for me because it uses none of the material (Euler Equation and Weierstrass-Erdman conditions). My goal is to understand the material (not taking a class), so I'm asking for help on how to properly prove this. First, any solution needs to satisfy
$$F_y-\frac{d}{dx}F_{y'}=0$$
Here $F_y=0$ and after a bunch of tedious work I have $F_{y'}=2y'^3-2y'$. So any solution must solve the differential equation $y'^3-2y'=C$. The solution according to Wolfram Alpha is linear but definitively not unit slope, unless $C$ is $0$. From that point, we would make sure our piece-wise function satisfies
$$F_{y'}|_{x=c-0}=F_{y'}|_{x=c+0}$$ and $$F-y'F_{y'}|_{x=c-0}=F-y'F_{y'}|_{x=c+0}$$
where $c$ is the point of a discontinous derivative. However,I haven't even bothered with this part since the first part doesn't match. Any suggestions?
Edit: corrected second condition thanks to careful feedback
Let's start with a correction: the second Weierstrass-Erdmann condition is$^{(*)}$ $$ F-y'F_{y'}|_{x=c-0}=F-y'F_{y'}|_{x=c+0}, \tag{1} $$ which, for $F=(y'-1)^2(y'+1)^2=(y'^2-1)^2$, yields $$ (y'^2-1)(1-3y'^2)|_{x=c-0}=(y'^2-1)(1-3y'^2)|_{x=c+0}. \tag{2} $$ On the other hand, the first Weierstrass-Erdmann condition yields $$ 4y'(y'^2-1)|_{x=c-0}=4y'(y'^2-1)|_{x=c+0}. \tag{3} $$ It's straightforward to verify that the solutions you found satisfy the Euler-Lagrange equation (see the footnote) and the Weierstrass-Erdmann conditions.
$^{(*)}$ A remark is in order here: if $F_x=0$ (as is the case for the given functional), the Euler-Lagrange equation $F_y-\frac{d}{dx}F_{y'}=0$ can be reduced to the Beltrami identity $F-y'F_{y'}=C$, which is the expression that appears in $(1)$. Therefore, the second Weierstrass-Erdmann condition express the continuity of the constant in the Beltrami identity at the corners of a broken extremal (in the cases where $F_x=0$).