Counting the number of triangles inside $3-4-5-$triangle [Found in Arabic Math book: الرياضيات | هندسة الإحداثيات | الإحصاء]
Solution 1:
In order to take an accurate census of the number of triangles inhabiting the $3-4-5$ Pythagorean triangle--an ancient city with three walls, twelve gates, and thirty-five gate-to-gate streets, as can be seen from OP's illustration,--I found it necessary to reconstruct the city one street at a time and count the successive generations of inhabitants as they appear along each new street.
I. Although easy enough at first, the need for a method soon became apparent. In triangle $ABC$, with $AB$, $AC$, $CB$ divided at $D$, $E$, $F$, $G$, $H$, $I$, $J$, $K$, $L$, joining segments $AI$, $AJ$, $AK$, $AL$ in succession produces two, three, four, and five new triangles.
Next, joining $BG$, $BH$ produces twenty and twenty-five more triangles, which I determined by the following method. With $BH$ the last line drawn, first count the three new triangles having $BH$ for a side: $ABH$, $GBH$, $CBH$.
Then take $Q$, the point next most distant from $B$ and the intersection of $BH$ with $AI$. With those lines as analogous to axes in coordinate geometry, making quadrants $IQB$, $IQH$, $HQA$, $AQB$, count all triangles having the new point $Q$ for vertex, beginning with with the largest triangle in each quadrant and working inward toward $Q$. Thus in the first quadrant $IQB$ we have triangle $IQB$; in $IQH$, no triangle; in $HQA$, triangle $HQA$; in $AQB$, triangles $AQB$, $AQT$, $AQS$, $AQR$, $PQB$.
Next, around point $R$ as vertex, in quadrants $JRB$, $JRH$, $HRA$, $ARB$ we find triangle $JRB$ in the first quadrant, none in the second, $HRA$ in the third ($QRA$ has already been counted), and $ARB$, $ART$, $ARS$, $ORB$ in the fourth.
Similarly with $S$ as vertex we get triangles $KSB$; none; $HSA$ ($HRA$, $HQA$ have already been counted); and $ASB$, $AST$, $NSB$.
Finally with $T$ as vertex we have triangles $LTB$; none; $HTA$; and $ATB$, $MTB$.
Summing up the new triangles:$$3+7+6+5+4=25$$
II. When $CD$, $CE$, $CF$ have been joined, as in the next figure, three-line concurrencies appear at points $O$ and $S$. Taking $CF$, the last line drawn, note that any triangles within sectors $KSB$, $KSH$, $HSA$, $ASB$ were already counted when $BH$ was joined.
There is now, however, an octant of new sectors around $S$ to be examined for new triangles:$$CSB, CSK, CSH, CSA, BSF, KSF, HSF, ASF$$(There appear to be seventeen three-line concurrencies when all thirty-five lines have been drawn in triangle $ABC$, each requiring that we search for new triangles in eight sectors instead of four.)
As $CD$, $CE$, $CF$ are successively joined, I count thirty-five, forty-three, and forty-seven triangles generated. Thus with the original triangle, when all nine lines from vertices $A$, $B$, $C$, are joined in the above order, the number of triangles is$$1+2+3+4+5+20+25+35+43+47=185$$
Twenty-six lines remain to be joined.
III. The seven segments $GI$, $GJ$, $GK$, $GL$, $GF$, $GE$, $GD$ generate$$26+41+56+74+65+58+52=372$$new triangles, bringing the triangle population now to$$185+372=557$$Segment $GJ$ passes through $C'$, making a third three-line concurrency as seen in the next figure.
IV. The next seven segments $HI$, $HJ$, $HK$, $HL$, $HF$, $HE$, $HD$ generate$$24+43+70+102+133+139+148=659$$more triangles, bringing the count to $$557+659=1216$$Segment $HE$ brings in a fourth and fifth three-line concurrency, and $HD$ a sixth. I leave the figure unlettered except for the points of 3-line concurrency.
V. The remaining twelve segments$$DI, DJ, DK, DL, EI, EJ, EK, EL, FI, FJ, FK, FL$$make$$16, 12, 11, 8, 14, 12, 8, 4, 16, 12, 6, 2$$intersections, respectively, within triangle $ABC$, each intersection a center of four (or eight) sectors to be searched for additional triangles. By using, for each new line drawn, the method explained above, I count$$232+186+155+117+239+188+139+89+249+183+117+62=1956$$new triangles, for a total of$$1216+1956=3172$$within the $3-4-5$ triangle.
I have indicated the order in which I have drawn the lines, and the number of new triangles I found for each line. I could in more detail also give the number of new triangles for each intersection point on a given line, as well as for each of the four (or eight sectors) around that point, in order to compare notes with anyone interested in this search of the Pythagorean triangle. I think this is a reliable way to find the number of triangles in the $3-4-5$ triangle, and to guard against leaving out any triangle or counting any triangle twice. It's laborious, but I don't see how combinatorial theory alone can yield an answer; the seventeen three-line concurrencies affect the count, and they arise from the geometry of the case being considered. But to proceed by counting, intersection points must be labeled, and things get very crowded and confusing to the eye, since the number of intersections generally increases as more lines are drawn. I relied greatly on GeoGebra's capacity to zoom in, and even to temporarily hide labels when they get too crowded. The figure below shows seventeen points of three-line concurrency.