Help in evaluating $\displaystyle\int\ \cos^2\Big(\arctan\big(\sin\left(\text{arccot}(x)\right)\big)\Big)\ \text{d}x$ Is there an easy way to prove this result?

$$\int\ \cos^2\Big(\arctan\big(\sin\left( \text{arccot}(x)\right)\big)\Big)\ \text{d}x = x - \frac{1}{\sqrt{2}}\arctan\left(\frac{x}{\sqrt{2}}\right)$$

I tried some substitutions but I got nothing helpful, like:

*

*$x = \cot (z)$
I also tried the crazy one:

*

*$x = \cot(\arcsin(\tan(\arccos(z))))$
Any hint?
Thank you!

As mentioned in comments, draw the triangles.  You have
$$
\frac x 1 = x = \cot\theta = \frac{\text{adjacent}}{\text{opposite}}
$$
so if you have a triangle in which $\text{opposite}=1$ and $\text{adjacent} = x$ then you have $\text{hypotenuse} = \sqrt{x^2+1}$ and so
$$
\sin\theta = \frac{\text{opposite}}{\text{hypotenuse}} = \frac 1 {\sqrt{x^2+1}}
$$
so
$$
\sin\operatorname{arccot} x = \frac 1 {\sqrt{x^2+1}}.
$$
Then do a similar thing with the cosine of the arctangent.
