# 1997 AIME Problems/Problem 13

## Problem

Let $S$ be the set of points in the Cartesian plane that satisfy

$\Big|\big||x|-2\big|-1\Big|+\Big|\big||y|-2\big|-1\Big|=1.$

If a model of $S$ were built from wire of negligible thickness, then the total length of wire required would be $a\sqrt{b}$, where $a$ and $b$ are positive integers and $b$ is not divisible by the square of any prime number. Find $a+b$.

## Solution

### Solution 1

This solution is non-rigorous.

Let $f(x) = \Big|\big||x|-2\big|-1\Big|$, $f(x) \ge 0$. Then $f(x) + f(y) = 1 \Longrightarrow f(x), f(y) \le 1 \Longrightarrow x, y \le 4$. We only have a $4\times 4$ area, so guessing points and graphing won't be too bad of an idea. Since $f(x) = f(-x)$, there's a symmetry about all four quadrants, so just consider the first quadrant. We now gather some points:

 $f(1) = 0$ $f(0.1) = 0.9$ $f(2) = 1$ $f(0.9) = 0.1$ $f(3) = 0$ $f(1.1) = 0.1$ $f(4) = 1$ $f(1.9) = 0.9$ $f(0.5) = 0.5$ $f(2.1) = 0.9$ $f(1.5) = 1.5$ $f(2.9) = 0.1$ $f(2.5) = 2.5$ $f(3.1) = 0.1$ $f(3.5) = 3.5$ $f(3.9) = 0.9$

We can now graph the pairs of coordinates which add up to $1$. Just using the first column of information gives us an interesting lattice pattern:

Plotting the remaining points and connecting lines, the graph looks like:

Calculating the lengths is now easy; each rectangle has sides of $\sqrt{2}, 3\sqrt{2}$, so the answer is $4(\sqrt{2} + 3\sqrt{2}) = 16\sqrt{2}$. For all four quadrants, this is $64\sqrt{2}$, and $a+b=\boxed{066}$.

### Solution 2

Since $0 \le \Big|\big||x| - 2\big| - 1\Big| \le 1$ and $0 \le \Big|\big||y| - 2\big| - 1\Big| \le 1$
$- 1 \le \big||x| - 2\big| - 1 \le 1$
$0 \le \big||x| - 2\big| \le 2$
$- 2 \le |x| - 2 \le 2$
$- 4 \le x \le 4$
Also $- 4 \le y \le 4$.

Define $f(a) = \Big|\big||a| - 2\big| - 1\Big|$.

• If $0 \le a \le 1$:
$f(3 + a) = \Big|\big||3 + a| - 2\big| - 1\Big| = a$
$f(3 - a) = \Big|\big||3 - a| - 2\big| - 1\Big| = a$
$f(3 + a) = f(3 - a)$
• If $0 \le a \le 2$:
$f(2 + a) = \Big|\big||2 + a| - 2\big| - 1\Big| = a - 1$
$f(2 - a) = \Big|\big||2 - a| - 2\big| - 1\Big| = a - 1$
$f(2 + a) = f(2 - a)$
• If $0 \le a \le 4$:
$f(a) = \Big|\big||a| - 2\big| - 1\Big| = a - 3$
$f( - a) = \Big|\big|| - a| - 2\big| - 1\Big| = a - 3$
$f(a) = f( - a)$
• So the graph of $y(x)$ at $3 \le x \le 4$ is symmetric to $y(x)$ at $2 \le x \le 3$ (reflected over the line x=3)
• And the graph of $y(x)$ at $2 \le x \le 4$ is symmetric to $y(x)$ at $0 \le x \le 2$ (reflected over the line x=2)
• And the graph of $y(x)$ at $0 \le x \le 4$ is symmetric to $y(x)$ at $- 4 \le x \le 0$ (reflected over the line x=0)

[this is also true for horizontal reflection, with $3 \le y \le 4$, etc]

So it is only necessary to find the length of the function at $3 \le x \le 4$ and $3 \le y \le 4$: $\Big|\big||x| - 2\big| - 1\Big| + \Big|\big||y| - 2\big| - 1\Big| = 1$
$x - 3 + y - 3 = 1$
$y = - x + 7$ (Length = $\sqrt {2}$)

This graph is reflected over the line y=3, the quantity of which is reflected over y=2,

the quantity of which is reflected over y=0,
the quantity of which is reflected over x=3,
the quantity of which is reflected over x=2,
the quantity of which is reflected over x=0..

So a total of $6$ doublings = $2^6$ = $64$, the total length = $64 \cdot \sqrt {2} = a\sqrt {b}$, and $a + b = 64 + 2 = \boxed{066}$.

### Solution 3 (FASTEST)

We make use of several consecutive substitutions. Let $||x| - 2|= x_1$ and similarly with $y$. Therefore, our graph is $|x_1 - 1| + |y_1 - 1| = 1$. This is a diamond with perimeter $4\sqrt{2}$. Now, we make use of the following fact for a function of two variables $x$ and $y$: Suppose we have $f(x, y) = c$. Then $f(|x|, |y|)$ is equal to the graph of $f(x, y)$ reflected across the y axis and x axis, and the reflection across the y axis across the x axis, therefore the perimeter of of $f(|x|, |y|)$ is 4 times the perimeter of $f(x, y)$. Now, we continue making substitutions at each absolute value sign ($|x| - 2 = x_2$ and finally $x = x_3$, similarly for y as well. ), noting that the constants don't matter as they just translate the graph and each absolute value sign increases the perimeter 4 times as much. Therefore, the length is $4^2 \times 4\sqrt{2} = 64\sqrt{2} = a\sqrt{b}$, and $a+b = \boxed{066}$.

- whatRthose

### Solution 4 (Exploiting intuitions about absolute value with linear functions)

In a similar manner to the other posted solutions, we want to find the length of just a piece of this monstrosity and then figure out what fraction of the entire function that piece represents. It is possible to go right for the smallest possible piece that'll help us by letting $a = \big||x|-2\big|-1$ and $b = \big||y|-2\big|-1$. We then get that $b = 1 - a$ (obviously the other way would work too). One specific "case" here is the one where all the numbers in the absolute value bars are positive, and thus where $b = 1 - x - 2 = -x - 1$. Since we're dealing with compounded absolute values, we can infer that the piece we just found has to be bounded by the two axes. Using the Pythagorean Theorem / distance formula, that tiny length comes out to be $\sqrt{2}$. Because we're working with linear terms only, the presence of each absolute value bar will double the length of the function at each step as we work backward to our original equation. As there are six absolute value bars to be added back in (three on each side), we find that there are $2^6$ of these pieces of length $\sqrt{2}$, making our answer $2 + 64 = \boxed{066}$.

~ anellipticcurveoverq