# Arc length contest! Minimize the arc length of $f(x)$ when given three conditions.

Contest: Give an example of a continuous function $f$ that satisfies three conditions:

1. $f(x) \geq 0$ on the interval $0\leq x\leq 1$;
2. $f(0)=0$ and $f(1)=0$;
3. the area bounded by the graph of $f$ and the $x$-axis between $x=0$ and $x=1$ is equal to $1$.

Compute the arc length, $L$, for the function $f$. The goal is to minimize $L$ given the three conditions above.

$\mathbf{\color{red}{\text{Contest results:}}}$ $$\begin{array}{c|ll} \hline \text{Rank} & \text{User} & {} & {} & \text{Arc length} \\ \hline \text{1} & \text{robjohn \blacklozenge} & {} & {} & 2.78540 \\ \text{2} & \text{Glen O} & {} & {} & 2.78567 \\ \text{3} & \text{mickep} & {} & {} & 2.81108 \\ \text{4} & \text{mstrkrft} & {} & {} & 2.91946 \\ \text{5} & \text{MathNoob} & {} & {} & 3.00000 \\\hline \text{-} & \text{xanthousphoenix} & {} & {} & 2.78540 \\ \text{-} & \text{Narasimham} & {} & {} & 2.78 \\ \end{array}$$

Original question after contest statement: The contest question was inspired by this paper. Can anyone come up with a different entry than those listed in the table below?

$$\begin{array}{c|ll} \hline \text{Rank} & \text{Function} & {} & {} & \text{Arc length} \\ \hline \text{1} & 1.10278[\sin(\pi x)]^{0.153764} & {} & {} & 2.78946 \\ \text{2} & (8/\pi)\sqrt{x-x^2} & {} & {} & 2.91902 \\ \text{3} & 1.716209468\sqrt{x}\,\mathrm{arccos}(x) & {} & {} & 2.91913 \\ \text{4} & (8/\pi)x\,\mathrm{arccos}(x) & {} & {} & 3.15180 \\ \text{5} & (15/4)x\sqrt{1-x} & {} & {} & 3.17617 \\ \text{6} & -4x\ln x & {} & {} & 3.21360 \\ \text{7} & 10x(1-\sqrt{x}) & {} & {} & 3.22108 \\ \text{8} & -6x^2+6x & {} & {} & 3.24903 \\ \text{9} & 9.1440276(2^x-x^2-1) & {} & {} & 3.25382 \\ \text{10} & (-12/5)(x^3+x^2-2x) & {} & {} & 3.27402 \\ \end{array}$$

• This sounds like a calculus of variations problem, but I'm not too familiar with the subject. Someone who is might want to consider adding the tag. – DanielV Jan 28 '15 at 5:29
• @DanielV. Yes, given area for minimum length with constrained /fixed boundary line slope. – Narasimham Feb 6 '15 at 16:28
• Is it possible to determine the minimum/infimum of all possible arc lengths without giving the function explicitly using calc of variations? – dalastboss Feb 6 '15 at 21:01
• A familiar problem. Looks like Stewart should have credited Riddle (and maybe he does somewhere in the front matter or back matter). – alex.jordan Feb 9 '15 at 7:09
• @M.Wind I don't understand your quibble--have you not seen some of the other contests on this site where nothing at all is given and users are encouraged to contribute something valuable? Or did you just look through all of my questions and try to find something you could harp on? Also, reputation does not matter in a case like this--I have had some of my own questions closed, downvoted, deleted, etc. Meanwhile, Andre Nicolas (330k) has received very poor treatment from a number of users bent on deleting questions to which he has provided answers. So: what exactly is your point? – Daniel W. Farlow Jul 9 '15 at 16:04

Find the Shape of the Graph

We wish to minimize $$\int_0^1\sqrt{f'(x)^2+1}\,\mathrm{d}x\tag{1}$$ while keeping $$\int_0^1f(x)\,\mathrm{d}x=1\tag{2}$$ This means that we wish to find an $f$ so that the variation of length is $0$ $$\int_0^1\frac{f'(x)\,\delta f'(x)}{\sqrt{f'(x)^2+1}}\,\mathrm{d}x=0\tag{3}$$ which, after integration by parts, noting that $\delta f(0)=\delta f(1)=0$, becomes $$\int_0^1\frac{f''(x)\,\delta f(x)}{\sqrt{f'(x)^2+1}^{\,3}}\,\mathrm{d}x=0\tag{4}$$ for all variations of $f$, $\delta f$, so that the variation of area is $0$ $$\int_0^11\,\delta f(x)\,\mathrm{d}x=0\tag{5}$$ This means that $\frac{f''(x)}{\sqrt{f'(x)^2+1}^{\,3}}$ is perpendicular to all $\delta f$ that $1$ is. This is so only when there is a $\lambda$ so that $$\frac{f''(x)}{\sqrt{f'(x)^2+1}^{\,3}}=\lambda\tag{6}$$ However, $(6)$ just says that the curvature of the graph of $f$ is $\lambda$. That is, the graph of $f$ is an arc of a circle.

Find the Length of the Arc

Since the length of the chord of the circle we want is $1$, we have $$2r\sin\left(\frac\theta2\right)=1\tag{7}$$ Since the area cut off by this chord is $1$, we have $$r^2\left[\frac\theta2-\sin\left(\frac\theta2\right)\cos\left(\frac\theta2\right)\right]=1\tag{8}$$ Square $(7)$ to get $$2r^2(1-\cos(\theta))=1\tag{9}$$ and rewrite $(8)$ to get $$\frac12r^2(\theta-\sin(\theta))=1\tag{10}$$ Solve $4(1-\cos(\theta))=\theta-\sin(\theta)$ to get $$\theta=4.3760724130128873845\tag{11}$$ and then $(7)$ gives $$r=0.61313651252231835636\tag{12}$$ This would lead to a minimum length of $$L=r\theta=2.6831297778598481320\tag{13}$$

Problem

Unfortunately, since $\theta\gt\pi$, the minimizing curve is an arc that cannot be represented by a function. The minimizing curve that is closest to the graph of a function is the curve that joins $(0,0)$ and $(1,0)$ to the endpoints of $$y=1-\frac\pi8+\sqrt{x-x^2}\tag{14}$$ which has a length of $$2+\frac\pi4=2.7853981633974483096\tag{15}$$ However, this curve is not the graph of a function.

A Sequence of Approximations

$$f_n(x)=\frac1{c_n}\left(1-\frac\pi8+\sqrt{x-x^2}\right)\left(x-x^2\right)^{1/n}\tag{16}$$ where $$c_n=\left(1-\frac\pi8\right)\frac{\Gamma\left(1+\frac1n\right)^2}{\Gamma\left(2+\frac2n\right)}+\frac{\Gamma\left(\frac32+\frac1n\right)^2}{\Gamma\left(3+\frac2n\right)}\tag{17}$$ As $n\to\infty$, the length of $f_n$ approaches $2+\frac\pi4$.

At $n=100$, we get a length of $L=2.7857313936$, less than $\frac1{3000}$ above the minimum: At $n=1000$, we get a length of $L=2.7854017568$, less than $\frac1{250000}$ above the minimum.

• You have said it all! I would give you +4 for this if I could. – TonyK Feb 4 '15 at 10:48
• This is such a sexy answer. – Daniel W. Farlow Feb 5 '15 at 3:42
• You seem to have made a mistake, as the equation for curvature has an exponent of $\frac32$ on the denominator, not $\frac12$. That being said, constant curvature is the "true" minimal arc length (so the mistake is in the variations expression, not the conclusion). – Glen O Feb 6 '15 at 10:56
• @GlenO: Ah, thanks. I miscomputed $\delta s$ and it should now be fixed. – robjohn Feb 6 '15 at 11:17

The absolute least value you can get is a rectangle topped by a half circle (the circle has the best area to arc length ratio of any shape) with a total arc length of $2 \big(1 - \frac{\pi}{8}\big) + \frac{\pi}{2} \approx 2.78539$. If you use Fourier approximation, you can come arbitrarily close to this limit. (I assume the fun of this challenge is to find an arbitrarily "low-term" function.)

• Are you certain you can approximate this with a fourier transform? Fourier approximations tend to have "bunny ears" around corner points in graphs, which makes them fine for approximating area but not so fine for approximating arc length. – DanielV Jan 28 '15 at 5:56
• You could try $C_n(x-x^2)^{1/n}\left(1-\frac\pi8+\sqrt{\frac14-(x-\frac12)^2}\right)$ with $n$ large ($C_n$ is a number a little larger than $1$ to make the area come out to $1$). – Jonas Meyer Jan 28 '15 at 6:39
• @JonasMeyer: I honestly had not read your comment until this morning, although my approximations are precisely what you suggest here. The nice thing is that $C_n$ can be computed in terms of Beta functions. – robjohn Feb 4 '15 at 16:40

Without a deeper thought or analysis, I thought it could be fun to look at parts of (translated) superellipses, and maybe make top 10 with it. And indeed it worked.

Thus, I defined $g(x,n)=(1-|x|^n)^{1/n}$, and then $$f(x,n)=g(2x-1,n) = (1-|2x-1|^n)^{1/n}.$$ Normalizing $c_n=1/\int_0^1 f(x,n)\,dx$ and then calculating the length of $c_n f(x,n)$, it looked like the optimum choice was $n=4$.

The constant $c_4\approx 1.07871$. The arc length of $$1.07871(1-|2x-1|^4)^{1/4}$$ was numerically calculated to be $$2.81108,$$ which I leave as my contribution.

The graph of $c_4f(x,4)$ is shown below: • (+1) I've checked the length and I get $2.81108$ as well. This is between functions $1$ and $2$ in the list. – robjohn Feb 4 '15 at 20:56
• I just wrote a program in Mathematica 8 to compute arclength (though I see there is a built-in function in Mathematica 10 to do the same thing). It says that the graph of your function has $L=2.8110842164$ – robjohn Feb 6 '15 at 17:55

A nice solution can be obtained by modifying the "exact" solution. The "exact" solution is $$f(x) = \frac{8-\pi}8 + \sqrt{x(1-x)}$$ which has an arc length of $\frac{8+\pi}4$. As such, I propose a solution of the form $$f(x) = \sqrt{x(1-x)}(1+g(x))$$ where the "exact" solution uses $g(x)=(8-\pi)/(8\sqrt{x(1-x)})$. We want a solution similar to this, but with a finite value at $x=0$ and $x=1$. As such, I propose a simple modification. $$f(x) = \sqrt{x(1-x)}\left(1+\frac{A}{\sqrt{(x+B)(1+B-x)}}\right)$$ Note that we recover the "exact" solution if $B=0$ and $A=\frac{8-\pi}8$. We can thus get arbitrarily close to this solution by selecting appropriate values for $A$ and $B$. Although a closed-form expression relating the two parameters isn't obvious, values can be chosen numerically. For example, for $B=0.0001$, we have $A\approx\frac{8-\pi}8+0.00058333971346\approx0.60788425801473$. For these, we have $$\int_0^1 \sqrt{1+f'(x)^2}dx\approx 2.78567 \approx \frac{8+\pi}4 + 2.67\times10^{−4}$$ In this case, the expression works out to be $$f(x)=\sqrt{x(1-x)}\left(1+\frac{0.60788425801473}{\sqrt{(x+0.0001)(1.0001-x)}}\right)$$ Note that this can also be expressed as $$f(x)=\sqrt{x(1-x)}\left(1+\frac{0.60788425801473}{\sqrt{x(1-x)+0.00010001}}\right)\tag{\dagger}$$ Here is the graph of the $f(x)$ given in $(\dagger)$: • Using your $f$, I get a length of $L=2.7856654010$ – robjohn Feb 6 '15 at 22:13
• I see that your plot misses the lower part of the curve (below $y=0.6$). I noticed that in my plots, too, until I used ParametricPlot and specified PlotRange->All. Also, AspectRatio->Automatic gives a $1$-$1$ $x$-$y$ scaling. – robjohn Feb 7 '15 at 0:49
• @induktio - thanks for adding the graph. – Glen O Feb 7 '15 at 1:03
• @robjohn - I rounded to match the values expressed in the question's top 10, in part because I didn't entirely trust the value I was getting from Maxima. Thanks for the higher-accuracy value. – Glen O Feb 7 '15 at 1:06
• I wrote a program in Mathematica to recursively subdivide until a given error per vertex. Your function took $122037$ points and had a maximum error of $1.22\times10^{-10}$ (though the error is typically about $\frac14$ of that). – robjohn Feb 7 '15 at 1:16

I would not be content without a proper derivation of Dido's problem of variational calculus with constraints of moving boundary considered. When properly done I expect the curvature would be proportional to the square or cube or some other function of $y$-coordinate.

For time being proceeding purely on squared variation hypothesis for curvature as:

$$k_g = - y^2 / a^3,$$ where $a$ is a constant, I obtained the above stationary closed loop.

Numerically adjusting constant $a$ and initial $y_i (a = 0.7925, y_i = 1.143)$, it is close to the results listed here. The constants are such that perturbation causes the loops to get either progressive or regressive. The area is not very accurately $1.0$ ($\sim 0.98$ only) satisfied, length is approximately $2.78$. Improvement of numerical accuracy possible, but proper theoretical basis is necessary. In this hypothetical case, hyper-Elliptic Integrals are involved.

• Solving Dido's problem says that non-constrained (free-standing) pieces of the curve should have constant curvature (this can be done in a bit more generality, but the solution in my answer is good enough for this problem). Why do you say that the curvature should vary with the $y$-coordinate? – robjohn Feb 7 '15 at 1:26
• Curvature discontinuity at $y = 1 - \pi/8$ is ruled out. Since classical Dido needs constant profile curvature. Alternatively curvature is to be made variable, proportional to x or y wlog , starting with zero curvature @ y=0. The simplest I could think of is $k_g = f(y)$ so that a single ODE characterizes the contour. – Narasimham Feb 11 '15 at 5:33
• The constant curvature applies to unconstrained portions of the solution. Your solution is unconstrained over its entire length, yet does not have constant curvature. Therefore, this solution can be improved by adjusting its unconstrained portion. – robjohn Feb 11 '15 at 9:58

An easy approach is to simply construct an ellipse with its upper half satisfying the above conditions.

An ellipse is defined via $2$ numbers $a$ and $b$ which are each the half of the major and minor axis of the ellipse. Then all points $(x,y)$ which suffice the following equation are on the ellipse:

$$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$$

Or to get the upper half of the eclipse as a function:

$$y = b \, \sqrt{\left(1 - \frac{x^2}{a^2}\right) }$$

The area $A$ of the complete ellipse is given via $A = \pi\,a\,b$ and therefore our first condition translates to:

$$\frac{1}{2}\,\pi\,a\,b = 1$$

Also, as we want that $f(0) = 0 = f(1)$, we have:

$$2\,a = 1$$

$$a = \frac{1}{2} \\ b = \frac{4}{\pi}$$

and therefore an ellipse with the correct size. However, this results in an ellipse which intersects the $x$-Axis at $x_1=-0.5$ and $x_2=0.5$. To meet our conditions, we move the ellipse $0.5$ to the right and get:

$$y = \frac{4}{\pi} \, \sqrt{1 - 4\,(x-0.5)^2 }\tag{\dagger}$$

Now we simply let Wolfram Alpha do the computation for the arc length. The result is $$2.919463,$$ and the graph in $(\dagger)$ appears below: • This is mickep's answer with $n=2$. I assume he used $n=4$ because it gives a smaller length. – robjohn Feb 6 '15 at 19:02
• For extra precision, I computed the length of your curve to be $L=2.9194626435$ – robjohn Feb 6 '15 at 21:18

Consider the following: $$f(x)=\begin{cases} cx & \text{ if } 0 \le x \le \frac{1}{c} \\ -cx+c & \text{ if } 1-c < x \le 1 \\ 1 & \text{ otherwise } \\ \end{cases}$$

If we take $c\to\infty$ we get that it is an arc length of 3.

• I was thinking about a non-continuous $f$ too. In that case, why not just $$f(x)=\begin{cases} 1 \,\,\,if \,\,0<x < 1\\ 0 \,\,\, else \end{cases}$$ – graydad Jan 28 '15 at 4:58
• You can approximate this very closely with a continuous function (even a polynomial). – Ross Millikan Jan 28 '15 at 5:11
• @MathNoob: I was responding to the graydad comment. – Ross Millikan Jan 28 '15 at 5:12
• Using continuous piecewise linear functions, you can get arbitrarily close to $3$ by going up quick, then horizontal, then down quick. – Jonas Meyer Jan 28 '15 at 5:27

As has already been explained at least twice, the best functions follow this pattern: a continuous function $f$ with $f(0)=f(1)=0$ that approximates $y = h(x) = 1-\frac\pi8+\sqrt{x-x^2}$ for $0<x<1.$

I propose a family of functions for $n$ a positive integer, $$f_n(x) = \sqrt{x-x^2} + \left(1-\frac\pi8\right)g_n(x),$$ where $$g_n(x) = \left(1 + \frac{1}{2n}\right)\left(1-(1-2x)^{2n}\right).$$ Since $$\int_0^1 1-(1-2x)^{2n}\; dx = \frac{2n}{2n+1},$$

we have $\int_0^1 g_n(x)\;dx = 1,$ and therefore $\int_0^1 f_n(x)\; dx = 1.$

The path integral is more difficult to compute than the area integral, but $1-(1-2x)^{2n}$ takes on its maximum value, $1$, at $x=\frac12$. So if we set $h_n(x) = h(x) + \frac{1}{2n}\left(1-\frac\pi8\right)$ we ensure that $f(x) \leq h_n(x)$ for $0 \leq x \leq 1.$ I claim the path length is less than the length of the bounding curve consisting of the graph of $h_n(x)$ from $x=0$ to $x=1$ and the two segments joining $(0,0)$ to $(0,h_n(0))$ and $(1,h_n(1))$ to $(1,0)$. The length of that bounding path is $$2+\frac\pi4 + \frac1n\left(1-\frac\pi8\right) < 2+\frac\pi4 + \frac{0.607301}{n}.$$ Therefore if we pick, say $n = 1000000,$ the resulting path exceeds the theoretical minimum by less than $6.074 \times 10^{-7},$ which is less than one part in $4.5 \times 10^6.$

To within the accuracy possible in any visual graph I could present here, the graph of $f_n(x)$ for large $n$ is the same as the graph of every other near-theoretical-minimum solution: Alternatively, stealing an idea from robjohn, we have $$\int_0^1 (x-x^2)^{1/n} = B\left(1+\frac1n, 1+\frac1n\right) = \frac{\Gamma\left(1+\frac1n\right)^2}{\Gamma\left(2+\frac2n\right)},$$ so we can set $$g_n(x) = \frac{\Gamma\left(2+\frac2n\right)}{\Gamma\left(1+\frac1n\right)^2}(x-x^2)^{1/n}$$ and proceed as before. This $n$th-root approach seems to converge faster than my $2n$th-power approach.

The answer is that you will need to have a constant curvature, which is the partial circle solution by robjohn. If you do want the curve within (0,1) then the rectangle + 1/2 circle solution by both rob and xan.

Why is that? it is actually a physics problem. The solution is a shape of a membrane under pressure.

Parametric function:

$$x= \left\{\begin{matrix} 1,& 0 \leq s \leq h \\ {1 \over 2}+{1 \over 2}cos(2(s-h)), & h < s < h + {2 \over \pi}\\ 0,& h + {2 \over \pi} < s < 2h + {2 \over \pi} \\ \end{matrix}\right.$$ $$y= \left\{\begin{matrix} s,& 0 \leq s \leq h \\ h+{1 \over 2}sin(2(s-h)), & h < s < h + {2 \over \pi}\\ (2h+{\pi \over 2}-s), & h + {2 \over \pi} < s < 2h + {2 \over \pi} \\ \end{matrix}\right.$$ Area: $$1=\int_{0}^{1}{y}dx$$ $$1=\int_{h+{\pi \over 2}}^{h}[h+{1 \over 2}sin(2(s-h))]d[{1 \over 2}+{1 \over 2}cos(2(s-h))]$$ Take: $$\theta=2(s-h)$$ $$4=\int_{\pi}^{0}[2h+sin(\theta)]d(cos(\theta))=4h+{\pi \over 2}$$ $$h=1-{\pi \over 8}$$ $$Length=s_{max}=2h+{\pi \over 2}=2 + {\pi \over 4} = 2.785398163...$$

• The requirement of function continuity is for second order derivative also, is it not? – Narasimham Feb 10 '15 at 19:52
• Even if it is required, we can modify the minimum range of s in the two points. As the length of the modified range goes to 0, it would not affect the result but make it continue in any order of continuity. It is mathematically true, just the way to express the equation may be different. – PdotWang Feb 10 '15 at 20:11

$p_0 = (0, 0), p_i = (i/n, y_n), p_n = (1,0)$

$A = \frac{1}{2} \cdot \sum_{i=1}^n{(y_i + y_{i-1})} \cdot \frac{1}{n} = 1$

$L = \sum{|p_{i+1} - p_i|}$

$\frac{\partial A}{\partial y_i} = \frac{\partial }{\partial y_i} \frac{1}{2n} \cdot (y_i + y_{i-1} + y_{i+1} + y_i) = \frac{1}{n}$

$\frac{\partial L}{\partial y_i} = \frac{\partial }{\partial y_i} \bigg[\sqrt{\frac{1}{n^2} + (y_i - y_{i-1})^2} + \sqrt{\frac{1}{n^2} + (y_{i+1} - y_i)^2}\bigg] =$

$= \frac{y_i - y_{i-1}}{\sqrt{\frac{1}{n^2} + (y_i - y_{i-1})^2}} + \frac{y_i - y_{i+1}}{\sqrt{\frac{1}{n^2} + (y_{i+1} - y_i)^2}} = \lambda / n$

Lagrange multiplier

Does anyone know how make this a differential equation? $n \rightarrow \infty, 1/n \rightarrow dx$

$\frac{\delta_i}{\sqrt{(dx)^2 + (\delta_i)^2}} - \frac{\Delta_i}{\sqrt{(dx)^2 + (\Delta_i)^2}} = \lambda \cdot dx$

$\frac{\delta_i^2}{{(dx)^2 + (\delta_i)^2}} = \lambda^2 \cdot (dx)^2 + \frac{\Delta_i^2}{{(dx)^2 + (\Delta_i)^2}} + 2 \frac{\Delta_i}{\sqrt{(dx)^2 + (\Delta_i)^2}} \lambda \cdot dx$

$\bigg[\frac{\delta_i^2}{{(dx)^2 + (\delta_i)^2}} - \lambda^2 \cdot (dx)^2 - \frac{\Delta_i^2}{{(dx)^2 + (\Delta_i)^2}}\bigg]^2 = 4 \frac{\Delta_i^2}{{(dx)^2 + (\Delta_i)^2}} \lambda^2 \cdot (dx)^2$