I am working on an investigation focusing on mathematics in music. Modelling various different chords and their mathematical functions, I now need to understand (in relative detail) how the most basic triangle wave can be explained using maths.
Hence, can someone explain how exactly this formula works:
(2/pi) * arcsin[sin(Pi*x)]
I'm trying to understand how exactly the arcsin(sin(...)) part links to producing an actual triangle. (especially because sin(arcsin) cancels out).
Thank you very much
If you're familiar with the definition of $\sin \theta$ using a unit circle, the following visualization might be useful. (And if you're not familiar with that definition, perhaps it would be useful to become familiar with it.)
Let $\pi x$ be the angle of a radius of the unit circle, measured counterclockwise from the positive horizontal axis. (I do not say $x$-axis, because we are already using $x$ for something else.) Then $\sin(\pi x)$ is the vertical coordinate of the point where the ray intersects the circle.
As $x$ increases, the ray sweeps around the circle, so the vertical coordinate of the intersecting point increases to $1$, then decreases to $-1$, then increases to $0$ again as the ray returns to its starting position. Then as $x$ continues to increase, the whole cycle repeats indefinitely.
Meanwhile, the $\arcsin$ function attempts to deduce the angle that could have produced a given vertical coordinate on the circle. But since there are many angles that reach the same point, and since for most points (other than $(0,1)$ and $(0,-1)$) there are other points with the same vertical coordinate, there are a lot of possible angles to choose from. This is resolved by choosing only angles in the range from $-\frac\pi2$ to $\frac\pi2$ inclusive.
Hence when $x = 0$, $\sin(\pi x) = 0$ and $\arcsin(\sin(\pi x)) = 0$ (since $0$ is the only angle in the range $-\frac\pi2$ to $\frac\pi2$ to produce a vertical coordinate of $0$). Then as $x$ increases, as long as $\pi x < \frac\pi2$, $\sin(\pi x)$ increases as the ray at angle $\pi x$ sweeps around the circle, and $\arcsin(\sin(\pi x))$ evaluates to $\pi x$ (the only angle in the range $-\frac\pi2$ to $\frac\pi2$ that produces the vertical coordinate of the intersection point).
But when $\pi x$ passes $\frac\pi2$ and the ray starts two sweep through decreasing vertical coordinates on the left side of the vertical axis, $\arcsin(\sin(\pi x))$ is "trapped" on the right side of the axis (it cannot produce angles greater than $\frac\pi2$), and therefore $\arcsin(\sin(\pi x))$ starts to describe the angle of a mirror-image ray that travels clockwise from angle $\frac\pi2$ to $-\frac\pi2$ at the same time the ray at angle $\pi x$ travels counterclockwise from $\frac\pi2$ to $\frac{3\pi}2$. But at angles $\frac{3\pi}2$ and $-\frac\pi2$, the rays intersect the same point, and they then proceed to sweep counterclockwise together back toward the top of the circle.
That is, as we increase $\pi x$ at a constant rate, $\arcsin(\sin(\pi x))$ initially increases at the same constant rate, but it then decreases at the "mirror image" constant rate, then increases again, and as the cycle repeats, it decreases, increases, decreases, increases, and so forth.
That's the geometric explanation of how the triangular wave gets to be triangular. The factor of $2/\pi$ is a scaling factor to get the wave to have the desired amplitude (peak value of $1$ rather than $\pi/2$).