Two Circles inside a right angle!

The other day I was playing with Ms Paint drawing circles here and there -I coincidentally drew a circle inside a right angled triangle which I already drew . Strangely A problem struck to my mind and I tried solving it , but I was unable to do so . I put forward the statement of the problem which I managed to frame my self

Problem : The legs of a right angled triangle are of length $a$ and $b$ . Two circles with equal radii are drawn such such that they touch each other and sides of the triangle as shown in the figure . Find the radius of the circle in terms of $a$ and $b$.

Figure - Of course my MS Paint one -

Further Scope- Is there any way to generalize this for other shapes or for any other triangle?

-------EDIT---------------------

Now to make things interesting : Say we have a right angled triangle which is given . Then is there a method by which we can construct those two circles with a straightedge and a compass?

-
Perhaps this topic may be useful? mathworld.wolfram.com/Excircles.html –  Erik Miehling Mar 22 at 6:25
@ErikMiehling thanks but it isn't helping much! –  Shivam Patel Mar 22 at 6:39
@ShivamPatel Can you give an example of a generalization? I don't really know "right pentagons" and "right hexagons". –  DanielV Mar 22 at 6:51
Or perhaps a generalization to multidimensional right triangles and hyperspheres would be meaningful? –  DanielV Mar 22 at 7:03
Straightedge and compass construction: draw an arbitrary circle with center $C$ that intersects the legs $AC, BC$ at $D, E$, respectively. Locate $F$ on $AC$ such that $CF = 3CA$. Locate $G$ such that $ECFG$ is a rectangle. Draw $CG$. Draw the angle bisector of $A$. The intersection of this angle bisector with $CG$ is the center of one of the two circles. –  heropup Mar 23 at 3:44

Writing $a := |BC|$, $b := |CA|$, $c := |AB| = \sqrt{a^2+b^2}$, and $r = |PE| = |PF|$ (so that $|PD| = 3r$), we have \begin{align} |\triangle ABC| &= |\triangle ABP| + |\triangle BCP| + |\triangle CAP| \\[4pt] \implies \qquad \frac{1}{2} |BC||CA| &= \frac{1}{2} \left(\; |AB| |PF| + |BC||PD| + |CA||PE| \;\right) \\[4pt] \implies \qquad a b &= c r + 3 a r + b r = r ( 3 a + b + c )\\[6pt] \implies \qquad r &= \frac{ab}{3 a + b + c} = \frac{ab}{3 a + b + \sqrt{a^2+b^2}} \end{align}

To address @DanielV's suggestion of generalizing to higher dimensions, consider a right-corner tetrahedron $OABC$, with right corner at $O$ and edge lengths $a := |OA|$, $b := |OB|$, $c := |OC|$. (Note that I'm changing notation slightly from the above.) Let a sphere with center $P$ and radius $r$ be tangent to the faces around vertex $A$, and let a congruent sphere (tangent to the first) be tangent to the faces around vertex $O$. Then $P$ has distance $r$ from faces $\triangle OAB$, $\triangle OCA$, $\triangle ABC$ (the ones touching $A$), and distance $3r$ from face $\triangle OBC$ (the one opposite $A$).

Here's a poor attempt at a diagram:

(In this case, the altitudes from $P$ are color-coded to match their parallel counterparts through $O$. The black altitude is to face $\triangle ABC$.)

Thus,

\begin{align} |OABC| &= |OABP| + |OBCP| + |OCAP| + |ABCP| \\[4pt] \implies \qquad \frac{1}{6}a b c &= \frac{1}{3}\left(\; r\;|\triangle OAB| + r \;|\triangle OCA| + r\;|\triangle ABC| + 3r\;|\triangle OBC| \;\right) \\[4pt] &= \frac{1}{3}r \cdot \frac{1}{2} \left(\; a b + c a + 3 b c + 2\;|\triangle ABC| \;\right) \\[6pt] \implies \qquad r &= \frac{abc}{3bc + ab + ca + 2\;|\triangle ABC|} \qquad (\star) \end{align}

Fun fact: The Pythagorean Theorem for Right-Corner Tetrahedra says that $$|\triangle ABC|^2 = |\triangle OBC|^2 + |\triangle OCA|^2 + |\triangle OAB|^2$$ so that we have $$|\triangle ABC| = \frac{1}{2} \sqrt{\; b^2 c^2 + c^2 a^2 + a^2 b^2 \;}$$ and $(\star)$ becomes $$r = \frac{abc}{3bc + ab + ca + \sqrt{\; b^2 c^2 + c^2 a^2 + a^2 b^2 \;}}$$

In $4$-dimensional space (where there's an analogous Pythagorean Theorem, as there is in any-dimensional space), we have $$r = \frac{abcd}{3bcd + acd + abd + abc + \sqrt{\;b^2 c^2 d^2 + a^2 c^2 d^2 + a^2 b^2 d^2 + a^2 b^2 c^2\;}}$$ and so forth.

Incidentally, the matching-notation version of the initial answer is $$r = \frac{ab}{3b + a + \sqrt{\;b^2 + a^2\;}}$$

-
@qwr: Thanks. :) As for coloring: I just like to highlight the association of a vertex with its opposite edge in a triangle, and other elements get their colors accordingly. I chose not to color-code the altitudes dropped from $P$ to the edges (I had reflexively done so in a "draft" image), in order to tie the congruent segments together visually. –  Blue Mar 22 at 8:00
@mathh: I use GeoGebra for my figures these days. –  Blue Mar 22 at 12:02
@AJP: "$|BC|$" represents the length of segment $\overline{BC}$. (I often leave out the over-bar to save typing.) By analogy, I use "$|\triangle ABC|$" for the area of $\triangle ABC$ (and then "$|OABC|$" for the volume of tetrahedron $OABC$, etc); this is non-standard, but I like it. :) The symbol ":=" indicates "is defined to be"; writing "$a:=|BC|$" says "I'm going to write '$a$' for '$|BC|$'". Others (even I) might otherwise write "let $a = |BC|$", but using ":=" is ever-so-slightly better, as it distinguishes definition "'$a$' means '$|BC|$'" from relation "$a$ equals $|BC|$". –  Blue Mar 22 at 13:10
@ShivamPatel: I added a figure that may (or may not) help with the $3d$ case. Just don't ask me for the $4d$ version. :) –  Blue Mar 22 at 14:46
@mathh: In GeoGebra, you can easily mark an angle with an arc via the "Angle" tool; if the sides of the angle happen to be perpendicular, GeoGebra turns the arc into a box. (There's a setting somewhere to turn that behavior off and on.) The little dashes are somewhat less convenient: with the segment selected, you have to open the "Object Properties..." panel and then the "Decoration" tab. (You can likewise "decorate" angles with little dashes and such.) –  Blue Mar 22 at 15:28

Assuming the corner of the triangle is the origin of a Cartesian plane, the line of the hypotenuse is $$y = -\frac{a}{b} x + a$$

The center of the second circle is at $\begin{bmatrix} 3r \\ r \end{bmatrix}$.

The radius of the second circle is the directed vector $\begin{bmatrix} ra \\ rb \end{bmatrix}\frac{1}{\sqrt{a^2 + b^2}}$.

Altogether :

$$\frac{rb}{\sqrt{a^2 + b^2}} + r = -\frac{a}{b}\left(3r + \frac{ra}{\sqrt{a^2 + b^2}}\right) + a$$

$$r = \frac{ab}{ 3a + b + \sqrt{a^2 + b^2}}$$

Since Blue showed an elegant volume based approach, I guess I'll try a multidimensional coordinate based approach. Suppose the origin $\begin{bmatrix} 0 \\ 0 \\ 0 \\ \vdots \end{bmatrix}$ and the points $\begin{bmatrix} \mathcal{l}_0\\ 0 \\ 0 \\ \vdots \end{bmatrix}$, $\begin{bmatrix} 0 \\ \mathcal{l}_1 \\ 0 \\ \vdots \end{bmatrix}$, $\begin{bmatrix} 0 \\ 0 \\ \mathcal{l}_2 \\\vdots \end{bmatrix}$ etc form a multidimensional right triangle. Suppose one hypersphere is tucked in at the origin and one hypersphere is tucked in at the corner along the first axis.

The hypotenuse plane of the triangle is $$\frac{x_0}{\mathcal{l}_0} + \frac{x_1}{\mathcal{l}_1} + \frac{x_2}{\mathcal{l}_2} + \dots = 1 \tag{Plane equation}$$

Or equivalently, using $\circ$ for dot product and $N = \begin{bmatrix} \frac{1}{\mathcal{l}_0} \\ \frac{1}{\mathcal{l}_1} \\ \frac{1}{\mathcal{l}_2} \\ \vdots \end{bmatrix}$, then the plane is: $$N \circ X = 1 \tag{Plane equation with dot product}$$

The center of the second hypershpere is $$c = \begin{bmatrix} 3r \\ r \\ r \\ \vdots\end{bmatrix} = rc_0 \tag{Center of second hypersphere}$$

The vector directed from the center of the second hypersphere to the hypotenuse plane is $$r_2 = r\frac{N}{|N|}\tag{Directed radius to hypotenuse}$$

Altogether: $$N \circ (c + r_2) = 1$$ $$N \circ \left(rc_0 + r\frac N {|N|}\right) = 1$$ \begin{align} r &= \frac{1}{N \circ c_0 + |N|} \\ &= \frac{1}{3l_0^{-1} + l_1^{-1} + l_2^{-1} \dots + \sqrt{l_0^{-2} + l_1^{-2} + l_2^{-2} \dots}} \end{align}

Note this is the same answer as Blue, but with $\mathcal{l}_0\mathcal{l}_1 \mathcal{l}_2 \dots$ factored out of the numerator and denominator.

-
+1. It's worth nothing that your multi-dimensional argument effectively re-derives the formula for the distance from point $P(p_0,p_1,\dots,p_n)$ to hyperplane $Q:\;q_0x_0+q_1x_1+\cdots+q_nx_n=q$; namely, $$\text{dist}(P,Q)=\frac{|\;p_0q_0+p_1q_1+\cdots+p_nq_n-q\;|}{\sqrt{\;q_0^2+ q_1^2 +\cdots+q_n^2\;}}$$ Replacing $p_0=3r$, $p_1=\cdots=p_n=r$, $q_i=l^{-1}_{i}$, and $q=1$, and then setting the computed distance equal to $r$, gives the equation you've solved for $r$. (Note: Dropping the formula's absolute value sign makes the distance negative here, since $P$ is on the "origin-side" of $Q$.) –  Blue Mar 22 at 22:29
Interesting how many different ways there can be to reach the same result. This is one reason I say that instead of memorizing formulas, students would appreciate mathematics more if they saw the "magic" of how many seemingly unrelated approaches give the same result in the end. –  DanielV Mar 22 at 23:38
@DanielV Can you look at the edit please... –  Shivam Patel Mar 23 at 3:24
@ShivamPatel Look at youtube.com/watch?v=CMP9a2J4Bqw espcially after 00:58 where it describes what is possible with a compass and straightedge. In short the answer is "yes", by applying what you see in the video to the formulas Blue and I gave you. ...But I doubt there is any short way to do it. Keep in mind that you effectively assume $a=1$ or $b=1$ since the units are arbitrary. –  DanielV Mar 23 at 3:37

Alternative solution:

Recall that for any triangle $\triangle ABC$, the area of the triangle equals the product of the inradius and its semiperimeter; i.e., $|\triangle ABC| = rs$, where $s = (a+b+c)/2$. Therefore, given legs $a, b$, $c = \sqrt{a^2+b^2}$, and $$r = \frac{2|\triangle ABC|}{a+b+c} = \frac{ab}{a+b+\sqrt{a^2+b^2}}.$$ Draw the tangent line to the two circles at their common point of tangency: this creates a smaller similar triangle with scaling factor $\frac{b-2\rho}{b}$ where $\rho$ is the common radius of the two circles. If $r$ is the inradius of $|\triangle ABC|$ as shown, then $$\frac{\rho}{r} = \frac{b - 2\rho}{b}.$$ Putting all of this together, we find $$\rho = \frac{br}{b+2r} = \frac{a b}{3a+b+c} = \frac{ab}{3a+b+\sqrt{a^2+b^2}}.$$ This method easily generalizes to more than two congruent circles tangent to one side: if $n$ circles are arranged along the leg of length $b$, then it is straightforward to find that $\rho = \frac{ab}{(2n-1)a + b + \sqrt{a^2+b^2}}$.

-

What about determining $a,b$ from $r$?
You can't - $a,b$ are not uniquely determined by $r$. Draw the two circles first, then draw the legs a and b as infinite lines. And line tangent to the right most circle will intersect lines A and B creating a right triangle, but for different tangents $a$ and $b$ will be different and r hasn't changed.
You can't even turn this into an interesting question by asking for all the possible ways to do it, because it turns out that these circles don't actually impose any restriction - since any angels can be achieved by the tangent line, any right triangle can. All $r$ does is create a scaling factor. $a$ can take on any value in $(2r,\infty)$ and $b$ the corresponding value in $(4r,\infty)$
suppose we say $a=kb$ for some fixed $k$ then? –  Shivam Patel Mar 22 at 6:46
I believe the question was to find the radius, given $a$ and $b$. –  N. Owad Mar 22 at 6:48