How to prove that $\frac{r}{R}+1=\cos A+\cos B+\cos C$?
here is mechanical solution:
$\cos A+\cos B+\cos C-1=\dfrac{a^2b+b^2c+c^2a+b^2a+c^2b+a^2c-a^3-b^3-c^3-2abc}{2abc}=\dfrac{(a+b-c)(b+c-a)(c+a-b)}{2abc}=\dfrac{(a+b+c)(a+b-c)(b+c-a)(c+a-b)}{2abc(a+b+c)}=\dfrac{8S^2}{abc(a+b+c)}=\dfrac{\dfrac{S}{s}}{\dfrac{abc}{4S}}=\dfrac{r}{R}$
$S=\sqrt{s(s-a)(s-b)(s-c)},s=\dfrac{a+b+c}{2}$
Using this, $$\cos A+\cos B+\cos C-1=4\sin\frac A2\sin\frac B2\sin\frac C2$$
Now from this
or using cosine formula & $\displaystyle\cos A=1-2\sin^2\dfrac A2\implies\sin\frac A2=+\sqrt{\frac{1-\cos A}2}$ as $\displaystyle0<\frac A2<\frac\pi2$
$\displaystyle\sin\frac A2=\sqrt{\frac{(s-b)(s-c)}{bc}}$ where $2s=a+b+c$
$$\implies4\sin\frac A2\sin\frac B2\sin\frac C2=4\frac{(s-a)(s-b)(s-c)}{abc}$$
Now, $\displaystyle\triangle =\frac12ab\sin C=\frac{abc}{4R}=\sqrt{s(s-a)(s-b)(s-c)}=r\cdot s$
This is corollary of Carnot theorem, which is stated that $d(O,BC)+d(O,CA)+d(O,AB)=R+r$. Let $M,N,P$ be the midpoints of $BC,CA,AB$. Then $\cos A+ \cos B+\cos C=\dfrac{OM+ON+OP}{R}=\dfrac{R+r}{R}=1+\dfrac{r}{R}.$