<s>[INST] Calculate the diagonal $d$ of three equal squares inscribed into a triangle whose sides $a$, $b$ and $c$ (and interior angles) are given We have a triangle, whose sides $a$, $b$ and $c$ (and interior angles $\alpha$, $\beta$ and $\gamma$) are given. Into this triangle three equally sized squares with a side length $r$ and a diagonal $d$ are inscribed as shown by the figure below.
I am searching for a formula depending on the triangle's properties ($a$, $b$, $c$, $\alpha$, $\beta$, $\gamma$) that calculates $d$.
A few basic thoughts about angular relationships have come to my mind:

*

*$360=2\cdot90+\beta+\frac{\gamma'}{2}+90+\frac{\alpha'}{2}=2\cdot90+\gamma+\frac{\alpha'}{2}+90+\frac{\beta'}{2}=2\cdot90+\alpha+\frac{\beta'}{2}+90+\frac{\gamma'}{2}$

*$90=\alpha+\frac{\beta'}{2}+\frac{\gamma'}{2}=\beta+\frac{\gamma'}{2}+\frac{\alpha'}{2}=\gamma+\frac{\alpha'}{2}+\frac{\beta'}{2}$

*$180=2\alpha+\beta'+\gamma'=2\beta+\gamma'+\alpha'=2\gamma+\alpha'+\beta'$
and

*

*$\alpha'+\beta'+\gamma'=90$

*$\alpha+\beta+\gamma=180$
I decompose the triangle sides as follows (see the illustration below):

*

*$c=c_a+c'+c_b$

*$a=a_b+a'+a_c$

*$b=b_c+b'+b_a$
Diagonal and side length of the three (equally sized) squares satisfy $d=r\sqrt{2}$.
Maybe using trigonometric relationships we can deduce an elegant formula that yields $d$ directly when inputting the triangle's parameters.

I kept trying yesterday and attached my sketches here: PDF
 [/INST] To establish the existence of such a construct and also find a way towards a solution it is useful to consider the inverse construction, starting from a central point $M$, and drawing three squares around it, with angles between the adjacent edges of adjacent squares being $\delta, \epsilon,\zeta$ and the length of the square being $r$. It is easy to see that a triangle with non-zero angles can always be constructed from that configuration, since there are always 3 pairs of adjacent vertices that can be joined by lines. These lines cannot be parallel to one another since $\delta+\epsilon+\zeta=\pi/2$, and therefore the triangles are always non-trivial when the angles are positive.
Now it is easy business to find the properties of the triangle $(a,b,c,\alpha, \beta,\gamma)$, especially the angles. Consider the triangle defined by the line segments $a_1,b_3$ and their endpoints. As noted in the drawing, the three angles are $(\pi/4+\delta/2, \pi/4+\epsilon/2, \gamma)$ and two of them are known, so the third can be computed easily.  Then we find consider the other two triangles as well that
$$\gamma=\pi/4+\zeta/2~~,~~\beta=\pi/4+\epsilon/2~~,~~\alpha=\pi/4+\delta/2$$
Now to determine the lengths $a_2,b_2,c_2$ apply the cosine law in the isosceles triangles defined by $(a_2, M)$, $(b_2, M)$, $(c_2, M)$ respectively to obtain
$$a_2=2r\sin\frac{\delta}{2}~~,~~b_2=2r\sin\frac{\epsilon}{2}~~,~~c_2=2r\sin\frac{\zeta}{2}$$
For all other lengths apply the sine law to the triangles defined by $(a_3, c_1), (a_1, b_3), (b_1, c_3)$ and solve to get
$$\begin{align}&a_1=\frac{\sin\left(\frac{\pi}{4}+\frac{\epsilon}{2}\right)}{\sin\left(\frac{\pi}{4}+\frac{\zeta}{2}\right)}r\sqrt{2}~~,~~ a_3=\frac{\sin\left(\frac{\pi}{4}+\frac{\zeta}{2}\right)}{\sin\left(\frac{\pi}{4}+\frac{\epsilon}{2}\right)}r\sqrt{2}\\ &b_1=\frac{\sin\left(\frac{\pi}{4}+\frac{\zeta}{2}\right)}{\sin\left(\frac{\pi}{4}+\frac{\delta}{2}\right)}r\sqrt{2}~~,~~ b_3=\frac{\sin\left(\frac{\pi}{4}+\frac{\delta}{2}\right)}{\sin\left(\frac{\pi}{4}+\frac{\zeta}{2}\right)}r\sqrt{2}\\ &c_1=\frac{\sin\left(\frac{\pi}{4}+\frac{\delta}{2}\right)}{\sin\left(\frac{\pi}{4}+\frac{\epsilon}{2}\right)}r\sqrt{2}~~,~~ c_3=\frac{\sin\left(\frac{\pi}{4}+\frac{\epsilon}{2}\right)}{\sin\left(\frac{\pi}{4}+\frac{\delta}{2}\right)}r\sqrt{2}\end{align}$$
Notably, $a_1a_3=b_1b_3=c_1c_3=2r^2$ (maybe this can be derived using power theorems). Finally putting everything together we get
$$a=r\left(2\sin\frac{\delta}{2}+\frac{\sin\left(\frac{\pi}{4}+\frac{\epsilon}{2}\right)}{\sin\left(\frac{\pi}{4}+\frac{\zeta}{2}\right)}\sqrt{2}+\frac{\sin\left(\frac{\pi}{4}+\frac{\zeta}{2}\right)}{\sin\left(\frac{\pi}{4}+\frac{\epsilon}{2}\right)}\sqrt{2}\right)$$
$$b=r\left(2\sin\frac{\epsilon}{2}+\frac{\sin\left(\frac{\pi}{4}+\frac{\zeta}{2}\right)}{\sin\left(\frac{\pi}{4}+\frac{\delta}{2}\right)}\sqrt{2}+\frac{\sin\left(\frac{\pi}{4}+\frac{\delta}{2}\right)}{\sin\left(\frac{\pi}{4}+\frac{\zeta}{2}\right)}\sqrt{2}\right)$$
$$c=r\left(2\sin\frac{\zeta}{2}+\frac{\sin\left(\frac{\pi}{4}+\frac{\epsilon}{2}\right)}{\sin\left(\frac{\pi}{4}+\frac{\delta}{2}\right)}\sqrt{2}+\frac{\sin\left(\frac{\pi}{4}+\frac{\delta}{2}\right)}{\sin\left(\frac{\pi}{4}+\frac{\epsilon}{2}\right)}\sqrt{2}\right)$$
In the case that the lengths of the triangle $(a,b,c)$ are known instead, one can easily find the angles $(\alpha, \beta, \gamma)$ since they are known to be acute
$$\alpha=\text{arccos}\left(\frac{b^2+c^2-a^2}{2bc}\right)$$
$$\beta=\text{arccos}\left(\frac{c^2+a^2-b^2}{2ac}\right)$$
$$\gamma=\text{arccos}\left(\frac{b^2+a^2-c^2}{2ab}\right)$$
and thus compute $\delta, \epsilon, \zeta$ and then solve for $r$ or $d$. For example
$$d=\frac{a}{\sin\alpha-\cos\alpha+\frac{\sin^2\beta+\sin^2\gamma}{\sin\beta\sin\gamma}}$$
The final formula for the diagonal can be expressed in terms of the lengths explicitly but due to lack of elegance I will avoid writing it down.
Importantly, note that not all triangle side lengths are admissible! Clearly $\alpha,\beta, \gamma \in [\pi/4,\pi/2]$ and that imposes various constraints on the possible values of $a,b,c$. These can be expressed as
$$0\leq b^2+c^2-a^2\leq \sqrt{2}bc$$
plus cyclic permutations of the above relation.

</s>