## The Diameter of a Log

This is an article about finding the diameter of a log – log as in “trunk of a tree in the horizontal position”.  Sorry to all mathematicians who were intrigued by the idea of the diameter of a logarithm.  At any rate I was over at IT consulting with Roger Linhart about Microsoft Onenote, when we got to discussing the good old days – we were both programmers at one time.  Roger, who had worked for a lumber company, built the electronics for a log sorter which moved logs to different chainways depending on their diameters.  Here is a diagram of the system he was using to size the logs.

Log Diameter Sensor - Schematic Diagram

The log moves under the light and a shadow sensor transmits the length of the shadow.  Disregarding the existence of non-circular logs and other intrusions from reality, the problem was to find the diameter of the log given the height of the light source, a fixed value, and the length of the shadow.  It can be solved in various ways but in all the cases that I will consider,  it reduces to finding the radius of a circle inscribed in an isosceles triangle of known height and half-base as in this diagram.

Diagram – Find the Radius of an Inscribed Circle in an Isosceles Triangle

The easiest way to do this is to use similar right triangles and the Pythagorean theorem as in the following diagram and argument.

Find the Radius using Similar Right Triangles
Find the Radius using Basic Geometry

The radius of the inscribed circle is $\frac{a(\sqrt{a^2+h^2}-a)}{h}$.  If I were writing the software I would just use a table of $r$ versus $a$ values for what I imagine are around 40 possible values for $a$.  This would avoid the real-time calculation of a square root.

It is possible to apply  increasingly sophisticated tools to solve the problem.  Here is a solution using trigonometry.

Finding the Radius of an Inscribed Circle using Trigonometry

Introducing an angle into the diagram allows one to set up a simply stated equation.   However we have to know the half-angle tangent formula.   Since triangle trigonometry is based on similar triangles, the Pythagorean theorem and a bunch of definitions anyway, why not just use the basic geometric concepts to solve the problem as in the first solution.

A solution can also be found using analytic geometry.

Find the Radius of the Inscribed Circle using Analytic Geometry

A solution can also be found using Lagrange multipliers.  Here we imagine a circle with shrinking radius with center along the y-axis and tangent to the x-axis.  We minimize the radius subject to the restriction that at least one point of the circle must like on the line.

Diminish the Radius Until Tangent to the Edge of the Triangle

Find the Radius of the Inscribed Circle using Lagrange Multipliers

I think the point of all this is that more you know the more you will tend to make a problem solution more complicated.   I have seen this with practicing engineers and with my students.  For instance calculus students  think that they need to use derivatives to solve all optimization problems.  I have seen an engineer  use a curve-fitting program instead of just noticing a simple linear relationship from first principles.  A good problem solving habit is to start with the basics and work up from there.