It occurred to me when looking at this picture that there may be a time in a laboratory setting when representing a sine curve with sawtooth waves might be useful. Can it be done?

The answer is yes – for the impatient, here is the plot I eventually made. The recipe is given below…

as was explained to me in the subreddit /r/puremathematics by reddit user /u/Gro-Tsen as follows:

`First, let me discuss how one can `

**formally** compute the coefficients expressing a sine wave as a sum of sawtooth waves: assume we have a formal sum

```
```f(x) = g(x) + c₂·g(2x) + c₃·g(3x) + c₄·g(4x) + …

where c₂,c₃,c₄,… are known coefficients, and we want to invert this to find a similar expression for g in function of f,

g(x) = f(x) + d₂·f(2x) + d₃·f(3x) + d₄·f(4x) + …

(our goal is to compute the d coefficients in function of the c's).

This can be done inductively as follows: assuming the N−1 first d's are known (starting with just d₁=1), truncate the expression of g to the first N terms (leaving the N-th d coefficient, d[N], as an unknown) and substitute this in the first expression, then equate the first N coefficients: clearly this will give an equation determining the unknown d[N] in function of the known ones and the c's, in fact, for all N>1 this gives

d[N] = − sum(d[i]·c[N/i]) where i ranges over divisors of N (including i=1, for which d₁=1, but excluding i=N)

so we can compute

- d₂ = −c₂

- d₃ = −c₃

- d₄ = −c₄+(c₂)²

- d₅ = −c₅

- d₆ = −c₆ + 2·c₂·c₃

`and so on (for any prime number, d[p] = −c[p] as is clear from my inductive formula).`

Now we can try the above purely formal method in the case where g(x) = sin(x) and f(x) is the sawtooth wave defined by f(x)=x/2 for −π<x<π. We have

```
```f(x) = sin(x) − sin(2x)/2 + sin(3x)/3 − sin(4x)/4 + …

in other words c[i] = (−1)^{i+1}/i and we can compute the d's from the above process:

1, 1/2, -1/3, 1/2, -1/5, -1/6, -1/7, 1/2, 0, -1/10, -1/11, -1/6, -1/13, -1/14, 1/15, 1/2, -1/17, 0, -1/19, -1/10, 1/21, -1/22, -1/23, -1/6, 0, -1/26, 0, -1/14, -1/29, 1/30, -1/31, 1/2, …

so we should have sin(x) = f(x) + f(2x)/2 − f(3x)/3 + f(4x)/2 − f(5x)/5 − f(6x)/6 − f(7x)/7 + f(8x)/2 − f(10x)/10 − … (where, again, f(x) is x/2 − π·floor((x+π)/(2π))).

*Unfortunately*, this reasoning was completely formal and does not say anything about convergence. I don't think one can reasonably expect convergence a.e. or L² convergence, because one can easily see that d[2^{n}] is always 1/2, for any n>0, so the d[i] don't even tend to zero! Still, there's probably some weak sense in which the series converges (e.g., I'm pretty sure it converges as distributions), but since I'm an algebraist and not an analyst I'll just leave it at that.

Well “terrific,” I thought. But does it really work? /u/Gro-Tsen warned us that it would not converge, and he was correct. I fired up Mathematica and generated the following image with 100 terms of the expansion /u/Gro-Tsen provided, displaying the weird convergence (code below). I still don’t know if its the convergence of the series causing this effect, or the built in machine representation of a sawtooth in Mathematica.

The coefficients were pulled from OEIS sequence A067856 with each entry divided by it’s index. Here is the Mathematica code for the plot:

`Tooth[x_] := SawtoothWave[(x - Pi)/(2*Pi)] - .5`

```
```Plot[Tooth[x], {x, -2*Pi, 2*Pi}] (* this will verify that the function Tooth[] is valid *)

BigArr =

{1, 1, -1, 2, -1, -1, -1, 4, 0, -1, -1, -2, -1, -1, 1, 8, -1, 0, -1, -2, 1, -1, -1, -4, 0, -1, 0, -2, -1, 1, -1, 16, 1, -1, 1, 0, -1, -1, 1, -4, -1, 1, -1, -2, 0, -1, -1, -8, 0, 0, 1, -2, -1, 0, 1, -4, 1, -1, -1, 2, -1, -1, 0, 32, 1, 1, -1, -2, 1, 1, -1, 0, -1, -1, 0, -2, 1, 1, -1, -8, 0, -1, -1, 2, 1, -1, 1, -4, -1, 0, 1, -2, 1, -1, 1, -16, -1, 0, 0, 0}

BigArray = BigArr*(Array[1/# &, 100, 1])

`Plot[Array[Tooth[# x] &, 100, 1].BigArray, {x, -2*Pi, 2*Pi},`

ImageSize -> 1800]