Here's another timeless classic, another optimization problem that just comes up in all the calculus textbooks. Goes like this: you've got some big object and you want to move that big object around a corner. The question is for some given corner, how big of a object can you navigate around that corner. This is an example of the so called piano moving problem. A piano is way to complicated of an object to really understand in this course right, it's just got a way to much geometry going on there. So going to consider a simpler example. So here's our diagram of a corner and I mentioned that I want to move this red stick around this corner without it getting stuck. Maybe it doesn't look like it but this problem can be set up as an optimization problem and we can solve it. It's an optimization problem, because I'm asking to know the length of the longest stick, that I can navigate around this corner. We have to think about where that stick can get stuck. Well the stick is going to get stuck when it's in a position like this. When it's touching these two walls and pressed up against this corner. So, what I actually have to think about is what's the shortest length of stick that simultaneously touches this wall, this wall and this corner. I think it's a little bit funny that in order to solve this problem, we end up minimizing something. We actually want to figure out the longest length, the maximum length of a stick that can be navigated around that corner. But to answer that problem, we end up solving a minimization problem. Well anyhow, let's proceed in our usual way. I'm going to draw a picture and label everything. So, here I have drawn this picture and I have labelled every thing. The width of this hallway is a, the width of this hallway is b, the length of this stick is l, and makes this angle theta with this bottom wall. Now we gotta figure out what it is that we are trying to optimize. What's the quantity that we are trying to minimize? What's the goal? So my goal is to minimize the length of this stick, right? I want to know the shortest length that touches these two walls and this corner, and that'll constrain the largest stick that'll fit around this corner. Now, my hallways have fixed lengths, and I'd like to express the length of this stick in terms of this angle theta. So I can break up the stick into 2 pieces. There's a piece that goes from this wall to the corner and a piece from this corner to the other wall. So this piece here, well that's really the hypotenuse of a right triangle, whose opposite side to this angle theta has length a. And that means this hypotenuse has length a times co-secant theta. Similarly here I got a right triangle and I have got this side length here is b so, the hypotenuse has length b times secant theta and the stick is just the sum of these two lengths so that gives me a formula for l in terms of theta. L is a cosecant theta plus b secant theta. What's the constraint in this problem? Yeah I only need to think about theta being between 0 and pi over 2 in order to touch these two walls and the corner. So now we've got a function, and it's function of a single variable so we can apply calculus. So, I'm going to differentiate this function, right, the derivative of L with respect to theta. Well what's the derivative of cosecant? That's minus cosecant theta cotangent theta. And what's the derivative of secant? Well that's secant theta Tangent theta. So that's the derivative of l minus a cosecant theta cotangent theta plus b secant theta tangent theta. With the derivative in hand I can now try to find the critical points for this function. Now since this function L is differentiable on the domain that we're considering, I don't have to worry about places where L fails to be differentiable when I'm looking for critical points. I only need to find points where the derivative is equal to zero. So for which values of theta does this thing vanish? Well, let's write this as an equation equal to 0, and let's add a cosecant theta contangent theta to both sides. So then I've got b secant theta tangent theta is equal to a cosecant theta cotangent theta. I, I will divide both sides by co-secant theta, cotangent theta and I will divide both sides by b so that I have got secant theta, tangent theta divided by cosecant theta, cotangent theta is equal to a over b. Now what do I notice here? Well dividing by cotangent is as good as multiplying by tangent. And secant and co-secant is actually tangent again. So this is in fact tangent cubed. So I've got tangent cubed theta. Is equal to A over B. If I take a cubed route now, I get that tangent theta is equal to the cube root of A over B. In over words, theta is arc tangent the cube root of A over B. So now I know what theta is, but I don't care about theta. What I really care about is L. What's the length? So let's evaluate l of theta at the critical point. Now, where's the critical point? It's where tangent of theta is equal to the cube root of a over b. I can build a right triangle with an angle whose tangent is the cube root of a over b. I do that as follows. I make this length 1. And this length the cube root of a over b and that makes the tangent of theta which is this divided by this equal to this right and this is 1 in the denominator. That is the right triangle which means I can compute the length of hypotenuse right. The length of hypotenuse is a square root of the sum of these two lengths squared and that's what I had written. And here. Okay, so I've got a right triangle. I've got an angle whose tangent is theta and I'm trying to calculate L of theta. And if you remember back L was defined in terms of cosecant and secant. And I can compute cosecant and secant for this angle theta whose tangent is this quantity by reading off the cosecant and secant from this triangle. So the co-secant remember is a one over sine which means it's hypotenuse divided by the opposite side length and that's what I got here, length by hypotenuse divided by length of opposite side and secant, remember is one over cosine so that means it's the side length by hypotenuse divided by this length, which is just one. Now once I know cosecant and secant in terms of this quantity here, I can then evaluate L at that quantity. So here we go, this is what I get when I plug in these quantities for coseekit, and seekit. Get. Now this looks terrible, right? Well, I can simplify this a little bit. What do you notice here? I've got a dividing by the cubert of B in the denominator, which is as good as putting a B to the thirds power up here. And here I'm going to separate out this B to B a B to the two thirds times B to the one third and move that inside the square root. The upshot is that this thing is in fact the same as this thing here. And now this begins to be a little bit more symmetric, right? I took the a and the cube root of a and that gave me the a to the 2 3rds and by putting a b to the 2 3rds inside here, I made this look a lot, a lot nicer. Okay. Now I've got a common factor of the square root of b to the 2 3rds plus a to the 2 3rds here and I can collect that out. So now I've got a to the 2 3rds plus b to the 2 3rds times the square root of b to the 2 3rds plus a to the 2 3rds. Now this is the same thing, here. It's this thing times the square root that thing. And another way of saying that is just this quantity to the 3/2 power, right? This is this quantity to the first power, times the 1/2 power, and that gives me the 3/2 power, here. So, at the critical point, l of theta is equal to this quantity. Now with a bit more work, we can show that this quantity is in fact the minimum value of l. We can summarize our answer. So given a hallway of width A meeting a hallway of width B at some corner, what we've shown is that a stick of length at most, A to the two thirds plus B to the two thirds, that quantity to the three halves power can be navigated around that corner. And we can see this playing out in action. I made a model that you can download Well here is an example. I've got a hallway of width 64 millimeters, that's a pretty small hallway, right? And I've got another hallway here, 27 millimeters. And the calculation that we've done tells us that a stick of length 125 millimeters will just be able to turnaround, this hallway. So let's see. Here's the stick and I start the stick moving down the hallway, right? And I start trying to rotate it around and eventually I'm going to bump up against the corner , but I'll just be able to make it around the corner and then I'll be able to move it out of the hallway. Perhaps you're wondering where those numbers came from. Well here's where I got these numbers from, right? 64 and 27, these are the widths of my hallways and this is the formula that tells us the largest stick that can pass through a hallway of these two widths. Now I chose 64 and 27 for, maybe two different reasons. One thing is that these are both perfect cubes. So, 64 to the one third power is 4 and 27 to the one third power is 3. The other thing that's nice about these numbers is that 4 squared plus 3 squared is 5 squared, right? These are Pythagorean triple. And 5 squared to the 1/2 is just 5. So it's 5 cubed which is 125.