Shape of a string/chain/cable/rope/wire? The height of a string in a gravitational field in 2-dimensions is bounded by $h(x_0)=h(x_l)=0$ (nails in the wall)  and also $\int_0^l ds= l$. ($h(0)=h(l)=0$, if you take $h$ as a function of arc length)
.
What shape does it take?
My try so far: minimise potential energy of the whole string, 
$$J(x,h, \dot{h})=\int_0^l gh(x) \rho \frac{ds}{l}=\frac{g \rho }{l}\int_0^l h(x) \sqrt{1+\dot{h}^2} dx$$
With the constraint 
$$\int_0^l \sqrt{1+\dot{h}^2} dx- l=0$$
If it helps, it's evident that $\dot{h}(\frac{l}{2})=0$.
Generally, this kind of equation is a case of a constrained variational problem, meaning that the integrand in 
$$\int_0^l \frac{g \rho }{l}h(x) \sqrt{1+\dot{h}^2} +\lambda(\int_0^l \sqrt{1+\dot{h}^2} dx- l)dx$$
Must satisfy the Euler Lagrange equation. The constraint must also be satisfied.
But, in truth, by this point I am clueless. $\lambda$ is worked through $\nabla J  = \lambda \nabla(\int_0^l \sqrt{1+\dot{h}^2} dx- l)$. I have tried this , but get nonsensical answers.
Is this method the best? If so, in what ways am I going about it wrongly thusfar?
 A: The 2D problem of a cable hanging over a span $S$ with end-point height difference of $h$ is solved with the following shape:
$$ y(x) = y_c + a \left( \cosh \left( \frac{x-x_c}{a} \right) - 1 \right) $$
Where $(x_c,y_c)$ is the lowest point on the catenary and $a$ the catenary constant ($a = \frac{H}{\lambda\,g}$, $H$ horizontal tension, $\lambda$ is mass per unit length and $g$ is gravity)
With the end-points $y(0)=0$ and $y(S)=h$ the solution for the lowest point on the catenary is
$$x_c = \frac{S}{2} + a \sinh^{-1} \left( \frac{h\; {\rm e}^\frac{S}{2 a}}{a\, (1-{\rm e}^\frac{S}{a})} \right) $$
$$ y_c = -a \left( \cosh \left( \frac{x_c}{a} \right) - 1 \right) $$


*

*an example solution is shown below:

The 3D problem is solved by a change of coordinates in order to make gravity vertical and the two end points in-plane. The apply the 2D solution from above.
A: Your approach so far is correct. Now, the first thing to do is to create a coordinate axes. In this case, I will say that the “poles” are at x=-a and x=a, and y=0 is the point where the rope is attached to the “poles”. Now, we can assume constant linear density μ. This is not strictly necessary, but it makes the calculations quite easier. Now, we can set up our constraints in this problem, which would be the length in this case.
$$ J \equiv L = \int_{string} dS = \int_{-a}^{a} \sqrt{1 + (\frac{dy}{dx})^2} dx$$
From now on, in order to maintain brevity, I will write $\frac{dy}{dx}$ as y’. Now, we need to find the quantity that needs to be minimized in this problem. In this case, we want to minimize the potential gravitational energy, $U_g$. So now we need to find the value of our differential, $dU_g$. Because $U_g = mgy$, it is easy to see that $dU_g = (μ dS) \cdot gy$. Putting this into an integral:
$$ U_g = \int_{-a}^{a} μgy \sqrt{1 + (y’)^{2}} dx$$
Now we need to implement our length constraint:
$$ K \equiv U_g + λJ = \int_{-a}^{a} [μgy \sqrt{1 + (y’)^{2}} + λ \sqrt{1 + (y’)^2}] dx$$
Now upon inspection, we can consider the function $$F(x, y, y') \equiv μgy \sqrt{1 + (y’)^{2}} + λ \sqrt{1 + (y’)^2}$$
Now notice that $F$ does not depend explicitly on $x$, so we can use the Beltrami Identity:
$$F - y' \cdot \frac{\partial F}{\partial y'} = C$$
Applying this identity,
$$μgy(1+(y')^2) + λ(1+(y')^2) - μgy(y')^2 - λ(y')^2 = C\sqrt{1+(y')^2}$$
$$μgy + λ = C\sqrt{1+(y')^2}$$
$$(μgy + λ)^2 = C^2 + C^2(y')^2$$
$$y' = \sqrt{\frac{(μgy + λ)^2}{C^2} - 1} \Rightarrow dx = \frac{1}{\sqrt{\frac{(μgy + λ)^2}{C^2} - 1}} dy$$
Now, although this integral might look challenging, it can be made quite easier with a simple substitution:
$$let\ \cosh u = \frac{μgy + λ}{C} \Rightarrow \sinh u\ du = \frac{μg}{C} dy$$
$$x+K_1 = \frac{Cu}{μg} \Rightarrow x+K_1 = \frac{C}{μg} \cosh ^{-1}(\frac{μgy + λ}{C})$$
$$\cosh (\frac{μg}{C} (x+K_1)) = \frac{μgy + λ}{C}$$
$$y = \frac{C}{μg} \cosh (\frac{μg}{C} (x+K_1)) - \frac{λ}{μg}$$
Now in order to solve for some of these constants, we can apply our boundary condtions.
When x = $\pm a$, $y = 0$:
$$0 = \frac{C}{μg} \cosh (\frac{μg}{C} (a+K_1)) - \frac{λ}{μg} = \frac{C}{μg} \cosh (\frac{μg}{C} (-a+K_1)) - \frac{λ}{μg}$$
$$0 = \cosh (\frac{μg}{C} (a+K_1)) = \cosh (\frac{μg}{C} (-a+K_1))$$
$$K_1 = 0$$
$$ \frac{C}{μg} \cosh (\frac{μga}{C}) - \frac{λ}{μg} \Rightarrow λ = C \cosh (\frac{μga}{C})$$
$$\boxed{\therefore\ y = \frac{C}{μg}( \cosh (\frac{μgx}{C}) - \cosh (\frac{μga}{C}))}$$
