Saturday, 13 December 2025

Pi and Pythagoras

Figure 1 shows a screenshot of a tweet from Cliff Pickover illustrating a surprising connection between the most famous 3 : 4 : 5 Pythagorean triangle and \(\pi\).

Figure 1

I asked Gemini to explain this as I was too lazy to think it through (it was too early in the day for me). It's first proof was algebraic and went like this:

Explanation Provided By Gemini

To understand why the area of the incircle is $\pi$, we simply need to prove that the radius of that circle is exactly 1Since the area of a circle is calculated as $A = \pi r^2$, if $r=1$, the area is $\pi (1)^2 = \pi$Here is the step-by-step breakdown of why the radius works out to be exactly 1 for a 3-4-5 triangle.

1. Find the Area of the Triangle


First, we calculate the area of the triangle itself. Since a 3-4-5 triangle is a right-angled triangle (because $3^2 + 4^2 = 5^2$), we can use the two legs (3 and 4) as the base and height.
$$ \begin{align} \text{Area } &= \frac{1}{2} \times \text{base} \times \text{height} \\ \text{Area } &= \frac{1}{2} \times 3 \times 4 = \mathbf{6} \end{align} $$

2. Find the Semi-perimeter ($s$)


The semi-perimeter is half of the total perimeter of the triangle.

$$s = \frac{3 + 4 + 5}{2} = \frac{12}{2} = \mathbf{6}$$

3. Calculate the Inradius ($r$)


There is a standard geometric formula connecting the Area of a triangle ($A$), its semi-perimeter ($s$), and the radius of its inscribed circle ($r$):

$$A = r \cdot s$$

We substitute the values we found in steps 1 and 2:

$$6 = r \cdot 6$$

Solving for $r$:

$$r = 1$$


Figure 2


Alternative Visual Proof (The "Tangent" Method)


You can also visualize this without using the area formula (see Figure 2).

  1. The Square in the Corner: In a right-angled triangle, the incircle creates a perfect square at the 90-degree corner. The sides of this square correspond to the radius $r$.

  2. Tangent Lengths: The distance from a triangle vertex to the point where the circle touches the side is equal on both sides of the corner.

  3. The Calculation:

    • The leg of length 3 is made of the radius $r$ and a remaining segment $(3-r)$.

    • The leg of length 4 is made of the radius $r$ and a remaining segment $(4-r)$.

    • The hypotenuse (length 5) is composed of these two remaining segments connected together.

Therefore:

$$(3 - r) + (4 - r) = 5$$
$$7 - 2r = 5$$
$$2r = 2$$
$$r = \mathbf{1}$$

Conclusion


Since the radius ($r$) is 1, the area of the incircle is:

$$ \text{Area } = \pi r^2 = \pi (1)^2 = \mathbf{\pi}$$

Would you like to know if there are other Pythagorean triples (like 5-12-13) that result in integer radii?

Yes. In fact, there is a fascinating rule in geometry: Every single Pythagorean triangle (where sides are integers) has an incircle with an integer radius.

So, the 3-4-5 triangle isn't a lucky exception—it is just the first in an infinite series.

The Shortcut Formula


You don't need to calculate the full area and semi-perimeter every time. As we saw in the "Tangent Method" previously, for any right-angled triangle with legs $a, b$ and hypotenuse $c$, the radius $r$ is simply:

$$r = \frac{a + b - c}{2}$$

Because of how Pythagorean triples work (number theory), the top number $(a + b - c)$ is always an even number, meaning $r$ is always a clean integer.

Common Examples


Here are a few famous Pythagorean triples and their incircle areas.

Triangle (a,b,c)Calculation 2a+b−c​Radius (r)Incircle Area (Ï€r2)
3 - 4 - 5$(3+4-5)/2$1$\mathbf{1\pi}$
5 - 12 - 13$(5+12-13)/2$2$\mathbf{4\pi}$
8 - 15 - 17$(8+15-17)/2$3$\mathbf{9\pi}$
7 - 24 - 25$(7+24-25)/2$3$\mathbf{9\pi}$
20 - 21 - 29$(20+21-29)/2$6$\mathbf{36\pi}$

Why is the radius always an integer?


For the radius to be an integer, the numerator $(a + b - c)$ must be divisible by 2.

In any primitive Pythagorean triple:

  1. One leg is always odd.

  2. The other leg is always even.

  3. The hypotenuse is always odd.

If you add an Odd + Even number, you get an Odd number.

If you then subtract the Odd hypotenuse, you get an Even number.

Since an even number divided by 2 is always an integer, the radius is always an integer.


Now back to me. What's great about Gemini is that the LaTeX formatting is built into the response which saves a great deal in time and effort to get things looking good. It's also made me realise that the $ is for easier to use for inline formatting than the \( that I've been using previously. I'm thinking of transitioning but first I thought I'd consult Gemini. It provided a comprehensive response and I was surprised about what was said about display format.

Is there any advantage or disadvantage to using "\)" versus "$" in LaTeX for inline formatting?

For most users, this is a choice between theoretical correctness (using \( \)) and practical convenience (using $).

While \( \) is technically the "official" LaTeX standard, the vast majority of LaTeX users—including experts—still use $ because it is faster to type and easier to read in the source code.

Here is the breakdown of the advantages and disadvantages.

Quick Comparison

Feature\( ... \) (LaTeX Standard)$ ... $ (TeX Primitive)
TypingSlower (2 keys: \ + ()Faster (1 key: $)
Error MessagesClearer (specific errors)Cryptic ("Missing $ inserted")
ParsingClear start/end delimitersAmbiguous start/end
ReadabilityCluttered in source codeCleaner in source code
RecommendationBest for macros & strictnessBest for manual editing

Deep Dive: Why use \( ... \)?

The \( ... \) syntax is a LaTeX wrapper around the primitive $. It adds a layer of logic that provides two main benefits:

1. Better Error Reporting

Because \( and \) are distinct commands for "start" and "end," LaTeX can tell you exactly what went wrong.

  • Scenario: You accidentally forget to close a math environment.

  • $ Result: LaTeX gets confused until it hits the next dollar sign later in the document, often breaking the rest of your text with a confusing Missing $ inserted error.

  • \( Result: LaTeX checks if you are already in math mode. If you try to open math mode when you are already inside it (or close it when you aren't in it), it stops immediately and gives you a LaTeX Error: Bad math environment delimiter.

2. Programmability & Search

  • Regex: It is much easier to search and replace math in your code using Regular Expressions because the start \( and end \) are different. With $, it is difficult for a script to tell if a specific $ marks the beginning or the end of a formula.

  • Macros: If you are writing your own packages or complex macros, \( \) is safer because it explicitly defines the boundary.


Deep Dive: Why use $ ... $?

Despite the advantages above, $ remains the dominant choice for one simple reason: ergonomics.

1. Source Code Readability

LaTeX source code can get messy. Adding backslashes and parentheses adds visual noise.

  • With $ : Let $x$ be a value such that $x > 0$. (Easy to scan)

  • With \(: Let \(x\) be a value such that \(x > 0\). (Harder to scan)

2. Muscle Memory

Pressing Shift+4 (on US keyboards) is significantly faster than typing \, Shift+9. Over the course of a long paper with hundreds of inline variables, this friction adds up.


Important Note: Display Math is Different

While $ vs \( is mostly a matter of preference, the rule for display math (equations on their own line) is much stricter.

You should always use \[ ... \] and never use $$...$$.

  • $$ is a plain TeX command that modifies vertical spacing in ways that are inconsistent with LaTeX style standards (especially the fleqn option).

  • \[ is the correct LaTeX command that handles spacing and checks properly.

Summary

  • For Inline Math: Use $ if you prefer speed and readability. Use \( if you want better error checking or are processing your files with external scripts.

  • For Display Math: Always use \[ ... \].

No comments:

Post a Comment