Tricky integral? $\int_0^{\frac{\pi}{2}}\arccos(\sin x)dx$ My answer doesn't match an online calculator I tried to calculate this integral:
$$\int_0^{\frac{\pi}{2}}\arccos(\sin x)dx$$
My result was $\dfrac{{\pi}^2}{8}$, but actually, according to https://www.integral-calculator.com/, the answer is $-\dfrac{{\pi}^2}{8}$.
It doesn't make sense to me as the result of the integration is $$x\arccos\left(\sin x\right)+\dfrac{x^2}{2}+C$$ 
and after substituting $x$ with $\dfrac{{\pi}}{2}$ and $0$, the result is a positive number. 
Can someone explain it? Thanks in advance!
 A: Yes, your result is correct. For $x\in[-1,1]$,
$$\arccos(x)=\frac{\pi}{2}-\arcsin(x).$$
Hence
$$\int_0^{\pi/2}\arccos(\sin(x))dx=
\int_0^{\pi/2}\left(\frac{\pi}{2}-x\right)dx=\int_0^{\pi/2}tdt=\left[\frac{t^2}{2}\right]_0^{\pi/2}=\frac{\pi^2}{8}.$$
P.S. WA gives the correct result. Moreover $t\to \arccos(t)$ is positive in $[-1,1)$  so the given integral has to be POSITIVE!
A: It seems you're using integration by parts:
\begin{alignat}{2}
\int_0^{\pi/2}\arccos\sin x\,dx
&=\Bigl[x\arccos\sin x\Bigr]_0^{\pi/2}
&&+\int_0^{\pi/2} x\frac{\cos x}{\sqrt{1-\sin^2x}}\,dx \\[4px]
&=0&&+\int_0^{\pi/2}x\,dx\\[4px]
&=\Bigl[\frac{x^2}{2}\Bigr]_0^{\pi/2}=\frac{\pi^2}{8}
\end{alignat}
However, note that it's not quite right to say that the antiderivative is like you write, because in general
$$
\frac{\cos x}{\sqrt{1-\sin^2x}}=\frac{\cos x}{\lvert\cos x\rvert}
$$
Indeed, if you differentiate $f(x)=\arccos\sin x$,
$$
f'(x)=\frac{\cos x}{\lvert\cos x\rvert}=
\begin{cases}
1 & -\pi/2+2k\pi < x < \pi/2+2k\pi \\[6px]
-1 & \pi/2+2k\pi < x < 3\pi/2+2k\pi
\end{cases}
$$
Therefore
$$
f(x)=
\begin{cases}
a_{k} + x & -\pi/2+2k\pi \le x \le \pi/2+2k\pi \\[6px]
b_{k} - x & \pi/2+2k\pi \le x \le 3\pi/2+2k\pi
\end{cases}
$$
where the constants are chosen so that the function is continuous.

A: Essentially the same idea of the other answer, but using the covs $x = t + \pi/2$, $t = -s$ and the evenness of $\cos$:
$$
\int_0^{\frac{\pi}2}\arccos(\sin(x))dx =
\int_{-\frac{\pi}2}^0\arccos(\sin(t + \pi/2))dt =
\int_{-\frac{\pi}2}^0\arccos(\cos(t))dt =
$$
$$
\int_0^{\frac{\pi}2}(\arccos(\cos(-s))ds =
\int_0^{\frac{\pi}2}(\arccos(\cos(s))ds =
\int_0^{\frac{\pi}2}s\,ds= \frac{\pi^2}8.
$$
A: Alternative solution,
\begin{align}J&=\int_0^{\frac{\pi}{2}}\arccos(\sin(x))dx\end{align}
Perform the change of variable $y=\dfrac{\pi}{2}-x$,
\begin{align}J&=\int_0^{\frac{\pi}{2}}\arccos(\cos(x))dx\\
&=\int_0^{\frac{\pi}{2}} x\,dx\\
&=\left[\frac{x^2}{2}\right]_0^{\frac{\pi}{2}}\\
&=\boxed{\frac{\pi^2}{8}}
\end{align}
A: A geometric argument could be using the identity: $\arccos x=\pi/2-\arcsin x$. This gives you $\pi/2-x$ as the integrand. If you carefully observe this is a straight with $x$ and $y$- intercepts at $\pi/2$.
Since Integration gives the area under the curve, the computation of the integral is just  transformed to the computation of the area of the triangle

$$I=\int_{0}^{\pi/2}\arccos(\sin x)\mathrm dx=\int_{0}^{\pi/2}(\pi/2-x)\mathrm dx=\dfrac{1}{2}\cdot \underbrace{\dfrac{\pi}{2}\cdot\dfrac{\pi}{2}}_{\text{base}\cdot\text{height}}=\dfrac{\pi^2}{8}$$
