# Calculus

## Applications of the Derivative # Optimization Problems in 2D Geometry

## Solved Problems

### Example 9.

$$A\left( {1,0} \right)$$ and $$B\left( {5,0} \right)$$ are points on the $$x-$$axis (Figure $$9a$$). Find the $$y-$$coordinate of the point $$M\left( {0,y} \right)$$ on the $$y-$$axis such that the angle $$\theta = \angle AMB$$ has the maximum possible value.

Solution.

We can express the angle $$\theta$$ in terms of $$\alpha$$ and $$\beta:$$

$\theta = \alpha - \beta .$

Use the tangent subtraction formula

$\tan \theta = \tan \left( {\alpha - \beta } \right) = \frac{{\tan \alpha - \tan \beta }}{{1 + \tan \alpha \tan \beta }}.$

As $$\tan \alpha = \frac{5}{y}$$ and $$\tan \beta = \frac{1}{y},$$ we obtain:

$\tan \theta = \frac{{\frac{5}{y} - \frac{1}{y}}}{{1 + \frac{5}{y} \cdot \frac{1}{y}}} = \frac{{\frac{{5y - y}}{{{y^2}}}}}{{\frac{{{y^2} + 5}}{{{y^2}}}}} = \frac{{5y - y}}{{{y^2} + 5}}.$

Hence

$\tan \theta = \frac{{\frac{5}{y} - \frac{1}{y}}}{{1 + \frac{5}{y} \cdot \frac{1}{y}}} = \frac{{\frac{{5y - y}}{{{y^2}}}}}{{\frac{{{y^2} + 5}}{{{y^2}}}}} = \frac{{5y - y}}{{{y^2} + 5}} = \frac{{4y}}{{{y^2} + 5}}.$

Determine the critical points of the function $$\theta \left( y \right):$$

$\theta^\prime\left( y \right) = \left( {\arctan \frac{{4y}}{{{y^2} + 5}}} \right)^\prime = \frac{1}{{1 + {{\left( {\frac{{4y}}{{{y^2} + 5}}} \right)}^2}}} \cdot \frac{{4\left( {{y^2} + 5} \right) - 4y \cdot 2y}}{{{{\left( {{y^2} + 5} \right)}^2}}} = \frac{1}{{1 + \frac{{16{y^2}}}{{{{\left( {{y^2} + 5} \right)}^2}}}}} \cdot \frac{{4{y^2} + 20 - 8{y^2}}}{{{{\left( {{y^2} + 5} \right)}^2}}} = \frac{{20 - 4{y^2}}}{{{{\left( {{y^2} + 5} \right)}^2} + 16{y^2}}}.$
$\theta ^\prime\left( y \right) = 0,\;\; \Rightarrow \frac{{20 - 4{y^2}}}{{{{\left( {{y^2} + 5} \right)}^2} + 16{y^2}}} = 0,\;\; \Rightarrow 20 - 4{y^2} = 0,\;\; \Rightarrow {y^2} = 5,\;\; \Rightarrow y = \pm \sqrt 5 .$

Assuming that $$y \gt 0,$$ we take the positive root $$y = \sqrt 5.$$ The derivative is positive to the left of this point and negative to the right. Therefore, $$y = \sqrt 5$$ is a point of maximum, that is the angle $$\theta$$ has the largest value when the point $$M$$ is located at $$\left( {0,\sqrt 5 } \right).$$

### Example 10.

Two channels of width $$a$$ and $$b$$ are connected to each other at right angles (Figure $$10a$$). Determine the maximum length of logs that can be floated through this system of channels.

Solution.

Let the position of a log be described by the angle $$\alpha,$$ as shown in Figure $$10a.$$ The maximum possible length of the log $$L$$ depends on the angle $$\alpha:$$

$L = \left| {AO} \right| + \left| {OB} \right| = \frac{a}{{\sin \alpha }} + \frac{a}{{\cos\alpha }} = L\left( \alpha \right).$

Note two extreme positions:

$\alpha \to 0,\;\; \Rightarrow \sin \alpha \to 0,\;\; \Rightarrow \left| {AO} \right| \to \infty ;$
$\alpha \to \frac{\pi }{2},\;\; \Rightarrow \cos \alpha \to 0,\;\; \Rightarrow \left| {OB} \right| \to \infty .$

Thus, the angle $$\alpha$$ changes in the range $$0 \lt \alpha \lt \frac{\pi }{2}.$$

Find the derivative of the function $$L\left( \alpha \right):$$

$L'\left( \alpha \right) = \left( { - \frac{a}{{{{\sin }^2}\alpha }}} \right) \cdot \cos \alpha - \frac{b}{{{{\cos }^2}\alpha }} \cdot \left( { - \sin \alpha } \right) = \frac{{b\sin \alpha }}{{{{\cos }^2}\alpha }} - \frac{{a\cos \alpha }}{{{\sin^2}\alpha }} = \frac{{b\,{{\sin }^3}\alpha - a\,{{\cos }^3}\alpha }}{{{{\cos }^2}\alpha \,{{\sin }^2}\alpha }} = \frac{{4\left( {b\,{{\sin }^3}\alpha - a\,{{\cos }^3}\alpha } \right)}}{{{{\sin }^2}\left( {2\alpha } \right)}}.$

Equating it to zero, we obtain the following solution:

$L'\left( \alpha \right) = 0,\;\; \Rightarrow \frac{{4\left( {b\,{{\sin }^3}\alpha - a\,{{\cos }^3}\alpha } \right)}}{{{{\sin }^2}\left( {2\alpha } \right)}} = 0,\;\; \Rightarrow \left\{ {\begin{array}{*{20}{l}} {b\,{{\sin }^3}\alpha - a\,{{\cos }^3}\alpha = 0}\\ {{{\sin }^2}\left( {2\alpha } \right) \ne 0} \end{array}} \right.,\;\; \Rightarrow b\,{\tan ^3}\alpha - a = 0,\;\; \Rightarrow \tan \alpha = \sqrt{{\frac{a}{b}}}.$

We can make sure that when passing through this critical value $$\alpha$$ the derivative changes sign from minus to plus, i.e. this point is a minimum of the function $$L\left( \alpha \right).$$ (It is clear that the length of the log must be less than the specified value to turn from one channel to another.)

Rewrite the sine and cosine of the angle $$\alpha$$ in terms of tangent:

$1 + {\cot^2}\alpha = \frac{1}{{{{\sin }^2}\alpha }},\;\; \Rightarrow \sin \alpha = \frac{1}{{\sqrt {1 + {{\cot }^2}\alpha } }} = \frac{1}{{\sqrt {1 + \frac{1}{{{{\tan }^2}\alpha }}} }} = \frac{{\tan \alpha }}{{\sqrt {1 + {{\tan }^2}\alpha } }};$
$1 + {\tan ^2}\alpha = \frac{1}{{{\cos^2}\alpha }},\;\; \Rightarrow \cos \alpha = \frac{1}{{\sqrt {1 + {{\tan }^2}\alpha } }}.$

Now we can write the final expression for the maximum possible length of the log:

${L_{\max }} = \frac{a}{{\sin \alpha }} + \frac{b}{{\cos\alpha }} = \frac{a}{{\frac{{\tan \alpha }}{{\sqrt {1 + {{\tan }^2}\alpha } }}}} + \frac{b}{{\frac{1}{{\sqrt {1 + {{\tan }^2}\alpha } }}}} = \sqrt {1 + {{\tan }^2}\alpha } \left( {\frac{a}{{\tan \alpha }} + b} \right) = \sqrt {1 + \sqrt{{{{\left( {\frac{a}{b}} \right)}^2}}}} \left( {\frac{a}{{\sqrt{{\frac{a}{b}}}}} + b} \right) = \sqrt {1 + \frac{{{a^{\frac{2}{3}}}}}{{{b^{\frac{2}{3}}}}}} \left( {{b^{\frac{1}{3}}}{a^{\frac{1}{3}}} + b} \right) = \frac{{\sqrt {{a^{\frac{2}{3}}} + {b^{\frac{2}{3}}}} }}{{{b^{\frac{1}{3}}}}} \cdot {b^{\frac{1}{3}}}\left( {{a^{\frac{2}{3}}} + {b^{\frac{2}{3}}}} \right) = {\left( {{a^{\frac{2}{3}}} + {b^{\frac{2}{3}}}} \right)^{\frac{3}{2}}}.$

In a particular case, for channels of equal width (when $$a = b$$), we have

$L_{\max } = \sqrt {{{\left( {2{a^{\frac{2}{3}}}} \right)}^3}} = \sqrt {8{a^2}} = a\sqrt 8 .$

### Example 11.

The bridge from $$A( - 2,4)$$ to $$M\left( {x,y} \right)$$ spans a gorge which has the shape of the parabola $$y = {x^2}$$ (Figure $$11a$$). Find the $$x-$$coordinate of the point $$M$$ such that the bridge $$AM$$ has the smallest length.

Solution.

The distance between the endpoints $$A( - 2,4)$$ to $$M\left( {x,y} \right)$$ is given by the formula

$d = \left| {AM} \right| = \sqrt {{{\left( {x + 2} \right)}^2} + {{\left( {y - 4} \right)}^2}}.$

As $$y = {x^2},$$ we obtain:

$d = \sqrt {{{\left( {x + 2} \right)}^2} + {{\left( {{x^2} - 4} \right)}^2}} = \sqrt {{x^2} + 4x + 4 + {x^4} - 8{x^2} + 16} = \sqrt {{x^4} - 7{x^2} + 4x + 20} .$

Take the derivative:

$d^\prime\left( x \right) = \left( {\sqrt {{x^4} - 7{x^2} + 4x + 20} } \right)^\prime = \frac{{4{x^3} - 14x + 4}}{{2\sqrt {{x^4} - 7{x^2} + 4x + 20} }} = \frac{{2{x^3} - 7x + 2}}{{\sqrt {{x^4} - 7{x^2} + 4x + 20} }}.$

The derivative is equal to zero when $$2{x^3} - 7x + 2 = 0.$$ Using some algebra, we find the roots of the cubic equation:

$2{x^3} - 7x + 2 = 2{x^3} + 4{x^2} - 4{x^2} - 8x + 8x - 7x + 2 = \left( {2{x^3} + 4{x^2}} \right) - \left( {4{x^2} + 8x} \right) + \left( {x + 2} \right) = 2{x^2}\left( {x + 2} \right) - 4x\left( {x + 2} \right) + \left( {x + 2} \right) = \left( {x + 2} \right)\left( {2{x^2} - 4x + 1} \right) = 0.$

The root $${x_1} = -2$$ is trivial. It corresponds to the zero length of the bridge. Solve the quadratic equation to find the other roots:

$2{x^2} - 4x + 1 = 0,\;\; \Rightarrow D = {\left( { - 4} \right)^2} - 4 \cdot 2 = 8,\;\; \Rightarrow {x_{2,3}} = \frac{{4 \pm \sqrt 8 }}{4} = 1 \pm \frac{{\sqrt 2 }}{2}.$

It follows from the sign chart that the minimum of $$d\left( x \right)$$ is attained at $$x = 1 + \frac{{\sqrt 2 }}{2} \approx 1.71$$

The schematic view of the function $$d\left( x \right)$$ is given in Figure $$11c.$$

### Example 12.

A rectangle with sides parallel to the coordinate axes is inscribed in an ellipse (Figure $$12a$$) defined by the equation $\frac{{{x^2}}}{{{a^2}}} + \frac{{{y^2}}}{{{b^2}}} = 1.$ Find the sides of the rectangle with the greatest area.

Solution.

Suppose that the point $$M\left( {x,y} \right)$$ is a vertex of the inscribed rectangle. The area of the rectangle is

$S = 2x \cdot 2y = 4xy.$

The quantity $$y$$ can be expressed from the equation of the ellipse:

$\frac{{{x^2}}}{{{a^2}}} + \frac{{{y^2}}}{{{b^2}}} = 1,\;\; \Rightarrow \frac{{{y^2}}}{{{b^2}}} = 1 - \frac{{{x^2}}}{{{a^2}}},\;\; \Rightarrow {y^2} = \frac{{{b^2}}}{{{a^2}}}\left( {{a^2} - {x^2}} \right),\;\; \Rightarrow y = \pm \frac{b}{a}\sqrt {{a^2} - {x^2}} .$

In the context of this problem, we consider only positive values of $$x$$ and $$y.$$ Consequently,

$S = 4xy = \frac{{4bx}}{a}\sqrt {{a^2} - {x^2}} = S\left( x \right).$

To find the extremum of $$S\left( x \right)$$, we compute the derivative:

$S'\left( x \right) = \left( {\frac{{4bx}}{a}\sqrt {{a^2} - {x^2}} } \right)^\prime = \frac{{4b}}{a} \left[ {\sqrt {{a^2} - {x^2}} + x \cdot \frac{1}{{2\sqrt {{a^2} - {x^2}} }} \cdot \left( { - 2x} \right)} \right] = \frac{{4b}}{a}\left[ {\sqrt {{a^2} - {x^2}} - \frac{{{x^2}}}{{\sqrt {{a^2} - {x^2}} }}} \right] = \frac{{4b}}{a} \cdot \frac{{{a^2} - {x^2} - {x^2}}}{{\sqrt {{a^2} - {x^2}} }} = \frac{{4b\left( {{a^2} - 2{x^2}} \right)}}{{a\sqrt {{a^2} - {x^2}} }}.$

The derivative is zero provided

${a^2} - 2{x^2} = 0,\;\; \Rightarrow {x^2} = \frac{{{a^2}}}{2},\;\; \Rightarrow x = \frac{a}{{\sqrt 2 }}.$

When passing through the point $$x = {\frac{a}{{\sqrt 2 }}}$$ the derivative changes sign from plus to minus. Therefore, this point is a maximum point.

The value of $$y$$ accordingly is equal to

$y = \frac{b}{a}\sqrt {{a^2} - {x^2}} = \frac{b}{a}\sqrt {{a^2} - {{\left( {\frac{a}{{\sqrt 2 }}} \right)}^2}} = \frac{b}{a}\sqrt {{a^2} - \frac{{{a^2}}}{2}} = \frac{b}{a}\sqrt {\frac{{{a^2}}}{2}} = \frac{b}{a} \cdot \frac{a}{{\sqrt 2 }} = \frac{b}{{\sqrt 2 }}.$

So the rectangle inscribed in the ellipse will has the largest possible area when its sides are equal to

$2x = 2 \cdot \frac{a}{{\sqrt 2 }} = a\sqrt 2 \;\;\;\text{and}\;\;\; 2y = 2 \cdot \frac{b}{{\sqrt 2 }} = b\sqrt 2 .$

The maximum area of the rectangle is given by

$S_{\max } = a\sqrt 2 \cdot b\sqrt 2 = 2ab.$

It is interesting to note the special case where the ellipse has equal major and minor axes, that is it is a circle:

$a = b = R.$

In this case, the rectangle with the largest area is a square with the side $$R\sqrt 2 .$$

### Example 13.

Find the point $$M\left( {x,y} \right)$$ on the graph of $$f\left( x \right) = \sqrt x$$ that is closest to $$A\left( {a,0} \right)$$ where $$a$$ is a positive real number (Figure $$13a$$).

Solution.

The distance $$d$$ between the points $$A$$ and $$M$$ is given by the formula

$d = \left| {AM} \right| = \sqrt {{{\left( {x - a} \right)}^2} + {y^2}} = \sqrt {{{\left( {x - a} \right)}^2} + x} = d\left( x \right).$

Take the derivative:

$d^\prime\left( x \right) = \left( {\sqrt {{{\left( {x - a} \right)}^2} + x} } \right)^\prime = \frac{{2\left( {x - a} \right) + 1}}{{2\sqrt {{{\left( {x - a} \right)}^2} + x} }} = \frac{{2x - 2a + 1}}{{2\sqrt {{{\left( {x - a} \right)}^2} + x} }}.$

Assuming that $$x \gt 0$$ and $$a \gt 0$$ we find the critical point(s):

$d^\prime\left( x \right) = 0,\;\; \Rightarrow \frac{{2x - 2a + 1}}{{2\sqrt {{{\left( {x - a} \right)}^2} + x} }} = 0,\;\; \Rightarrow 2x - 2a + 1 = 0,\;\; \Rightarrow x = a - \frac{1}{2}.$

When passing through this point from left to right, the derivative changes sign from negative to positive. Therefore, $$x = a - \frac{1}{2}$$ is a point of minimum.

The $$y-$$value at this point is equal

$y\left( {a - \frac{1}{2}} \right) = \sqrt {a - \frac{1}{2}} ,$

so the closest point has the coordinates $$\left( {a - \frac{1}{2},\sqrt {a - \frac{1}{2}} } \right).$$

We can also calculate the minimum distance between the points:

${d_{\min }} = \sqrt {{{\left( {x - a} \right)}^2} + x} = \sqrt {{{\left( {\cancel{a} - \frac{1}{2} - \cancel{a}} \right)}^2} + a - \frac{1}{2}} = \sqrt {\frac{1}{4} + a - \frac{1}{2}} = \sqrt {a - \frac{1}{4}} .$

### Example 14.

The length of the altitude drawn from the hypotenuse of a right triangle is $$h$$ (Figure $$14a$$). Determine the shortest length of the median drawn to the longest leg.

Solution.

By Pythagorean theorem, we can write:

$m = \sqrt {{a^2} + {{\left( {\frac{b}{2}} \right)}^2}} ,\;\; \Rightarrow {m^2} = {a^2} + \frac{{{b^2}}}{4}.$

Since the area of the right triangle is given by

$A = \frac{1}{2}ab = \frac{1}{2}ch,$

we can express the altitude $$h$$ in terms of the legs $$a$$ and $$b:$$

$h = \frac{{ab}}{c} = \frac{{ab}}{{\sqrt {{a^2} + {b^2}} }},\;\; \Rightarrow {h^2} = \frac{{{a^2}{b^2}}}{{{a^2} + {b^2}}}.$

Hence, we get the following system of two equations

$\left\{ \begin{array}{l} {m^2} = {a^2} + \frac{{{b^2}}}{4}\\ {h^2} = \frac{{{a^2}{b^2}}}{{{a^2} + {b^2}}} \end{array} \right.,$

where the first equation represents the objective function, and the second equation is the constraint equation.

To simplify algebraic expressions, we denote $${m^2} = M,$$ $${h^2} = H,$$ $${a^2} = A,$$ and $${b^2} = B$$ so the system of equations becomes

$\left\{ \begin{array}{l} M = A + \frac{B}{4}\\ H = \frac{{AB}}{{A + B}} \end{array} \right..$

We write the variable $$A$$ in terms of $$B$$ and $$H$$ from the second equation:

$AB = AH + BH,\;\; \Rightarrow A\left( {B - H} \right) = BH,\;\; \Rightarrow A = \frac{{BH}}{{B - H}}$

and substitute it into the first equation:

$M = A + \frac{B}{4} = \frac{{BH}}{{B - H}} + \frac{B}{4} = \frac{{4BH + {B^2} - BH}}{{4B - 4H}} = \frac{{3BH + {B^2}}}{{4B - 4H}} = M\left( B \right).$

Now we can examine the function $$M\left( B \right)$$ for extreme values. The derivative has the form

$M^\prime\left( B \right) = \left( {\frac{{3BH + {B^2}}}{{4B - 4H}}} \right)^\prime = \frac{{{B^2} - 2BH - 3{H^2}}}{{4{{\left( {B - H} \right)}^2}}}.$

Calculate the values of $$B$$ when the numerator is equal to zero:

${B^2} - 2BH - 3{H^2} = 0,\;\; \Rightarrow D = 4{H^2} + 12{H^2} = 16{H^2},\;\; \Rightarrow {B_{1,2}} = \frac{{2H \pm \sqrt {16{H^2}} }}{2} = - H,3H.$

We take only positive solution, that is $$B = 3H.$$ This is the right root of the parabola that is curved upwards. Therefore the sign of the derivative changes from negative to positive around this point, so this solution relates to the smallest median.

Compute the value of $$A:$$

$A = \frac{{BH}}{{B - H}} = \frac{{3H \cdot H}}{{3H - H}} = \frac{{3H}}{2}.$

Now we can determine the variable $$M:$$

$M = A + \frac{B}{4} = \frac{{3H}}{2} + \frac{{3H}}{4} = \frac{{9H}}{4}.$

It follows from here that $$m = \frac{{3h}}{2}.$$

### Example 15.

A picture of height $$a$$ is hung on a wall in such a way that its bottom edge is $$h$$ units above the eye level. At what distance $$x$$ should the observer stand from the wall to be the most favourable for viewing the picture (Figure $$15a$$)?

Solution.

Obviously, the observer is in optimal position when the angle of vision is the largest.

We derive the relationship for the angle of vision $$\varphi = \angle BPA.$$

It follows from Figure $$15b$$ that $$\varphi = \alpha - \beta$$ where

$\tan \beta = \frac{h}{x},\;\;\;\tan \alpha = \frac{{a + h}}{x}.$

Using the difference identity for tangent, we get

$\tan \varphi = \tan \left( {\alpha - \beta } \right) = \frac{{\tan \alpha - \tan \beta }}{{1 + \tan \alpha \tan \beta }} = \frac{{\frac{{a + h}}{x} - \frac{h}{x}}}{{1 + \frac{{a + h}}{x} \cdot \frac{h}{x}}} = \frac{{\frac{{a + \cancel{h} - \cancel{h}}}{x}}}{{\frac{{{x^2} + \left( {a + h} \right)h}}{{{x^2}}}}} = \frac{{ax}}{{{x^2} + ah + {h^2}}}.$

Hence, we can write the following expression for the function $$\varphi \left( x \right):$$

$\varphi = \varphi \left( x \right) = \arctan \frac{{ax}}{{{x^2} + ah + {h^2}}}.$

Calculate the derivative:

$\varphi^\prime\left( x \right) = \left( {\arctan \frac{{ax}}{{{x^2} + ah + {h^2}}}} \right)^\prime = \frac{1}{{1 + {{\left( {\frac{{ax}}{{{x^2} + ah + {h^2}}}} \right)}^2}}} \cdot {\left( {\frac{{ax}}{{{x^2} + ah + {h^2}}}} \right)^\prime } = \frac{{{{\left( {{x^2} + ah + {h^2}} \right)}^2}}}{{{{\left( {{x^2} + ah + {h^2}} \right)}^2} + {{\left( {ax} \right)}^2}}} \cdot \frac{{a\left( {{x^2} + ah + {h^2}} \right) - ax \cdot 2x}}{{{{\left( {{x^2} + ah + {h^2}} \right)}^2} + {{\left( {ax} \right)}^2}}} = \frac{{a{x^2} + {a^2}h + a{h^2} - 2a{x^2}}}{{{{\left( {{x^2} + ah + {h^2}} \right)}^2} + {a^2}{x^2}}} = \frac{{{a^2}h + a{h^2} - a{x^2}}}{{{{\left( {{x^2} + ah + {h^2}} \right)}^2} + {a^2}{x^2}}} = \frac{{a\left( {ah + {h^2} - {x^2}} \right)}}{{{{\left( {{x^2} + ah + {h^2}} \right)}^2} + {a^2}{x^2}}}.$

The derivative is zero provided

$\varphi^\prime\left( x \right) = 0,\;\; \Rightarrow \frac{{a\left( {ah + {h^2} - {x^2}} \right)}}{{{{\left( {{x^2} + ah + {h^2}} \right)}^2} + {a^2}{x^2}}} = 0,\;\; \Rightarrow ah + {h^2} - {x^2} = 0,\;\; \Rightarrow {x^2} = ah + {h^2},\;\; \Rightarrow x = \sqrt {h\left( {a + h} \right)} .$

and at this point the function $$\varphi \left( x \right)$$ has a maximum as the first derivative changes from positive to negative when passing through this point.

Thus, the optimal distance from the wall for the best viewing of the picture is determined by the formula

$x = \sqrt {h\left( {a + h} \right)} .$

For example, if $$a = 3\,\text{m}$$ and $$h = 2\,\text{m},$$ the optimal distance is

$x = \sqrt {h\left( {a + h} \right)} = \sqrt {2\left( {3 + 2} \right)} = \sqrt {10} \approx 3,16\,\text{m}.$

### Example 16.

A rectangle is inscribed in a semicircle of radius $$R$$ with one of its sides on the diameter of the semicircle (Figure $$16a$$). Find the maximum perimeter of the rectangle.

Solution.

Let the perimeter of the rectangle $$L = 2\left( {a + b} \right)$$ be the objective function.

We introduce the base angle $$\theta$$ $$\left( {0 \le \theta \le \frac{\pi }{2}} \right).$$ Then

$\frac{a}{2} = R\cos \theta ,\;\; b = R\sin \theta .$

The perimeter $$L$$ is expressed in terms of the angle $$\theta$$ as follows:

$L = 2\left( {a + b} \right) = 2\left( {2R\cos \theta + R\sin \theta } \right) = 2R\left( {2\cos \theta + \sin \theta } \right) = L\left( \theta \right).$

Calculate the value of the perimeter at the endpoints:

$L\left( 0 \right) = 2R\left( {2\cos 0 + \sin 0} \right) = 2R\left( {2 \cdot 1 + 0} \right) = 4R;$
$L\left( {\frac{\pi }{2}} \right) = 2R\left( {2\cos \frac{\pi }{2} + \sin \frac{\pi }{2}} \right) = 2R\left( {2 \cdot 0 + 1} \right) = 2R.$

Differentiate the function $$L\left( \theta \right)$$ and find the critical point(s):

$L^\prime\left( \theta \right) = \left[ {2R\left( {2\cos \theta + \sin \theta } \right)} \right]^\prime = 2R\left( { - 2\sin \theta + \cos \theta } \right).$
$L^\prime\left( \theta \right) = 0,\;\; \Rightarrow 2R\left( { - 2\sin \theta + \cos \theta } \right) = 0,\;\; \Rightarrow 2\sin \theta = \cos \theta ,\;\; \Rightarrow \tan \theta = \frac{1}{2},\;\; \Rightarrow \theta = \arctan \frac{1}{2}.$

Hence, we have one critical point $$\theta = \arctan \frac{1}{2}.$$ To compute the perimeter at this point, we first calculate the sine and cosine of the angle $$\theta = \arctan \frac{1}{2}:$$

$\sin \left(\arctan \frac{1}{2}\right) = \frac{{\tan \left(\arctan \frac{1}{2}\right)}}{{\sqrt {1 + {{\tan }^2}\left(\arctan \frac{1}{2}\right)} }} = \frac{{\frac{1}{2}}}{{\sqrt {1 + {{\left( {\frac{1}{2}} \right)}^2}} }} = \frac{{\frac{1}{2}}}{{\sqrt {\frac{5}{4}} }} = \frac{1}{{\sqrt 5 }};$
$\cos \left(\arctan \frac{1}{2}\right) = \frac{1}{{\sqrt {1 + {{\tan }^2}\left(\arctan \frac{1}{2}\right)} }} = \frac{1}{{\sqrt {1 + {{\left( {\frac{1}{2}} \right)}^2}} }} = \frac{1}{{\sqrt {\frac{5}{4}} }} = \frac{2}{{\sqrt 5 }}.$

So the perimeter is equal

$L\left(\arctan \frac{1}{2}\right) = 2R\left( {2 \cdot \frac{2}{{\sqrt 5 }} + \frac{1}{{\sqrt 5 }}} \right) = 2R \cdot \frac{5}{{\sqrt 5 }} = 2\sqrt 5 R \approx 4.47R$

We see that the maximum value of the perimeter of the inscribed rectangle is $$2\sqrt 5 R.$$

### Example 17.

Find the point $$M\left( {x,y} \right)$$ on the parabola $$y = {x^2}$$ assuming $$x \gt 0$$ that is closest to $$B\left( {0,b} \right)$$ where $$b$$ is a positive real number (Figure $$17a$$).

Solution.

The distance $$d$$ between the points $$B$$ and $$M$$ is given by

$d = \sqrt {{x^2} + {{\left( {y - b} \right)}^2}} = \sqrt {{x^2} + {y^2} - 2by + {b^2}} = \sqrt {{x^2} + {x^4} - 2b{x^2} + {b^2}} = \sqrt {{x^4} + \left( {1 - 2b} \right){x^2} + {b^2}} .$

Instead of the distance $$d$$ we can consider the square of the distance $$D = {d^2}$$ and differentiate the function $$D\left({x}\right)$$ with respect to $$x:$$

$D\left( x \right) = {d^2}\left( x \right) = {x^4} + \left( {1 - 2b} \right){x^2} + {b^2}.$
$D^\prime\left( x \right) = \left[ {{x^4} + \left( {1 - 2b} \right){x^2} + {b^2}} \right]^\prime = 4{x^3} + 2\left( {1 - 2b} \right)x.$

Find the critical points by equating the derivative to zero:

$D^\prime\left( x \right) = 0,\;\; \Rightarrow 4{x^3} + 2\left( {1 - 2b} \right)x = 0,\;\; \Rightarrow x\left( {2{x^2} + 1 - 2b} \right) = 0.$

The first root $${x_1} = 0$$ does not satisfy the condition of the problem. The other critical points can be found from the quadratic equation:

$2{x^2} + 1 - 2b = 0,\;\; \Rightarrow 2{x^2} = 2b - 1,\;\; \Rightarrow {x^2} = b - \frac{1}{2},\;\; \Rightarrow x = \sqrt {b - \frac{1}{2}} ,$

where $$b \gt \frac{1}{2}$$ and $$x \gt 0.$$

To determine whether the point $$x = \sqrt {b - \frac{1}{2}}$$ is a local maximum or minimum, we use the Second Derivative Test:

$D^{\prime\prime}\left( x \right) = \left[ {4{x^3} + 2\left( {1 - 2b} \right)x} \right]^\prime = 12{x^2} + 2 - 4b.$

Check for the sign of the second derivative at $$x = \sqrt {b - \frac{1}{2}}:$$

$D^{\prime\prime}\left( {\sqrt {b - \frac{1}{2}} } \right) = 12\left( {b - \frac{1}{2}} \right) + 2 - 4b = 12b - 6 + 2 - 4b = 8b - 4.$

We see that the second derivative is positive for all values of $$b \gt \frac{1}{2},$$ so the point $$x = \sqrt {b - \frac{1}{2}}$$ is a point of local minimum.

Hence, the closest point on the parabola has the coordinates

$\left( {x,y} \right) = \left( {\sqrt {b - \frac{1}{2}} ,b - \frac{1}{2}} \right).$

### Example 18.

Two sides of a parallelogram lie on the sides of a triangle, and one vertex of the parallelogram belongs to the third side of the triangle (Figure $$18a$$). Find the conditions under which the area of the parallelogram is greatest.

Solution.

Let the triangle be defined by two sides $$a = BC,$$ $$b = AC$$ and the angle $$\alpha = \angle BCA$$ between them. We draw the parallelogram $$CMKN$$ in accordance with the conditions of the problem. Denote the sides of the parallelogram as $$x = MK$$ and $$y = KN.$$ The area of the parallelogram is determined by the formula

$S = xy\sin \alpha .$

We express $$y$$ in terms of $$x$$ and the sides of the triangle $$a, b.$$

From the similarity of triangles $$BMK$$ and $$BCA$$ we see that

$\frac{{a - y}}{a} = \frac{x}{b}.$

Then

$\left( {a - y} \right)b = ax,\;\; \Rightarrow ab - by = ax,\;\; \Rightarrow by = ab - ax,\;\; \Rightarrow y = \frac{{ab - ax}}{b} = a - \frac{a}{b}x.$

As a result, the area $$S$$ is written as a function $$S\left( x \right):$$

$S = S\left( x \right) = x\left( {a - \frac{a}{b}x} \right)\sin \alpha = ax\sin \alpha - \frac{a}{b}{x^2}\sin \alpha.$

Find the derivative:

$S'\left( x \right) = \left( {ax\sin \alpha - \frac{a}{b}{x^2}\sin \alpha } \right)^\prime = a\sin \alpha - \frac{{2ax}}{b}\sin \alpha = a\sin \alpha \left( {1 - \frac{{2x}}{b}} \right).$

This shows that the extremum of the function $$S\left( x \right)$$ exists at the following point:

$S'\left( x \right) = 0,\;\; \Rightarrow 1 - \frac{{2x}}{b} = 0,\;\; \Rightarrow 2x = b,\;\; \Rightarrow x = \frac{b}{2}.$

When passing through this point the derivative changes sign from plus to minus, that is this point is a maximum point. The other side of the parallelogram is equal to

$y = a - \frac{a}{b}x = a - \frac{a}{b} \cdot \frac{b}{2} = a - \frac{a}{2} = \frac{a}{2}.$

Thus, the parallelogram with the sides $$x, y$$ inscribed in a triangle has the largest area under the following condition:

$x = \frac{b}{2},\;\;y = \frac{a}{2},$

where $$a, b$$ are the sides of the triangle. It is interesting that the result does not depend on the angle $$\alpha$$ between the sides of the triangle.

### Example 19.

An isosceles trapezoid has base angles of 45 degrees and a perimeter $$L$$ (Figure $$19a$$). What is the largest area of the trapezoid?

Solution.

The area of trapezoid (the objective function) has the form:

$A = \frac{{a + b}}{2} \cdot h,$

where $$a$$ and $$b$$ are the parallel sides and $$h$$ is the height of the trapezoid.

We can express the height as follows:

$h = \left| {AM} \right|\tan 45^\circ = \frac{{a - b}}{2}.$

Hence $$a = b + 2h$$ and

$A = \frac{{a + b}}{2} \cdot h = \frac{{b + 2h + b}}{2} \cdot h = bh + {h^2}.$

The perimeter $$L$$ is given by

$L = a + b +2l.$

This is our constraint equation.

Since

$l = \frac{{a - b}}{{2\cos 45^\circ }} = \frac{{a - b}}{{2 \cdot \frac{{\sqrt 2 }}{2}}} = \frac{{a - b}}{{\sqrt 2 }},$

we can write the perimeter $$L$$ as

$L = a + b + 2l = a + b + \sqrt 2 \left( {a - b} \right).$

Given that

$a = b + 2h,\;\; \Rightarrow a - b = 2h,$

we obtain:

$L = b + 2h + b + 2\sqrt 2 h = 2b + 2\left( {1 + \sqrt 2 } \right)h.$

Now we solve the last equation for $$b:$$

$\frac{L}{2} = b + \left( {1 + \sqrt 2 } \right)h,\;\; \Rightarrow b = \frac{L}{2} - \left( {1 + \sqrt 2 } \right)h.$

Then we substitute $$b$$ in the formula for the area of the triangle:

$A = bh + {h^2} = \left( {\frac{L}{2} - \left( {1 + \sqrt 2 } \right)h} \right)h + {h^2} = \frac{{Lh}}{2} - \cancel{h^2} - \sqrt 2 {h^2} + \cancel{h^2} = \frac{{Lh}}{2} - \sqrt 2 {h^2} = A\left( h \right).$

Take the derivative and find the critical points:

$A^\prime\left( h \right) = \left( {\frac{{Lh}}{2} - \sqrt 2 {h^2}} \right)^\prime = \frac{L}{2} - 2\sqrt 2 h;$
$A^\prime\left( h \right) = 0,\;\; \Rightarrow \frac{L}{2} - 2\sqrt 2 h = 0,\;\; \Rightarrow h = \frac{L}{{4\sqrt 2 }}.$

As $$A^\prime\left( h \right) = - 2\sqrt 2 \lt 0,$$ the solution $$h = \frac{L}{{4\sqrt 2 }}$$ corresponds to the local maximum of the function $$A\left( h \right).$$

Calculate the largest area of the trapezoid:

${A_{\max }} = A\left( {h = \frac{L}{{4\sqrt 2 }}} \right) = \frac{L}{2} \cdot \frac{L}{{4\sqrt 2 }} - \sqrt 2 \cdot {\left( {\frac{L}{{4\sqrt 2 }}} \right)^2} = \frac{{{L^2}}}{{8\sqrt 2 }} - \frac{{\sqrt 2 {L^2}}}{{32}} = \frac{{2\sqrt 2 {L^2}}}{{32}} - \frac{{\sqrt 2 {L^2}}}{{32}} = \frac{{\sqrt 2 {L^2}}}{{32}}.$