As Bubbler already noted in a comment, the final formula is
$$d=\frac{2ab}{a+b+c}$$
To derive that, I will use the following facts and properties.
- Triangle areas
If you shorten or lengthen one side of a triangle by moving one vertex directly towards or away from another, then the area of the triangle is changed by the same factor as the side length. This is obvious if you consider that side as the base, and the fact that the area is proportional to the base when the height is kept constant.
- In-radius
The radius $r$ of the in-circle of a triangle with area $A$ and perimeter $p$ is given by $r=\frac{2A}{p}$. This is because if you dissect the triangle by cutting from vertices to the circle centre then you get triangles of equal height $r$. This is the basis for many cake cutting puzzles similar to Piece of Cake for King Solomon.
- Rhombus
A rhombus can be split along its diagonal into two equal triangles. The area of a rhombus is equal to the height times its base.
Now let's put all this together:
Start with the rhombus. It's area is $2r\cdot d$ because the incircle touches the top and the base.
Halve it along the diagonal not involving vertex $C$. The half that is the triangle with vertex $C$ then has area $rd$.
Lengthen one side from length $d$ to length $a$, and the other side from length $d$ to length $b$. You now get the original triangle, and from fact #1 we know its area is $rd\cdot \frac{a}{d}\cdot \frac{b}{d} = \frac{rab}{d}$.
Substituting this area into the formula #2 for the inradius $r=\frac{2A}{p}$, we get $r=\frac{2rab}{dp}$ which simplifies to $d=\frac{2ab}{p}$.
sqrt((a+b+c)(a+b-c)(a-b+c)(-a+b+c))
, or even better,sin C
. $\endgroup$/
in the middle. $\endgroup$