# A right triangle optimization problem

James Tanton asked in a tweet a few days ago: “If a,b,c are the sides of a right triangle with hypotenuse c, what is the largest possible value of a/c + b/c?”

The answer is the square root of 2. But how to see this?

Well, without loss of generality we can assume c = 1. So we want to know, if a and b are the sides of a right triangle with hypotenuse 1, what is the largest possible value of a + b?

Now a and b are, respectively, cos θ and sin θ for some acute angle θ… so we want to maximize $\sin \theta + \cos \theta$ over acute angles $\theta$. But how? Differentiate? That sounds like work.

Take a look at the picture below. Imagine moving the upper right corner of the (black) right triangle along the (black) circular arc; we’re looking for the point where the sum of the lengths of the legs is maximized. But now say we can move the upper right corner of the right triangle wherever we want it. As long as we stay along one of those red lines — which have slope -1, i. e. make a 45-degree angle with each axis, the sum of the leg lengths stays constant! As we move the upper right corner along the circular arc, the sum of the leg lengths is maximized when it’s locally constant — that is, when the circle is tangent to one of those lines. The red lines make a 45-degree angle with the coordinate axes; the optimal hypotenuse will be perpendicular to them, also making a 45-degree angle with the coordinate axes. The optimal right triangle is the one with 45-degree angles… so if its hypotenuse is 1, its legs are each $1/\sqrt{2}$, and their sum $\sqrt{2}$. (This is not the triangle in the plot — the triangle in the plot is in the 3-4-5 ratio. The sum of its legs is 1.4, not much short of optimality.)

This is, secretly, the principle behind using Lagrange multipliers to maximize a function subject to a constraint. It’s also much easier to see than to explain.

## 6 thoughts on “A right triangle optimization problem”

1. Pseudonym says:

Even simpler, this is a result of a classical inequality. Like the famous arithmetic mean/geometric mean inequality, there is the slightly less famous arithmetic mean/root mean square inequality.

If a and b are greater than or equal to zero, then the arithmetic mean of a and b is less than or equal to the root-mean-square of a and b, with equality if and only if a=b.

That is:

(a+b)/2 ≤ √[(a² + b²) / 2]
⇔ a+b ≤ √2 √(a²+b²)

However a²+b²=1. Therefore a+b≤√2, with equality if and only if a=b. The result trivially follows.

2. Yemon Choi says:

Another approach with trig functions, which I’m sure you know but which some readers might find of mild interest: $\cos(\theta)+ \sin(\theta) = \sqrt{2}\sin(\theta+ \pi/4)$
maximized when $latex\theta=\pi/4$.

Of course this doesn’t have the geometric intuition and the links to more general optimization approaches as explained in your post, but it is a “cookbook trick” for certain problems which avoids the need to differentiate. I sometimes use this to do calculations with 2 by 2 normal matrices in linear algebra classes (before showing them that the largest eigenvalue coincides with the operator norm, etc).

3. lkafle says:

Reblogged this on lava kafle kathmandu nepal.

4. Joni says:

Instead of maximizing $\cos \theta + \sin \theta$, you can maximize its square, which is $1 + \sin 2\theta$. The maximum of this is 2, obtained with \theta = \pi/4, so the maximum of $\cos \theta + \sin \theta$ is $\sqrt{2}$.

5. Engywuck says:

this seems to be one example where the graphical method is more work than differntiating. You not only need to draw the circle but also know that you have to draw the red lines and that the total length stays the same when on them.

Where differentiating and using extremum rules yields to $cos(\theta)-sin(\theta)=0$ which means that the sine and the cosine of the angle have to be the same, and that can in the region 0..90° only be fulfilled for $\theta$=45°, where $cos(45°)=sin(45°)=1/2*sqrt(2)$ and so the sum is $sqrt(2)$
(Of course you’d have to show that this is not the minimum and the second differentiation is not 0 but in this case its obvious and not too hard to add ;-))

6. Marko says:

I suggest another nice problem

a)For a triangle ABC inscribed in a circle(O,r), find the greatest possible area of ABC in terms of r

b)For a circle(O,r) inscribed in a triangle ABC, find the least possible area of ABC in terms of r