# Extended General Malfatti's Problem
## 2 Problem Description and Algorithm to Solve Tri(T\({}_{n}\)) Problem
### Algebraic Analysis of the Problem  
We can approach [PERSON]'s problem (see Figure 1) in the following way:  
1. Let C\({}_{i}\) = (x\({}_{i}\),y\({}_{i}\),r\({}_{i}\)) represent a circle whose center and radius are (x\({}_{i}\),y\({}_{i}\)) and r\({}_{i}\), respectively; \(i\) = 1, 2, 3. L\({}_{1}\), L\({}_{2}\), L\({}_{3}\) are three lines for the triangle. Circle C\({}_{1}\) is tangent to lines L\({}_{2}\) and L\({}_{3}\). Circle C\({}_{2}\) is tangent to lines L\({}_{1}\) and L\({}_{3}\), and Circle C\({}_{3}\) is tangent to lines L\({}_{1}\) and, L\({}_{2}\). 2. Generate the equations for the \"circle/side\" tangency relation carefully. For example, circle C\({}_{3}\) is tangent to line L\({}_{1}\). The equation can be generated by computing the distance from (x\({}_{3}\),y\({}_{3}\)) to line L\({}_{1}\) is equal to r\({}_{3}\). The line equation we generate, ax + by + c = 0, has the properties that all points (x\({}_{i}\),y\({}_{i}\)) inside the triangle have the property that ax\({}_{i}\) + by\({}_{i}\) + c > 0, \(i\) = 1, 2, 3 (detailed explained below). Therefore, we generate six equations because every circle is tangent to two sides of the triangle. Note that the equations are degree-one equations. 3. Generate the equations for the \"circle/circle\" tangency relation. For example, circle C\({}_{1}\) is tangent to C\({}_{2}\). The equation can be generated by computing the distance between two centers, which is equal to the sum of their radii. There are three equations generated in this case. Note that when we want to eliminate the square root of the distance function, it becomes a degree-two polynomial. We generate six degree-one (details explained below) and three degree-two polynomials. It probably can be solved by a Computer Algebra package, such as Maple [5] or SymPy [6], in this case. However, When n increases, the number of equations grows quadratically. Using SymPy to implement the above approach, it is easy to solve the Tri(T\({}_{1}\)) problem because we generate three linear equations with three variables. However, when we go to the Tri(T\({}_{2}\)) problem, we generate six linear equations and three quadratic equations. The program runs for a long time without a solution or any error message. Therefore, we stop using a symbolic approach to solve the Tri(T\({}_{n}\)) problem when n > 1. Regarding how to generate the degree-one equation in step two, we use a directed line, or ray, to generate the equation. Let v\({}_{1}\) = (x\({}_{1}\),y\({}_{1}\)), v\({}_{2}\) = (x\({}_{2}\),y\({}_{2}\)), v\({}_{3}\) = (x\({}_{3}\),y\({}_{3}\)) be the vertices of the triangle, rotated counterclockwise. Consider the ray from v\({}_{1}\) to v\({}_{2}\), the equation for this ray is ax + by + c = 0, where a = y\({}_{1}\) - y\({}_{2}\), b = x\({}_{2}\) - x\({}_{1}\), c = x\({}_{1}\)y\({}_{2}\) - x\({}_{2}\)y\({}_{1}\). Using this formula, the ray from v\({}_{2}\) to v\({}_{1}\) will be \(-\)ax - by \(-\) c = 0. Furthermore, the points (x\({}_{3}\),y\({}_{3}\)) on the left part of the ray have the property ax\({}_{3}\) + by\({}_{3}\) + c > 0. Both rays from v\({}_{1}\) to v\({}_{2}\) and from v\({}_{2}\) to v\({}_{1}\) represent the same line. The equation for the constraint with the circle center (x\({}_{3}\),y\({}_{3}\)) and radius r\({}_{3}\), which is tangent to the ray ax + by + c=0, is ax\({}_{3}\) + by\({}_{3}\) + \(c\) - \(r_{3}\sqrt{a^{2}+b^{2}}\ =\ 0\). This is because a, b, c are real numbers; this is a degree-one equation with variables x\({}_{3}\), y\({}_{3}\), and r\({}_{3}\). In the Tri(T\({}_{n}\)) problem, we have 3T\({}_{n}\) variables. There are 3n equations generated by the \"circle/side\" tangency relation and the 3T\({}_{n-1}\) \"circle/circle\" tangency relation. If we want  
Figure 3: The tangency graph among circles and triangle edge. (**a**) Inside of the triangle, (**b**) With the triangle edge.