Computing integral of absolute value Compute $ \int_{0}^{\pi} |$sin$(kx)| \,dx \quad (\forall k \in \mathbb{Z}$).
My question: Can I say $\int_{0}^{\pi} |$sin$(kx)| \,dx = \int_{0}^{\pi} $sin$(kx) \,dx$, because sin$(x)$ is positive on $[0;\pi]$?
 A: The graph of $|sin(kx)|$ and $sin(kx)$ will look something like this(for simplicity).Upward graph is of $|sin(kx)|$


On Introducing $(kx)$ instead of $x$ in sine function, the graph will cut $x$-axis $(k-1)$ times more than usual graph of $sinx$ in interval $[0,\pi]$ and that to symmetrically. After introducing modulus you have to take image of graph below $x$-axis about $x$-axis itself that will make graph similar to above.
So you have find area under graph in interval $[0,\pi]$.Notice that area under each small branches are equal.
$$\int_{0}^{\pi}|sin(kx)|dx=\int_{0}^{\frac{\pi}{k}}|sin(kx)|dx+\int_{\frac{\pi}{k}}^{\frac{2\pi}{k}}|sin(kx)|dx+\int_{ \frac{2\pi}{k}}
 ^{\frac{3\pi}{k}}|sin(kx)|dx+.....+\int_{ \frac{(k-1)\pi}{k}}^{\frac{k\pi}{k}}|sin(kx)|dx$$
Since value of all integrals are equal(Area under each small branches are equal)
$$\int_{0}^{\pi}|sin(kx)|dx=k\int_{0}^{\frac{\pi}{k}}|sin(kx)|dx$$
Also In interval $\Big[0,\frac{\pi}{k}\Big]$ ,$sin(kx)$ is positive as it is first branch of graph. Similarly in next brach i.e$\Big[\frac{\pi}{k},\frac{2\pi}{k}\Big]$ $sin(kx)$ is negative. So sign of $sin(kx)$ changes alternatively from $+ $ to $-$.
$$\int_{0}^{\pi}|sin(kx)|dx=k\int_{0}^{\frac{\pi}{k}}sin(kx)dx$$
This gives $$\int_{0}^{\pi}|sin(kx)|dx=2$$
A: No. While $\sin(x)$ is positive on $[0, \pi]$, $\sin(kx)$ is not positive on $[0, \pi]$ (equivalently, $\sin(x)$ is not positive on $[0, k\pi]$) for all $k$. Your logic is fine for $\int_0^\pi |\sin(x)|\;\mathrm{d}x$, but this is not the integral in question.
Instead, note that $|\sin(x)|$ has period $\pi$, and so $|\sin(kx)|$ has period $\pi/k$ (where we assume $k > 0$ for now). Thus, $|\sin(kx)|$ achieves $k$ full periods in the interval $[0, \pi]$, so
$$\int_0^\pi |\sin(kx)| \; \mathrm{d}x = k\int_0^{\pi/k} |\sin(kx)| \; \mathrm{d}x = k\int_0^{\pi/k} \sin(kx) \; \mathrm{d}x = 2.$$
For negative $k$, note that $|\sin(-kx)| = |\sin(kx)|$, so we can simply replace $k$ with $|k|$ and get the same result. For $k = 0$, direct computation shows the integral is $0$.
