# why does the additive synthesis method for a triangle wave require amplitude scaling by 8/pi^2?

I had to make a bunch of band limited digital triangle waves recently, so I went to (where else) wikipedia for the equations.

I noticed that there is a constant amplitude scalar of 8/pi^2 (~.8106). And indeed this does bring the amplitude range down to about +/-1. The wikipedia article doesn't explain the theoretical reasoning for this but I would like to know why this is so.

• Look for the value of the sum $\sum_k (-1)^n \frac{1}{k^2}$. Commented Jul 14, 2020 at 2:43

Are you familiar with how to obtain the Fourier series of an arbitrary periodic function? Because if you are, I'm confused at your confusion.

This is simply the Fourier series expansion of the triangle wave with fundamental frequency $$f_0=1/T$$. This can be found by taking the inner product of the function with the basis functions. We note that the DC value (the time-average) is zero, and that the function is odd, so it has no cosine terms. So, let's attempt to expand it as the sum of sines or in other words as $$x(t) = \sum_{k=0}^{\infty} b_k \sin\left(\frac{2 \pi k t}{T}\right)$$ where $$x(t)$$ is the triangle wave defined on the interval $$-T/2$$ to $$T/2$$ as $$x(t) = \left\{\begin{array}{cc} \frac{4 t + 2 T}{T} & -\frac{T}{2} < t < -\frac{T}{4} \\ \frac{4 t}{T} & -\frac{T}{4} < t < \frac{T}{4} \\ \frac{4 t - 2 T}{T} & \frac{T}{4} < t < \frac{T}{2} & \end{array}\right.$$ and elsewhere by the fact that $$x(t) = x(t+T)$$.

To calculate our Fourier series coefficients, we must compute the integral $$b_k = \frac{2}{T} \int_{-\frac{T}{2}}^{\frac{T}{2}} x(t) \sin\left(\frac{2 \pi k t}{T}\right) dt.$$

Because the function we are integrating is a product of two odd functions, it is even, so we can reduce this to $$b_k = \frac{4}{T} \int_{0}^{\frac{T}{2}} x(t) \sin\left(\frac{2 \pi k t}{T}\right) dt.$$

We notice that $$x(t)$$ exhibits even symmetry about the point $$\frac{T}{4}$$ while even frequency sine waves of the form $$\sin(4\pi k t)$$ exhibit odd symmetry about the same point. This is quarter wave symmetry and tells us that the even harmonics will all be zero. So, we only need to solve this for odd values of $$k$$. To that end, we replace $$k$$ with $$2 k + 1$$.

We can once again exploit the even symmetry of the odd harmonics to further reduce the range of our integral to $$b_{2 k + 1} = \frac{8}{T} \int_{0}^{\frac{T}{4}} \frac{4 t}{T} \sin\left(\frac{2 \pi (2 k + 1) t}{T}\right) dt,$$ and, skipping the calculus (for brevity), we arrive at $$b_{2 k + 1} = \frac{8}{\pi^2 (2 k + 1)^2} \cos(\pi k).$$

This reduces to the formula given on Wikipedia. If you don't see it, let me know and I'll be explicit.

• Yes I am. This is not an answer to my question, though. Please post such comments as a comment. Commented Jul 14, 2020 at 2:44
• I thought it was a comment. I apologize for the inconvenience.
– hops
Commented Jul 14, 2020 at 2:46
– hops
Commented Jul 14, 2020 at 3:57
• @dmedine: If you understand what a Fourier series is and why it looks the way it does for a triangular wave, what's your question then? Commented Jul 14, 2020 at 7:09
• @dmedine Irrespective of what Matt L. said, do you believe I answered your question? If not, what are your further doubts? If so, would you mark it as an accepted answer? My original question was meant to probe to find out what you are looking for if not this. Could you please help me understand?
– hops
Commented Jul 15, 2020 at 1:25

Given that the max amplitude of the normalized cosine is known (-1 to 1) and given that the additively constructed triwave contains cosines with weighted max amplitudes appearing at the same time such as...

$$\frac{1}{1 \cdot 1}, \frac{1}{5 \cdot 5}, \frac{1}{9 \cdot 9}, \frac{1}{13 \cdot 13}, \frac{1}{17 \cdot 17}, \frac{1}{21 \cdot 21}, \frac{1}{25 \cdot 25}, \ldots$$

You could think that the amplitude of the sum should only reach around $$\sim 1.068$$ and $$0.81$$ for correction is like $$3$$ times more.

But as it seems the inverted/phaseshifted-for-$$\pi$$ partials did also count in because if you include the third and the fifth partials in this game you end up with a max amplitude of $$\sim 1.22$$ - which is about the inverse of $$8 \pi^{2}$$, or $$\sim 0.82$$.

so in other words, one can explain that using simple arithmetics already.

See here.