# 2006 iTest Problems/Problem U7

## Problem

Triangle $ABC$ has integer side lengths, including $BC = 696$, and a right angle, $\angle ABC$. Let $r$ and $s$ denote the inradius and semiperimeter of $ABC$ respectively. Find the perimeter of the triangle ABC which minimizes $\frac{s}{r}$.

## Solutions

### Solution 1 (credit to NikoIsLife)

Let $AB = x$ and $AC = y$. By the Pythagorean Theorem, $y^2 - x^2 = 696^2$, and applying difference of squares yields $(y-x)(y+x)=696^2$. Because $x$ and $y$ have the same parity (due to being integers), both $y+x$ and $y-x$ are even.

Let $y+x = 2b$ abd $y-x = 2a$; then $ab = 348^2$. Additionally, $$r = \frac{x+696-y}{2} = 348 - a$$ $$s = \frac{x+696+y}{2} = 348+b.$$ Therefore, \begin{align*} \frac{s}{r} &= \frac{348+b}{348-a} \\ &= \frac{348 + b}{348 - \frac{348^2}{b}} \\ &= \frac{b^2 + 348b}{348b - 348^2} \\ &= \frac{b}{348} + 2 + \frac{2 \cdot 348^2}{348b - 348^2} \\ &= \frac{b}{348} + 2 + \frac{696}{b-348}. \end{align*} Note that because $y > 696$, we must have $b > 696$. We can do some optimization by using the derivative -- if we let $f(b) = \frac{b}{348} + 2 + \frac{696}{b-348}$, then $$f'(b) = \frac{1}{348} + \frac{-696}{(b-348)^2},$$ which equals $0$ if $b = 348 + 348\sqrt{2} \approx 840.146$. Since $f'(b) < 0$ if $696 < b < 348+348\sqrt{2}$ and $f'(b) > 0$ if $b > 348 + 348\sqrt{2}$, we can confirm that $b = 348+348\sqrt{2}$ results in the absolute minimum of $\frac{s}{r}$. However, the case where $b = 348+348\sqrt{2}$ does not happen if $x, y$ are integers, and since $b$ is a factor of $348^2$, we need to test the largest factor of $348^2$ less than $348 + 348\sqrt{2}$ and the smallest factor of $348^2$ greater than $348 + 348\sqrt{2}$.

The largest factor of $348^2$ less than $348 + 348\sqrt{2}$ is $696$ (which does not work), and the smallest factor of $348^2$ greater than $348+348\sqrt{2}$ is $841$. Therefore, $b = 841$, which means that $a = 144$, $y = 985$, and $x = 697$. Our wanted perimeter is $696+697+985=\boxed{2378}$.

### Solution 2

As before, label the other leg $x$ and the hypotenuse $y$. Let the opposite angle to $x$ be $\theta$, and let $t:=\tan\frac{\theta}{2}$; let the area be $A$ and the semiperimeter $s$. Then we have $x = 696*\frac{2t}{1-t^2}, y = 696*\frac{1+t^2}{1-t^2}, A = 696^2*\frac{t}{1-t^2}, s = 696*\frac{1+t}{1-t^2} = 696*\frac{1}{1-t}$. This means that $\frac{s}{r} = \frac{s^2}{sr} = \frac{(\frac{1}{1-t})^2}{\frac{t}{1-t^2}} = \frac{1+t}{t(1-t)}$. By calculus, we know that this function is minimized at $t = \sqrt{2}-1$, which corresponds to $\theta = 45^\circ$ and $x = 696$; by geometry, we know that this function, expressed in terms of $\theta$, is symmetric around this point.

Then we proceed as before, searching for Diophantine solutions of $y^2 - x^2 = 696^2$ with $x$ closest to $696$, and we find that $x = 697, y = 985$ is the closest. (We can do so by noting that we would want $y - x \approx 696*(\sqrt{2}-1) = 288.29$.) Then the perimeter is $696+697+985=\boxed{2378}$ as before, and we are done.

~duck_master