Distance between incentre and orthocentre. I want to prove that the distance between incentre and orthocentre is $$\sqrt{2r^2-4R^2\cos A\cos B\cos C} $$here $r$ is inradius and $R$ is circumradius.
I considered $\triangle API$ ($P$ is orthocentre and $I$ is incentre). I could find  $AP=2R\cos A$, $AI=4R\sin\frac{B}{2}\sin\frac{C}{2} $ and $\angle PAI=\angle \frac{B-C}{2}$.
So applying cosine rule I got $$PI^2=4R^2+16R^2\sin^2\frac{B}{2}\sin^2\frac{C}{2} -16R^2\cos A\sin\frac{B}{2}\sin\frac{C}{2}\Bigg(\cos\frac{B}{2}\cos\frac{C}{2}+\sin\frac{B}{2}\sin\frac{C}{2}\Bigg)$$
How to proceed form here ?
 A: 
So applying cosine rule I got $$\small PI^2=4R^2+16R^2\sin^2\frac{B}{2}\sin^2\frac{C}{2} -16R^2\cos A\sin\frac{B}{2}\sin\frac{C}{2}\Bigg(\cos\frac{B}{2}\cos\frac{C}{2}+\sin\frac{B}{2}\sin\frac{C}{2}\Bigg)$$

I think that you have a typo (the red part) : 
$$\begin{align}&\small PI^2=4R^2\color{red}{\cos^2A}+16R^2\sin^2\frac{B}{2}\sin^2\frac{C}{2} -16R^2\cos A\sin\frac{B}{2}\sin\frac{C}{2}\Bigg(\cos\frac{B}{2}\cos\frac{C}{2}+\sin\frac{B}{2}\sin\frac{C}{2}\Bigg)\\&\small=4R^2\left(\cos^2A+4\sin^2\frac{B}{2}\sin^2\frac{C}{2} -4\cos A\sin\frac{B}{2}\sin\frac{C}{2}\Bigg(\cos\frac{B}{2}\cos\frac{C}{2}+\sin\frac{B}{2}\sin\frac{C}{2}\Bigg)\right)\\&\small=4R^2\left(\cos^2A+4\sin^2\frac{B}{2}\sin^2\frac{C}{2}-\cos A\cdot \color{green}{2\sin\frac{B}{2}\cos\frac{B}{2}\cdot 2\sin\frac{C}{2}\cos\frac{C}{2}}-4\cos A\sin^2\frac{B}{2}\sin^2\frac{C}{2}\right)\\&\small=4R^2\left(\cos^2A+8\sin^2\frac{B}{2}\sin^2\frac{C}{2}\cdot \color{blue}{\frac 12\left(1-\cos A\right)}-\cos A\color{green}{\sin B\sin C}\right)\\&\small=4R^2\left(\cos^2A+8\color{blue}{\sin^2\frac A2}\sin^2\frac{B}{2}\sin^2\frac{C}{2}-\cos A\sin B\sin C\right)\\&\small=4R^2\left(8\sin^2\frac A2\sin^2\frac{B}{2}\sin^2\frac{C}{2}+\cos A(\cos A-\sin B\sin C)\right)\\&\small=4R^2\left(8\sin^2\frac A2\sin^2\frac{B}{2}\sin^2\frac{C}{2}+\cos A(\cos(180^\circ-(B+C))-\sin B\sin C)\right)\\&\small=4R^2\left(8\sin^2\frac A2\sin^2\frac{B}{2}\sin^2\frac{C}{2}-\cos A\cos B\cos C\right)\\&\small =2\left(4R\sin \frac A2\sin \frac B2\sin\frac C2\right)^2-4R^2\cos A\cos B\cos C\\&\small=2r^2-4R^2\cos A\cos B\cos C\end{align}$$
A: Use these facts
1. The Euler circle is tangent to the inscribed circle
2. The distance between the circumcenter and the incenter using the Euler formula.
3. The formula for the power of a point with respect to a circle
4. The properties of the Euler line
5. The fact that the reflection of the orthocenter with respect to any side of a triangle is on the circumcircle 
6. the relationship between the median, the two adjacent sides to that median and the third side.
Then just do the algebra
Let O be the circumcenter (X(3), H the orthocenter (X(4)),I the incenter (X(1)), and W The center of the Euler circle (X(5)), and A' the foot of the altitude on  the corresponding side. Assuming a triangle ABC
We have OI^2 =R^2 -2Rr where R is the circumradius and r the inscribed circle  radius(
