Find the positive value of $k$ for which the value of the definite integral $\int_0^{\frac{\pi}2}|\cos x-kx|dx$ is minimized.
If I draw the graph of $\cos x$ and the straight line $kx$, they intersect between $0$ to $\frac{\pi}2$. Let the abscissa of that point of intersection be $\alpha$. So, the given integral can be written as $$\int_0^{\alpha}(\cos x-kx)dx+\int_{\alpha}^{\frac{\pi}2}(kx-\cos x)dx$$
I tried to take its derivative but got $\cos \alpha=k\alpha$, which is the same as the point of intersection. So, don't know how to find $\alpha$ or $k$.
A similar question exists here.