Function extremal - calculus of variations Find a curve passing through (1,2) and (2,4) that is an extremal of the function:
$J(x,y')=\int_1^2 xy'(x)+(y'(x))^2dx$
I don't know what methods to use at all.
 A: Hint: In general, a necessary condition for
$$J = \int_A^B f(x, y, y') dx$$
to attain an extremum is that $y(x)$ must satisfy the Euler-Lagrange differential equation:
$$\frac{\partial f}{\partial y} - \frac{d}{dx}\left(\frac{\partial f}{\partial y'}\right) = 0.$$
In your case,
$$\frac{\partial f}{\partial y} = 0 \quad \text{and} \quad \frac{\partial f}{\partial y'} = x + 2y',$$
so differentiating $x + 2y'$ with respect to $x$ and equating it to zero we obtain
$$1 + 2y'' = 0,$$
which is a simple homogeneous second order differential equation. It can be shown (by integrating $1 + 2y'' = 0$ twice) that
$$y(x) = -\frac{x^2}{4} + Ax + B.$$
Since $y(x)$ passes through $(1, 2)$ and $(2, 4)$, we must have
$$y(1) = 2 = -\frac{1}{4} + A + B \quad \text{and} \quad y(2) = 4 = -1 + 2A + B.$$
The first equation yields $A = 9/4 - B$, which we substitute into the second equation to get
$$4 = -1 + 2\left(\frac{9}{4} - B\right) + B.$$
Solving for $B$ we find $B = -1/2$, which means $A = 9/4 + 1/2 = 11/4$.
A: This is a very simple problem.  You are trying to find the function $y$ which gives a minimum of the following integral:
$$
J = \int\left(xy' + y'^2\right)dx = \int\mathcal{L}(y, y', x)dx
$$
Where $y$ is a function of $x$.  The very first thing to notice is that $\mathcal{L}$ has no dependence on $y$!  Therefore $\frac{\partial \mathcal{L}}{\partial y} = 0$.  This leads to the following Euler-Lagrange equation:
$$
\frac{d}{dx}\left(\frac{\partial \mathcal{L}}{\partial y'}\right) = 0
$$
If the full derivative with respect to $x$ is $0$, then the this partial must be a constant.  Let me write this out in two steps:
\begin{align}
\frac{\partial \mathcal{L}}{\partial y'} =& \alpha \\
\frac{d}{dx}\left(\frac{\partial \mathcal{L}}{\partial y'}\right) =& \frac{d}{dx}\left(\alpha\right) = 0
\end{align}
Now simply set the partial with respect to $y'$ to a constant:
$$
\frac{\partial \mathcal{L}}{\partial y'} = x + 2y' = \alpha
$$
This is a separable equation, just integrate both sides:
$$
2y' = \alpha - x \\
2y = \alpha x - \frac{x^2}{2} + \beta \\
y = \alpha x - \frac{x^2}{4} + \beta \\
y = -\frac{1}{4}\left(x^2 - 2\alpha x\right) + \beta \\
y = -\frac{1}{4}\left(x - \alpha\right)^2 + \beta - \alpha^2 \\
y = -\frac{1}{4}\left(x - \alpha\right)^2 + \beta
$$
Notice that $\alpha$ and $\beta$ changed a lot in the last few steps.  Rememeber these are constants, so I can make them whatever I like.  Just as one example, in the last step I had $\beta - \alpha^2$ then changed to just $\beta$.  This is a constant minus another constant which gives some other constant.  That is, the new $\beta$ is whatever the old one was minus $\alpha^2$.
Now find $\alpha$ and $\beta$ for your problem:
$$
y(1) = 2 = -\frac{1}{4}(1 - \alpha)^2 + \beta \\
y(2) = 4 = -\frac{1}{4}(2 - \alpha)^2 + \beta \\
$$
Subtract the equations to find $\alpha$:
$$
2 = -\frac{1}{4}\left((2 - \alpha)^2 - (1 - \alpha)^2\right) \\
-8 = 4 + \alpha^2 - 4\alpha - (1 + \alpha^2 - 2\alpha) \\
-8 = 3 - 2\alpha \rightarrow \alpha = \frac{11}{2}
$$
Now use either equation to find $\beta$:
$$
2 = -\frac{1}{4}\left(1 - \frac{11}{2}\right)^2 + \beta \\
\beta = 2 + \frac{1}{4}\cdot\frac{9^2}{2^2} = \frac{113}{16}
$$
Giving:
$$
y(x) = -\frac{1}{4}\left(x - \frac{11}{2}\right)^2 + \frac{113}{16} = \frac{113 - (2x - 11)^2}{16}\\
y' = -\frac{2x - 11}{4} \rightarrow y'^2 = \frac{(2x - 11)^2}{16}
$$
Finally, if you want to find the value of the integral:
\begin{align}
J =& \int\limits_1^2\left(-x\frac{2x - 11}{4} + \frac{(2x - 11)^2}{16}\right)dx = \frac{1}{16}\int\limits_1^2\left(44x - 8x^2 + (2x - 11)^2\right)dx \\
J =& \frac{1}{16}\left.\left(22x^2 - \frac{8}{3}x^3 + \frac{1}{2\cdot 3}(2x - 11)^3\right)\right|_1^2 \\
J=& \frac{1}{16}\left(22\cdot3 - \frac{8}{3}\cdot7 + \frac{1}{6}\cdot386\right) = \frac{1}{16}\left(\frac{198 - 56 + 193}{3}\right) = \frac{335}{48}
\end{align}
