I have a question that asks me to show that the functional $$I(x) = \int^{x_2}_{x_1} (x^2 + 3y^2)y' + 2xydx$$ has an extremal that is independent of the choice of $y$ that joins two arbitrary points $(x_1, y_1), (x_2, y_2)$.
So I tried solving for the extremal, which give me the euler lagrange equation:
$$ 6yy' + 2x = 2x +6yy'$$
That's not an error it seems that $\frac{d}{dx}\bigg(\frac{\partial F}{\partial y'}\bigg) =\frac{\partial F}{\partial y}$.
Ok then no wonder that the path doesn't matter. But now I am trying to compute the value of the functional for the two points, I tried a straight line between the 2, but this is giving me a messy expression, it's computable but ugly:
$$J(y) = \int^{x_2}_{x_1} s(x^2 + 3(sx + k)^2) + 2x(sx +k) dx$$
(where s and k are the linear coefficients of the line connecting the two points).
Is there a better way to do this?
You can actually bypass certain variation considerations for this one, but its good to treat it both ways.
Notice I is a line integral. Multiplied out, you are integrating $(x^2+3y^2)dy+(2xy)dx$. This has the form of a vector field times a distance element, $\vec{F}\cdot\vec{ds}$. By the Fundamental Theorem of Line Integrals, the integral is path independent if $\vec{F}=\nabla V$ for some scalar $V$. A quick test for that is to take the $x$ derivative of the term being multipled by $dy$ and the $y$ derivative of the term being multiplied by $dx$. If these derivatives are equal, then you can find the necessary scalar potential and the Theorem applies. In the background this follows because the curl of a gradient is zero and Stoke's Law.
To find the potential, integrate the term multiplied by $dy$ with respect to $y$. To that integral add an arbitrary function $g(x)$, then take the $x$ derivative of the resulting sum. Subtract the term being multiplied by $dx$ and set what remains to zero. Solve the resulting differential equation for $g(x)$.
In this case $g(x)=0$ and $V(x,y)=x^2y+y^3$ as pointed out by one of the comments, so the integral is always $V(x_2,y_2)-V(x_1,y_1)$ regardless of path.