# What is the length of a sine wave from $0$ to $2\pi$?

What is the length of a sine wave from $$0$$ to $$2\pi$$? Physically I would plot $$y=\sin(x),\quad 0\le x\le {2\pi}$$ and measure line length.

I think part of the answer is to integrate this: $$\int_0^{2\pi} \sqrt{ 1 + (\sin(x))^2} \, {\rm d}x$$

Any ideas?

• Does the dx math-e-magically escape the sqrt? Commented Jun 13, 2011 at 12:04
• Responding to Henry, June 6, 2011, this equivalence emerges from a simple experiment given by Hugo Steinhaus in 'Mathematical Snapshots'. Take a roll of something (I use paper towelling) and saw through it obliquely, thus producing elliptic sections. Unroll it and you have a sine curve. (Tom Apostol and Mamikon Mnatsakanian suggest you rest a paint roller at an angle in the paint tray. Then paint!) Paul Stephenson May 8 '13 at 21.00 Commented May 8, 2013 at 19:05
• Can someone answer with a simple number? I need this to know how much paint to buy to paint my corrugated sheet roof.
– SF.
Commented Aug 23, 2013 at 19:46
• FWIW, I've created a JS demo showing numerical integration of this function, with the purpose of evenly spacing points along the curve (as opposed to along the X axis). jsfiddle.net/fp7aknoc Commented Oct 7, 2014 at 7:22
• I have a related question posted here: math.stackexchange.com/questions/3617566/…. I am looking not for the net arc length of a sinusoid, but only its x-projection. Could someone help?
– ap21
Commented Apr 10, 2020 at 11:39

I'm nowhere near a computer with elliptic integrals handy, so I'll give the explicit evaluation of

$$\int_0^{2 \pi} \sqrt{1+\cos^2 x}\,\mathrm dx$$

Note that an entire sine wave can be cut up into four congruent arcs; we can thus consider instead the integral

$$4\int_0^{\pi/2} \sqrt{1+\cos^2 x}\,\mathrm dx$$

(alternatively, one can split the integral into four "chunks" and find that those four chunks can be made identical; I'll leave that manipulation to somebody else.)

Now, after some Pythagorean manipulation:

$$4\int_0^{\pi/2} \sqrt{1+\cos^2 x}\,\mathrm dx=4\int_0^{\pi/2} \sqrt{2-\sin^2 x}\,\mathrm dx$$

and then a bit of algebraic massage:

$$4\sqrt{2}\int_0^{\pi/2} \sqrt{1-\frac12\sin^2 x}\,\mathrm dx$$

we then recognize the complete elliptic integral of the second kind $E(m)$

$$E(m):=\int_0^{\pi/2}\sqrt{1-m\sin^2u}\mathrm du$$

(where $m$ is a parameter):

$$4\sqrt{2}E\left(\frac12\right)$$

As Robert notes in a comment, different computing environments have different argument conventions for elliptic integrals; Maple for instance uses the modulus $k$ (thus, $E(k)$) instead of the parameter $m$ as input (as used by Mathematica and MATLAB), but these conventions are easy to translate to and from: $m=k^2$. So, using the modulus, the answer is then $4\sqrt{2}E\left(\frac1{\sqrt 2}\right)$.

Now to address the noted equivalence for negative parameter and a parameter in the interval $(0,1)$ by Henry, there is what's called the "imaginary modulus transformations"; the DLMF link gives the transformation for the incomplete case, but I'll explicitly do the complete case here for reference since it's not too gnarly to do (all you have to remember are the symmetries of the trigonometric functions):

Letting $E(-1)=\int_0^{\pi/2}\sqrt{1+\sin^2 u}\,\mathrm du$, we then go this way:

$$\int_0^{\pi/2}\sqrt{1+\sin^2 u}\,\mathrm du=\int_{-\pi/2}^0\sqrt{1+\sin^2 u}\,\mathrm du$$

$$=\int_0^{\pi/2}\sqrt{1+\sin^2\left(u-\frac{\pi}{2}\right)}\,\mathrm du=\int_0^{\pi/2} \sqrt{1+\cos^2 u}\,\mathrm du$$

from which I've shown what you're supposed to do earlier.

Computationally, the complete elliptic integral of the second kind isn't too difficult to evaluate, thanks to the arithmetic-geometric mean. Usually, this method is used for computing the complete elliptic integral of the first kind, but the iteration is easily hijacked to compute the integral of the second kind as well.

Here's some C(-ish) code for computing $E(m)$:

#include <math.h>

double ellipec(double m)
{
double f, pi2, s, v, w;

if (m == 1.0)
return 1.0;

pi2 = 2.0 * atan(1.0);

v = 0.5 * (1.0 + sqrt(1 - m));
w = 0.25 * m / v;
s = v * v;
f = 1.0;

do {
v = 0.5 * (v + sqrt((v - w) * (v + w)));
w = 0.25 * w * w / v;
f *= 2.0;
s -= f * w * w;
} while (abs(v) + abs(w) != abs(v))

return pi2 * s / v;
}


(make sure either your compiler does not (aggressively) optimize out the while (abs(v) + abs(w) != abs(v)) portion, or you'll have to use a termination criterion of the form abs(w) < tinynumber.)

Finally,

"I am also puzzled: a circle's circumference is $2\pi r$ and yet an ellipse's is an infinite series - why?"

My belief is that we are actually very lucky that the arclength function for a circle is remarkably simple compared to most other curves, the symmetry of the circle (and thus also the symmetry properties of the trigonometric functions that can parametrize it) being one factor. The reduction in symmetry in going from a circle to an ellipse means that you will have to compensate for those "perturbations", and that's where the series comes in...

• This is not yet my official return; I decided to answer this question in the short time I have access to a computer today. Commented Jul 5, 2011 at 7:36
• Well J. M. your contributions to the site a very much appreciated so even if it is only to answer a question every now and then when you have some free time and computer access, it is really a great thing. Good luck with whatever you're doing =) Commented Jul 5, 2011 at 7:45
• Thanks. I am out of my depth here and I don't really understand what E(x) is. It is interesting that a seemingly simple question can have a complex and I gather a difficult answer to calculate. I am also puzzled: a circle's circumference is 2.pi.r and yet an ellipse's is an infinite series - why? Commented Jul 7, 2011 at 12:01
• "we are actually very lucky that the arclength function for a circle is remarkably simple compared to most other curves" - How is it simple? It is "an infinite series" just like an ellipse's circumference. Commented Dec 11, 2015 at 18:40
• In that formula you are using angular units that are defined as the arc length of a unit circle spanned by that angle, which is "cheating". Of course assuming that the angle spanned by a unit circle is $2\pi$, the circumference is also $2\pi$. But $\pi$ is not a "simple" number - it is transcendental. I suppose you can argue that it is nice on the grounds that it pops up everywhere. Commented Dec 11, 2015 at 18:44

The arc length of the graph of a function $f$ between $x=a$ and $x=b$ is given by $\int_{a}^{b} \sqrt { 1 + [f'(x)]^2 }\, dx$. So, if you're considering $f(x)=\sin(x)$ then the correct integral is $\int_{0}^{2\pi} \sqrt { 1 + [\cos(x)]^2 }\, dx$. Unfortunately, this integral cannot be expressed in elementary terms. This is quite common for arc-length integrals. However, the definite integral might be expressible in elementary terms; Wolfram Alpha says it cannot.

• That's interesting, as the two definite integrals are clearly the same over this interval. Following up my comment to Chandru's answer, Wolfram Alpha's gives you $4 \sqrt{2} E(\tfrac{1}{2}) \approx 7.6404$, which is the circumference of an ellipse. Commented Jun 13, 2011 at 12:03

It is given by $$I = \int_{0}^{2 \pi} \sqrt{ 1 + (\cos{x})^{2}} \ \rm{dx}$$ and I think this is an elliptic integral of the second kind. (That's what Wolfram says.)

• Wolfram Alpha gives it as $4E(-1) \approx 7.6404$ where $E(m)$ is the complete elliptic integral of the second kind, though clearly not the circumference of an ellipse with eccentricity $-1$. Commented Jun 13, 2011 at 11:42
• @Henry: Thanks. My simple 8-straight line approximation yielded 7.58... Commented Jun 13, 2011 at 12:11
• The first word of this answer isn't quite right, because the value of the integral in the question is correct. Commented Jun 13, 2011 at 18:47
• @Jonas: for the arc length it has to derivative of $\sin{x}$ that is $\cos{x}$, so I have added $\cos{x}$
– user9413
Commented Jun 13, 2011 at 18:50
• Maple, which uses a different convention for the elliptic integrals, gives the answer as $4 \sqrt{2} {\rm EllipticE}(\sqrt{2}/2)$. The circumference of an ellipse with semi-major axis $a$ and eccentricity $e$ would be, in this notation, $4 a {\rm EllipticE}(e)$. Commented Jun 13, 2011 at 19:28

The given integral equals $$4\int_{0}^{\pi/2}\sqrt{1+\sin^2 x}\,dx = 4\int_{0}^{1}\frac{\sqrt{1+x^2}}{\sqrt{1-x^2}}\,dx = 4\int_{0}^{1}\frac{1+x^2}{\sqrt{1-x^4}}\,dx \\= \int_{0}^{1}\left(x^{-3/4}+x^{-1/4}\right)(1-x)^{-1/2}\,dx = B\left(\tfrac{1}{4},\tfrac{1}{2}\right)+B\left(\tfrac{3}{4},\tfrac{1}{2}\right)\tag{A}$$ where $B$ is Euler's Beta function. In terms of the $\Gamma$ function this length equals $$L=\frac{1}{\sqrt{2\pi}}\,\Gamma\left(\tfrac{1}{4}\right)^2 +4\pi\sqrt{2\pi}\,\Gamma\left(\tfrac{1}{4}\right)^{-2}.\tag{B}$$ On the other hand $\Gamma\left(\tfrac{1}{4}\right)$, the value of the complete elliptic integral of the first kind $K(m)$ at $m=\frac{1}{2}$ and the lemniscate constant are all related (see some special values for the $\Gamma$ function). Additionally, the AGM mean provides a very efficient numerical technique for the evaluation of a complete elliptic integral of the first kind. We may write $(B)$ as $$L = \frac{2\pi}{\text{AGM}(1,\sqrt{2})}+2\,\text{AGM}\left(1,\sqrt{2}\right) \tag{C}$$ hence this is an efficient algorithm for the numerical evaluation of the wanted length:

• Initialize $a\leftarrow 1$, $b\leftarrow\sqrt{2}$
• Repeat $a\leftarrow\frac{a+b}{2}$, $b\leftarrow\sqrt{ab}$ until $a-b$ is smaller than the wanted accuracy
• Return $2\sqrt{ab}+\frac{2\pi}{\sqrt{ab}}$.

We get $L\approx 7.640395578055424$ with very few steps.

• $\text{AGM}\left(1,\sqrt{2}\right) = \text{AGM}\left(1+i,1-i\right)$ Commented Jul 9, 2022 at 22:31
• Arbitrary precision AGM calculator for L in Sage: sagecell.sagemath.org/… Commented Aug 28, 2022 at 16:55

The length of A sin(x) from 0 to 2$$\pi$$ is

$$4 \sqrt{A^2+1} E\left(\frac{A^2}{A^2+1}\right)$$

Where $$E(m)$$ is the elliptic integral of the second kind.

So if your corrugated sheet is 10cm thick and has 20cm between peaks $$A = \frac{10/2}{20/2\pi} = \pi/2$$ so the length is $$\frac{20\text{ cm}}{2\pi} \times 4 \sqrt{\pi^2/4+1} E\left(\frac{\pi^2/4}{\pi^2/4+1}\right) = 29.3\text{ cm}$$

\begin{align} \int_0^{2\pi}\sqrt{1+\cos^2(x)} dx &= 4 \int_0^{\pi/2}\sqrt{1+\cos^2(x)}dx \\ &= 4 \int_0^{\pi/2}\sqrt{1+\dfrac{1+\cos(2x)}2 }dx\\ &= 4 \sqrt{\dfrac{3}2} \int_0^{\pi/2} \sqrt{1+\dfrac{\cos(2x)}3} dx \\ &= 2\sqrt6 \int_0^{\pi/2} \sum_{n=0}^\infty a_n (\dfrac{\cos(2x)}3)^n dx \tag1 \end{align} where $$\sqrt{1+t}=\sum_{n=0}^\infty a_n t^n, \mbox{ and }\ a_n = \frac{(-1)^{n+1} (2n-3)!!}{n! 2^n}$$ Let $I_n = \int_0^{\pi/2} \cos^n(2x) dx$, then $I_n = 0\$ if $\ n\$ is odd, and $I_n = \dfrac{\pi}2 b_{n/2}$ if $\ n\$ is even, where $b_k = \dfrac{(2k-1)!!}{k! 2^k}$.

The equation $(1) = 2\sqrt6 \sum\limits_{n=0}^\infty \dfrac{a_n}{3^n} I_n = 2\sqrt6 \sum\limits_{k=0}^\infty \dfrac{a_{2k}}{3^{2k}} \dfrac{\pi}2 b_k = \sqrt6 \pi \sum\limits_{k=0}^\infty c_k \tag2$

where $c_k = a_{2k} b_k 3^{-2k} = -\dfrac{(4k-3)!!}{(2k)! 2^{2k}} \dfrac{(2k-1)!!}{k! 2^k} 3^{-2k} = -\dfrac{(4k-3)!!}{(k!)^2 2^{4k} 3^{2k}} = -\dfrac{\binom{4k-3}{2k-1}\binom{2k-1}{k}}{2^{6k-2} 3^{2k} k}$.

Note $c_0 = -(-3)!! = -\dfrac{1(-1)(-3)!!}{1(-1)} = 1$.

Additionally, \begin{align} \int_0^{2\pi}\sqrt{1+\cos^2(x)} dx & = 4 \int_0^{\pi/2}\sqrt{1+\cos^2(x)}dx = 4 \int_0^{\pi/2}\sqrt{2-\sin^2(x)}dx\\ & = 4 \sqrt2 \int_0^{\pi/2} \sqrt{1-\dfrac{\sin^2(x)}2} dx = 4 \sqrt2 E\left(\dfrac1{\sqrt2}\right) \tag3 \end{align}

where $$E(k) = \displaystyle \int_0^{\pi/2} \sqrt{1-k^2 \sin^2(x)} dx = \dfrac{\pi}2 \sum_{n=0}^{\infty} \left(\dfrac{\dbinom{2n}n}{4^n} \right)^2 \dfrac{k^{2n}}{1-2n}$$ and is referred to as the complete elliptic integral of second kind.

$E\left(\dfrac1{\sqrt2}\right) = \dfrac{\pi}2 \sum\limits_{n=0}^{\infty} d_n \tag4$ where $d_n = \left[ \dfrac{(2n-1)!!}{n!2^n} \right]^2 \dfrac{1}{(1-2n)2^n}$.

By $(2)$ and $(3)$, $E\left(\dfrac1{\sqrt2}\right) = \dfrac{\sqrt3 \pi}4 \sum\limits_{n=0}^{\infty} c_n \tag5$

$(4) = (5)$. Because $c_n$ and $d_n \to 0$ as $n\to \infty$, the convergence rate of $c_n$ and $d_n$ are given by \begin{align} \lim_{n\to\infty} \left| \dfrac{c_n}{c_{n-1}} \right| &= \lim_{n\to\infty} \dfrac{(4n-3)(4n-5)}{n^2 2^4 3^2} = \dfrac 1 9\ \mbox{ and }\\ \lim_{n\to\infty} \left| \dfrac{d_n}{d_{n-1}} \right| &= \lim_{n\to\infty} \dfrac{(2n-1)(2n-3)}{n^2 8} = \dfrac 1 2,\ \mbox{ respectively. } \end{align} We obtain the values of $(4)$ and $(5)$ by the power series expansion of $\sqrt{1-\dfrac{\sin^2(x)}2}$ and $\sqrt{1+\dfrac{\cos(2x)}3}$, respectively. Hence using $(5)$, we can obtain accurate estimates faster.

On MATLAB:

$$t = 0:0.001:(2\pi);$$ $$st = \sin(t);$$

$$\text{sum( sqrt( diff(st).^2 + diff(t).^2 ) )}$$

$$\text{ans} = 7.6401$$

You will need $21.6$% more paint to paint the corrugated roof ;).

An improved analytical approximation to the one I gave before (user375743) is: $$l(x) = \frac{121}{100}x + \frac{1}{10} \mathrm{sin(2x)}$$ It has a maximum error of less than 1.5% and an error of 0.5% for the range 0 to $2\pi$.

By arclength formula and symmetry, the length of the curve $$y=\sin x$$, $$0\leq x\leq 2\pi$$, is $$L=4\int_0^{\tfrac\pi 2}\sqrt{1+\left(\frac{d}{dx}\sin x\right)^2}dx=4\int_0^{\tfrac\pi 2}\sqrt{1+\cos^2 x}dx=4\int_0^{\tfrac\pi 2}\sqrt{2-\sin^2 x}dx =4\sqrt2\int_0^{\tfrac\pi 2}\sqrt{1-\tfrac12\sin^2 x}dx=\color{red}{4\sqrt2E(\tfrac1{\sqrt2})}.$$ By Legendre's relation we have $$2E(\tfrac1{\sqrt2})K(\tfrac1{\sqrt2})-K(\tfrac1{\sqrt2})^2=\tfrac\pi 2.$$ Combining we have $$L=\frac{\sqrt2 \pi}{K(\tfrac1{\sqrt2})}+2\sqrt2K(\tfrac1{\sqrt2}).$$ Now, $$K(\tfrac1{\sqrt2})=\frac{\Gamma(\tfrac14)^2}{4\sqrt\pi}\approx 1.854$$ is well-known compared to $$E(\tfrac1{\sqrt2})$$ and thus $$L\approx 7.64$$.

Dr Math did give a much better response than anyone else in this forum did, but no one seemed able to understand Dr Math and Dr Math is no longer available for anything like this anymore, so here is a different answer taken from an elementary Calculus I book...

A 4.2" Corrugated Metal Panel has a period of 10.67 cm (distance from the top of one crest to the next one) and an amplitude of 1.35 cm (height from the mid-point of the wave to the top of a crest). Modeling the sinewave gives us:

y = 1.35 sin 0.589x

...where 1.35 is the amplitude and
the period is 0.589 (or 2π/10.67)

The arc length of the curve is:

$$\displaystyle \int_{a}^{b}\sqrt{1+\left(\frac{dy}{dx}\right)^2}$$dx

Simple calculus tells us if $$\frac{dy}{dx}$$ = $$0.795 * cos(0.589x)$$
and since $$a=0$$ and $$b=10.67$$

$$\displaystyle \int_{0}^{10.67}\sqrt{1+\left(0.795 * cos(0.589x)\right)^2}$$dx

Then the answer should be 12.196 cm per wavelength.

That wasn't so hard now, was it?

• "'...has no elementary antideravitive,' which contradicts the accepted answer!" - yes, I believe it was mentioned somewhere the the elliptic integrals are not elementary, and that Dr. Math was merely sparing you from functions you are apparently not prepared to deal with. :P Commented May 18, 2016 at 9:22
• @j-m-is-not-a-mathematician I was indirectly quoting Dr Math, so they aren't really my words or my "misunderstanding", they are the sole property of Dr Math, if they really are "misunderstandings" :)
– ar18
Commented Jan 4, 2019 at 2:09
• What does it mean that a function has no elementary antiderivative: quora.com/…
– ar18
Commented Jan 4, 2019 at 2:32
• Hey Bob! Answer my question too. Your answers are interesting. HEAP. Mathematics is not everything. Commented Jan 20, 2023 at 14:09
• Hey Alfred! Are you saying you can't answer my question first? No matter. I rewrote my answer so even you can understand it.
– ar18
Commented Jan 21, 2023 at 23:06