In today's video, we use calculus to solve several contrasting problems in optimization. Which means to find the smallest or largest values of some quantity of interests. In first problem, we're asked to minimize the sum of a real number and its reciprocal. You can experiment with a few numbers to get a feeling for what the answer might be before we actually do the calculus. We want to find the smallest sum of the results by adding a number to its reciprocal. You may well guess the answer, but we want to be absolutely sure. To turn this into mathematics, we put y equals f of x equals x plus one over x. Which can be rewritten as x plus x to the minus one. The strategy is to use the derivative to find the turning point which should tell us what the minimum might be. The derivative is y dash equal one minus x to the minus two. Which we can rewrite it in a couple of steps as x squared minus one over x squared. So that y dash to zero when x equals plus or minus one. Note that y dashed is undefined when x equals zero. So, we get the following sign diagram, with the pattern positive, negative, negative again, positive. Which indicates the pattern increasing, decreasing, decreasing again, increasing with a maximum when x equals minus one and a minimum when x equals one. In fact, we only need to focus on positive x and the corresponding part of the sign diagram highlighted here, producing a global minimum for x greater than zero occurring when x equals one, with value f of one equals two. This solves the original problem. The answer is that the minimum sum of the positive real with its reciprocal is two and this occurs by adding one to its reciprocal. The mathematics tells us, it's impossible to do any better than this. Though we don't need to, we can if we like graph the curve y equals x plus one over x. Which splits into two branches, with y-axis being a vertical asymptote, the line y equals x being an oblique asymptote. The branch of the curve in the first quadrant is directly relevant for our original problem and the turning point with coordinates one, two corresponds to the solution. In the next optimization problem, we're asked to build rectangular enclosure using a 100 meters of fencing in order to maximize the area. What should we do? For example, if we make a thin rectangle, only five meters deep and 45 meters wide, then we use up a 100 meters of fencing and the area becomes 225 square meters. If we try making it 10 meters deep and now 40 meters wide, we get a larger area of 400 square meters but we can do better. If it's 20 meters deep and 30 meters wide, we increase the area to 600 square meters. We can still do better. If it's 25 meters deep and 25 meters wide, then the area becomes 625 square meters. Notice now that we've produced a perfect square, and it looks like there's no way to make the area any larger. It seems reasonable to guess intuitively the perfect squares should solve the problem. Let's do the math to see if it confirms our intuition. Here's a diagram representing a general enclosure with side lengths x and y meters. Note that the diagram is just a guide to assist us in creating the mathematics. In fact, we're expecting to get a perfect square in the end but we're not sure. So, just try to imagine any or typical rectangle but realize this is only to help set up the mathematics. Denote the area of the rectangle by A square meters so that A as a product xy. The constraint is that we only have a 100 meters of fencing. So, we add up all the sides of the rectangle, that is x plus y plus x again plus y again to get a 100. Then 2x plus 2y equals 100 so x plus y equals 50. Hence y equals 50 minus x. We can now express A in terms of x only because A is x times y which is x times 50 minus x. Which expands out into the quadratic 50x minus x squared. The derivative dA, dx becomes 50 minus 2x or two times 25 minus x. Hence dA, dx is zero when x equals 25. We can now build its sign diagram with pattern; positive, negative and increasing then decreasing, with a maximum occurring when x equals 25. It follows that the area A is maximized when x and y are both equal to 25. So, indeed the enclosure turns out to be a perfect square as we suspected all along, with maximum area 625 square meters. The maths guarantees that there's no chance of doing better than this. The area function A turned out to be a quadratic in x. So of course, we can also visualize the solution in terms of the associated parabola. Here's the information we used about the derivative. It matches perfectly with the actual parabola, which passes through the x-axis at zero and 50 with apex exactly halfway between corresponding to the solution. The problem is constrained by having non-negative side lengths with x equals zero or x equals 50 at the boundaries of the actual physical domain, the rectangle becomes infinitely thin with zero area. Note also that the second derivative is negative two which is less than zero so the curves should be concave down, which indeed corresponds to the fact that the parabola is facing downwards. Our final optimization problem is quite difficult and uses all of the techniques that we've been building up over several videos. We're unlikely to be able to guess the answer so we rely on producing a carefully developed mathematical solution. We revisit the Statue of Liberty which you might remember is 46 meters high, standing on a pedestal which is also 46 meters high. The problem is, to find the horizontal distance x meters from the base of the pedestal that maximizes the angle theta subtended by the statue and also, to find this largest angle. It's useful especially in developing formulae to refer to the common height of the statue and pedestal using the symbol, h. Though it hasn't been asked for in the problem, we give a name phi to the angle subtended by the pedestal. We then insert into the diagram, a vertical length of height 2h, the combined height of the statue and the pedestal, opposite the two angles that creates this figure involving a large right-angled triangle. Focusing on the smaller right-angled triangle with angle phi, we see that the tan of phi is the opposite over the adjacent that is h over x. The larger right-angled triangle has angles theta plus phi and tan of this combined angle is 2h over x. Hence phi becomes inverse tan of h over x and theta plus phi becomes inverse tan of 2h over x. So that subtracting phi, theta becomes inverse tan of 2h over x minus inverse tan of h over x. So finally, we're able to express theta as a function of x. Remember that we want to maximize theta, so it should be useful to look at the derivative d theta/dx. Since theta is a difference of two expressions, its derivative will be the difference of the derivatives of the expressions. We apply the chain rule to each piece using the substitutions, u equals two h on x for the first piece, and v equals h on x for the second piece. But u can be written as 2h times x to the minus one so each derivative with respect to x is minus 2h times x to the minus two, which can be rewritten as minus 2h over x squared. Similarly, the derivative of v with respect to x becomes minus h on x squared. The other ingredient we need is the fact that the derivative of inverse tan of x is one over x squared plus one. The rule for the function whose graph is the witch of Maria Agnesi that we discussed in detail in an earlier video. Now we're just carefully insert all these bits and pieces into the expression for d theta/dx. To produce this expression involving u, v, h and x which becomes an expression involving just h and x. Which you can check simplifies to this expression. We now put everything over a common denominator and carefully simplify until we finally get the fraction below in terms of x and the constant h. It's a lot of careful algebraic manipulation, probably the most difficult and intricate so far in this course, but it's worth the effort. Though this might look complicated, notice that a large portion of this expression circled in pink is always positive. Remember, it's the changing sign of the derivative that gives us information about the turning points. In this case, the sign of the derivative is completely determined by the sign of the expression 2h squared minus x squared highlighted here in blue. Observe that the derivative is zero precisely when x square equals 2h squared. This occurs when x equals the square root of two times h where h remember, is the height of both the pedestal and statue. Note that we're only interested in positive distances for x so we can ignore the negative square root. We can now build the sign diagram for the derivative with the important point root two times h for x where the derivative is zero with pattern, positive, negative, increasing then decreasing with a maximum when x equals root two times h. This shows that the angle subtended by the statue is maximized when the distance x is root two times h where h equals 46, which evaluates to about 65 meters. The maximum angle becomes this expression, inverse tan of root two minus inverse tan of one over route two, which evaluates to about 19.5 degrees. Notice that the final expression does not depend on h which cancels out in the process of simplifying the answer. The maximum angle is nearly 20 degrees and this works regardless of the height of the statue and pedestal. By carefully checking the mathematics, you see that we only need that they are of the same height to get this particular maximum angle. Whatever h happens to be the horizontal distance that achieves its maximum angle, where root two times h which of course does vary with h. In our case, this horizontal distance turns out to be about 65 meters. In today's video, we discussed and solved three contrasting optimization problems. All the solutions relied on determining and understanding the behavior of the sign of the derivative. The first two problems have solutions that one could reasonably guess in advance, either by experimenting or thinking about the problem intuitively. The third problem however, was very difficult with the final answer that I think will be impossible to guess. The derivation relied on the derivative of the inverse tan function, "The witch of Maria Agnesi," together with quite intricate algebraic manipulations. I hope you'll be able to follow through and check all of the details. By doing so, you'll develop very strong technique and a thorough understanding of the underlying principles. Please read the notes, when you're ready please attempt the exercises. Thank you very much for watching and I look forward to seeing you again soon.