[Math] Maximum and minimum function on circle

calculusmultivariable-calculusoptimization

Find minimum and maximum value of function
$f(x,y) = 3x+4y + |x-y|$
on circle
$$\left\{ (x,y): x^2+y^2 = 1 \right\}$$

I used polar coordinate system. So I have $x = \cos t$ and $y=\sin t$ where $ t \in [0, 2 \pi)$.

Then i exploited definition of absolute function and i got:

$$h(t) = \begin{cases} 4 \cos t + 3 \sin t \quad t \in [0, \frac{\pi}{4}] \cup [\frac{5}{4} \pi,2 \pi) \\ 2 \cos t + 5 \sin t \quad t \in (\frac{\pi}{4}, \frac{5}{4} \pi) \end{cases}$$

Hence i received following critical points (earlier i computed first derivative):

$$\cos t = \pm \frac{4}{5} \vee \cos t = \pm \frac{2}{ \sqrt{29} }$$

Then i computed second derivative and after all i received that in $( \frac{2}{ \sqrt{29} } , \frac{5}{ \sqrt{29} }) $ is maximum equal $\sqrt{29}$ and in $(- \frac{4}{ 5 } ,- \frac{3}{5} )$ is minimum equal $- \frac{23}{5}$.

I examined my resolution in wolfram alpha:

enter image description here

How you can see, this resolutions are very different than my. Even the crital points are other. Could you tell me where i have mistake?

Best Answer

Your treatment of the given function as "piecewise" is proper, but I believe your parameterization isn't quite correct. Since the "split" in the absolute-value term occurs at $ \ x - y \ \ge \ 0 \ $ versus $ \ x - y \ < \ 0 \ $ , there is a single "dividing line" between the "branches" of the function at $ \ y \ = \ x \ $ . So the parameterized form of the function should simply be

$$ f(t) = \begin{cases} 4 \cos t \ + \ 3 \sin t \ \ , \quad -\frac{3\pi}{4} \ \le \ t \ < \ \frac{\pi}{4} \\ 2 \cos t \ + \ 5 \sin t \ \ , \quad \frac{\pi}{4} \ \le \ t \ < \ \frac{5 \pi}{4} \end{cases} \ \ . $$

[Other choices for "angle-names" can be used: these intervals were chosen to keep calculations simpler below.]

In a more conventional Cartesian form, we can write the function as

$$ f(x, \ y) = \begin{cases} 3x \ + \ 4y \ + \ (x - y) \ = \ 4x \ + \ 3y \ \ , \quad y \ \le \ x \\ 3x \ + \ 4y \ - \ (x - y) \ = \ 2x \ + \ 5y \ \ , \quad y \ \ge \ x \end{cases} \ \ . $$

enter image description here

We will approach the problem of extremization in two ways.

$$ \ \ $$

In the first, we can look for critical points by solving $ \ \frac{df}{dt} \ = \ 0 \ $ on the two halves of the circle as you did. Another method would be to write the linear functions in sine and cosine as a single sine (or cosine) function. We have (neglecting a constant factor for each)

$$ \frac{4}{\sqrt{4^2 + 3^2}} \cos t \ + \ \frac{3}{\sqrt{4^2 + 3^2}} \sin t $$ $$ \rightarrow \ \sin \ \alpha \ \cos t \ + \ \cos \ \alpha \ \sin t \ = \ \sin (t + \alpha) \ \ , \ \ \alpha \ = \ \arctan \left( \frac{4}{3} \right) \ \approx \ 0.9273 $$

and

$$ \frac{2}{\sqrt{2^2 + 5^2}} \cos t \ + \ \frac{5}{\sqrt{2^2 + 5^2}} \sin t $$ $$ \rightarrow \ \sin \ \beta \ \cos t \ + \ \cos \ \beta \ \sin t \ = \ \sin (t + \beta) \ \ , \ \ \beta \ = \ \arctan \left( \frac{2}{5} \right) \ \approx \ 0.3805 \ \ . $$

The maximal and minimal values of these sine functions occur for

$$ \sin (t + \alpha) \ = \ \pm 1 \ \ \Rightarrow \ \ \begin{cases} t \ + \ \alpha \ = \ \frac{\pi}{2} \ \ \Rightarrow \ \ t \ \approx \ 0.6435 \\ t \ + \ \alpha \ = \ \frac{3 \pi}{2} \ \ \Rightarrow \ \ t \ \approx \ 3.7851 \end{cases} \ \ \text{and} $$

$$ \sin (t + \beta) \ = \ \pm 1 \ \ \Rightarrow \ \ \begin{cases} t \ + \ \beta \ = \ \frac{\pi}{2} \ \ \Rightarrow \ \ t \ \approx \ 1.1903 \\ t \ + \ \beta \ = \ \frac{3 \pi}{2} \ \ \Rightarrow \ \ t \ \approx \ 4.3319 \end{cases} \ \ . $$

For our choice of parameterization here, the domains of the "branches" of $ \ f(t) \ $ permit only the "maximum value" solutions for both linear functions [indicated on the graph above by the blue and purple asterisks, respectively]. The "minimum value" solutions, which are at the diametrically-opposite locations marked by six-pointed stars, are not in the appropriate domains. Upon comparing the maximal values of the function in the two branches, we find

$$ f(0.6435) \ = \ 4 \ \cos \ 0.6435 \ + \ 3 \ \sin \ 0.6435 \ = \ 5 \ \ \text{[exact]} \ \ , $$

$$ f(1.1903) \ = \ 2 \ \cos \ 1.1903 \ + \ 5 \ \sin \ 1.1903 \ \approx \ 5.385 \ \ . $$

We also need to examine the "boundary points" between the two branches, $ \ t \ = \ \frac{\pi}{4} \ $ [green star] and $ \ t \ = \ \frac{5 \pi}{4} \ $ [green asterisk] . The function proves to be continuous through these points (if we allow the parameter $ \ t \ $ to continue tracing the circle indefinitely). We obtain

$$ f\left( \frac{\pi}{4} \right) \ = \ 4 \ \cos \frac{\pi}{4} \ + \ 3 \ \sin \frac{\pi}{4} \ = \ 2 \ \cos \frac{\pi}{4} \ + \ 5 \ \sin \frac{\pi}{4} \ = \ \frac{7 \ \sqrt{2}}{2} \ \approx \ 4.949 \ \ , $$

$$ f\left( \frac{5 \pi}{4} \right) \ = \ 4 \ \cos \frac{5 \pi}{4} \ + \ 3 \ \sin \frac{5 \pi}{4} \ = \ 2 \ \cos \frac{5 \pi}{4} \ + \ 5 \ \sin \frac{5 \pi}{4} \ = \ -\frac{7 \ \sqrt{2}}{2} \ \approx \ -4.949 \ \ . $$

We have determined then that the maximum value of $ \ f(x, \ y) \ $ is about $ \ 5.385 \ $ and the minimum value is $ \ - \frac{7 \ \sqrt{2}}{2} \ $ . (There is something "off" about the posted WolframAlpha result -- for example, the coordinates of the point for the minimum is not quite on the unit circle, so the function value is also slightly in error. We will also not confirm the maximum value shown.)

$$ \ \ $$

We can confirm these results by another approach, which is to use Lagrange multipliers. The constraint function throughout is $ \ g(x, \ y) \ = \ x^2 \ + y^2 \ - \ 1 \ $ .

In the "lower" ( $ \ y \ \le \ x \ $ ) semicircle, we have $ \ f(x, \ y) \ = \ 4x \ + \ 3y \ $ , giving us the Lagrange equations

$$ \ \nabla f \ = \ \lambda \nabla g \ \ \Rightarrow \ \ 4 \ = \ \lambda \cdot 2x \ \ , \ \ 3 \ = \ \lambda \cdot 2y \ \ \Rightarrow \ \ \lambda \ = \ \frac{4}{2x} \ = \ \frac{3}{2y} $$

$$ \Rightarrow \ \ y \ = \ \frac{3}{4} x \ \ \Rightarrow \ \ x^2 \ + \ \left( \frac{3}{4} x \right)^2 \ = \ 1 \ \ \Rightarrow \ \ (x, \ y) \ = \ ( \ \pm \frac{4}{5}, \ \pm \frac{3}{5} \ ) \ . $$

The domain only gives us the single point $ \ ( \ \frac{4}{5}, \ \frac{3}{5} \ ) \ $ , for which the function value is $ \ f \left(\frac{4}{5}, \ \frac{3}{5} \right) \ = \ 4 \cdot \frac{4}{5} \ + \ 3 \cdot \frac{3}{5} \ = \ \frac{25}{5} \ = \ 5 \ $ . This is the tangent point [the blue asterisk] of the [blue] line described by $ \ f(x, \ y) \ $ , in this portion of its domain, with the constraint circle.

[Side note -- If this single function were applicable over the full circle, the minimum value of $ \ 4x \ + \ 3y \ $ would be given by the tangent line $ \ 4x \ + \ 3y \ = \ -5 \ $ [the light-blue line] , meeting the circle at the diametrically-opposite point $ \ ( \ -\frac{4}{5}, \ -\frac{3}{5} \ ) \ $ [the light-blue star] . ]

For the "upper" ( $ \ y \ \ge \ x \ $ ) semicircle, the function is $ \ f(x, \ y) \ = \ 2x \ + \ 5y \ $ , making the Lagrange equations

$$ \ \ 2 \ = \ \lambda \cdot 2x \ \ , \ \ 5 \ = \ \lambda \cdot 2y \ \ \Rightarrow \ \ \lambda \ = \ \frac{2}{2x} \ = \ \frac{5}{2y} \ \ \Rightarrow \ \ y \ = \ \frac{5}{2} x $$ $$ \Rightarrow \ \ x^2 \ + \ \left( \frac{5}{2} x \right)^2 \ = \ 1 \ \ \Rightarrow \ \ (x, \ y) \ = \ ( \ \pm \frac{2}{\sqrt{29}}, \ \pm \frac{5}{\sqrt{29}} \ ) \ . $$

The domain again only permits $ \ ( \ \frac{2}{\sqrt{29}}, \ \frac{5}{\sqrt{29}} \ ) \ $ , where the function value is $ \ f \left(\frac{2}{\sqrt{29}}, \ \frac{5}{\sqrt{29}} \right) \ = \ 2 \cdot \frac{2}{\sqrt{29}} \ + \ 5 \cdot \frac{5}{\sqrt{29}} \ = \ \frac{29}{\sqrt{29}} \ = \ \sqrt{29} \ \approx \ 5.385 \ $ . This is the tangent point [purple asterisk] of the [purple] line. (The light purple line and star shown where the minimum of $ \ 2x \ + \ 5y \ $ would be on the full circle.)

The Lagrange-multiplier method will not give us any information about the points where the "halves" of the circle meet, since the level curves of $ \ f (x, \ y) \ $ are not tangent there. Upon inspecting $ \ f ( \ \pm \frac{\sqrt{2}}{2}, \ \pm \frac{\sqrt{2}}{2}) \ $ , we obtain the minimum value for the function on the unit circle as

$$ \ f ( \ - \frac{\sqrt{2}}{2}, \ - \frac{\sqrt{2}}{2} \ ) \ = \ -\frac{7 \ \sqrt{2}}{2} \ \ ; $$

the maximum value is

$$ f \left(\frac{2}{\sqrt{29}}, \ \frac{5}{\sqrt{29}} \right) \ = \ \sqrt{29} \ \ . $$

These also agree with the results for user64494's graph.