Thinking outside the box - How I solved problems in math competitions

What is the minimum of $(x-4\cos y)^2 + (3\sqrt{x} -2\sin y + 5)^2$? To solve this problem within 1 minute, you need to think outside the box!

When I was in high school (Affiliated High School of National Taiwan Normal University, HSNU), I was fortunate to get selected as one of the members on the school math team. During my training, one of my favorite topics is solving maximum/minimum problems because it could involve a lot of creative skills. Back then, there was once when we were asked to solve the following problem within just 1 minute.

Problem 1: What is the minimum of $(x-4\cos y)^2 + (3\sqrt{x} -2\sin y + 5)^2$ with $x, y \in \mathbb{R}$?

If you know calculus, this problem is probably not hard for you at all - one could just equate the partial derivatives of the function to 0, solve the critical points, perform a second derivative test, substitute the root(s) back to the function, and then boom, the job is done!

However, we only had 1 minute to solve the problem! 😬 Although I was sure that my coach would still be impressed if I was able to carry out all the steps above in just 1 minute - as a high school junior, I knew we were not trained for speed, but thinking processes. With this in mind, I took an non-conventional route. Without even taking my pen, I solved the problem within 1 minute.

So how can we approach this problem? Well, if we put the whole function (let’s call it $f(x, y)$) inside a square root: $\sqrt{(x-4\cos y)^2 + (3\sqrt{x} -2\sin y + 5)^2}$, it looks just like the distance formula in the 2D Cartesian coordinate system! Specifically, $\sqrt{f(x, y)}$ is the expression of the distance between to moving points $(x, 3\sqrt{x} + 5)$ and $(4\cos{y}, 2\sin{y})$. With $x$ and $y$ being any real numbers, the first moving point traces out a square root function $y=3\sqrt{x}+5$, while the trajectory of the other moving point is an ellipse (major axis: 8, minor axis: 4) $(\frac{x}{4})^2 + (\frac{y}{2})^2=1$ Therefore, the original problem is completely equivalent to the following problem:

Point A is on $y=3\sqrt{x}+5$. Point B is on $(\frac{x}{4})^2 + (\frac{y}{2})^2=1$. What is the minimal distance between points A and B?

And if you visualize these two functions (Figure 1A), you’ll easily know that the minimal distance between the two functions is 3, so the answer to the original problem is 9!

Figure 1. (A) The functions between which we want to calculate the minimal distance in Problem 1, with the blue one being $(\frac{x}{4})^2 + (\frac{y}{2})^2=1$ and the orange one being $y=3\sqrt{x}+5$. (B) The functions between which we want to calculate the minimal distance in Problem 2, with the blue one being $f(x)$ and the orange one being $g(x)$.

This kind of problem can be generalized with arbitrarily complicated functions. Here is another one that looks a little bit more daunting:

Problem 2: What is the minimum of $(x- y)^2 + (|x-2\lfloor \frac{x+1}{2} \rfloor | - \sqrt{y-\lfloor y \rfloor} - 3)^2$ with $x, y \in \mathbb{R}$?

With the floor functions involved, now this problem is not straightforward even with calculus, so the trick we’ve just learned is probably the easiest way out. Apparently, now we are finding the minimal distance between the functions $f(x)=|x-2\lfloor \frac{x+1}{2} \rfloor |$ and $g(x)=\sqrt{x-\lfloor x \rfloor} + 3$. While now it is easy to plot such functions with tools like Desmos or Geogebra, we were not allowed to use calculators! Fortunately, breaking down the floor functions in these two functions is not hard, as we can just try out different intervals of $x$ values. As I still have a lot of cool stuff I want to show you and I don’t want to make this article too long, I’m not going to show how to plot these functions step-by-step, but as you could examine, these two functions can be visualized as in Figure 1B, whose minimal distance is apparently 2. Therefore, the answer to the original problem is 4.


Both examples above show that we can tackle a seemingly hard algebra problem by converting it into a geometry problem. Using the distance formula, we could solve a lot more variety of problems. Below let’s take a look at some other examples!

Problem 3: What is the minimum of $f(x)=\sqrt{x^2-6x+58} + \sqrt{x^2-18x+82}$ given that $x\in \mathbb{R}$?

This problem is actually pretty common in high school math quizzes in Taiwan! All we need to do is to rewrite $f(x)$ as $\sqrt{(x-3)^2+(0-7)^2} + \sqrt{(x-9)^2 + (0-1)^2}$, which expresses $\overline{\rm PA} + \overline{\rm PB}$, with points A, B respectively at $(3, 7)$ and $(9, 1)$ and point P being any point on the $x$-axis (i.e. $(x, 0)$). As shown in Figure 2A, $\overline{\rm PA} + \overline{\rm PB}$ has its minimum when point P is the intersection of $\overline{\rm PB’}$ and the $x$-axis, with B’ being the symmetric point of B with respect to the $x$-axis. (It’s easy to prove that all the other points on the $x$-axis, say point P’ in Figure 1B, will lead to a larger sum because $\overline{\rm P’A} + \overline{\rm P’B} = \overline{\rm P’A} + \overline{\rm P’B’} > \overline{\rm AB’}=\overline{\rm PA} + \overline{\rm PB’}=\overline{\rm PA} + \overline{\rm PB}$.) Therefore, the minimum of $f(x)$ is equal to $\overline{\rm PA} + \overline{\rm PB} = \overline{\rm PA} + \overline{\rm PB’} =10$.

Figure 2. (A) Visualization of Problem 3. (B) Visualization of Problem 4.

Imaginably, this problem can be generalized and complicated. Now buckle up! Let’s take a look at the sum of multiple distances in a 3D Cartesian coordinate system below.

Problem 4: Let $f=\sqrt{a^2 + b^2 -4a - 8b +24} + \sqrt{a^2+b^2+c^2+d^2-2ac}+\sqrt{c^2+d^2-8c-12d+56}$. What is the minimum of $f(a, b, c, d)$ given that $a, b, c, d \in \mathbb{R}?$

Here I’m just putting new wine in old bottles! To start off, we can rewrite $f(a, b, c, d)$ as $$\begin{aligned} f(a, b, c, d) & = \sqrt{(a-2)^2 + (b-4)^2 + (0-2)^2} \\ & + \sqrt{(a-c)^2 + (b-0)^2 + (d-0)^2} + \sqrt{(c-4)^2 + (d-6)^2 + (0-2)^2} \end{aligned}$$ which expresses $\overline{\rm AP} + \overline{\rm PQ} + \overline{\rm QB}$ (as shown in Figure 2B), with $A(2, 4, 2)$, $P(a, b, 0)$ (any point on the x-y plane), $Q(c, 0, d)$ (any point on the x-z plane) and $B(4, 2, 6)$. Then, we find the symmetric points of points A and B, with respect to the x-y plane and the x-z plane, respectively. Finally, the minimum of $f(a, b, c, d)$ is simply the length of the line segment $\overline{\rm A’B’}$, which is $2\sqrt{26}$.


Apparently, it’s not always about the minimal sum of distances! Below let’s take a look at an example that can be interpreted as asking for the maximal difference of distances.

Problem 5: [2007 HSNU Math contest] $x\in \mathbb{R}$. What is the maximum of $T(x)=\sqrt{x^4-5x^2-8x+25}-\sqrt{x^4-3x^2+4}$?

Similarly, we rewrite $T(x)$ as $T(x)=\sqrt{(x^2-3)^2+(x-4)^2} + \sqrt{(x^2-2)^2+(x-0)^2}$, which can be regarded as the $\overline{\rm PA}-\overline{\rm PB}$, where $P(x, x^2)$ is a moving point on $y=x^2$ and points A, B are at $(4, 3)$ and $(0, 2)$, respectively. Apparently, $\overline{\rm PA}-\overline{\rm PB}\leq \overline{\rm AB}$ (see Figure 3A). When point P is the intersection of $\overrightarrow{\rm AB}$ and $T(x)$, $T(x)$ has its maximum, which is equal to the length of $\overline{\rm AB}$, $\sqrt{17}$.

Figure 3. (A) Visualization of Problem 5. (B) Visualization of Problem 6.

Also, it’s not always about distances!

Problem 6: What is the maximum of $f(x)=\frac{5-2\cos{x}}{\sqrt{7}-\sqrt{2-2\cos{2x}}}$ with $x\in\mathbb{R}$?

I guess we all hate the sine and cosine functions in the same expression taking in different angles ($x$ and $2x$ in our case), so let’s first rewrite the denominator of $f(x)$ as follows: $$\sqrt{7}-\sqrt{2-2\cos{2x}}=\sqrt{7}-2\sqrt{\frac{1-\cos{2x}}{2}}=\sqrt{7}-2\sin{x}$$ With this, $f(x)$ can be rewritten as $\frac{5-2\cos{x}}{\sqrt{7}-2\sin{x}}$. To solve the maximum of such a function, we could imagine a moving point $P(2\cos{x}, 2\sin{x})$ on the circle $x^2+y^2=4$ and a fixed point $A(5, \sqrt{7})$ (see Figure 3B), then $f(x)$ is equal to the reciprocal of the slope of $\overline{\rm PA}$. As shown in Figure 3B, $f(x)$ is therefore maximized when point P is the tangent point on the tangent line that has the minimal positive slope. It’s easy to get that this tangent line is $y=\frac{1}{3\sqrt{7}}x+\frac{16}{3\sqrt{7}}$, which indicates that the maximum of $f(x)$ is $3\sqrt{7}$.


If you’re tired of solving maximum/minimum problems, let’s use the same technique of “geometrizing algebra problems” to solve other types of interesting problems! 😎

Problem 7: [2005 Taipei Math Contest] Given that $|x^2-3x+2|=ax$ has three real roots, what is the value of $a$?

The problem statement essentially implies that there are three points of contact between $y=|x^2-3x+2|$ and $y=ax$. To plot $y=|x^2-3x+2|$, we need to first remove the absolute value function: $$ f(x)= \begin{cases} y=x^2-3x+2,& \text{if } x^2-3x+2\geq0 \Rightarrow x \geq 2 \text{ or } x \leq 1 \\ y=-x^2+3x-2, & \text{if } x^2-3x+2 < 0 \Rightarrow 1 < x < 2 \end{cases}$$ As shown in Figure 4A, to have 3 points of contact, $y=ax$ must be the tangent line of the convex part of $y=|x^2-3x+2|$ and have two intersections with the concave part. Since the convex part of $y=|x^2-3x+2|$ is exactly $y=-(x^2-3x+2)$ for $1<x<2$, this means that the equation $ax=-(x^2-3x+2)$ has a double root, i.e. the discriminant $D=(3-a)^2-4\cdot(-1)\cdot(-2)=0\Rightarrow a=3\pm2\sqrt{2}$. $a=3+2\sqrt{2}$ is not the case since its tangent point with $y=-(x^2-3x+2)$ is not within the interval of $1<x<2$. Therefore, we have $a=3-2\sqrt{2}$.

Figure 4. (A) Visualization of Problem 7 (B) Visualization of Problem 8

Finally, if you’re done with plotting functions in a coordinate system. Here is one that does not need it!

Problem 8: The three side lengths of $\triangle \text{ABC}$ are $\overline{\rm AB}=\sqrt{a^2+b^2+d^2+2ab}$, $\overline{\rm BC}=\sqrt{a^2+c^2+d^2+2cd}$, and $\overline{\rm AC}=\sqrt{b^2+c^2}$. What is the area of $\triangle \text{ABC}$ in terms of $a$, $b$, $c$ and $d$?

To calculate the area of a triangle given its three side lengths, the most straightforward way is to use Heron’s formula. Or, as an alternative, we can pick any two adjacent sides, apply the law of cosines to determine their included angle, and calculate the area as $\frac{1}{2} ab \sin{\theta}$. In this case, applying the law of cosines will be easier than Heron’s formula since some of the terms will be canceled as we calculate the sum of the squared side lengths. However, both methods are not as easy as considering the triangle inside the rectangle with sides of $a+b$ and $c+d$ (see Figure 4B), which turns the problem into an elementary school math problem! With this conversion, $\triangle \text{ABC}$ is simply $(a+b)(c+d)-\frac{1}{2}a(c+d)-\frac{1}{2}d(a+b)-\frac{1}{2}bc=\frac{1}{2}(ac+bc+bd)$.

Acknowledgement

This article is dedicated to my high school math teacher, Mr. Li-Wei, Wong, who recommended me to the math team representative of HSNU. Mr. Wong passed away in my junior year of undergrad, but his education has been influential in my life. All the problems in this article (except for the noted ones) were designed by myself in the project I did during my winter vacation of my high school junior year. The project was also assigned by Mr. Wong.


This is the end of the article! 🎉🎉 If you enjoyed this article, you are welcome to share it or leave a comment below, so I will be more motivated to write more! Thank you for reading this far! 😃

Wei-Tse Hsu
Wei-Tse Hsu
Incoming Postdoctoral Research Associate in Drug Design

Computational Biophysicist keen on molecular dynamics, deep learning, and education